File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,17 @@ typedef struct _jl_ast_context_t {
139139 arraylist_t pinned_objects ;
140140} jl_ast_context_t ;
141141
142+ // FIXME: Ugly hack to get a pointer to the pinned objects
143+ arraylist_t * extract_pinned_objects_from_ast_ctx (void * ctx )
144+ {
145+ // This is used to extract pinned objects from the context
146+ // for the purpose of pinning them in MMTk.
147+ if (ctx == NULL )
148+ return NULL ;
149+ jl_ast_context_t * jl_ctx = (jl_ast_context_t * )ctx ;
150+ return & jl_ctx -> pinned_objects ;
151+ }
152+
142153static jl_ast_context_t jl_ast_main_ctx ;
143154
144155#ifdef __clang_gcanalyzer__
Original file line number Diff line number Diff line change @@ -263,6 +263,17 @@ void gc_pin_objects_from_compiler_frontend(arraylist_t *objects_pinned_by_call)
263263 arraylist_push (objects_pinned_by_call , obj );
264264 }
265265 }
266+ for (size_t i = 0 ; i < jl_ast_ctx_used .len ; i ++ ) {
267+ void * ctx = jl_ast_ctx_used .items [i ];
268+ arraylist_t * pinned_objects = extract_pinned_objects_from_ast_ctx (ctx );
269+ for (size_t j = 0 ; j < pinned_objects -> len ; j ++ ) {
270+ void * obj = pinned_objects -> items [j ];
271+ unsigned char got_pinned = mmtk_pin_object (obj );
272+ if (got_pinned ) {
273+ arraylist_push (objects_pinned_by_call , obj );
274+ }
275+ }
276+ }
266277}
267278
268279void gc_unpin_objects_from_compiler_frontend (arraylist_t * objects_pinned_by_call )
Original file line number Diff line number Diff line change @@ -2439,6 +2439,7 @@ JL_DLLEXPORT void jl_register_newmeth_tracer(void (*callback)(jl_method_t *trace
24392439
24402440// AST access
24412441JL_DLLEXPORT jl_value_t * jl_copy_ast (jl_value_t * expr JL_MAYBE_UNROOTED );
2442+ arraylist_t * extract_pinned_objects_from_ast_ctx (void * ctx );
24422443extern arraylist_t jl_ast_ctx_used ;
24432444
24442445// IR representation
You can’t perform that action at this time.
0 commit comments