Skip to content

Commit b50cb4e

Browse files
qinsoonudesou
authored andcommitted
Trace pinned objects as roots (mmtk#91)
Following the suggestion in mmtk#89 (comment), trace recently added pinned objects as roots. When we pass those objects as 'nodes' to MMTk, MMTk does not know the slots so MMTk cannot update the reference, thus MMTk will not move those objects. This is essentially the same as pinning those objects before a GC, and unpinning after a GC.
1 parent ee3a422 commit b50cb4e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/ast.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,9 @@ static value_t julia_to_list2_noalloc(fl_context_t *fl_ctx, jl_value_t *a, jl_va
797797

798798
static value_t julia_to_scm_(jl_ast_context_t *ctx, jl_value_t *v, int check_valid)
799799
{
800+
// The following code will take internal pointers to v's fields. We need to make sure
801+
// that v will not be moved by GC.
802+
arraylist_push(&ctx->ast_roots, v);
800803
value_t retval;
801804
fl_context_t *fl_ctx = &ctx->fl;
802805
if (julia_to_scm_noalloc1(fl_ctx, v, &retval))

0 commit comments

Comments
 (0)