Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gensources #309

Merged
merged 5 commits into from
Aug 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
94 changes: 46 additions & 48 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,51 @@
language: generic
dist: trusty
sudo: false
matrix:
env:
- [ "V=4.0", "PREFIX=/usr/lib/llvm-4.0/lib/cmake", "BIN=/usr/lib/llvm-4.0/bin" ]
addons:
apt:
sources: [ "ubuntu-toolchain-r-test", "llvm-toolchain-trusty-4.0" ]
packages: [ "libboost-all-dev", "tcl-dev", "tk-dev", "emacs", "clang-4.0", "libclang-4.0-dev", "llvm-4.0-dev", "clang-format-4.0", "clang-tidy-4.0" ]
jobs:
include:
# Versions before 3.8 are not included nor whitelisted
- stage: compiling and checking sources
before_script:
# Fix clang cmake dirs
- if [ $V == 4.0 ]; then sudo -E ln -sn /usr/share/llvm-4.0/cmake /usr/lib/llvm-4.0/lib/cmake/clang; fi
- if [ $V == 4.0 ]; then sudo -E ln -sn /usr/share/llvm-4.0/cmake /usr/lib/llvm-4.0/lib/cmake/clang-4.0; fi
- if [ $V == 4.0 ]; then sudo -E ln -s /usr/bin/* /usr/lib/llvm-4.0/bin || true; fi
script:
- mkdir -p ../cache/vm ../cache/boostenv
- mv vm/boostenv/main/cached ../cache/boostenv
- mv vm/vm/main/cached ../cache/vm
- export SOURCES=$(pwd) && mkdir ../build && cd ../build
- cmake -DCMAKE_BUILD_TYPE=Release -DMOZART_BOOST_USE_STATIC_LIBS=False -DCMAKE_PROGRAM_PATH=$BIN -DCMAKE_PREFIX_PATH=$PREFIX -DMOZART_CACHED_BUILD=OFF $SOURCES
- make -B gensources genboostsources VERBOSE=1
- cd ..
- diff -q -r cache/boostenv/cached build/vm/boostenv/main/generated
- diff -Npur cache/boostenv/cached build/vm/boostenv/main/generated
- diff -q -r cache/vm/cached build/vm/vm/main/generated
- diff -Npur cache/vm/cached build/vm/vm/main/generated

# Broken (uses ubuntu's version, not llvm one. {LLVM,Clang}Config.cmake are beyond redemption
#- env: [ "V=3.8", "PREFIX=/usr/lib/llvm-3.8" ]
# addons:
# apt:
# sources: [ "ubuntu-toolchain-r-test", "llvm-toolchain-trusty-3.8" ]
# packages: [ "libboost-all-dev", "tcl-dev", "tk-dev", "emacs", "clang-3.8", "libclang-3.8-dev", "llvm-3.8-dev" ]

# Broken: Unknown relocation 0x2a (llvm-3.9 known to be bugged on travis)
#- env: [ "V=3.9", "PREFIX=/usr/lib/llvm-3.9/lib/cmake" ]
# addons:
# apt:
# sources: [ "ubuntu-toolchain-r-test", "llvm-toolchain-trusty-3.9" ]
# packages: [ "libboost-all-dev", "tcl-dev", "tk-dev", "emacs", "clang-3.9", "libclang-3.9-dev", "llvm-3.9-dev" ]

# Works, with heavy fixing (see below)
- env: [ "V=4.0", "PREFIX=/usr/lib/llvm-4.0/lib/cmake", "BIN=/usr/lib/llvm-4.0/bin" ]
addons:
apt:
sources: [ "ubuntu-toolchain-r-test", "llvm-toolchain-trusty-4.0" ]
packages: [ "libboost-all-dev", "tcl-dev", "tk-dev", "emacs", "clang-4.0", "libclang-4.0-dev", "llvm-4.0-dev", "clang-format-4.0", "clang-tidy-4.0" ]

before_script:
- apt list --installed
- env
# Fix clang cmake dirs
- if [ $V == 3.9 ]; then sudo -E ln -sn /usr/share/llvm-3.9/cmake /usr/lib/llvm-3.9/lib/cmake/clang; fi

- if [ $V == 4.0 ]; then sudo -E ln -sn /usr/share/llvm-4.0/cmake /usr/lib/llvm-4.0/lib/cmake/clang; fi
- if [ $V == 4.0 ]; then sudo -E ln -sn /usr/share/llvm-4.0/cmake /usr/lib/llvm-4.0/lib/cmake/clang-4.0; fi
- if [ $V == 4.0 ]; then sudo -E ln -s /usr/bin/* /usr/lib/llvm-4.0/bin || true; fi

script:
- export SOURCES=$(pwd) && mkdir ../build && cd ../build
- cmake -DCMAKE_BUILD_TYPE=Release -DMOZART_BOOST_USE_STATIC_LIBS=False -DCMAKE_PROGRAM_PATH=$BIN -DCMAKE_PREFIX_PATH=$PREFIX $SOURCES
- make dist VERBOSE=1
- make VERBOSE=1
- make check
deploy:
provider: releases
skip_cleanup: true
on:
tags: true
file_glob: true
file: mozart2-*-Source.zip
api_key:
secure: GxwttdinweSfTeSkWu3aSp//AGT/ew4iyEUaLxh8nDeVRpAHEPBtMhgF25zoP6JLfhlEAOW7+5Gmomk1a/k+VQQWbFbod3jSSUIH/4gafEN7MVgy3Ma1NEWqViSC7IH/DDIhMzHAttznDOA2nWzoV1nyDpUydM8wvs3VK2N2wEI=
- stage: compiling with pre-generated sources
before_script:
# Fix clang cmake dirs
- if [ $V == 4.0 ]; then sudo -E ln -sn /usr/share/llvm-4.0/cmake /usr/lib/llvm-4.0/lib/cmake/clang; fi
- if [ $V == 4.0 ]; then sudo -E ln -sn /usr/share/llvm-4.0/cmake /usr/lib/llvm-4.0/lib/cmake/clang-4.0; fi
- if [ $V == 4.0 ]; then sudo -E ln -s /usr/bin/* /usr/lib/llvm-4.0/bin || true; fi
script:
- export SOURCES=$(pwd) && mkdir ../build && cd ../build
- cmake -DCMAKE_BUILD_TYPE=Release -DMOZART_BOOST_USE_STATIC_LIBS=False -DCMAKE_PROGRAM_PATH=$BIN -DCMAKE_PREFIX_PATH=$PREFIX $SOURCES
- make dist VERBOSE=1
- make VERBOSE=1
- make check
deploy:
provider: releases
skip_cleanup: true
on:
tags: true
file_glob: true
file: mozart2-*-Source.zip
api_key:
secure: GxwttdinweSfTeSkWu3aSp//AGT/ew4iyEUaLxh8nDeVRpAHEPBtMhgF25zoP6JLfhlEAOW7+5Gmomk1a/k+VQQWbFbod3jSSUIH/4gafEN7MVgy3Ma1NEWqViSC7IH/DDIhMzHAttznDOA2nWzoV1nyDpUydM8wvs3VK2N2wEI=
6 changes: 3 additions & 3 deletions cmake_local/MozartProperties.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ target_architecture(MOZART_PROP_PLATFORM_ARCH)
# For source tarballs, oz.version and os.date
# are exported id MozartConfigVersion.cmake
include(MozartConfigVersion
RESULT_VARIABLE MOZART_CACHED_BUILD OPTIONAL)
RESULT_VARIABLE MOZART_SOURCE_TARBALL_BUILD OPTIONAL)

# oz.version

if(NOT MOZART_CACHED_BUILD)
if(NOT MOZART_SOURCE_TARBALL_BUILD)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --dirty
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
Expand All @@ -45,7 +45,7 @@ endif()

# oz.date

if(NOT MOZART_CACHED_BUILD)
if(NOT MOZART_SOURCE_TARBALL_BUILD)
execute_process(
COMMAND ${GIT_EXECUTABLE} log "--format=%aD" -1
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
Expand Down
2 changes: 2 additions & 0 deletions vm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ set(LLVM_BUILD_DIR ${DEFAULT_LLVM_BUILD_DIR} CACHE PATH "Path to LLVM build (wit
set(MOZART_GENERATOR_FLAGS "${DEFAULT_MOZART_GENERATOR_FLAGS}" CACHE STRING
"Additional flags for the generator parser (clang)")

set(MOZART_CACHED_BUILD ON CACHE STRING "Use pre-generated sources")

add_compile_options(-std=c++0x)

add_subdirectory(generator)
Expand Down
4 changes: 4 additions & 0 deletions vm/boostenv/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ add_custom_command(
${GENERATED_BOOSTSOURCES_BINARY_DIR}/
boostenvbuiltins

COMMAND ${CMAKE_COMMAND} -E remove
${GENERATED_BOOSTSOURCES_BINARY_DIR}/boostenv.ast
${GENERATED_BOOSTSOURCES_BINARY_DIR}/boostenvmodules.astbi

# Tag
COMMAND ${CMAKE_COMMAND} -E touch ${GENERATED_BOOSTSOURCES_BINARY_DIR}/boostenv.gen

Expand Down
94 changes: 94 additions & 0 deletions vm/boostenv/main/cached/Abstraction-implem-decl-after.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
template <>
class TypeInfoOf<Abstraction>: public TypeInfo {

static constexpr UUID uuid() {
return UUID();
}
public:
TypeInfoOf() : TypeInfo("Abstraction", uuid(), false, false, false, sbTokenEq, 0) {}

static const TypeInfoOf<Abstraction>* const instance() {
return &RawType<Abstraction>::rawType;
}

static Type type() {
return Type(instance());
}

atom_t getTypeAtom(VM vm) const {
return Abstraction::getTypeAtom(vm);
}

inline
void printReprToStream(VM vm, RichNode self, std::ostream& out,
int depth, int width) const;

inline
UnstableNode serialize(VM vm, SE s, RichNode from) const;

inline
GlobalNode* globalize(VM vm, RichNode from) const;

inline
void gCollect(GC gc, RichNode from, StableNode& to) const;

inline
void gCollect(GC gc, RichNode from, UnstableNode& to) const;

inline
void sClone(SC sc, RichNode from, StableNode& to) const;

inline
void sClone(SC sc, RichNode from, UnstableNode& to) const;
};

template <>
class TypedRichNode<Abstraction>: public BaseTypedRichNode {
public:
explicit TypedRichNode(RichNode self) : BaseTypedRichNode(self) {}

inline
size_t getArraySize();

inline
StaticArray<class mozart::StableNode> getElementsArray();

inline
class mozart::StableNode& getElements(size_t i);

inline
class mozart::Space * home();

inline
size_t getArraySizeImpl();

inline
atom_t getPrintName(VM vm);

inline
bool isCallable(VM vm);

inline
bool isProcedure(VM vm);

inline
size_t procedureArity(VM vm);

inline
void getCallInfo(VM vm, size_t & arity, ProgramCounter & start, size_t & Xcount, StaticArray<class mozart::StableNode> & Gs, StaticArray<class mozart::StableNode> & Ks);

inline
void getDebugInfo(VM vm, atom_t & printName, class mozart::UnstableNode & debugData);

inline
void printReprToStream(VM vm, std::ostream & out, int depth, int width);

inline
class mozart::UnstableNode serialize(VM vm, SE se);

inline
class mozart::GlobalNode * globalize(VM vm);

inline
void setUUID(VM vm, const struct mozart::UUID & uuid);
};
7 changes: 7 additions & 0 deletions vm/boostenv/main/cached/Abstraction-implem-decl.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Abstraction;

template <>
class Storage<Abstraction> {
public:
typedef ImplWithArray<Abstraction, class mozart::StableNode> Type;
};
116 changes: 116 additions & 0 deletions vm/boostenv/main/cached/Abstraction-implem.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@

void TypeInfoOf<Abstraction>::printReprToStream(VM vm, RichNode self, std::ostream& out,
int depth, int width) const {
assert(self.is<Abstraction>());
self.as<Abstraction>().printReprToStream(vm, out, depth, width);
}

UnstableNode TypeInfoOf<Abstraction>::serialize(VM vm, SE s, RichNode from) const {
assert(from.is<Abstraction>());
return from.as<Abstraction>().serialize(vm, s);
}

GlobalNode* TypeInfoOf<Abstraction>::globalize(VM vm, RichNode from) const {
assert(from.is<Abstraction>());
return from.as<Abstraction>().globalize(vm);
}

void TypeInfoOf<Abstraction>::gCollect(GC gc, RichNode from, StableNode& to) const {
assert(from.type() == type());
to.make<Abstraction>(gc->vm, from.as<Abstraction>().getArraySize(), gc, from.access<Abstraction>());
}

void TypeInfoOf<Abstraction>::gCollect(GC gc, RichNode from, UnstableNode& to) const {
assert(from.type() == type());
to.make<Abstraction>(gc->vm, from.as<Abstraction>().getArraySize(), gc, from.access<Abstraction>());
}

void TypeInfoOf<Abstraction>::sClone(SC sc, RichNode from, StableNode& to) const {
assert(from.type() == type());
if (from.as<Abstraction>().home()->shouldBeCloned()) {
to.make<Abstraction>(sc->vm, from.as<Abstraction>().getArraySize(), sc, from.access<Abstraction>());
} else {
to.init(sc->vm, from);
}
}

void TypeInfoOf<Abstraction>::sClone(SC sc, RichNode from, UnstableNode& to) const {
assert(from.type() == type());
if (from.as<Abstraction>().home()->shouldBeCloned()) {
to.make<Abstraction>(sc->vm, from.as<Abstraction>().getArraySize(), sc, from.access<Abstraction>());
} else {
to.init(sc->vm, from);
}
}

size_t TypedRichNode<Abstraction>::getArraySize() {
return _self.access<Abstraction>().getArraySize();
}

StaticArray<class mozart::StableNode> TypedRichNode<Abstraction>::getElementsArray() {
return _self.access<Abstraction>().getElementsArray();
}

class mozart::StableNode& TypedRichNode<Abstraction>::getElements(size_t i) {
return _self.access<Abstraction>().getElements(i);
}

inline
class mozart::Space * TypedRichNode<Abstraction>::home() {
return _self.access<Abstraction>().home();
}

inline
size_t TypedRichNode<Abstraction>::getArraySizeImpl() {
return _self.access<Abstraction>().getArraySizeImpl();
}

inline
atom_t TypedRichNode<Abstraction>::getPrintName(VM vm) {
return _self.access<Abstraction>().getPrintName(vm);
}

inline
bool TypedRichNode<Abstraction>::isCallable(VM vm) {
return _self.access<Abstraction>().isCallable(vm);
}

inline
bool TypedRichNode<Abstraction>::isProcedure(VM vm) {
return _self.access<Abstraction>().isProcedure(vm);
}

inline
size_t TypedRichNode<Abstraction>::procedureArity(VM vm) {
return _self.access<Abstraction>().procedureArity(vm);
}

inline
void TypedRichNode<Abstraction>::getCallInfo(VM vm, size_t & arity, ProgramCounter & start, size_t & Xcount, StaticArray<class mozart::StableNode> & Gs, StaticArray<class mozart::StableNode> & Ks) {
_self.access<Abstraction>().getCallInfo(vm, arity, start, Xcount, Gs, Ks);
}

inline
void TypedRichNode<Abstraction>::getDebugInfo(VM vm, atom_t & printName, class mozart::UnstableNode & debugData) {
_self.access<Abstraction>().getDebugInfo(vm, printName, debugData);
}

inline
void TypedRichNode<Abstraction>::printReprToStream(VM vm, std::ostream & out, int depth, int width) {
_self.access<Abstraction>().printReprToStream(vm, out, depth, width);
}

inline
class mozart::UnstableNode TypedRichNode<Abstraction>::serialize(VM vm, SE se) {
return _self.access<Abstraction>().serialize(vm, se);
}

inline
class mozart::GlobalNode * TypedRichNode<Abstraction>::globalize(VM vm) {
return _self.access<Abstraction>().globalize(_self, vm);
}

inline
void TypedRichNode<Abstraction>::setUUID(VM vm, const struct mozart::UUID & uuid) {
_self.access<Abstraction>().setUUID(_self, vm, uuid);
}
Loading