Skip to content

Conversation

@aapoalas
Copy link
Member

@aapoalas aapoalas commented Jun 30, 2024

First step towards actually making heap GC usable. This PR adds a BoxedAgent struct that contains a Box<Agent> and exposes a with(closure) API that is the real "entry point" into calling JS in the familiar Agent. Additionally, BoxedAgent exposes a gc() method. Note that gc() cannot be called on the Agent struct, only on BoxedAgent. You also cannot access Agent through BoxedAgent without going into with(closure).

Together, this means that you cannot run GC while JS is running. This is good. You also cannot use JS Values without again going into with(closure). This is also good.

This however doesn't stop you from sneaking out JS Values of with(closure). This is bad, but that's future stuff.

@aapoalas aapoalas force-pushed the feat/heap-agent-gc branch 2 times, most recently from 1763891 to d21f761 Compare July 2, 2024 18:16
andreubotella
andreubotella previously approved these changes Jul 3, 2024
Copy link
Collaborator

@andreubotella andreubotella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked through the entire PR, because I'm not too familiar with how some parts of the GC infrastructure work, but I left some comments on the API.

@aapoalas aapoalas force-pushed the feat/heap-agent-gc branch from 2f76b11 to c128e8f Compare July 25, 2024 14:49
@aapoalas aapoalas requested a review from andreubotella July 25, 2024 15:14
@aapoalas aapoalas merged commit daf2b36 into main Jul 25, 2024
@aapoalas aapoalas deleted the feat/heap-agent-gc branch July 25, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants