refactor(compiler)!: migrate SDK to minimal storage ISA
Test / Tests and coverage
Intrepid/Prometeu/Studio/pipeline/pr-master This commit looks good

Replace retired guards and publication opcodes with SDK checks, neutral TRAP and sequential List/Linked mutations with explicit failure phases. Preserve snapshot cursors and import schema 2 metadata with the delivered provider pin.

Include common/source/installed conformance, debug and release evidence, synchronized specs and the consolidated lesson. Runtime checkout remains unchanged.
This commit is contained in:
2026-10-24 01:35:42 +01:00
parent 77aada6259
commit 632ba6d0d6
51 changed files with 2688 additions and 711 deletions
@@ -220,7 +220,7 @@ public class IRBackend implements IRBackendReader {
instruction.expectedRetSlots(),
instruction.span(), instruction.registryInstruction() == null ? null :
new p.studio.compiler.models.registry.IRRegistryInstruction(instruction.registryInstruction().kind(), instruction.registryInstruction().type(), instruction.registryInstruction().targetType(),
instruction.registryInstruction().function() == null ? null : remapCallableId(instruction.registryInstruction().function(), callableRemap, "Registry instruction"), instruction.registryInstruction().member(), instruction.registryInstruction().secondMember())));
instruction.registryInstruction().function() == null ? null : remapCallableId(instruction.registryInstruction().function(), callableRemap, "Registry instruction"), instruction.registryInstruction().member())));
}
return new IRBackendExecutableFunction(
function.fileId(),
@@ -385,7 +385,7 @@ public record IRBackendExecutableFunction(
throw new IllegalArgumentException("CALL_INTRINSIC must not carry host metadata");
}
}
case HALT, RET, POP, ADD, SUB, MUL, DIV, MOD, EQ, NEQ, LT, LTE, GT, GTE, AND, OR, NOT, NEG -> {
case HALT, TRAP, RET, POP, ADD, SUB, MUL, DIV, MOD, EQ, NEQ, LT, LTE, GT, GTE, AND, OR, NOT, NEG -> {
if (!calleeCallableName.isBlank() || calleeCallableId != null || hostCall != null || intrinsicCall != null) {
throw new IllegalArgumentException(kind + " must not carry callsite metadata");
}
@@ -457,6 +457,7 @@ public record IRBackendExecutableFunction(
NOT,
NEG,
HALT,
TRAP,
RET,
CALL_FUNC,
CALL_HOST,
@@ -5,32 +5,27 @@ import java.util.Objects;
/** Semantic Registry operands before image linking. No frontend syntax is exposed. */
public record IRRegistryInstruction(Kind kind, IRRegistry.TypeRef type, IRRegistry.TypeRef targetType,
CallableId function, int member, int secondMember) {
public IRRegistryInstruction(Kind kind, IRRegistry.TypeRef type, IRRegistry.TypeRef targetType, CallableId function, int member) {
this(kind,type,targetType,function,member,0);
}
CallableId function, int member) {
public enum Kind {
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),
STRUCT_NEW(0xa0), STRUCT_GET(0xa1), STRUCT_SET(0xa2),
ARRAY_NEW(0xa3), ARRAY_LEN(0xa4), ARRAY_GET(0xa5), ARRAY_SET(0xa6),
INDEX_GUARD(0xa7), ARRAY_CHECK_LENGTH(0xa8), ARRAY_COPY(0xa9), STORAGE_PUBLISH(0xaa), FIELDS_PUBLISH(0xab);
ARRAY_COPY(0xa9);
private final int opcode;
Kind(int opcode) { this.opcode=opcode; }
public int opcode(){return opcode;}
}
public IRRegistryInstruction {
Objects.requireNonNull(kind);
if(member<0 || secondMember<0)throw new IllegalArgumentException("negative member index");
if(kind!=Kind.GET_CAPTURE && kind!=Kind.INDEX_GUARD)Objects.requireNonNull(type,"type");
if(kind!=Kind.STORAGE_PUBLISH && secondMember!=0)throw new IllegalArgumentException("unexpected second member");
if(kind==Kind.STORAGE_PUBLISH && member==secondMember)throw new IllegalArgumentException("publication fields must differ");
if(member<0)throw new IllegalArgumentException("negative member index");
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)||kind==Kind.STORAGE_PUBLISH;
boolean pair=(kind.opcode()>=0x93&&kind.opcode()<=0x96);
if(pair)Objects.requireNonNull(targetType,"targetType");
else if(targetType!=null)throw new IllegalArgumentException("unexpected target type");
if((kind==Kind.GET_CAPTURE||kind==Kind.INDEX_GUARD)&&type!=null)throw new IllegalArgumentException("capture index is not a TypeId");
if(kind==Kind.GET_CAPTURE&&type!=null)throw new IllegalArgumentException("capture index is not a TypeId");
}
}