Skip to content

Commit 8ca67e0

Browse files
committed
chore: make clippy happy
1 parent 1ac1b1b commit 8ca67e0

File tree

7 files changed

+23
-11
lines changed

7 files changed

+23
-11
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
CARGO_TARGET_DIR: ${{ matrix.CARGO_TARGET_DIR }}
8989
KAGARI_LIB_ROOT: ${{ github.workspace }}${{ matrix.KAGARI_LIB_ROOT }}
9090
PL_ROOT: ${{ github.workspace }}${{ matrix.PL_ROOT }}
91-
GC_LOG: warn
91+
GC_LOG: trace
9292
steps:
9393
- uses: actions/checkout@v4
9494
with:
@@ -120,7 +120,7 @@ jobs:
120120
uses: actions-rs/cargo@v1
121121
with:
122122
command: build
123-
args: --manifest-path vm/Cargo.toml --target-dir target -vv
123+
args: --manifest-path vm/Cargo.toml --target-dir target -vv --no-default-features --features "static,immix,jitdylib"
124124

125125
# - name: build plc
126126
# uses: actions-rs/cargo@v1

src/ast/ctx/cast.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,7 @@ impl<'a, 'ctx> Ctx<'a> {
288288
if let PLType::Union(u) = &*target_pltype.borrow() {
289289
let mut union_members = vec![];
290290
for tp in &u.sum_types {
291-
let tp = self.run_in_type_mod(u, |ctx,u|{
292-
tp.get_type(ctx, builder, true)
293-
})?;
291+
let tp = self.run_in_type_mod(u, |ctx, _| tp.get_type(ctx, builder, true))?;
294292
union_members.push(tp);
295293
}
296294
for (i, tp) in union_members.iter().enumerate() {

src/ast/test.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,12 @@ fn test_compile() {
510510
let exe = crate::utils::canonicalize(&exe)
511511
.unwrap_or_else(|_| panic!("static compiled file not found {:?}", exe));
512512
eprintln!("exec: {:?}", exe);
513+
eprintln!(
514+
"start: {:?}",
515+
std::time::SystemTime::now().duration_since(std::time::SystemTime::UNIX_EPOCH)
516+
);
513517
let mut child = Command::new(exe.to_str().unwrap())
518+
.env("GC_LOG", "info")
514519
.spawn()
515520
.expect("failed to execute compiled program");
516521

test/test/std_test.pi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ impl Task<i64> for CustomTask {
3939

4040
pub fn test_std() void {
4141
iter::test_generator();
42+
println!("test_gen done");
4243
let re = "abcde".index_of("cde");
4344
let chars = [1,2,3];
4445
let subchars = [3];
@@ -72,7 +73,7 @@ pub fn test_std() void {
7273
let mi = math::min(1.0, 2.0);
7374
panic::assert(mi==1.0);
7475
panic::assert((math::cos(math::PI) - -1.0).abs() < 0.0000001);
75-
76+
println!("math done");
7677
let task = async_f1();
7778
task.poll(||=>{
7879
return;
@@ -103,7 +104,9 @@ pub fn test_std() void {
103104
});
104105
panic::assert(b == 100);
105106
fn1(test{a:9999});
107+
println!("async done");
106108
test_json();
109+
println!("json done");
107110
return;
108111
}
109112

vm/src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ fn printi64ln(i: i64) {
2828
println!("{}", i);
2929
}
3030

31+
#[is_runtime]
32+
fn eprinti64ln(i: i64) {
33+
eprintln!("{}", i);
34+
}
35+
3136
#[is_runtime]
3237
fn pl_panic() {
3338
println!("pivot lang panic occured!");
@@ -91,21 +96,19 @@ fn vm_ftoa(f: f32, rec: *mut u8) {
9196
}
9297

9398
#[is_runtime]
94-
fn new_thread(f: *mut i128, sp:*mut u8) {
99+
fn new_thread(f: *mut i128, sp: *mut u8) {
95100
// f's first 8 byte is fn pointer, next 8 byte is data pointer
96101
let ptr = f as *const i64;
97102
let f_ptr = ptr as *const extern "C" fn(i64);
98103
let data_ptr = unsafe { *ptr.offset(1) };
99104
let func = unsafe { *f_ptr };
100105
let (s, r) = channel::<()>();
101-
let ptr_i = ptr as i64;
106+
// let ptr_i = ptr as i64;
102107
immix::pin(data_ptr as _);
103108
// immix::gc_keep_live(data_ptr as _);
104109
// immix::gc_add_root(data_ptr as *mut _, ObjectType::Pointer.int_value());
105110
let c = move || {
106111
// thread::sleep(std::time::Duration::from_secs(1));
107-
let sp = immix::Collector::current_sp();
108-
immix::set_high_sp(sp);
109112
// immix::gc_keep_live(data_ptr as _);
110113
// immix::set_evacuation(false);
111114
// immix::gc_add_root(&mut f as *mut _ as *mut _, ObjectType::Trait.int_value());

vm/src/mutex/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use std::{
66

77
use internal_macro::is_runtime;
88

9+
use crate::logger::SimpleLogger;
10+
911
struct MutexContainer {
1012
mutex: Mutex<()>,
1113
guard: Cell<Option<MutexGuard<'static, ()>>>,
@@ -16,6 +18,7 @@ pub struct OpaqueMutex {
1618

1719
#[is_runtime]
1820
fn create_mutex(mutex: *mut *mut OpaqueMutex) -> u64 {
21+
SimpleLogger::init_from_env("GC_LOG");
1922
// immix::pin(mutex.cast());
2023
// immix::gc_keep_live_pinned(mutex.cast());
2124
*mutex = Box::into_raw(Box::new(MutexContainer {

0 commit comments

Comments
 (0)