Skip to content

Conversation

@qinsoon
Copy link
Contributor

@qinsoon qinsoon commented Feb 7, 2025

This PR adds two things:

  1. a different shadow stack to record objects that are GC preserved. We need to be able to identify those objects, and they are different from the objects in the normal stack.
  2. GC-specific hooks that are inserted for GC.@preserve regions, and related refactoring for code gen. Each GC can deal with the semantics of GC.@preserve based on its implementation.

There could be an alternative implementation for 1. Instead of having a different shadow stack, we just use an extra bit to encode whether the objects is from GC preserve, or from normal GC push. This would require changing the stock GC to handle the extra bit. But this is definitely viable.

@qinsoon qinsoon added the GC: MMTK MMTK GC integration label Feb 7, 2025
@qinsoon qinsoon mentioned this pull request Feb 7, 2025
5 tasks
@vchuravy
Copy link
Member

vchuravy commented Feb 7, 2025

We need to be able to identify those objects, and they are different from the objects in the normal stack.

Can you exand on this? GC.preserve is a simple life-time extension of an object that is on the stack.

If you need to handle these objects specifically you likely also need to handle the gc_roots bundle on foreigncalls.

A separate shadow-stack is relatively expensive, and we may want to move to stack maps in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GC: MMTK MMTK GC integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants