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.
This commit is contained in:
Damian Gryski
2022-04-27 10:28:04 -07:00
committed by Ron Evans
parent 1abe1203a3
commit b251ce7b33
+4 -2
View File
@@ -91,7 +91,8 @@ func hashmapKeyEqualAlg(alg hashmapAlgorithm) func(x, y unsafe.Pointer, n uintpt
case hashmapAlgorithmInterface: case hashmapAlgorithmInterface:
return hashmapInterfaceEqual return hashmapInterfaceEqual
default: default:
panic("unknown hashmap equal algorithm") // compiler bug :(
return nil
} }
} }
@@ -104,7 +105,8 @@ func hashmapKeyHashAlg(alg hashmapAlgorithm) func(key unsafe.Pointer, n uintptr)
case hashmapAlgorithmInterface: case hashmapAlgorithmInterface:
return hashmapInterfacePtrHash return hashmapInterfacePtrHash
default: default:
panic("unknown hashmap hash algorithm") // compiler bug :(
return nil
} }
} }