feat(pbs): add Set and reusable identity hashing

This commit is contained in:
2026-10-25 12:15:13 +00:00
parent 632ba6d0d6
commit 8105604f92
59 changed files with 4190 additions and 34 deletions
@@ -10,6 +10,7 @@ public record IRRegistryInstruction(Kind kind, IRRegistry.TypeRef type, IRRegist
MAKE_CLOSURE(0x52), CALL_CLOSURE(0x53), GET_CAPTURE(0x57), CALL_TRAIT(0x58),
DYN_PACK(0x90), DYN_UNPACK(0x91), DYN_CAN_UNPACK(0x92),
REF_IS_EXACT(0x93), REF_IMPLEMENTS(0x94), REF_TO_TRAIT(0x95), REF_CAST(0x96),
REF_IDENTITY_HASH(0x97), REF_IDENTITY_EQ(0x98),
STRUCT_NEW(0xa0), STRUCT_GET(0xa1), STRUCT_SET(0xa2),
ARRAY_NEW(0xa3), ARRAY_LEN(0xa4), ARRAY_GET(0xa5), ARRAY_SET(0xa6),
ARRAY_COPY(0xa9);
@@ -23,7 +24,7 @@ public record IRRegistryInstruction(Kind kind, IRRegistry.TypeRef type, IRRegist
if(kind!=Kind.GET_CAPTURE)Objects.requireNonNull(type,"type");
if(kind==Kind.MAKE_CLOSURE) {Objects.requireNonNull(function,"function");function.getIndex();}
else if(function!=null)throw new IllegalArgumentException("unexpected function operand");
boolean pair=(kind.opcode()>=0x93&&kind.opcode()<=0x96);
boolean pair=(kind.opcode()>=0x93&&kind.opcode()<=0x96)||kind==Kind.REF_IDENTITY_EQ;
if(pair)Objects.requireNonNull(targetType,"targetType");
else if(targetType!=null)throw new IllegalArgumentException("unexpected target type");
if(kind==Kind.GET_CAPTURE&&type!=null)throw new IllegalArgumentException("capture index is not a TypeId");