Skip to content

Commit 0dd460e

Browse files
authored
Merge pull request #309 from azarzadavila/gensources
2 parents 181ebf7 + e525255 commit 0dd460e

File tree

394 files changed

+28448
-52
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

394 files changed

+28448
-52
lines changed

.travis.yml

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,51 @@
11
language: generic
22
dist: trusty
33
sudo: false
4-
matrix:
4+
env:
5+
- [ "V=4.0", "PREFIX=/usr/lib/llvm-4.0/lib/cmake", "BIN=/usr/lib/llvm-4.0/bin" ]
6+
addons:
7+
apt:
8+
sources: [ "ubuntu-toolchain-r-test", "llvm-toolchain-trusty-4.0" ]
9+
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" ]
10+
jobs:
511
include:
6-
# Versions before 3.8 are not included nor whitelisted
12+
- stage: compiling and checking sources
13+
before_script:
14+
# Fix clang cmake dirs
15+
- if [ $V == 4.0 ]; then sudo -E ln -sn /usr/share/llvm-4.0/cmake /usr/lib/llvm-4.0/lib/cmake/clang; fi
16+
- 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
17+
- if [ $V == 4.0 ]; then sudo -E ln -s /usr/bin/* /usr/lib/llvm-4.0/bin || true; fi
18+
script:
19+
- mkdir -p ../cache/vm ../cache/boostenv
20+
- mv vm/boostenv/main/cached ../cache/boostenv
21+
- mv vm/vm/main/cached ../cache/vm
22+
- export SOURCES=$(pwd) && mkdir ../build && cd ../build
23+
- cmake -DCMAKE_BUILD_TYPE=Release -DMOZART_BOOST_USE_STATIC_LIBS=False -DCMAKE_PROGRAM_PATH=$BIN -DCMAKE_PREFIX_PATH=$PREFIX -DMOZART_CACHED_BUILD=OFF $SOURCES
24+
- make -B gensources genboostsources VERBOSE=1
25+
- cd ..
26+
- diff -q -r cache/boostenv/cached build/vm/boostenv/main/generated
27+
- diff -Npur cache/boostenv/cached build/vm/boostenv/main/generated
28+
- diff -q -r cache/vm/cached build/vm/vm/main/generated
29+
- diff -Npur cache/vm/cached build/vm/vm/main/generated
730

8-
# Broken (uses ubuntu's version, not llvm one. {LLVM,Clang}Config.cmake are beyond redemption
9-
#- env: [ "V=3.8", "PREFIX=/usr/lib/llvm-3.8" ]
10-
# addons:
11-
# apt:
12-
# sources: [ "ubuntu-toolchain-r-test", "llvm-toolchain-trusty-3.8" ]
13-
# packages: [ "libboost-all-dev", "tcl-dev", "tk-dev", "emacs", "clang-3.8", "libclang-3.8-dev", "llvm-3.8-dev" ]
14-
15-
# Broken: Unknown relocation 0x2a (llvm-3.9 known to be bugged on travis)
16-
#- env: [ "V=3.9", "PREFIX=/usr/lib/llvm-3.9/lib/cmake" ]
17-
# addons:
18-
# apt:
19-
# sources: [ "ubuntu-toolchain-r-test", "llvm-toolchain-trusty-3.9" ]
20-
# packages: [ "libboost-all-dev", "tcl-dev", "tk-dev", "emacs", "clang-3.9", "libclang-3.9-dev", "llvm-3.9-dev" ]
21-
22-
# Works, with heavy fixing (see below)
23-
- env: [ "V=4.0", "PREFIX=/usr/lib/llvm-4.0/lib/cmake", "BIN=/usr/lib/llvm-4.0/bin" ]
24-
addons:
25-
apt:
26-
sources: [ "ubuntu-toolchain-r-test", "llvm-toolchain-trusty-4.0" ]
27-
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" ]
28-
29-
before_script:
30-
- apt list --installed
31-
- env
32-
# Fix clang cmake dirs
33-
- if [ $V == 3.9 ]; then sudo -E ln -sn /usr/share/llvm-3.9/cmake /usr/lib/llvm-3.9/lib/cmake/clang; fi
34-
35-
- if [ $V == 4.0 ]; then sudo -E ln -sn /usr/share/llvm-4.0/cmake /usr/lib/llvm-4.0/lib/cmake/clang; fi
36-
- 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
37-
- if [ $V == 4.0 ]; then sudo -E ln -s /usr/bin/* /usr/lib/llvm-4.0/bin || true; fi
38-
39-
script:
40-
- export SOURCES=$(pwd) && mkdir ../build && cd ../build
41-
- cmake -DCMAKE_BUILD_TYPE=Release -DMOZART_BOOST_USE_STATIC_LIBS=False -DCMAKE_PROGRAM_PATH=$BIN -DCMAKE_PREFIX_PATH=$PREFIX $SOURCES
42-
- make dist VERBOSE=1
43-
- make VERBOSE=1
44-
- make check
45-
deploy:
46-
provider: releases
47-
skip_cleanup: true
48-
on:
49-
tags: true
50-
file_glob: true
51-
file: mozart2-*-Source.zip
52-
api_key:
53-
secure: GxwttdinweSfTeSkWu3aSp//AGT/ew4iyEUaLxh8nDeVRpAHEPBtMhgF25zoP6JLfhlEAOW7+5Gmomk1a/k+VQQWbFbod3jSSUIH/4gafEN7MVgy3Ma1NEWqViSC7IH/DDIhMzHAttznDOA2nWzoV1nyDpUydM8wvs3VK2N2wEI=
31+
- stage: compiling with pre-generated sources
32+
before_script:
33+
# Fix clang cmake dirs
34+
- if [ $V == 4.0 ]; then sudo -E ln -sn /usr/share/llvm-4.0/cmake /usr/lib/llvm-4.0/lib/cmake/clang; fi
35+
- 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
36+
- if [ $V == 4.0 ]; then sudo -E ln -s /usr/bin/* /usr/lib/llvm-4.0/bin || true; fi
37+
script:
38+
- export SOURCES=$(pwd) && mkdir ../build && cd ../build
39+
- cmake -DCMAKE_BUILD_TYPE=Release -DMOZART_BOOST_USE_STATIC_LIBS=False -DCMAKE_PROGRAM_PATH=$BIN -DCMAKE_PREFIX_PATH=$PREFIX $SOURCES
40+
- make dist VERBOSE=1
41+
- make VERBOSE=1
42+
- make check
43+
deploy:
44+
provider: releases
45+
skip_cleanup: true
46+
on:
47+
tags: true
48+
file_glob: true
49+
file: mozart2-*-Source.zip
50+
api_key:
51+
secure: GxwttdinweSfTeSkWu3aSp//AGT/ew4iyEUaLxh8nDeVRpAHEPBtMhgF25zoP6JLfhlEAOW7+5Gmomk1a/k+VQQWbFbod3jSSUIH/4gafEN7MVgy3Ma1NEWqViSC7IH/DDIhMzHAttznDOA2nWzoV1nyDpUydM8wvs3VK2N2wEI=

cmake_local/MozartProperties.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ target_architecture(MOZART_PROP_PLATFORM_ARCH)
1717
# For source tarballs, oz.version and os.date
1818
# are exported id MozartConfigVersion.cmake
1919
include(MozartConfigVersion
20-
RESULT_VARIABLE MOZART_CACHED_BUILD OPTIONAL)
20+
RESULT_VARIABLE MOZART_SOURCE_TARBALL_BUILD OPTIONAL)
2121

2222
# oz.version
2323

24-
if(NOT MOZART_CACHED_BUILD)
24+
if(NOT MOZART_SOURCE_TARBALL_BUILD)
2525
execute_process(
2626
COMMAND ${GIT_EXECUTABLE} describe --dirty
2727
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
@@ -45,7 +45,7 @@ endif()
4545

4646
# oz.date
4747

48-
if(NOT MOZART_CACHED_BUILD)
48+
if(NOT MOZART_SOURCE_TARBALL_BUILD)
4949
execute_process(
5050
COMMAND ${GIT_EXECUTABLE} log "--format=%aD" -1
5151
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"

vm/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ set(LLVM_BUILD_DIR ${DEFAULT_LLVM_BUILD_DIR} CACHE PATH "Path to LLVM build (wit
1313
set(MOZART_GENERATOR_FLAGS "${DEFAULT_MOZART_GENERATOR_FLAGS}" CACHE STRING
1414
"Additional flags for the generator parser (clang)")
1515

16+
set(MOZART_CACHED_BUILD ON CACHE STRING "Use pre-generated sources")
17+
1618
add_compile_options(-std=c++0x)
1719

1820
add_subdirectory(generator)

vm/boostenv/main/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ add_custom_command(
7373
${GENERATED_BOOSTSOURCES_BINARY_DIR}/
7474
boostenvbuiltins
7575

76+
COMMAND ${CMAKE_COMMAND} -E remove
77+
${GENERATED_BOOSTSOURCES_BINARY_DIR}/boostenv.ast
78+
${GENERATED_BOOSTSOURCES_BINARY_DIR}/boostenvmodules.astbi
79+
7680
# Tag
7781
COMMAND ${CMAKE_COMMAND} -E touch ${GENERATED_BOOSTSOURCES_BINARY_DIR}/boostenv.gen
7882

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
template <>
2+
class TypeInfoOf<Abstraction>: public TypeInfo {
3+
4+
static constexpr UUID uuid() {
5+
return UUID();
6+
}
7+
public:
8+
TypeInfoOf() : TypeInfo("Abstraction", uuid(), false, false, false, sbTokenEq, 0) {}
9+
10+
static const TypeInfoOf<Abstraction>* const instance() {
11+
return &RawType<Abstraction>::rawType;
12+
}
13+
14+
static Type type() {
15+
return Type(instance());
16+
}
17+
18+
atom_t getTypeAtom(VM vm) const {
19+
return Abstraction::getTypeAtom(vm);
20+
}
21+
22+
inline
23+
void printReprToStream(VM vm, RichNode self, std::ostream& out,
24+
int depth, int width) const;
25+
26+
inline
27+
UnstableNode serialize(VM vm, SE s, RichNode from) const;
28+
29+
inline
30+
GlobalNode* globalize(VM vm, RichNode from) const;
31+
32+
inline
33+
void gCollect(GC gc, RichNode from, StableNode& to) const;
34+
35+
inline
36+
void gCollect(GC gc, RichNode from, UnstableNode& to) const;
37+
38+
inline
39+
void sClone(SC sc, RichNode from, StableNode& to) const;
40+
41+
inline
42+
void sClone(SC sc, RichNode from, UnstableNode& to) const;
43+
};
44+
45+
template <>
46+
class TypedRichNode<Abstraction>: public BaseTypedRichNode {
47+
public:
48+
explicit TypedRichNode(RichNode self) : BaseTypedRichNode(self) {}
49+
50+
inline
51+
size_t getArraySize();
52+
53+
inline
54+
StaticArray<class mozart::StableNode> getElementsArray();
55+
56+
inline
57+
class mozart::StableNode& getElements(size_t i);
58+
59+
inline
60+
class mozart::Space * home();
61+
62+
inline
63+
size_t getArraySizeImpl();
64+
65+
inline
66+
atom_t getPrintName(VM vm);
67+
68+
inline
69+
bool isCallable(VM vm);
70+
71+
inline
72+
bool isProcedure(VM vm);
73+
74+
inline
75+
size_t procedureArity(VM vm);
76+
77+
inline
78+
void getCallInfo(VM vm, size_t & arity, ProgramCounter & start, size_t & Xcount, StaticArray<class mozart::StableNode> & Gs, StaticArray<class mozart::StableNode> & Ks);
79+
80+
inline
81+
void getDebugInfo(VM vm, atom_t & printName, class mozart::UnstableNode & debugData);
82+
83+
inline
84+
void printReprToStream(VM vm, std::ostream & out, int depth, int width);
85+
86+
inline
87+
class mozart::UnstableNode serialize(VM vm, SE se);
88+
89+
inline
90+
class mozart::GlobalNode * globalize(VM vm);
91+
92+
inline
93+
void setUUID(VM vm, const struct mozart::UUID & uuid);
94+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Abstraction;
2+
3+
template <>
4+
class Storage<Abstraction> {
5+
public:
6+
typedef ImplWithArray<Abstraction, class mozart::StableNode> Type;
7+
};
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
2+
void TypeInfoOf<Abstraction>::printReprToStream(VM vm, RichNode self, std::ostream& out,
3+
int depth, int width) const {
4+
assert(self.is<Abstraction>());
5+
self.as<Abstraction>().printReprToStream(vm, out, depth, width);
6+
}
7+
8+
UnstableNode TypeInfoOf<Abstraction>::serialize(VM vm, SE s, RichNode from) const {
9+
assert(from.is<Abstraction>());
10+
return from.as<Abstraction>().serialize(vm, s);
11+
}
12+
13+
GlobalNode* TypeInfoOf<Abstraction>::globalize(VM vm, RichNode from) const {
14+
assert(from.is<Abstraction>());
15+
return from.as<Abstraction>().globalize(vm);
16+
}
17+
18+
void TypeInfoOf<Abstraction>::gCollect(GC gc, RichNode from, StableNode& to) const {
19+
assert(from.type() == type());
20+
to.make<Abstraction>(gc->vm, from.as<Abstraction>().getArraySize(), gc, from.access<Abstraction>());
21+
}
22+
23+
void TypeInfoOf<Abstraction>::gCollect(GC gc, RichNode from, UnstableNode& to) const {
24+
assert(from.type() == type());
25+
to.make<Abstraction>(gc->vm, from.as<Abstraction>().getArraySize(), gc, from.access<Abstraction>());
26+
}
27+
28+
void TypeInfoOf<Abstraction>::sClone(SC sc, RichNode from, StableNode& to) const {
29+
assert(from.type() == type());
30+
if (from.as<Abstraction>().home()->shouldBeCloned()) {
31+
to.make<Abstraction>(sc->vm, from.as<Abstraction>().getArraySize(), sc, from.access<Abstraction>());
32+
} else {
33+
to.init(sc->vm, from);
34+
}
35+
}
36+
37+
void TypeInfoOf<Abstraction>::sClone(SC sc, RichNode from, UnstableNode& to) const {
38+
assert(from.type() == type());
39+
if (from.as<Abstraction>().home()->shouldBeCloned()) {
40+
to.make<Abstraction>(sc->vm, from.as<Abstraction>().getArraySize(), sc, from.access<Abstraction>());
41+
} else {
42+
to.init(sc->vm, from);
43+
}
44+
}
45+
46+
size_t TypedRichNode<Abstraction>::getArraySize() {
47+
return _self.access<Abstraction>().getArraySize();
48+
}
49+
50+
StaticArray<class mozart::StableNode> TypedRichNode<Abstraction>::getElementsArray() {
51+
return _self.access<Abstraction>().getElementsArray();
52+
}
53+
54+
class mozart::StableNode& TypedRichNode<Abstraction>::getElements(size_t i) {
55+
return _self.access<Abstraction>().getElements(i);
56+
}
57+
58+
inline
59+
class mozart::Space * TypedRichNode<Abstraction>::home() {
60+
return _self.access<Abstraction>().home();
61+
}
62+
63+
inline
64+
size_t TypedRichNode<Abstraction>::getArraySizeImpl() {
65+
return _self.access<Abstraction>().getArraySizeImpl();
66+
}
67+
68+
inline
69+
atom_t TypedRichNode<Abstraction>::getPrintName(VM vm) {
70+
return _self.access<Abstraction>().getPrintName(vm);
71+
}
72+
73+
inline
74+
bool TypedRichNode<Abstraction>::isCallable(VM vm) {
75+
return _self.access<Abstraction>().isCallable(vm);
76+
}
77+
78+
inline
79+
bool TypedRichNode<Abstraction>::isProcedure(VM vm) {
80+
return _self.access<Abstraction>().isProcedure(vm);
81+
}
82+
83+
inline
84+
size_t TypedRichNode<Abstraction>::procedureArity(VM vm) {
85+
return _self.access<Abstraction>().procedureArity(vm);
86+
}
87+
88+
inline
89+
void TypedRichNode<Abstraction>::getCallInfo(VM vm, size_t & arity, ProgramCounter & start, size_t & Xcount, StaticArray<class mozart::StableNode> & Gs, StaticArray<class mozart::StableNode> & Ks) {
90+
_self.access<Abstraction>().getCallInfo(vm, arity, start, Xcount, Gs, Ks);
91+
}
92+
93+
inline
94+
void TypedRichNode<Abstraction>::getDebugInfo(VM vm, atom_t & printName, class mozart::UnstableNode & debugData) {
95+
_self.access<Abstraction>().getDebugInfo(vm, printName, debugData);
96+
}
97+
98+
inline
99+
void TypedRichNode<Abstraction>::printReprToStream(VM vm, std::ostream & out, int depth, int width) {
100+
_self.access<Abstraction>().printReprToStream(vm, out, depth, width);
101+
}
102+
103+
inline
104+
class mozart::UnstableNode TypedRichNode<Abstraction>::serialize(VM vm, SE se) {
105+
return _self.access<Abstraction>().serialize(vm, se);
106+
}
107+
108+
inline
109+
class mozart::GlobalNode * TypedRichNode<Abstraction>::globalize(VM vm) {
110+
return _self.access<Abstraction>().globalize(_self, vm);
111+
}
112+
113+
inline
114+
void TypedRichNode<Abstraction>::setUUID(VM vm, const struct mozart::UUID & uuid) {
115+
_self.access<Abstraction>().setUUID(_self, vm, uuid);
116+
}

0 commit comments

Comments
 (0)