@@ -2084,9 +2084,11 @@ mono_class_create_runtime_vtable (MonoDomain *domain, MonoClass *klass, MonoErro
2084
2084
/* it's a pointer type: add check */
2085
2085
g_assert ((fklass -> byval_arg .type == MONO_TYPE_PTR ) || (fklass -> byval_arg .type == MONO_TYPE_FNPTR ));
2086
2086
* t = * (char * )data ;
2087
+ /* This is not needed by sgen, as it does not seem
2088
+ + to need write barriers for uncollectable objects (like the vtables storing static
2089
+ + fields), but it is needed for incremental boehm. */
2090
+ mono_gc_wbarrier_generic_nostore (t );
2087
2091
}
2088
- // can probably be in else clause above:
2089
- mono_gc_wbarrier_generic_nostore (t );
2090
2092
continue ;
2091
2093
}
2092
2094
}
@@ -3296,7 +3298,11 @@ mono_field_static_set_value (MonoVTable *vt, MonoClassField *field, void *value)
3296
3298
dest = (char * )mono_vtable_get_static_field_data (vt ) + field -> offset ;
3297
3299
}
3298
3300
mono_copy_value (field -> type , dest , value , FALSE);
3299
- mono_gc_wbarrier_generic_nostore (dest );
3301
+ /* This is not needed by sgen, as it does not seem
3302
+ to need write barriers for uncollectable objects (like the vtables storing static
3303
+ + fields), but it is needed for incremental boehm. */
3304
+ if (field -> offset == -1 )
3305
+ mono_gc_wbarrier_generic_nostore (dest );
3300
3306
}
3301
3307
3302
3308
/**
@@ -3334,7 +3340,6 @@ mono_field_get_addr (MonoObject *obj, MonoVTable *vt, MonoClassField *field)
3334
3340
src = (guint8 * )mono_get_special_static_data (GPOINTER_TO_UINT (addr ));
3335
3341
} else {
3336
3342
src = (guint8 * )mono_vtable_get_static_field_data (vt ) + field -> offset ;
3337
- mono_gc_wbarrier_generic_nostore (src );
3338
3343
}
3339
3344
} else {
3340
3345
src = (guint8 * )obj + field -> offset ;
0 commit comments