@@ -71,16 +71,6 @@ static inline HM_HierarchicalHeap toSpaceHH (GC_state s, struct ForwardHHObjptrA
7171// void scavengeChunkOfPinnedObject(GC_state s, objptr op, void* rawArgs);
7272
7373
74-
75- static bool try_disentangle_object (objptr op , uint32_t opDepth ) {
76- if (isPinned (op ) && unpinDepthOf (op ) >= opDepth ) {
77- bool successful_unpin = tryUnpinWithDepth (op , opDepth );
78- return successful_unpin ;
79- }
80- return TRUE;
81- }
82-
83-
8474#if ASSERT
8575void checkRememberedEntry (GC_state s , HM_remembered remElem , void * args );
8676bool hhContainsChunk (HM_HierarchicalHeap hh , HM_chunk theChunk );
@@ -1382,17 +1372,20 @@ void markAndAdd(
13821372 return ;
13831373 }
13841374
1385- bool de_success = try_disentangle_object (op , opDepth );
1386- if (!de_success ) {
1387- DIE ("try_disentangle_object failed? should be impossible" );
1375+ if (isPinned (op ) && unpinDepthOf (op ) >= opDepth ) {
1376+ // This object should be unpinned. BUT, it's possible that concurrently
1377+ // it gets repinned (to a shallower unpin depth).
1378+ //
1379+ // So, if this call returns false, no problem.
1380+ tryUnpinWithDepth (op , opDepth );
13881381 }
13891382
13901383 enum PinType pt = pinType (getHeader (p ));
13911384
13921385 if (pt == PIN_DOWN )
13931386 {
13941387 // it is okay to not trace PIN_DOWN objects because the remembered set will have them
1395- // and we will definitely trace; this relies on the failure of unpinning in try_disentangle_object.
1388+ // and we will definitely trace;
13961389 // it is dangerous to skip PIN_ANY objects here because the remSet entry for them might be created
13971390 // concurrently to LGC and LGC may miss them.
13981391 return ;
@@ -1933,10 +1926,15 @@ void forwardHHObjptr(
19331926 return ;
19341927 }
19351928 else
1936- {
1937- bool de_success = try_disentangle_object (op , opDepth );
1938- if (!de_success ) {
1939- DIE ("try_disentangle_object failed? should be impossible" );
1929+ {
1930+ assert (pinType (op ) != PIN_ANY );
1931+
1932+ if (isPinned (op )) {
1933+ assert (unpinDepthOf (op ) >= opDepth );
1934+ // This object should be unpinned
1935+ if (!tryUnpinWithDepth (op , opDepth )) {
1936+ DIE ("impossible? unpin should always succeed here, because object is not reachable from entanglement sources" );
1937+ }
19401938 }
19411939 }
19421940
0 commit comments