Skip to content

Commit 6a540e8

Browse files
add Julia to pipeline (#4199)
* add Julia to pipeline Signed-off-by: Nikolaj Bjorner <[email protected]> * na Signed-off-by: Nikolaj Bjorner <[email protected]> * na Signed-off-by: Nikolaj Bjorner <[email protected]>
1 parent d3e4dd6 commit 6a540e8

File tree

3 files changed

+115
-59
lines changed

3 files changed

+115
-59
lines changed

azure-pipelines.yml

Lines changed: 92 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -93,67 +93,125 @@ jobs:
9393
# - template: scripts/test-jupyter.yml
9494
# - template: scripts/test-java-cmake.yml
9595
# - template: scripts/test-regressions.yml
96-
97-
96+
9897
- job: "LinuxCMake"
9998
displayName: "Ubuntu build - cmake"
10099
pool:
101100
vmImage: "Ubuntu-16.04"
102101
strategy:
103102
matrix:
104-
debugClang:
105-
cmdLine: 'CC=clang CXX=clang++ cmake $(cmakeStdArgs)'
106-
runUnitTest: 'True'
107103
releaseClang:
108-
cmdLine: 'CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release $(cmakeStdArgs)'
109-
runUnitTest: 'True'
104+
setupCmd1: ''
105+
setupCmd2: ''
106+
buildCmd: 'CC=clang CXX=clang++ cmake -DCMAKE_BUILD_TYPE=Release $(cmakeStdArgs)'
107+
runTests: 'True'
108+
debugClang:
109+
setupCmd1: 'julia -e "using Pkg; Pkg.add(PackageSpec(name=\"libcxxwrap_julia_jll\", version=\"0.7.0\"))"'
110+
setupCmd2: 'JlCxxDir=$(julia -e "using libcxxwrap_julia_jll; print(dirname(libcxxwrap_julia_jll.libcxxwrap_julia_path))")'
111+
buildCmd: 'CC=clang CXX=clang++ cmake -DJlCxx_DIR=$JlCxxDir/cmake/JlCxx -DZ3_BUILD_JULIA_BINDINGS=True $(cmakeStdArgs)'
112+
runTests: 'True'
110113
debugGcc:
111-
cmdLine: 'CC=gcc CXX=g++ cmake $(cmakeStdArgs)'
112-
runUnitTest: 'True'
114+
setupCmd1: ''
115+
setupCmd2: ''
116+
buildCmd: 'CC=gcc CXX=g++ cmake $(cmakeStdArgs)'
117+
runTests: 'True'
113118
releaseSTGcc:
114-
cmdLine: 'CC=gcc CXX=g++ cmake -DCMAKE_BUILD_TYPE=Release -DSINGLE_THREADED=ON $(cmakeStdArgs)'
115-
runUnitTest: 'True'
116-
# gccX86:
117-
# cmdLine: 'CXXFLAGS="${CXXFLAGS} -m32" CFLAGS="${CFLAGS} -m32" CC=gcc-5 CXX=g++-5 cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo $(cmakeStdArgs)'
118-
# runUnitTest: 'True'
119-
# asan:
120-
# cmdLine: '$(asanEnv) cmake $(cmakeStdArgs)'
121-
# runUnitTest: 'False'
119+
setupCmd1: ''
120+
setupCmd2: ''
121+
buildCmd: 'CC=gcc CXX=g++ cmake -DCMAKE_BUILD_TYPE=Release -DSINGLE_THREADED=ON $(cmakeStdArgs)'
122+
runTests: 'True'
122123
steps:
123124
- script: sudo apt-get install ninja-build
124125
- script: |
125126
set -e
126127
mkdir build
127128
cd build
128-
$(cmdLine)
129+
$(setupCmd1)
130+
$(setupCmd2)
131+
$(buildCmd)
129132
ninja
130133
ninja test-z3
131134
cd ..
132135
- script: |
133136
cd build
134137
./test-z3 -a
135138
cd ..
136-
condition: eq(variables['runUnitTest'], 'True')
137-
- template: scripts/test-examples-cmake.yml
139+
condition: eq(variables['runTests'], 'True')
140+
- ${{if eq(variables['runTests'], 'True')}}:
141+
- template: scripts/test-examples-cmake.yml
138142
# - template: scripts/test-jupyter.yml
139143
# - template: scripts/test-java-cmake.yml
140-
- template: scripts/test-regressions.yml
144+
- ${{if eq(variables['runTests'], 'True')}}:
145+
- template: scripts/test-regressions.yml
141146

142-
143-
- job: "Windows2017"
144-
displayName: "Windows 2017 build"
145-
pool:
146-
vmImage: "vs2017-win2016"
147-
steps:
148-
- script: scripts\vsts-vs2017.cmd x64
149-
150-
- job: "Windows2017ARM64"
151-
displayName: "Windows 2017 ARM64 build"
152-
pool:
153-
vmImage: "vs2017-win2016"
147+
- job: "WindowsLatest"
148+
displayName: "Windows Latest build"
149+
pool:
150+
vmImage: "windows-latest"
151+
strategy:
152+
matrix:
153+
x64:
154+
arch: 'x64'
155+
setupCmd1: ''
156+
setupCmd2: ''
157+
setupCmd3: ''
158+
bindings: '-DZ3_BUILD_DOTNET_BINDINGS=True -DZ3_BUILD_JAVA_BINDINGS=True -DZ3_BUILD_PYTHON_BINDINGS=True'
159+
runTests: 'True'
160+
x86:
161+
arch: 'x86'
162+
setupCmd1: ''
163+
setupCmd2: ''
164+
setupCmd3: ''
165+
bindings: '-DZ3_BUILD_PYTHON_BINDINGS=True'
166+
runTests: 'False'
167+
arm64:
168+
arch: 'amd64_arm64'
169+
setupCmd1: ''
170+
setupCmd2: ''
171+
setupCmd3: ''
172+
bindings: ''
173+
runTests: 'False'
174+
Julia:
175+
arch: 'x64'
176+
setupCmd1: 'julia -e "using Pkg; Pkg.add(PackageSpec(name=\"libcxxwrap_julia_jll\", version=\"0.7.0\"))"'
177+
setupCmd2: 'julia -e "using libcxxwrap_julia_jll; print(dirname(libcxxwrap_julia_jll.libcxxwrap_julia_path))" > tmp.env'
178+
setupCmd3: 'set /P JlCxxDir=<tmp.env'
179+
bindings: '-DJlCxx_DIR=%JlCxxDir%\..\lib\cmake\JlCxx -DZ3_BUILD_JULIA_BINDINGS=True'
180+
runTests: 'False'
154181
steps:
155-
- script: scripts\vsts-vs2017.cmd amd64_arm64
182+
- script: md build
183+
- script: |
184+
cd build
185+
$(setupCmd1)
186+
$(setupCmd2)
187+
$(setupCmd3)
188+
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" $(arch)
189+
cmake $(bindings) -G "NMake Makefiles" ../
190+
nmake
191+
cd ..
192+
- script: |
193+
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" $(arch)
194+
pushd build\python
195+
python z3test.py z3
196+
python z3test.py z3num
197+
popd
198+
pushd build
199+
nmake cpp_example
200+
examples\cpp_example_build_dir\cpp_example.exe
201+
nmake c_example
202+
examples\c_example_build_dir\c_example.exe
203+
nmake java_example
204+
nmake dotnet_example
205+
nmake test-z3
206+
test-z3.exe -a
207+
popd
208+
condition: eq(variables['runTests'], 'True')
209+
- script: |
210+
git clone https://github.com/z3prover/z3test z3test
211+
python z3test\scripts\test_benchmarks.py build\z3.exe z3test\regressions\smt2
212+
condition: eq(variables['runTests'], 'True')
156213
214+
157215
- job: "MacOS"
158216
displayName: "MacOS build"
159217
pool:

src/ast/rewriter/seq_rewriter.cpp

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,9 @@ br_status seq_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * con
585585
case _OP_STRING_STRIDOF:
586586
UNREACHABLE();
587587
}
588+
if (st == BR_FAILED) {
589+
st = lift_ite(f, num_args, args, result);
590+
}
588591
if (st != BR_FAILED && m().get_sort(result) != f->get_range()) {
589592
std::cout << expr_ref(m().mk_app(f, num_args, args), m()) << " -> " << result << "\n";
590593
}
@@ -685,21 +688,29 @@ br_status seq_rewriter::mk_seq_length(expr* a, expr_ref& result) {
685688
result = m_autil.mk_add(es.size(), es.c_ptr());
686689
return BR_REWRITE2;
687690
}
691+
return BR_FAILED;
692+
}
693+
694+
br_status seq_rewriter::lift_ite(func_decl* f, unsigned n, expr* const* args, expr_ref& result) {
688695
expr* c = nullptr, *t = nullptr, *e = nullptr;
689-
if (m().is_ite(a, c, t, e) && (t->get_ref_count() == 1 || e->get_ref_count() == 1)) {
690-
result = m().mk_ite(c, m_util.str.mk_length(t), m_util.str.mk_length(e));
691-
return BR_REWRITE3;
692-
}
693-
#if 0
694-
if (m().is_ite(a, c, t, e) && (get_depth(t) <= 2 || get_depth(e) <= 2)) {
695-
result = m().mk_ite(c, m_util.str.mk_length(t), m_util.str.mk_length(e));
696-
return BR_REWRITE3;
696+
for (unsigned i = 0; i < n; ++i) {
697+
if (m().is_ite(args[i], c, t, e) &&
698+
(get_depth(t) <= 2 || t->get_ref_count() == 1 ||
699+
get_depth(e) <= 2 || e->get_ref_count() == 1)) {
700+
ptr_buffer<expr> new_args;
701+
for (unsigned j = 0; j < n; ++j) new_args.push_back(args[j]);
702+
new_args[i] = t;
703+
expr_ref arg1(m().mk_app(f, new_args), m());
704+
new_args[i] = e;
705+
expr_ref arg2(m().mk_app(f, new_args), m());
706+
result = m().mk_ite(c, arg1, arg2);
707+
return BR_REWRITE2;
708+
}
697709
}
698-
#endif
699-
700710
return BR_FAILED;
701711
}
702712

713+
703714
bool seq_rewriter::is_suffix(expr* s, expr* offset, expr* len) {
704715
expr_ref_vector lens(m());
705716
rational a, b;
@@ -771,21 +782,6 @@ br_status seq_rewriter::mk_seq_extract(expr* a, expr* b, expr* c, expr_ref& resu
771782
bool lengthPos = m_util.str.is_length(b) || m_autil.is_add(b);
772783
sort* a_sort = m().get_sort(a);
773784

774-
expr* cond = nullptr, *t = nullptr, *e = nullptr;
775-
#if 0
776-
if (m().is_ite(a, cond, t, e) && (get_depth(t) <= 2 || get_depth(e) <= 2)) {
777-
result = m().mk_ite(cond, m_util.str.mk_substr(t, b, c), m_util.str.mk_substr(e, b, c));
778-
return BR_REWRITE3;
779-
}
780-
if (m().is_ite(b, cond, t, e) && (get_depth(t) <= 2 || get_depth(e) <= 2)) {
781-
result = m().mk_ite(cond, m_util.str.mk_substr(a, t, c), m_util.str.mk_substr(a, e, c));
782-
return BR_REWRITE3;
783-
}
784-
if (m().is_ite(c, cond, t, e) && (get_depth(t) <= 2 || get_depth(e) <= 2)) {
785-
result = m().mk_ite(cond, m_util.str.mk_substr(a, b, t), m_util.str.mk_substr(a, b, e));
786-
return BR_REWRITE3;
787-
}
788-
#endif
789785
sign sg;
790786
if (sign_is_determined(c, sg) && sg == sign_neg) {
791787
result = m_util.str.mk_empty(a_sort);
@@ -1759,6 +1755,7 @@ br_status seq_rewriter::mk_str_stoi(expr* a, expr_ref& result) {
17591755
result = m().mk_ite(m_autil.mk_ge(b, zero()), b, minus_one());
17601756
return BR_DONE;
17611757
}
1758+
17621759
expr* c = nullptr, *t = nullptr, *e = nullptr;
17631760
if (m().is_ite(a, c, t, e)) {
17641761
result = m().mk_ite(c, m_util.str.mk_stoi(t), m_util.str.mk_stoi(e));

src/ast/rewriter/seq_rewriter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ class seq_rewriter {
163163
br_status mk_re_opt(expr* a, expr_ref& result);
164164
br_status mk_re_loop(func_decl* f, unsigned num_args, expr* const* args, expr_ref& result);
165165
br_status mk_re_range(expr* lo, expr* hi, expr_ref& result);
166+
br_status lift_ite(func_decl* f, unsigned n, expr* const* args, expr_ref& result);
166167

167168
bool cannot_contain_prefix(expr* a, expr* b);
168169
bool cannot_contain_suffix(expr* a, expr* b);

0 commit comments

Comments
 (0)