Change soft-fail to use the config, rather than env
[rbx.git] / shotgun / lib / object_memory-barrier.h
blobb8c95aeaa0059b56125a0d598a2c4ae8ceec4793
1 /*
3 We need to have a write barrier that performs checks whenever a reference
4 is written. This allows the new generation to collected without collecting
5 the old generation too.
7 The idea is that if +target+ is on object in the old generation, and +val+
8 is an object in the new generation, we need to add +target+ to the remember
9 set of new generation so that when we go to collect the new generation,
10 we are sure that +val+ survives.
12 The flag is so that we don't put the object into the remember set
13 more than once.
17 /* TODO: This routine MUST be optimized because it's hit constantly. */
19 #include <assert.h>
21 static inline void object_memory_write_barrier(object_memory om, OBJECT target, OBJECT val) {
22 gc_zone tz, vz;
23 if(!REFERENCE_P(val)) return;
25 tz = target->gc_zone;
26 vz = val->gc_zone;
28 assert(tz > 0);
29 assert(vz > 0);
30 xassert(val->klass != Qnil);
32 /* if the target is in a higher numbered zone than val, then
33 that means it needs to be in the remember set. */
34 if(tz < vz) {
35 object_memory_update_rs(om, target, val);