Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect root objects in WASM stack #100

Open
myuon opened this issue Sep 10, 2023 · 5 comments
Open

Detect root objects in WASM stack #100

myuon opened this issue Sep 10, 2023 · 5 comments
Labels
bug Something isn't working gc

Comments

@myuon
Copy link
Owner

myuon commented Sep 10, 2023

// FIXME: this is broken at 2.8.1

@myuon myuon added bug Something isn't working gc labels Sep 10, 2023
@myuon
Copy link
Owner Author

myuon commented Sep 10, 2023

How about pushing to stack at every t_make or t_record, instead of t_let?

Or, at every function call of alloc_with_rep

@myuon
Copy link
Owner Author

myuon commented Sep 12, 2023

fun f() {
  let k = make[vec[i32]]();

  return k;
}

fun g() {
  let l = f();
}

@myuon
Copy link
Owner Author

myuon commented Sep 12, 2023

Observation: We only need to find the locals and get their values.

fun f() {
  let k = make[vec[i32]]();
  let h = make[vec[i32]]();
 
  return k;
}

fun g() {
  let l = f();

unwind:
  stack_push(l);

  perform_gc();
}
fun recursive(i: vec[i32]) {
  let k = make[vec[i32]]();
  
unwind:
  stack_push(k);

  recursive(k);
}

@myuon
Copy link
Owner Author

myuon commented Sep 12, 2023

Or we should avoid using local variables, push everything to memory, which solves this issue

@myuon
Copy link
Owner Author

myuon commented Sep 12, 2023

We need to do this:

  • push all local variables to stack before function call
  • push all local variables just before calling perform_gc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gc
Projects
Status: Todo
Development

No branches or pull requests

1 participant