Skip to content

Commit

Permalink
refactor(kclvm-runner): encapsulate lib generating, linking and execu…
Browse files Browse the repository at this point in the history
…ting into kclvm-runner.

1. Encapsulate generating of libs  in "kclvm/src/lib.rs" and "kclvm/src/main.rs"  into "kclvm/runner/assembler.rs".
2. Encapsulate linking of libs in "kclvm/src/lib.rs" and "kclvm/src/main.rs" into "kclvm/runner/linker.rs"
3. Encapsulate executing of libs  in "kclvm/src/lib.rs" and "kclvm/src/main.rs" into "kclvm/runner/lib.rs".
4. A timer is added during the concurrent multi-file compilation to prevent KCLVM locked due to child thread panic.

fix #67 #106 #82
  • Loading branch information
zong-zhe committed Jul 11, 2022
1 parent 1a3729e commit 6409a6d
Show file tree
Hide file tree
Showing 33 changed files with 439 additions and 451 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/github-actions.yaml
Expand Up @@ -35,7 +35,7 @@ jobs:
components: clippy, rustfmt
- name: Rust unit test
working-directory: ./kclvm
run: export PATH=$PATH:$(PWD)/_build/dist/ubuntu/kclvm/bin/ && make && make codecov-lcov
run: export PATH=$PATH:$PWD/../_build/dist/ubuntu/kclvm/bin && make install-rustc-wasm && make && make codecov-lcov
shell: bash
- name: Coveralls upload
uses: coverallsapp/github-action@master
Expand Down
1 change: 0 additions & 1 deletion internal/kclvm_py/scripts/update-kclvm.sh
Expand Up @@ -122,7 +122,6 @@ cargo build --release --target wasm32-unknown-unknown
cp $topdir/kclvm/target/wasm32-unknown-unknown/release/libkclvm.a $kclvm_install_dir/lib/libkclvm_wasm32.a
cp src/_kclvm_undefined_wasm.txt $kclvm_install_dir/lib/_kclvm_undefined_wasm.txt


cp src/_kclvm.bc $kclvm_install_dir/include/_kclvm.bc
cp src/_kclvm.h $kclvm_install_dir/include/_kclvm.h

Expand Down
10 changes: 2 additions & 8 deletions kclvm/runner/benches/bench_runner.rs
Expand Up @@ -3,18 +3,12 @@ use kclvm_parser::load_program;
use kclvm_runner::{execute, runner::ExecProgramArgs};
use kclvm_tools::query::apply_overrides;

const TEST_CASE_PATH: &str = "/src/test_datas/init_check_order_0/main.k";
const TEST_CASE_PATH: &str = "./src/test_datas/init_check_order_0/main.k";

pub fn criterion_benchmark(c: &mut Criterion) {
let kcl_path = &format!(
"{}{}",
std::env::current_dir().unwrap().to_str().unwrap(),
TEST_CASE_PATH
);

c.bench_function("refactor kclvm-runner", |b| {
b.iter(|| {
after_refactor(kcl_path.to_string());
after_refactor(TEST_CASE_PATH.to_string());
})
});
}
Expand Down

0 comments on commit 6409a6d

Please sign in to comment.