Skip to content

Commit

Permalink
chore: make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Chronostasys committed Dec 19, 2024
1 parent 1ac1b1b commit f67a87c
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions planglib/std/task/reactor.pi
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ fn async_cb(async_t:*libuv::uv_async_t) void {
return;
}

fn eprinti64ln(i:i64) void ;

fn idle_cb(_idle: *libuv::uv_idle_t) void {
eprinti64ln(9877);
gc::DioGC__safepoint(asm_sp());
return;
}
Expand Down
4 changes: 1 addition & 3 deletions src/ast/ctx/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
1 change: 1 addition & 0 deletions src/ast/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ fn test_compile() {
.unwrap_or_else(|_| panic!("static compiled file not found {:?}", exe));
eprintln!("exec: {:?}", exe);
let mut child = Command::new(exe.to_str().unwrap())
.env("GC_LOG", "info")
.spawn()
.expect("failed to execute compiled program");

Expand Down
5 changes: 4 additions & 1 deletion test/test/std_test.pi
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ impl Task<i64> 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];
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
11 changes: 7 additions & 4 deletions vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ fn printi64ln(i: i64) {
println!("{}", i);
}

#[is_runtime]
fn eprinti64ln(i: i64) {
eprintln!("{}", i);

Check warning on line 33 in vm/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

vm/src/lib.rs#L32-L33

Added lines #L32 - L33 were not covered by tests
}

#[is_runtime]
fn pl_panic() {
println!("pivot lang panic occured!");
Expand Down Expand Up @@ -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) {

Check warning on line 99 in vm/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

vm/src/lib.rs#L99

Added line #L99 was not covered by tests
// 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 _);

Check warning on line 108 in vm/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

vm/src/lib.rs#L106-L108

Added lines #L106 - L108 were not covered by tests
// 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 _);

Check warning on line 112 in vm/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

vm/src/lib.rs#L112

Added line #L112 was not covered by tests
// immix::set_evacuation(false);
// immix::gc_add_root(&mut f as *mut _ as *mut _, ObjectType::Trait.int_value());
Expand Down
3 changes: 3 additions & 0 deletions vm/src/mutex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use std::{

use internal_macro::is_runtime;

use crate::logger::SimpleLogger;

struct MutexContainer {
mutex: Mutex<()>,
guard: Cell<Option<MutexGuard<'static, ()>>>,
Expand All @@ -16,6 +18,7 @@ pub struct OpaqueMutex {

#[is_runtime]
fn create_mutex(mutex: *mut *mut OpaqueMutex) -> u64 {
SimpleLogger::init_from_env("GC_LOG");
// immix::pin(mutex.cast());
// immix::gc_keep_live_pinned(mutex.cast());

Check warning on line 23 in vm/src/mutex/mod.rs

View check run for this annotation

Codecov / codecov/patch

vm/src/mutex/mod.rs#L21-L23

Added lines #L21 - L23 were not covered by tests
*mutex = Box::into_raw(Box::new(MutexContainer {
Expand Down

0 comments on commit f67a87c

Please sign in to comment.