diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-11-15 15:48:29 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-12-16 16:12:45 -0500 |
commit | eb1a013648f6c4ff7704a99a7c654f7dec787b63 (patch) | |
tree | 21b546e99a7786e51eeedbe88e818602790447f6 | |
parent | 82c62074cdf5077efcc31128695eca4e4b9da75b (diff) | |
download | haskell-eb1a013648f6c4ff7704a99a7c654f7dec787b63.tar.gz |
rts: Fix ordering of makeStableName
-rw-r--r-- | rts/PrimOps.cmm | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index 96fd969e93..94e2eb28f5 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -2389,7 +2389,8 @@ stg_makeStableNamezh ( P_ obj ) /* Is there already a StableName for this heap object? * stable_name_table is a pointer to an array of snEntry structs. */ - if ( snEntry_sn_obj(W_[stable_name_table] + index*SIZEOF_snEntry) == NULL ) { + sn_obj = %acquire snEntry_sn_obj(W_[stable_name_table] + index*SIZEOF_snEntry); + if (sn_obj == NULL) { // At this point we have a snEntry, but it doesn't look as used to the // GC yet because we don't have a StableName object for the sn_obj field // (remember that sn_obj == NULL means the entry is free). So if we call @@ -2406,10 +2407,7 @@ stg_makeStableNamezh ( P_ obj ) // This will make the StableName# object visible to other threads; // be sure that its completely visible to other cores. // See Note [Heap memory barriers] in SMP.h. - prim_write_barrier; - snEntry_sn_obj(W_[stable_name_table] + index*SIZEOF_snEntry) = sn_obj; - } else { - sn_obj = snEntry_sn_obj(W_[stable_name_table] + index*SIZEOF_snEntry); + %release snEntry_sn_obj(W_[stable_name_table] + index*SIZEOF_snEntry) = sn_obj; } return (sn_obj); |