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 {
139
139
arraylist_t pinned_objects ;
140
140
} jl_ast_context_t ;
141
141
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
+
142
153
static jl_ast_context_t jl_ast_main_ctx ;
143
154
144
155
#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)
263
263
arraylist_push (objects_pinned_by_call , obj );
264
264
}
265
265
}
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
+ }
266
277
}
267
278
268
279
void 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
2439
2439
2440
2440
// AST access
2441
2441
JL_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 );
2442
2443
extern arraylist_t jl_ast_ctx_used ;
2443
2444
2444
2445
// IR representation
You can’t perform that action at this time.
0 commit comments