File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -123,8 +123,20 @@ func (b gcBlock) address() uintptr {
123123// points to an allocated object. It returns the same block if this block
124124// already points to the head.
125125func (b gcBlock ) findHead () gcBlock {
126- for b .state () == blockStateTail {
127- b --
126+ const blockStateByteAllTails = uint8 (blockStateTail << (stateBits * 3 ) | blockStateTail << (stateBits * 2 ) | blockStateTail << (stateBits * 1 ) | blockStateTail << (stateBits * 0 ))
127+ for {
128+ if b % blocksPerStateByte == blocksPerStateByte - 1 {
129+ stateByte := * (* uint8 )(unsafe .Add (metadataStart , b / blocksPerStateByte ))
130+ if stateByte == blockStateByteAllTails {
131+ b -= 4
132+ continue
133+ }
134+ }
135+ if b .state () == blockStateTail {
136+ b --
137+ continue
138+ }
139+ break
128140 }
129141 if gcAsserts {
130142 if b .state () != blockStateHead && b .state () != blockStateMark {
You can’t perform that action at this time.
0 commit comments