@@ -413,7 +413,8 @@ get_context (void)
413
413
context = g_new0 (ThreadContext , 1 );
414
414
context -> stack_start = (guchar * )mono_valloc_aligned (INTERP_STACK_SIZE , MINT_STACK_ALIGNMENT , MONO_MMAP_READ | MONO_MMAP_WRITE , MONO_MEM_ACCOUNT_INTERP_STACK );
415
415
// A bit for every pointer sized slot in the stack. FIXME don't allocate whole bit array
416
- context -> no_ref_slots = (guchar * )mono_valloc (NULL , INTERP_STACK_SIZE / (8 * sizeof (gpointer )), MONO_MMAP_READ | MONO_MMAP_WRITE , MONO_MEM_ACCOUNT_INTERP_STACK );
416
+ if (mono_interp_opt & INTERP_OPT_PRECISE_GC )
417
+ context -> no_ref_slots = (guchar * )mono_valloc (NULL , INTERP_STACK_SIZE / (8 * sizeof (gpointer )), MONO_MMAP_READ | MONO_MMAP_WRITE , MONO_MEM_ACCOUNT_INTERP_STACK );
417
418
context -> stack_end = context -> stack_start + INTERP_STACK_SIZE - INTERP_REDZONE_SIZE ;
418
419
context -> stack_real_end = context -> stack_start + INTERP_STACK_SIZE ;
419
420
/* We reserve a stack slot at the top of the interp stack to make temp objects visible to GC */
@@ -8013,6 +8014,8 @@ interp_parse_options (const char *options)
8013
8014
#endif
8014
8015
else if (strncmp (arg , "ssa ", 3 ) == 0 )
8015
8016
opt = INTERP_OPT_SSA ;
8017
+ else if (strncmp (arg , "precise ", 7 ) == 0 )
8018
+ opt = INTERP_OPT_PRECISE_GC ;
8016
8019
else if (strncmp (arg , "all ", 3 ) == 0 )
8017
8020
opt = ~INTERP_OPT_NONE ;
8018
8021
@@ -8558,13 +8561,15 @@ interp_mark_stack (gpointer thread_data, GcScanFunc func, gpointer gc_data, gboo
8558
8561
if (!context || !context - > stack_start )
8559
8562
return ;
8560
8563
8561
- MonoLMF * * lmf_addr = (MonoLMF * * )info - > tls [TLS_KEY_LMF_ADDR ];
8562
- if (lmf_addr )
8563
- interp_mark_no_ref_slots (context , * lmf_addr );
8564
+ if (mono_interp_opt & INTERP_OPT_PRECISE_GC ) {
8565
+ MonoLMF * * lmf_addr = (MonoLMF * * )info - > tls [TLS_KEY_LMF_ADDR ];
8566
+ if (lmf_addr )
8567
+ interp_mark_no_ref_slots (context , * lmf_addr );
8568
+ }
8564
8569
8565
8570
int slot_index = 0 ;
8566
8571
for (gpointer * p = (gpointer * )context - > stack_start ; p < (gpointer * )context - > stack_pointer ; p + + ) {
8567
- if (context - > no_ref_slots [slot_index / 8 ] & (1 << (slot_index % 8 )))
8572
+ if (context - > no_ref_slots && ( context - > no_ref_slots [slot_index / 8 ] & (1 << (slot_index % 8 ) )))
8568
8573
;// This slot is marked as no ref, we don't scan it
8569
8574
else
8570
8575
func (p , gc_data );
0 commit comments