compiler,reflect: use two bits of the meta byte for comparable/isBinary

Fixes #3683
This commit is contained in:
Damian Gryski
2023-06-07 11:56:44 -07:00
committed by Ron Evans
parent 213e73ad84
commit 37849c4897
2 changed files with 16 additions and 55 deletions
+10
View File
@@ -238,6 +238,16 @@ func (c *compilerContext) getTypeCode(typ types.Type) llvm.Value {
c.interfaceTypes.Set(typ, global)
}
metabyte := getTypeKind(typ)
// Precompute these so we don't have to calculate them at runtime.
if types.Comparable(typ) {
metabyte |= 1 << 6
}
if hashmapIsBinaryKey(typ) {
metabyte |= 1 << 7
}
switch typ := typ.(type) {
case *types.Basic:
typeFields = []llvm.Value{c.getTypeCode(types.NewPointer(typ))}