diff --git a/.github/workflows/npmpkg.yml b/.github/workflows/npmpkg.yml index eb5265c6..a5327a87 100644 --- a/.github/workflows/npmpkg.yml +++ b/.github/workflows/npmpkg.yml @@ -23,7 +23,7 @@ jobs: - name: install rust run: cargo install wasm-pack - name: build wasm - run: wasm-pack build --target bundler --no-default-features --scope pivot-lang --release + run: wasm-pack build --target bundler --no-default-features --scope pivot-lang --release --locked # Setup .npmrc file to publish to npm - uses: actions/setup-node@v3 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index af2978de..12511b56 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -88,7 +88,7 @@ jobs: CARGO_TARGET_DIR: ${{ matrix.CARGO_TARGET_DIR }} KAGARI_LIB_ROOT: ${{ github.workspace }}${{ matrix.KAGARI_LIB_ROOT }} PL_ROOT: ${{ github.workspace }}${{ matrix.PL_ROOT }} - GC_LOG: warn + GC_LOG: trace steps: - uses: actions/checkout@v4 with: @@ -120,7 +120,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: build - args: --manifest-path vm/Cargo.toml --target-dir target -vv + args: --manifest-path vm/Cargo.toml --target-dir target -vv --no-default-features --features "static,immix,jitdylib" # - name: build plc # uses: actions-rs/cargo@v1 diff --git a/immix b/immix index e8ee732b..b7f8fc61 160000 --- a/immix +++ b/immix @@ -1 +1 @@ -Subproject commit e8ee732bdfaeba9b122245573937fb27ab09f692 +Subproject commit b7f8fc61b704de4d1e9115289e5e763ff7e94247 diff --git a/src/ast/ctx/cast.rs b/src/ast/ctx/cast.rs index 35e72991..cbfecdd4 100644 --- a/src/ast/ctx/cast.rs +++ b/src/ast/ctx/cast.rs @@ -288,9 +288,7 @@ impl<'a, 'ctx> Ctx<'a> { if let PLType::Union(u) = &*target_pltype.borrow() { let mut union_members = vec![]; for tp in &u.sum_types { - let tp = self.run_in_type_mod(u, |ctx,u|{ - tp.get_type(ctx, builder, true) - })?; + let tp = self.run_in_type_mod(u, |ctx, _| tp.get_type(ctx, builder, true))?; union_members.push(tp); } for (i, tp) in union_members.iter().enumerate() { diff --git a/src/ast/test.rs b/src/ast/test.rs index 375cc9df..26cc2684 100644 --- a/src/ast/test.rs +++ b/src/ast/test.rs @@ -510,12 +510,17 @@ fn test_compile() { let exe = crate::utils::canonicalize(&exe) .unwrap_or_else(|_| panic!("static compiled file not found {:?}", exe)); eprintln!("exec: {:?}", exe); + eprintln!( + "start: {:?}", + std::time::SystemTime::now().duration_since(std::time::SystemTime::UNIX_EPOCH) + ); let mut child = Command::new(exe.to_str().unwrap()) + .env("GC_LOG", "info") .spawn() .expect("failed to execute compiled program"); let o = child - .wait_timeout(std::time::Duration::from_secs(50)) + .wait_timeout(std::time::Duration::from_secs(500)) .expect("failed to wait on child"); if o.is_none() { child.kill().expect("failed to kill child"); diff --git a/test/test/std_test.pi b/test/test/std_test.pi index 9e1de084..74f7dc73 100644 --- a/test/test/std_test.pi +++ b/test/test/std_test.pi @@ -39,6 +39,7 @@ impl Task for CustomTask { pub fn test_std() void { iter::test_generator(); + println!("test_gen done"); let re = "abcde".index_of("cde"); let chars = [1,2,3]; let subchars = [3]; @@ -72,7 +73,7 @@ pub fn test_std() void { let mi = math::min(1.0, 2.0); panic::assert(mi==1.0); panic::assert((math::cos(math::PI) - -1.0).abs() < 0.0000001); - + println!("math done"); let task = async_f1(); task.poll(||=>{ return; @@ -103,7 +104,9 @@ pub fn test_std() void { }); panic::assert(b == 100); fn1(test{a:9999}); + println!("async done"); test_json(); + println!("json done"); return; } diff --git a/vm/src/lib.rs b/vm/src/lib.rs index 54ae1758..73653755 100644 --- a/vm/src/lib.rs +++ b/vm/src/lib.rs @@ -28,6 +28,11 @@ fn printi64ln(i: i64) { println!("{}", i); } +#[is_runtime] +fn eprinti64ln(i: i64) { + eprintln!("{}", i); +} + #[is_runtime] fn pl_panic() { println!("pivot lang panic occured!"); @@ -91,21 +96,19 @@ fn vm_ftoa(f: f32, rec: *mut u8) { } #[is_runtime] -fn new_thread(f: *mut i128, sp:*mut u8) { +fn new_thread(f: *mut i128, sp: *mut u8) { // f's first 8 byte is fn pointer, next 8 byte is data pointer let ptr = f as *const i64; let f_ptr = ptr as *const extern "C" fn(i64); let data_ptr = unsafe { *ptr.offset(1) }; let func = unsafe { *f_ptr }; let (s, r) = channel::<()>(); - let ptr_i = ptr as i64; + // let ptr_i = ptr as i64; immix::pin(data_ptr as _); // immix::gc_keep_live(data_ptr as _); // immix::gc_add_root(data_ptr as *mut _, ObjectType::Pointer.int_value()); let c = move || { // thread::sleep(std::time::Duration::from_secs(1)); - let sp = immix::Collector::current_sp(); - immix::set_high_sp(sp); // immix::gc_keep_live(data_ptr as _); // immix::set_evacuation(false); // immix::gc_add_root(&mut f as *mut _ as *mut _, ObjectType::Trait.int_value());