Skip to content

Commit b251ce7

Browse files
dgryskideadprogram
authored andcommitted
src/runtime: return a nil pointer for compiler bugs in hashmap code
We'll still panic if there's a compiler bug, but at least we'll have smaller code in all the cases where we don't.
1 parent 1abe120 commit b251ce7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/runtime/hashmap.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ func hashmapKeyEqualAlg(alg hashmapAlgorithm) func(x, y unsafe.Pointer, n uintpt
9191
case hashmapAlgorithmInterface:
9292
return hashmapInterfaceEqual
9393
default:
94-
panic("unknown hashmap equal algorithm")
94+
// compiler bug :(
95+
return nil
9596
}
9697
}
9798

@@ -104,7 +105,8 @@ func hashmapKeyHashAlg(alg hashmapAlgorithm) func(key unsafe.Pointer, n uintptr)
104105
case hashmapAlgorithmInterface:
105106
return hashmapInterfacePtrHash
106107
default:
107-
panic("unknown hashmap hash algorithm")
108+
// compiler bug :(
109+
return nil
108110
}
109111
}
110112

0 commit comments

Comments
 (0)