implements PR-09.1: remove moduleKey from FE/BE contracts

This commit is contained in:
2026-03-24 13:42:33 +00:00
parent 98adb67bc0
commit 32ab6d7a76
17 changed files with 53 additions and 166 deletions
@@ -360,7 +360,6 @@ public final class PbsFrontendCompiler {
final var callableShapeId = callableShapeId(declaredFn, typeSurfaceTable, callableShapeTable);
final var callableId = callableIdTable.register(
normalizedModuleId,
normalizedModuleKey,
declaredCallable.callableName(),
declaredFn.parameters().size(),
callableShapeSurface(callableShapeId, typeSurfaceTable, callableShapeTable));
@@ -376,7 +375,6 @@ public final class PbsFrontendCompiler {
for (final var importedCallable : importedCallables) {
final var callableId = callableIdTable.register(
importedCallable.moduleId(),
importedCallable.moduleKey(),
importedCallable.callableName(),
importedCallable.arity(),
importedCallable.shapeSurface());
@@ -425,7 +423,6 @@ public final class PbsFrontendCompiler {
instructions.add(new IRBackendExecutableFunction.Instruction(
IRBackendExecutableFunction.InstructionKind.RET,
"",
"",
null,
null,
null,
@@ -451,7 +448,6 @@ public final class PbsFrontendCompiler {
executableFunctions.add(new IRBackendExecutableFunction(
fileId,
normalizedModuleId,
normalizedModuleKey,
callable.callableName(),
functionCallableId,
start,
@@ -670,7 +666,6 @@ public final class PbsFrontendCompiler {
context.instructions().add(new IRBackendExecutableFunction.Instruction(
IRBackendExecutableFunction.InstructionKind.RET,
"",
"",
null,
null,
null,
@@ -926,7 +921,6 @@ public final class PbsFrontendCompiler {
context.instructions().add(new IRBackendExecutableFunction.Instruction(
IRBackendExecutableFunction.InstructionKind.CALL_HOST,
"",
"",
new IRBackendExecutableFunction.HostCallMetadata(
host.abiModule(),
host.abiMethod(),
@@ -948,7 +942,6 @@ public final class PbsFrontendCompiler {
context.instructions().add(new IRBackendExecutableFunction.Instruction(
IRBackendExecutableFunction.InstructionKind.CALL_INTRINSIC,
"",
"",
null,
new IRBackendExecutableFunction.IntrinsicCallMetadata(
intrinsic.canonicalName(),
@@ -977,7 +970,6 @@ public final class PbsFrontendCompiler {
context.instructions().add(new IRBackendExecutableFunction.Instruction(
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
calleeSignature.moduleId(),
calleeSignature.moduleKey(),
calleeSignature.callableName(),
calleeCallableId,
null,
@@ -1127,7 +1119,7 @@ public final class PbsFrontendCompiler {
final ExecutableLoweringContext context) {
context.instructions().add(new IRBackendExecutableFunction.Instruction(
jumpKind,
"",
ModuleId.none(),
"",
null,
null,
@@ -1145,7 +1137,7 @@ public final class PbsFrontendCompiler {
final ExecutableLoweringContext context) {
context.instructions().add(new IRBackendExecutableFunction.Instruction(
IRBackendExecutableFunction.InstructionKind.LABEL,
"",
ModuleId.none(),
"",
null,
null,
@@ -1163,7 +1155,7 @@ public final class PbsFrontendCompiler {
final ExecutableLoweringContext context) {
context.instructions().add(new IRBackendExecutableFunction.Instruction(
IRBackendExecutableFunction.InstructionKind.PUSH_I32,
"",
ModuleId.none(),
"",
null,
null,
@@ -1181,7 +1173,7 @@ public final class PbsFrontendCompiler {
final ExecutableLoweringContext context) {
context.instructions().add(new IRBackendExecutableFunction.Instruction(
IRBackendExecutableFunction.InstructionKind.PUSH_CONST,
"",
ModuleId.none(),
"",
null,
null,
@@ -1199,7 +1191,7 @@ public final class PbsFrontendCompiler {
final ExecutableLoweringContext context) {
context.instructions().add(new IRBackendExecutableFunction.Instruction(
IRBackendExecutableFunction.InstructionKind.GET_LOCAL,
"",
ModuleId.none(),
"",
null,
null,
@@ -46,7 +46,7 @@ class PbsGoldenArtifactsTest {
final var callable = file.callableSignatures().get(i);
out.append(i)
.append(':')
.append(callable.moduleKey())
.append(callable.moduleId().isNone() ? "-" : callable.moduleId().getIndex())
.append("::")
.append(callable.callableName())
.append('/')
@@ -61,7 +61,7 @@ class PbsGoldenArtifactsTest {
out.append("fn#")
.append(i)
.append(':')
.append(fn.moduleKey())
.append(fn.moduleId().isNone() ? "-" : fn.moduleId().getIndex())
.append("::")
.append(fn.callableName())
.append(" id=")
@@ -211,7 +211,6 @@ class PBSFrontendPhaseServiceTest {
assertNotNull(callInstruction.calleeModuleId());
assertEquals(targetFn.moduleId().getIndex(), callInstruction.calleeModuleId().getIndex());
assertEquals(targetFn.moduleKey(), callInstruction.calleeModuleKey());
assertTrue(callerFn.moduleId().getIndex() != callInstruction.calleeModuleId().getIndex());
}
@@ -916,7 +915,8 @@ class PBSFrontendPhaseServiceTest {
.filter(function -> "frame".equals(function.callableName()))
.findFirst();
final var executableNames = irBackend.getExecutableFunctions().stream()
.map(function -> function.callableName() + "@" + function.moduleKey())
.map(function -> function.callableName() + "@"
+ (function.moduleId().isNone() ? "-" : function.moduleId().getIndex()))
.toList();
assertTrue(
frameExecutableOptional.isPresent(),
@@ -1,11 +1,11 @@
callables=2
0:::b/1|(simple:int)->simple:int
1:::a/0|()->simple:int
0:-::b/1|(simple:int)->simple:int
1:-::a/0|()->simple:int
intrinsics=0
fn#0:::b id=0
fn#0:-::b id=0
GET_LOCAL calleeId=- intrinsicId=-
RET calleeId=- intrinsicId=-
fn#1:::a id=1
fn#1:-::a id=1
PUSH_I32 calleeId=- intrinsicId=-
CALL_FUNC calleeId=0 intrinsicId=-
RET calleeId=- intrinsicId=-