summaryrefslogtreecommitdiff
path: root/rts/sm/GC.c
diff options
context:
space:
mode:
Diffstat (limited to 'rts/sm/GC.c')
-rw-r--r--rts/sm/GC.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/rts/sm/GC.c b/rts/sm/GC.c
index dabcd722d7..19d9ab23bc 100644
--- a/rts/sm/GC.c
+++ b/rts/sm/GC.c
@@ -670,6 +670,15 @@ GarbageCollect (nat collect_gen,
if (major_gc) { gcCAFs(); }
#endif
+ // Update the stable pointer hash table.
+ updateStableTables(major_gc);
+
+ // unlock the StablePtr table. Must be before scheduleFinalizers(),
+ // because a finalizer may call hs_free_fun_ptr() or
+ // hs_free_stable_ptr(), both of which access the StablePtr table.
+ stableUnlock();
+
+ // Must be after stableUnlock(), because it might free stable ptrs.
if (major_gc) {
checkUnload (gct->scavenged_static_objects);
}
@@ -696,14 +705,6 @@ GarbageCollect (nat collect_gen,
}
}
- // Update the stable pointer hash table.
- updateStableTables(major_gc);
-
- // unlock the StablePtr table. Must be before scheduleFinalizers(),
- // because a finalizer may call hs_free_fun_ptr() or
- // hs_free_stable_ptr(), both of which access the StablePtr table.
- stableUnlock();
-
// Start any pending finalizers. Must be after
// updateStableTables() and stableUnlock() (see #4221).
RELEASE_SM_LOCK;