implements PR-09.1: remove moduleKey from FE/BE contracts
This commit is contained in:
parent
98adb67bc0
commit
32ab6d7a76
@ -360,7 +360,6 @@ public final class PbsFrontendCompiler {
|
|||||||
final var callableShapeId = callableShapeId(declaredFn, typeSurfaceTable, callableShapeTable);
|
final var callableShapeId = callableShapeId(declaredFn, typeSurfaceTable, callableShapeTable);
|
||||||
final var callableId = callableIdTable.register(
|
final var callableId = callableIdTable.register(
|
||||||
normalizedModuleId,
|
normalizedModuleId,
|
||||||
normalizedModuleKey,
|
|
||||||
declaredCallable.callableName(),
|
declaredCallable.callableName(),
|
||||||
declaredFn.parameters().size(),
|
declaredFn.parameters().size(),
|
||||||
callableShapeSurface(callableShapeId, typeSurfaceTable, callableShapeTable));
|
callableShapeSurface(callableShapeId, typeSurfaceTable, callableShapeTable));
|
||||||
@ -376,7 +375,6 @@ public final class PbsFrontendCompiler {
|
|||||||
for (final var importedCallable : importedCallables) {
|
for (final var importedCallable : importedCallables) {
|
||||||
final var callableId = callableIdTable.register(
|
final var callableId = callableIdTable.register(
|
||||||
importedCallable.moduleId(),
|
importedCallable.moduleId(),
|
||||||
importedCallable.moduleKey(),
|
|
||||||
importedCallable.callableName(),
|
importedCallable.callableName(),
|
||||||
importedCallable.arity(),
|
importedCallable.arity(),
|
||||||
importedCallable.shapeSurface());
|
importedCallable.shapeSurface());
|
||||||
@ -425,7 +423,6 @@ public final class PbsFrontendCompiler {
|
|||||||
instructions.add(new IRBackendExecutableFunction.Instruction(
|
instructions.add(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@ -451,7 +448,6 @@ public final class PbsFrontendCompiler {
|
|||||||
executableFunctions.add(new IRBackendExecutableFunction(
|
executableFunctions.add(new IRBackendExecutableFunction(
|
||||||
fileId,
|
fileId,
|
||||||
normalizedModuleId,
|
normalizedModuleId,
|
||||||
normalizedModuleKey,
|
|
||||||
callable.callableName(),
|
callable.callableName(),
|
||||||
functionCallableId,
|
functionCallableId,
|
||||||
start,
|
start,
|
||||||
@ -670,7 +666,6 @@ public final class PbsFrontendCompiler {
|
|||||||
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@ -926,7 +921,6 @@ public final class PbsFrontendCompiler {
|
|||||||
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_HOST,
|
IRBackendExecutableFunction.InstructionKind.CALL_HOST,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
new IRBackendExecutableFunction.HostCallMetadata(
|
new IRBackendExecutableFunction.HostCallMetadata(
|
||||||
host.abiModule(),
|
host.abiModule(),
|
||||||
host.abiMethod(),
|
host.abiMethod(),
|
||||||
@ -948,7 +942,6 @@ public final class PbsFrontendCompiler {
|
|||||||
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_INTRINSIC,
|
IRBackendExecutableFunction.InstructionKind.CALL_INTRINSIC,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
new IRBackendExecutableFunction.IntrinsicCallMetadata(
|
new IRBackendExecutableFunction.IntrinsicCallMetadata(
|
||||||
intrinsic.canonicalName(),
|
intrinsic.canonicalName(),
|
||||||
@ -977,7 +970,6 @@ public final class PbsFrontendCompiler {
|
|||||||
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
||||||
calleeSignature.moduleId(),
|
calleeSignature.moduleId(),
|
||||||
calleeSignature.moduleKey(),
|
|
||||||
calleeSignature.callableName(),
|
calleeSignature.callableName(),
|
||||||
calleeCallableId,
|
calleeCallableId,
|
||||||
null,
|
null,
|
||||||
@ -1127,7 +1119,7 @@ public final class PbsFrontendCompiler {
|
|||||||
final ExecutableLoweringContext context) {
|
final ExecutableLoweringContext context) {
|
||||||
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
||||||
jumpKind,
|
jumpKind,
|
||||||
"",
|
ModuleId.none(),
|
||||||
"",
|
"",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@ -1145,7 +1137,7 @@ public final class PbsFrontendCompiler {
|
|||||||
final ExecutableLoweringContext context) {
|
final ExecutableLoweringContext context) {
|
||||||
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.LABEL,
|
IRBackendExecutableFunction.InstructionKind.LABEL,
|
||||||
"",
|
ModuleId.none(),
|
||||||
"",
|
"",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@ -1163,7 +1155,7 @@ public final class PbsFrontendCompiler {
|
|||||||
final ExecutableLoweringContext context) {
|
final ExecutableLoweringContext context) {
|
||||||
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.PUSH_I32,
|
IRBackendExecutableFunction.InstructionKind.PUSH_I32,
|
||||||
"",
|
ModuleId.none(),
|
||||||
"",
|
"",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@ -1181,7 +1173,7 @@ public final class PbsFrontendCompiler {
|
|||||||
final ExecutableLoweringContext context) {
|
final ExecutableLoweringContext context) {
|
||||||
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.PUSH_CONST,
|
IRBackendExecutableFunction.InstructionKind.PUSH_CONST,
|
||||||
"",
|
ModuleId.none(),
|
||||||
"",
|
"",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@ -1199,7 +1191,7 @@ public final class PbsFrontendCompiler {
|
|||||||
final ExecutableLoweringContext context) {
|
final ExecutableLoweringContext context) {
|
||||||
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
context.instructions().add(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.GET_LOCAL,
|
IRBackendExecutableFunction.InstructionKind.GET_LOCAL,
|
||||||
"",
|
ModuleId.none(),
|
||||||
"",
|
"",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class PbsGoldenArtifactsTest {
|
|||||||
final var callable = file.callableSignatures().get(i);
|
final var callable = file.callableSignatures().get(i);
|
||||||
out.append(i)
|
out.append(i)
|
||||||
.append(':')
|
.append(':')
|
||||||
.append(callable.moduleKey())
|
.append(callable.moduleId().isNone() ? "-" : callable.moduleId().getIndex())
|
||||||
.append("::")
|
.append("::")
|
||||||
.append(callable.callableName())
|
.append(callable.callableName())
|
||||||
.append('/')
|
.append('/')
|
||||||
@ -61,7 +61,7 @@ class PbsGoldenArtifactsTest {
|
|||||||
out.append("fn#")
|
out.append("fn#")
|
||||||
.append(i)
|
.append(i)
|
||||||
.append(':')
|
.append(':')
|
||||||
.append(fn.moduleKey())
|
.append(fn.moduleId().isNone() ? "-" : fn.moduleId().getIndex())
|
||||||
.append("::")
|
.append("::")
|
||||||
.append(fn.callableName())
|
.append(fn.callableName())
|
||||||
.append(" id=")
|
.append(" id=")
|
||||||
|
|||||||
@ -211,7 +211,6 @@ class PBSFrontendPhaseServiceTest {
|
|||||||
|
|
||||||
assertNotNull(callInstruction.calleeModuleId());
|
assertNotNull(callInstruction.calleeModuleId());
|
||||||
assertEquals(targetFn.moduleId().getIndex(), callInstruction.calleeModuleId().getIndex());
|
assertEquals(targetFn.moduleId().getIndex(), callInstruction.calleeModuleId().getIndex());
|
||||||
assertEquals(targetFn.moduleKey(), callInstruction.calleeModuleKey());
|
|
||||||
assertTrue(callerFn.moduleId().getIndex() != callInstruction.calleeModuleId().getIndex());
|
assertTrue(callerFn.moduleId().getIndex() != callInstruction.calleeModuleId().getIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -916,7 +915,8 @@ class PBSFrontendPhaseServiceTest {
|
|||||||
.filter(function -> "frame".equals(function.callableName()))
|
.filter(function -> "frame".equals(function.callableName()))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
final var executableNames = irBackend.getExecutableFunctions().stream()
|
final var executableNames = irBackend.getExecutableFunctions().stream()
|
||||||
.map(function -> function.callableName() + "@" + function.moduleKey())
|
.map(function -> function.callableName() + "@"
|
||||||
|
+ (function.moduleId().isNone() ? "-" : function.moduleId().getIndex()))
|
||||||
.toList();
|
.toList();
|
||||||
assertTrue(
|
assertTrue(
|
||||||
frameExecutableOptional.isPresent(),
|
frameExecutableOptional.isPresent(),
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
callables=2
|
callables=2
|
||||||
0:::b/1|(simple:int)->simple:int
|
0:-::b/1|(simple:int)->simple:int
|
||||||
1:::a/0|()->simple:int
|
1:-::a/0|()->simple:int
|
||||||
intrinsics=0
|
intrinsics=0
|
||||||
fn#0:::b id=0
|
fn#0:-::b id=0
|
||||||
GET_LOCAL calleeId=- intrinsicId=-
|
GET_LOCAL calleeId=- intrinsicId=-
|
||||||
RET calleeId=- intrinsicId=-
|
RET calleeId=- intrinsicId=-
|
||||||
fn#1:::a id=1
|
fn#1:-::a id=1
|
||||||
PUSH_I32 calleeId=- intrinsicId=-
|
PUSH_I32 calleeId=- intrinsicId=-
|
||||||
CALL_FUNC calleeId=0 intrinsicId=-
|
CALL_FUNC calleeId=0 intrinsicId=-
|
||||||
RET calleeId=- intrinsicId=-
|
RET calleeId=- intrinsicId=-
|
||||||
|
|||||||
@ -299,8 +299,8 @@ public class LowerToIRVMService {
|
|||||||
final var entryPointModuleId = backend.getEntryPointModuleId();
|
final var entryPointModuleId = backend.getEntryPointModuleId();
|
||||||
final var sorted = new ArrayList<>(backend.getExecutableFunctions().asList());
|
final var sorted = new ArrayList<>(backend.getExecutableFunctions().asList());
|
||||||
sorted.sort((left, right) -> {
|
sorted.sort((left, right) -> {
|
||||||
final var leftModuleKey = moduleSortKey(backend, left.moduleId(), left.moduleKey());
|
final var leftModuleKey = moduleSortKey(backend, left.moduleId());
|
||||||
final var rightModuleKey = moduleSortKey(backend, right.moduleId(), right.moduleKey());
|
final var rightModuleKey = moduleSortKey(backend, right.moduleId());
|
||||||
final var moduleCmp = leftModuleKey.compareTo(rightModuleKey);
|
final var moduleCmp = leftModuleKey.compareTo(rightModuleKey);
|
||||||
if (moduleCmp != 0) {
|
if (moduleCmp != 0) {
|
||||||
return moduleCmp;
|
return moduleCmp;
|
||||||
@ -367,15 +367,14 @@ public class LowerToIRVMService {
|
|||||||
|
|
||||||
private String moduleSortKey(
|
private String moduleSortKey(
|
||||||
final IRBackend backend,
|
final IRBackend backend,
|
||||||
final ModuleId moduleId,
|
final ModuleId moduleId) {
|
||||||
final String fallbackModuleKey) {
|
|
||||||
if (moduleId != null && !moduleId.isNone()) {
|
if (moduleId != null && !moduleId.isNone()) {
|
||||||
final var index = moduleId.getIndex();
|
final var index = moduleId.getIndex();
|
||||||
if (index >= 0 && index < backend.getModulePool().size()) {
|
if (index >= 0 && index < backend.getModulePool().size()) {
|
||||||
return canonicalModuleSortKey(backend.getModulePool().get(index));
|
return canonicalModuleSortKey(backend.getModulePool().get(index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fallbackModuleKey == null ? "" : fallbackModuleKey;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String canonicalModuleSortKey(final ModuleReference reference) {
|
private String canonicalModuleSortKey(final ModuleReference reference) {
|
||||||
|
|||||||
@ -45,7 +45,6 @@ class GoldenArtifactsTest {
|
|||||||
return IRBackend.builder()
|
return IRBackend.builder()
|
||||||
.executableFunctions(ReadOnlyList.from(new IRBackendExecutableFunction(
|
.executableFunctions(ReadOnlyList.from(new IRBackendExecutableFunction(
|
||||||
new FileId(1),
|
new FileId(1),
|
||||||
"app/main",
|
|
||||||
"main",
|
"main",
|
||||||
new CallableId(0),
|
new CallableId(0),
|
||||||
0,
|
0,
|
||||||
@ -58,15 +57,12 @@ class GoldenArtifactsTest {
|
|||||||
new IRBackendExecutableFunction.Instruction(
|
new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_HOST,
|
IRBackendExecutableFunction.InstructionKind.CALL_HOST,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
|
||||||
new IRBackendExecutableFunction.HostCallMetadata("gfx", "draw_pixel", 1, 0, 0),
|
new IRBackendExecutableFunction.HostCallMetadata("gfx", "draw_pixel", 1, 0, 0),
|
||||||
null,
|
null,
|
||||||
Span.none()),
|
Span.none()),
|
||||||
new IRBackendExecutableFunction.Instruction(
|
new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_INTRINSIC,
|
IRBackendExecutableFunction.InstructionKind.CALL_INTRINSIC,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
new IRBackendExecutableFunction.IntrinsicCallMetadata("input.pad", 1, new IntrinsicId(0)),
|
new IRBackendExecutableFunction.IntrinsicCallMetadata("input.pad", 1, new IntrinsicId(0)),
|
||||||
0,
|
0,
|
||||||
@ -75,7 +71,6 @@ class GoldenArtifactsTest {
|
|||||||
new IRBackendExecutableFunction.Instruction(
|
new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Span.none())),
|
Span.none())),
|
||||||
|
|||||||
@ -264,7 +264,6 @@ class LowerToIRVMServiceTest {
|
|||||||
final ReadOnlyList<IRBackendExecutableFunction.Instruction> instructions) {
|
final ReadOnlyList<IRBackendExecutableFunction.Instruction> instructions) {
|
||||||
return new IRBackendExecutableFunction(
|
return new IRBackendExecutableFunction(
|
||||||
new FileId(0),
|
new FileId(0),
|
||||||
moduleKey,
|
|
||||||
name,
|
name,
|
||||||
new CallableId(callableId),
|
new CallableId(callableId),
|
||||||
0,
|
0,
|
||||||
@ -296,7 +295,6 @@ class LowerToIRVMServiceTest {
|
|||||||
return new IRBackendExecutableFunction(
|
return new IRBackendExecutableFunction(
|
||||||
new FileId(0),
|
new FileId(0),
|
||||||
new ModuleId(moduleId),
|
new ModuleId(moduleId),
|
||||||
moduleKey,
|
|
||||||
name,
|
name,
|
||||||
new CallableId(callableId),
|
new CallableId(callableId),
|
||||||
0,
|
0,
|
||||||
@ -313,7 +311,6 @@ class LowerToIRVMServiceTest {
|
|||||||
return new IRBackendExecutableFunction.Instruction(
|
return new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Span.none());
|
Span.none());
|
||||||
@ -325,7 +322,7 @@ class LowerToIRVMServiceTest {
|
|||||||
final int calleeCallableId) {
|
final int calleeCallableId) {
|
||||||
return new IRBackendExecutableFunction.Instruction(
|
return new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
||||||
moduleKey,
|
ModuleId.none(),
|
||||||
name,
|
name,
|
||||||
new CallableId(calleeCallableId),
|
new CallableId(calleeCallableId),
|
||||||
null,
|
null,
|
||||||
@ -341,7 +338,7 @@ class LowerToIRVMServiceTest {
|
|||||||
final int expectedRetSlots) {
|
final int expectedRetSlots) {
|
||||||
return new IRBackendExecutableFunction.Instruction(
|
return new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
||||||
moduleKey,
|
ModuleId.none(),
|
||||||
name,
|
name,
|
||||||
new CallableId(calleeCallableId),
|
new CallableId(calleeCallableId),
|
||||||
null,
|
null,
|
||||||
@ -360,7 +357,6 @@ class LowerToIRVMServiceTest {
|
|||||||
return new IRBackendExecutableFunction.Instruction(
|
return new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_HOST,
|
IRBackendExecutableFunction.InstructionKind.CALL_HOST,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
new IRBackendExecutableFunction.HostCallMetadata(module, name, version, argSlots, retSlots),
|
new IRBackendExecutableFunction.HostCallMetadata(module, name, version, argSlots, retSlots),
|
||||||
null,
|
null,
|
||||||
Span.none());
|
Span.none());
|
||||||
@ -373,7 +369,6 @@ class LowerToIRVMServiceTest {
|
|||||||
return new IRBackendExecutableFunction.Instruction(
|
return new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_INTRINSIC,
|
IRBackendExecutableFunction.InstructionKind.CALL_INTRINSIC,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
new IRBackendExecutableFunction.IntrinsicCallMetadata(canonicalName, canonicalVersion, new IntrinsicId(intrinsicId)),
|
new IRBackendExecutableFunction.IntrinsicCallMetadata(canonicalName, canonicalVersion, new IntrinsicId(intrinsicId)),
|
||||||
0,
|
0,
|
||||||
@ -384,7 +379,7 @@ class LowerToIRVMServiceTest {
|
|||||||
private static IRBackendExecutableFunction.Instruction label(final String label) {
|
private static IRBackendExecutableFunction.Instruction label(final String label) {
|
||||||
return new IRBackendExecutableFunction.Instruction(
|
return new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.LABEL,
|
IRBackendExecutableFunction.InstructionKind.LABEL,
|
||||||
"",
|
ModuleId.none(),
|
||||||
"",
|
"",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@ -399,7 +394,7 @@ class LowerToIRVMServiceTest {
|
|||||||
private static IRBackendExecutableFunction.Instruction jmp(final String target) {
|
private static IRBackendExecutableFunction.Instruction jmp(final String target) {
|
||||||
return new IRBackendExecutableFunction.Instruction(
|
return new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.JMP,
|
IRBackendExecutableFunction.InstructionKind.JMP,
|
||||||
"",
|
ModuleId.none(),
|
||||||
"",
|
"",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
|||||||
@ -322,7 +322,6 @@ class OptimizeIRVMEquivalenceHarnessTest {
|
|||||||
final ReadOnlyList<IRBackendExecutableFunction.Instruction> instructions) {
|
final ReadOnlyList<IRBackendExecutableFunction.Instruction> instructions) {
|
||||||
return new IRBackendExecutableFunction(
|
return new IRBackendExecutableFunction(
|
||||||
new FileId(1),
|
new FileId(1),
|
||||||
"app",
|
|
||||||
name,
|
name,
|
||||||
new CallableId(callableId),
|
new CallableId(callableId),
|
||||||
0,
|
0,
|
||||||
@ -339,8 +338,6 @@ class OptimizeIRVMEquivalenceHarnessTest {
|
|||||||
return new IRBackendExecutableFunction.Instruction(
|
return new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Span.none());
|
Span.none());
|
||||||
@ -355,8 +352,6 @@ class OptimizeIRVMEquivalenceHarnessTest {
|
|||||||
return new IRBackendExecutableFunction.Instruction(
|
return new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_HOST,
|
IRBackendExecutableFunction.InstructionKind.CALL_HOST,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
|
||||||
new IRBackendExecutableFunction.HostCallMetadata(module, name, version, argSlots, retSlots),
|
new IRBackendExecutableFunction.HostCallMetadata(module, name, version, argSlots, retSlots),
|
||||||
null,
|
null,
|
||||||
Span.none());
|
Span.none());
|
||||||
@ -371,7 +366,6 @@ class OptimizeIRVMEquivalenceHarnessTest {
|
|||||||
return new IRBackendExecutableFunction.Instruction(
|
return new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_INTRINSIC,
|
IRBackendExecutableFunction.InstructionKind.CALL_INTRINSIC,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
new IRBackendExecutableFunction.IntrinsicCallMetadata(canonicalName, canonicalVersion, new IntrinsicId(intrinsicId)),
|
new IRBackendExecutableFunction.IntrinsicCallMetadata(canonicalName, canonicalVersion, new IntrinsicId(intrinsicId)),
|
||||||
|
|||||||
@ -188,7 +188,6 @@ class BackendGateIIntegrationTest {
|
|||||||
final ReadOnlyList<IRBackendExecutableFunction.Instruction> instructions) {
|
final ReadOnlyList<IRBackendExecutableFunction.Instruction> instructions) {
|
||||||
return new IRBackendExecutableFunction(
|
return new IRBackendExecutableFunction(
|
||||||
new FileId(1),
|
new FileId(1),
|
||||||
"app/main",
|
|
||||||
name,
|
name,
|
||||||
new CallableId(1),
|
new CallableId(1),
|
||||||
0,
|
0,
|
||||||
@ -205,7 +204,6 @@ class BackendGateIIntegrationTest {
|
|||||||
return new IRBackendExecutableFunction.Instruction(
|
return new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Span.none());
|
Span.none());
|
||||||
@ -220,7 +218,6 @@ class BackendGateIIntegrationTest {
|
|||||||
return new IRBackendExecutableFunction.Instruction(
|
return new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_HOST,
|
IRBackendExecutableFunction.InstructionKind.CALL_HOST,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
new IRBackendExecutableFunction.HostCallMetadata(module, name, version, argSlots, retSlots),
|
new IRBackendExecutableFunction.HostCallMetadata(module, name, version, argSlots, retSlots),
|
||||||
null,
|
null,
|
||||||
Span.none());
|
Span.none());
|
||||||
@ -233,7 +230,6 @@ class BackendGateIIntegrationTest {
|
|||||||
return new IRBackendExecutableFunction.Instruction(
|
return new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_INTRINSIC,
|
IRBackendExecutableFunction.InstructionKind.CALL_INTRINSIC,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
new IRBackendExecutableFunction.IntrinsicCallMetadata(canonicalName, canonicalVersion, new IntrinsicId(intrinsicId)),
|
new IRBackendExecutableFunction.IntrinsicCallMetadata(canonicalName, canonicalVersion, new IntrinsicId(intrinsicId)),
|
||||||
0,
|
0,
|
||||||
|
|||||||
@ -28,7 +28,6 @@ class BackendSafetyGateSUTest {
|
|||||||
final var backend = IRBackend.builder()
|
final var backend = IRBackend.builder()
|
||||||
.executableFunctions(ReadOnlyList.from(new IRBackendExecutableFunction(
|
.executableFunctions(ReadOnlyList.from(new IRBackendExecutableFunction(
|
||||||
new FileId(1),
|
new FileId(1),
|
||||||
"app",
|
|
||||||
"main",
|
"main",
|
||||||
new CallableId(1),
|
new CallableId(1),
|
||||||
0,
|
0,
|
||||||
@ -40,7 +39,7 @@ class BackendSafetyGateSUTest {
|
|||||||
ReadOnlyList.from(
|
ReadOnlyList.from(
|
||||||
new IRBackendExecutableFunction.Instruction(
|
new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
||||||
"app",
|
p.studio.compiler.source.identifiers.ModuleId.none(),
|
||||||
"missing",
|
"missing",
|
||||||
new CallableId(99),
|
new CallableId(99),
|
||||||
null,
|
null,
|
||||||
@ -51,7 +50,6 @@ class BackendSafetyGateSUTest {
|
|||||||
new IRBackendExecutableFunction.Instruction(
|
new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Span.none())),
|
Span.none())),
|
||||||
@ -113,7 +111,6 @@ class BackendSafetyGateSUTest {
|
|||||||
final var backend = IRBackend.builder()
|
final var backend = IRBackend.builder()
|
||||||
.executableFunctions(ReadOnlyList.from(new IRBackendExecutableFunction(
|
.executableFunctions(ReadOnlyList.from(new IRBackendExecutableFunction(
|
||||||
new FileId(1),
|
new FileId(1),
|
||||||
"app",
|
|
||||||
"main",
|
"main",
|
||||||
new CallableId(1),
|
new CallableId(1),
|
||||||
0,
|
0,
|
||||||
@ -125,7 +122,6 @@ class BackendSafetyGateSUTest {
|
|||||||
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Span.none())),
|
Span.none())),
|
||||||
|
|||||||
@ -38,7 +38,6 @@ class LowerToIRVMPipelineStageTest {
|
|||||||
ctx.irBackend = IRBackend.builder()
|
ctx.irBackend = IRBackend.builder()
|
||||||
.executableFunctions(ReadOnlyList.from(new IRBackendExecutableFunction(
|
.executableFunctions(ReadOnlyList.from(new IRBackendExecutableFunction(
|
||||||
new FileId(0),
|
new FileId(0),
|
||||||
"app",
|
|
||||||
"main",
|
"main",
|
||||||
new CallableId(1),
|
new CallableId(1),
|
||||||
0,
|
0,
|
||||||
@ -50,7 +49,6 @@ class LowerToIRVMPipelineStageTest {
|
|||||||
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Span.none())),
|
Span.none())),
|
||||||
@ -71,7 +69,6 @@ class LowerToIRVMPipelineStageTest {
|
|||||||
ctx.irBackend = IRBackend.builder()
|
ctx.irBackend = IRBackend.builder()
|
||||||
.executableFunctions(ReadOnlyList.from(new IRBackendExecutableFunction(
|
.executableFunctions(ReadOnlyList.from(new IRBackendExecutableFunction(
|
||||||
new FileId(0),
|
new FileId(0),
|
||||||
"app",
|
|
||||||
"main",
|
"main",
|
||||||
new CallableId(1),
|
new CallableId(1),
|
||||||
0,
|
0,
|
||||||
@ -83,7 +80,6 @@ class LowerToIRVMPipelineStageTest {
|
|||||||
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Span.none())),
|
Span.none())),
|
||||||
@ -104,7 +100,6 @@ class LowerToIRVMPipelineStageTest {
|
|||||||
ctx.irBackend = IRBackend.builder()
|
ctx.irBackend = IRBackend.builder()
|
||||||
.executableFunctions(ReadOnlyList.from(new IRBackendExecutableFunction(
|
.executableFunctions(ReadOnlyList.from(new IRBackendExecutableFunction(
|
||||||
new FileId(9),
|
new FileId(9),
|
||||||
"app",
|
|
||||||
"main",
|
"main",
|
||||||
new CallableId(1),
|
new CallableId(1),
|
||||||
10,
|
10,
|
||||||
@ -116,7 +111,7 @@ class LowerToIRVMPipelineStageTest {
|
|||||||
ReadOnlyList.from(
|
ReadOnlyList.from(
|
||||||
new IRBackendExecutableFunction.Instruction(
|
new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
||||||
"app",
|
p.studio.compiler.source.identifiers.ModuleId.none(),
|
||||||
"missing",
|
"missing",
|
||||||
new CallableId(99),
|
new CallableId(99),
|
||||||
null,
|
null,
|
||||||
@ -125,7 +120,6 @@ class LowerToIRVMPipelineStageTest {
|
|||||||
new IRBackendExecutableFunction.Instruction(
|
new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Span.none())),
|
Span.none())),
|
||||||
@ -149,7 +143,6 @@ class LowerToIRVMPipelineStageTest {
|
|||||||
.executableFunctions(ReadOnlyList.from(
|
.executableFunctions(ReadOnlyList.from(
|
||||||
new IRBackendExecutableFunction(
|
new IRBackendExecutableFunction(
|
||||||
new FileId(0),
|
new FileId(0),
|
||||||
"app",
|
|
||||||
"callee",
|
"callee",
|
||||||
new CallableId(2),
|
new CallableId(2),
|
||||||
0,
|
0,
|
||||||
@ -161,14 +154,12 @@ class LowerToIRVMPipelineStageTest {
|
|||||||
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Span.none())),
|
Span.none())),
|
||||||
Span.none()),
|
Span.none()),
|
||||||
new IRBackendExecutableFunction(
|
new IRBackendExecutableFunction(
|
||||||
new FileId(0),
|
new FileId(0),
|
||||||
"app",
|
|
||||||
"main",
|
"main",
|
||||||
new CallableId(1),
|
new CallableId(1),
|
||||||
0,
|
0,
|
||||||
@ -180,7 +171,7 @@ class LowerToIRVMPipelineStageTest {
|
|||||||
ReadOnlyList.from(
|
ReadOnlyList.from(
|
||||||
new IRBackendExecutableFunction.Instruction(
|
new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
||||||
"app",
|
p.studio.compiler.source.identifiers.ModuleId.none(),
|
||||||
"callee",
|
"callee",
|
||||||
new CallableId(2),
|
new CallableId(2),
|
||||||
null,
|
null,
|
||||||
@ -191,7 +182,6 @@ class LowerToIRVMPipelineStageTest {
|
|||||||
new IRBackendExecutableFunction.Instruction(
|
new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Span.none())),
|
Span.none())),
|
||||||
|
|||||||
@ -6,17 +6,15 @@ import java.util.Objects;
|
|||||||
|
|
||||||
public record CallableSignatureRef(
|
public record CallableSignatureRef(
|
||||||
ModuleId moduleId,
|
ModuleId moduleId,
|
||||||
String moduleKey,
|
|
||||||
String callableName,
|
String callableName,
|
||||||
int arity,
|
int arity,
|
||||||
String typeShape) {
|
String typeShape) {
|
||||||
|
|
||||||
public CallableSignatureRef(
|
public CallableSignatureRef(
|
||||||
final String moduleKey,
|
|
||||||
final String callableName,
|
final String callableName,
|
||||||
final int arity,
|
final int arity,
|
||||||
final String typeShape) {
|
final String typeShape) {
|
||||||
this(ModuleId.none(), moduleKey, callableName, arity, typeShape);
|
this(ModuleId.none(), callableName, arity, typeShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CallableSignatureRef {
|
public CallableSignatureRef {
|
||||||
@ -24,7 +22,6 @@ public record CallableSignatureRef(
|
|||||||
if (!moduleId.isNone()) {
|
if (!moduleId.isNone()) {
|
||||||
moduleId.getIndex();
|
moduleId.getIndex();
|
||||||
}
|
}
|
||||||
moduleKey = moduleKey == null ? "" : moduleKey;
|
|
||||||
callableName = Objects.requireNonNull(callableName, "callableName");
|
callableName = Objects.requireNonNull(callableName, "callableName");
|
||||||
typeShape = typeShape == null ? "" : typeShape;
|
typeShape = typeShape == null ? "" : typeShape;
|
||||||
if (callableName.isBlank()) {
|
if (callableName.isBlank()) {
|
||||||
|
|||||||
@ -10,19 +10,17 @@ public class CallableTable extends InternTable<CallableId, CallableSignatureRef>
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CallableId register(
|
public CallableId register(
|
||||||
final String moduleKey,
|
|
||||||
final String callableName,
|
final String callableName,
|
||||||
final int arity,
|
final int arity,
|
||||||
final String typeShape) {
|
final String typeShape) {
|
||||||
return register(new CallableSignatureRef(ModuleId.none(), moduleKey, callableName, arity, typeShape));
|
return register(new CallableSignatureRef(ModuleId.none(), callableName, arity, typeShape));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CallableId register(
|
public CallableId register(
|
||||||
final ModuleId moduleId,
|
final ModuleId moduleId,
|
||||||
final String moduleKey,
|
|
||||||
final String callableName,
|
final String callableName,
|
||||||
final int arity,
|
final int arity,
|
||||||
final String typeShape) {
|
final String typeShape) {
|
||||||
return register(new CallableSignatureRef(moduleId, moduleKey, callableName, arity, typeShape));
|
return register(new CallableSignatureRef(moduleId, callableName, arity, typeShape));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,9 +11,9 @@ class CallableTableTest {
|
|||||||
void shouldInternEqualCallableSignaturesToSameIdentifier() {
|
void shouldInternEqualCallableSignaturesToSameIdentifier() {
|
||||||
final var table = new CallableTable();
|
final var table = new CallableTable();
|
||||||
|
|
||||||
final var first = table.register("app/main", "draw", 2, "(simple:int,simple:int)->unit");
|
final var first = table.register("draw", 2, "(simple:int,simple:int)->unit");
|
||||||
final var second = table.register("app/main", "draw", 2, "(simple:int,simple:int)->unit");
|
final var second = table.register("draw", 2, "(simple:int,simple:int)->unit");
|
||||||
final var third = table.register("app/main", "draw", 1, "(simple:int)->unit");
|
final var third = table.register("draw", 1, "(simple:int)->unit");
|
||||||
|
|
||||||
assertEquals(first, second);
|
assertEquals(first, second);
|
||||||
assertEquals(2, table.size());
|
assertEquals(2, table.size());
|
||||||
@ -22,7 +22,7 @@ class CallableTableTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldRejectInvalidCallableSignatureReferenceContract() {
|
void shouldRejectInvalidCallableSignatureReferenceContract() {
|
||||||
assertThrows(IllegalArgumentException.class, () -> new CallableSignatureRef("app/main", "", 1, "(unit)->unit"));
|
assertThrows(IllegalArgumentException.class, () -> new CallableSignatureRef("", 1, "(unit)->unit"));
|
||||||
assertThrows(IllegalArgumentException.class, () -> new CallableSignatureRef("app/main", "draw", -1, "(unit)->unit"));
|
assertThrows(IllegalArgumentException.class, () -> new CallableSignatureRef("draw", -1, "(unit)->unit"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import p.studio.utilities.structures.ReadOnlyList;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Builder
|
@Builder
|
||||||
@Getter
|
@Getter
|
||||||
@ -108,12 +107,10 @@ public class IRBackend {
|
|||||||
final var signature = localCallableSignatures.get(i);
|
final var signature = localCallableSignatures.get(i);
|
||||||
final var remappedModuleId = remapModuleId(
|
final var remappedModuleId = remapModuleId(
|
||||||
signature.moduleId(),
|
signature.moduleId(),
|
||||||
signature.moduleKey(),
|
|
||||||
moduleRemap,
|
moduleRemap,
|
||||||
"callable signature");
|
"callable signature");
|
||||||
remap[i] = callableTable.register(
|
remap[i] = callableTable.register(
|
||||||
remappedModuleId,
|
remappedModuleId,
|
||||||
signature.moduleKey(),
|
|
||||||
signature.callableName(),
|
signature.callableName(),
|
||||||
signature.arity(),
|
signature.arity(),
|
||||||
signature.typeShape());
|
signature.typeShape());
|
||||||
@ -129,7 +126,6 @@ public class IRBackend {
|
|||||||
final var remappedInstructions = new ArrayList<IRBackendExecutableFunction.Instruction>(function.instructions().size());
|
final var remappedInstructions = new ArrayList<IRBackendExecutableFunction.Instruction>(function.instructions().size());
|
||||||
final var remappedFunctionModuleId = remapModuleId(
|
final var remappedFunctionModuleId = remapModuleId(
|
||||||
function.moduleId(),
|
function.moduleId(),
|
||||||
function.moduleKey(),
|
|
||||||
moduleRemap,
|
moduleRemap,
|
||||||
"function");
|
"function");
|
||||||
for (final var instruction : function.instructions()) {
|
for (final var instruction : function.instructions()) {
|
||||||
@ -151,13 +147,11 @@ public class IRBackend {
|
|||||||
}
|
}
|
||||||
final var remappedCalleeModuleId = remapModuleId(
|
final var remappedCalleeModuleId = remapModuleId(
|
||||||
instruction.calleeModuleId(),
|
instruction.calleeModuleId(),
|
||||||
instruction.calleeModuleKey(),
|
|
||||||
moduleRemap,
|
moduleRemap,
|
||||||
"callee");
|
"callee");
|
||||||
remappedInstructions.add(new IRBackendExecutableFunction.Instruction(
|
remappedInstructions.add(new IRBackendExecutableFunction.Instruction(
|
||||||
instruction.kind(),
|
instruction.kind(),
|
||||||
remappedCalleeModuleId,
|
remappedCalleeModuleId,
|
||||||
instruction.calleeModuleKey(),
|
|
||||||
instruction.calleeCallableName(),
|
instruction.calleeCallableName(),
|
||||||
remappedCallee,
|
remappedCallee,
|
||||||
instruction.hostCall(),
|
instruction.hostCall(),
|
||||||
@ -171,7 +165,6 @@ public class IRBackend {
|
|||||||
return new IRBackendExecutableFunction(
|
return new IRBackendExecutableFunction(
|
||||||
function.fileId(),
|
function.fileId(),
|
||||||
remappedFunctionModuleId,
|
remappedFunctionModuleId,
|
||||||
function.moduleKey(),
|
|
||||||
function.callableName(),
|
function.callableName(),
|
||||||
remapCallableId(function.callableId(), callableRemap, "function"),
|
remapCallableId(function.callableId(), callableRemap, "function"),
|
||||||
function.sourceStart(),
|
function.sourceStart(),
|
||||||
@ -186,7 +179,6 @@ public class IRBackend {
|
|||||||
|
|
||||||
private ModuleId remapModuleId(
|
private ModuleId remapModuleId(
|
||||||
final ModuleId localModuleId,
|
final ModuleId localModuleId,
|
||||||
final String moduleKey,
|
|
||||||
final ModuleId[] moduleRemap,
|
final ModuleId[] moduleRemap,
|
||||||
final String label) {
|
final String label) {
|
||||||
if (localModuleId != null && !localModuleId.isNone()) {
|
if (localModuleId != null && !localModuleId.isNone()) {
|
||||||
@ -196,33 +188,9 @@ public class IRBackend {
|
|||||||
}
|
}
|
||||||
return moduleRemap[localIndex];
|
return moduleRemap[localIndex];
|
||||||
}
|
}
|
||||||
final var fallbackReference = moduleReferenceFromKey(moduleKey);
|
|
||||||
if (fallbackReference != null) {
|
|
||||||
return moduleTable.register(fallbackReference);
|
|
||||||
}
|
|
||||||
return ModuleId.none();
|
return ModuleId.none();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModuleReference moduleReferenceFromKey(final String moduleKey) {
|
|
||||||
if (moduleKey == null || moduleKey.isBlank()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final var separator = moduleKey.indexOf(':');
|
|
||||||
if (separator <= 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
final var project = moduleKey.substring(0, separator).trim();
|
|
||||||
final var rawPath = moduleKey.substring(separator + 1).trim();
|
|
||||||
if (project.isBlank()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (rawPath.isBlank()) {
|
|
||||||
return new ModuleReference(project, ReadOnlyList.empty());
|
|
||||||
}
|
|
||||||
final var segments = List.of(rawPath.split("/"));
|
|
||||||
return new ModuleReference(project, ReadOnlyList.wrap(segments));
|
|
||||||
}
|
|
||||||
|
|
||||||
private CallableId remapCallableId(
|
private CallableId remapCallableId(
|
||||||
final CallableId localCallableId,
|
final CallableId localCallableId,
|
||||||
final CallableId[] callableRemap,
|
final CallableId[] callableRemap,
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import java.util.Objects;
|
|||||||
public record IRBackendExecutableFunction(
|
public record IRBackendExecutableFunction(
|
||||||
FileId fileId,
|
FileId fileId,
|
||||||
ModuleId moduleId,
|
ModuleId moduleId,
|
||||||
String moduleKey,
|
|
||||||
String callableName,
|
String callableName,
|
||||||
CallableId callableId,
|
CallableId callableId,
|
||||||
int sourceStart,
|
int sourceStart,
|
||||||
@ -26,7 +25,6 @@ public record IRBackendExecutableFunction(
|
|||||||
|
|
||||||
public IRBackendExecutableFunction(
|
public IRBackendExecutableFunction(
|
||||||
final FileId fileId,
|
final FileId fileId,
|
||||||
final String moduleKey,
|
|
||||||
final String callableName,
|
final String callableName,
|
||||||
final CallableId callableId,
|
final CallableId callableId,
|
||||||
final int sourceStart,
|
final int sourceStart,
|
||||||
@ -40,7 +38,6 @@ public record IRBackendExecutableFunction(
|
|||||||
this(
|
this(
|
||||||
fileId,
|
fileId,
|
||||||
ModuleId.none(),
|
ModuleId.none(),
|
||||||
moduleKey,
|
|
||||||
callableName,
|
callableName,
|
||||||
callableId,
|
callableId,
|
||||||
sourceStart,
|
sourceStart,
|
||||||
@ -59,7 +56,6 @@ public record IRBackendExecutableFunction(
|
|||||||
if (!moduleId.isNone()) {
|
if (!moduleId.isNone()) {
|
||||||
moduleId.getIndex();
|
moduleId.getIndex();
|
||||||
}
|
}
|
||||||
moduleKey = moduleKey == null ? "" : moduleKey;
|
|
||||||
callableName = Objects.requireNonNull(callableName, "callableName");
|
callableName = Objects.requireNonNull(callableName, "callableName");
|
||||||
if (callableName.isBlank()) {
|
if (callableName.isBlank()) {
|
||||||
throw new IllegalArgumentException("callableName must not be blank");
|
throw new IllegalArgumentException("callableName must not be blank");
|
||||||
@ -88,7 +84,6 @@ public record IRBackendExecutableFunction(
|
|||||||
public record Instruction(
|
public record Instruction(
|
||||||
InstructionKind kind,
|
InstructionKind kind,
|
||||||
ModuleId calleeModuleId,
|
ModuleId calleeModuleId,
|
||||||
String calleeModuleKey,
|
|
||||||
String calleeCallableName,
|
String calleeCallableName,
|
||||||
CallableId calleeCallableId,
|
CallableId calleeCallableId,
|
||||||
HostCallMetadata hostCall,
|
HostCallMetadata hostCall,
|
||||||
@ -101,19 +96,17 @@ public record IRBackendExecutableFunction(
|
|||||||
public Instruction(
|
public Instruction(
|
||||||
final InstructionKind kind,
|
final InstructionKind kind,
|
||||||
final ModuleId calleeModuleId,
|
final ModuleId calleeModuleId,
|
||||||
final String calleeModuleKey,
|
|
||||||
final String calleeCallableName,
|
final String calleeCallableName,
|
||||||
final CallableId calleeCallableId,
|
final CallableId calleeCallableId,
|
||||||
final HostCallMetadata hostCall,
|
final HostCallMetadata hostCall,
|
||||||
final IntrinsicCallMetadata intrinsicCall,
|
final IntrinsicCallMetadata intrinsicCall,
|
||||||
final Span span) {
|
final Span span) {
|
||||||
this(kind, calleeModuleId, calleeModuleKey, calleeCallableName, calleeCallableId, hostCall, intrinsicCall, null, null, null, null, span);
|
this(kind, calleeModuleId, calleeCallableName, calleeCallableId, hostCall, intrinsicCall, null, null, null, null, span);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instruction(
|
public Instruction(
|
||||||
final InstructionKind kind,
|
final InstructionKind kind,
|
||||||
final ModuleId calleeModuleId,
|
final ModuleId calleeModuleId,
|
||||||
final String calleeModuleKey,
|
|
||||||
final String calleeCallableName,
|
final String calleeCallableName,
|
||||||
final CallableId calleeCallableId,
|
final CallableId calleeCallableId,
|
||||||
final HostCallMetadata hostCall,
|
final HostCallMetadata hostCall,
|
||||||
@ -121,36 +114,33 @@ public record IRBackendExecutableFunction(
|
|||||||
final Integer expectedArgSlots,
|
final Integer expectedArgSlots,
|
||||||
final Integer expectedRetSlots,
|
final Integer expectedRetSlots,
|
||||||
final Span span) {
|
final Span span) {
|
||||||
this(kind, calleeModuleId, calleeModuleKey, calleeCallableName, calleeCallableId, hostCall, intrinsicCall, null, null, expectedArgSlots, expectedRetSlots, span);
|
this(kind, calleeModuleId, calleeCallableName, calleeCallableId, hostCall, intrinsicCall, null, null, expectedArgSlots, expectedRetSlots, span);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instruction(
|
public Instruction(
|
||||||
final InstructionKind kind,
|
final InstructionKind kind,
|
||||||
final ModuleId calleeModuleId,
|
final ModuleId calleeModuleId,
|
||||||
final String calleeModuleKey,
|
|
||||||
final String calleeCallableName,
|
final String calleeCallableName,
|
||||||
final HostCallMetadata hostCall,
|
final HostCallMetadata hostCall,
|
||||||
final IntrinsicCallMetadata intrinsicCall,
|
final IntrinsicCallMetadata intrinsicCall,
|
||||||
final Span span) {
|
final Span span) {
|
||||||
this(kind, calleeModuleId, calleeModuleKey, calleeCallableName, null, hostCall, intrinsicCall, null, null, null, null, span);
|
this(kind, calleeModuleId, calleeCallableName, null, hostCall, intrinsicCall, null, null, null, null, span);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instruction(
|
public Instruction(
|
||||||
final InstructionKind kind,
|
final InstructionKind kind,
|
||||||
final ModuleId calleeModuleId,
|
final ModuleId calleeModuleId,
|
||||||
final String calleeModuleKey,
|
|
||||||
final String calleeCallableName,
|
final String calleeCallableName,
|
||||||
final HostCallMetadata hostCall,
|
final HostCallMetadata hostCall,
|
||||||
final IntrinsicCallMetadata intrinsicCall,
|
final IntrinsicCallMetadata intrinsicCall,
|
||||||
final Integer expectedArgSlots,
|
final Integer expectedArgSlots,
|
||||||
final Integer expectedRetSlots,
|
final Integer expectedRetSlots,
|
||||||
final Span span) {
|
final Span span) {
|
||||||
this(kind, calleeModuleId, calleeModuleKey, calleeCallableName, null, hostCall, intrinsicCall, null, null, expectedArgSlots, expectedRetSlots, span);
|
this(kind, calleeModuleId, calleeCallableName, null, hostCall, intrinsicCall, null, null, expectedArgSlots, expectedRetSlots, span);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instruction(
|
public Instruction(
|
||||||
final InstructionKind kind,
|
final InstructionKind kind,
|
||||||
final String calleeModuleKey,
|
|
||||||
final String calleeCallableName,
|
final String calleeCallableName,
|
||||||
final CallableId calleeCallableId,
|
final CallableId calleeCallableId,
|
||||||
final HostCallMetadata hostCall,
|
final HostCallMetadata hostCall,
|
||||||
@ -160,23 +150,21 @@ public record IRBackendExecutableFunction(
|
|||||||
final Integer expectedArgSlots,
|
final Integer expectedArgSlots,
|
||||||
final Integer expectedRetSlots,
|
final Integer expectedRetSlots,
|
||||||
final Span span) {
|
final Span span) {
|
||||||
this(kind, ModuleId.none(), calleeModuleKey, calleeCallableName, calleeCallableId, hostCall, intrinsicCall, label, targetLabel, expectedArgSlots, expectedRetSlots, span);
|
this(kind, ModuleId.none(), calleeCallableName, calleeCallableId, hostCall, intrinsicCall, label, targetLabel, expectedArgSlots, expectedRetSlots, span);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instruction(
|
public Instruction(
|
||||||
final InstructionKind kind,
|
final InstructionKind kind,
|
||||||
final String calleeModuleKey,
|
|
||||||
final String calleeCallableName,
|
final String calleeCallableName,
|
||||||
final CallableId calleeCallableId,
|
final CallableId calleeCallableId,
|
||||||
final HostCallMetadata hostCall,
|
final HostCallMetadata hostCall,
|
||||||
final IntrinsicCallMetadata intrinsicCall,
|
final IntrinsicCallMetadata intrinsicCall,
|
||||||
final Span span) {
|
final Span span) {
|
||||||
this(kind, ModuleId.none(), calleeModuleKey, calleeCallableName, calleeCallableId, hostCall, intrinsicCall, null, null, null, null, span);
|
this(kind, ModuleId.none(), calleeCallableName, calleeCallableId, hostCall, intrinsicCall, null, null, null, null, span);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instruction(
|
public Instruction(
|
||||||
final InstructionKind kind,
|
final InstructionKind kind,
|
||||||
final String calleeModuleKey,
|
|
||||||
final String calleeCallableName,
|
final String calleeCallableName,
|
||||||
final CallableId calleeCallableId,
|
final CallableId calleeCallableId,
|
||||||
final HostCallMetadata hostCall,
|
final HostCallMetadata hostCall,
|
||||||
@ -184,29 +172,27 @@ public record IRBackendExecutableFunction(
|
|||||||
final Integer expectedArgSlots,
|
final Integer expectedArgSlots,
|
||||||
final Integer expectedRetSlots,
|
final Integer expectedRetSlots,
|
||||||
final Span span) {
|
final Span span) {
|
||||||
this(kind, ModuleId.none(), calleeModuleKey, calleeCallableName, calleeCallableId, hostCall, intrinsicCall, null, null, expectedArgSlots, expectedRetSlots, span);
|
this(kind, ModuleId.none(), calleeCallableName, calleeCallableId, hostCall, intrinsicCall, null, null, expectedArgSlots, expectedRetSlots, span);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instruction(
|
public Instruction(
|
||||||
final InstructionKind kind,
|
final InstructionKind kind,
|
||||||
final String calleeModuleKey,
|
|
||||||
final String calleeCallableName,
|
final String calleeCallableName,
|
||||||
final HostCallMetadata hostCall,
|
final HostCallMetadata hostCall,
|
||||||
final IntrinsicCallMetadata intrinsicCall,
|
final IntrinsicCallMetadata intrinsicCall,
|
||||||
final Span span) {
|
final Span span) {
|
||||||
this(kind, ModuleId.none(), calleeModuleKey, calleeCallableName, null, hostCall, intrinsicCall, null, null, null, null, span);
|
this(kind, ModuleId.none(), calleeCallableName, null, hostCall, intrinsicCall, null, null, null, null, span);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instruction(
|
public Instruction(
|
||||||
final InstructionKind kind,
|
final InstructionKind kind,
|
||||||
final String calleeModuleKey,
|
|
||||||
final String calleeCallableName,
|
final String calleeCallableName,
|
||||||
final HostCallMetadata hostCall,
|
final HostCallMetadata hostCall,
|
||||||
final IntrinsicCallMetadata intrinsicCall,
|
final IntrinsicCallMetadata intrinsicCall,
|
||||||
final Integer expectedArgSlots,
|
final Integer expectedArgSlots,
|
||||||
final Integer expectedRetSlots,
|
final Integer expectedRetSlots,
|
||||||
final Span span) {
|
final Span span) {
|
||||||
this(kind, ModuleId.none(), calleeModuleKey, calleeCallableName, null, hostCall, intrinsicCall, null, null, expectedArgSlots, expectedRetSlots, span);
|
this(kind, ModuleId.none(), calleeCallableName, null, hostCall, intrinsicCall, null, null, expectedArgSlots, expectedRetSlots, span);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Instruction {
|
public Instruction {
|
||||||
@ -216,7 +202,6 @@ public record IRBackendExecutableFunction(
|
|||||||
if (!calleeModuleId.isNone()) {
|
if (!calleeModuleId.isNone()) {
|
||||||
calleeModuleId.getIndex();
|
calleeModuleId.getIndex();
|
||||||
}
|
}
|
||||||
calleeModuleKey = calleeModuleKey == null ? "" : calleeModuleKey;
|
|
||||||
calleeCallableName = calleeCallableName == null ? "" : calleeCallableName;
|
calleeCallableName = calleeCallableName == null ? "" : calleeCallableName;
|
||||||
label = label == null ? "" : label;
|
label = label == null ? "" : label;
|
||||||
targetLabel = targetLabel == null ? "" : targetLabel;
|
targetLabel = targetLabel == null ? "" : targetLabel;
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class IRBackendExecutableContractTest {
|
|||||||
void callInstructionMustRequireCategorySpecificMetadata() {
|
void callInstructionMustRequireCategorySpecificMetadata() {
|
||||||
assertThrows(IllegalArgumentException.class, () -> new IRBackendExecutableFunction.Instruction(
|
assertThrows(IllegalArgumentException.class, () -> new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_HOST,
|
IRBackendExecutableFunction.InstructionKind.CALL_HOST,
|
||||||
"",
|
ModuleId.none(),
|
||||||
"",
|
"",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@ -29,7 +29,7 @@ class IRBackendExecutableContractTest {
|
|||||||
|
|
||||||
final var callFunc = new IRBackendExecutableFunction.Instruction(
|
final var callFunc = new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
||||||
"app/main",
|
ModuleId.none(),
|
||||||
"foo",
|
"foo",
|
||||||
new CallableId(7),
|
new CallableId(7),
|
||||||
null,
|
null,
|
||||||
@ -42,7 +42,6 @@ class IRBackendExecutableContractTest {
|
|||||||
void functionContractMustRejectInvalidSlotAndSpanBounds() {
|
void functionContractMustRejectInvalidSlotAndSpanBounds() {
|
||||||
assertThrows(IllegalArgumentException.class, () -> new IRBackendExecutableFunction(
|
assertThrows(IllegalArgumentException.class, () -> new IRBackendExecutableFunction(
|
||||||
new FileId(1),
|
new FileId(1),
|
||||||
"app",
|
|
||||||
"main",
|
"main",
|
||||||
new CallableId(1),
|
new CallableId(1),
|
||||||
10,
|
10,
|
||||||
@ -56,7 +55,6 @@ class IRBackendExecutableContractTest {
|
|||||||
|
|
||||||
final var thrown = assertThrows(IllegalArgumentException.class, () -> new IRBackendExecutableFunction(
|
final var thrown = assertThrows(IllegalArgumentException.class, () -> new IRBackendExecutableFunction(
|
||||||
new FileId(1),
|
new FileId(1),
|
||||||
"app",
|
|
||||||
"main",
|
"main",
|
||||||
new CallableId(1),
|
new CallableId(1),
|
||||||
0,
|
0,
|
||||||
@ -74,7 +72,7 @@ class IRBackendExecutableContractTest {
|
|||||||
void instructionContractMustRejectMixedMetadataKinds() {
|
void instructionContractMustRejectMixedMetadataKinds() {
|
||||||
assertThrows(IllegalArgumentException.class, () -> new IRBackendExecutableFunction.Instruction(
|
assertThrows(IllegalArgumentException.class, () -> new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
||||||
"app/main",
|
ModuleId.none(),
|
||||||
"foo",
|
"foo",
|
||||||
new CallableId(1),
|
new CallableId(1),
|
||||||
new IRBackendExecutableFunction.HostCallMetadata("gfx", "draw", 1, 0, 0),
|
new IRBackendExecutableFunction.HostCallMetadata("gfx", "draw", 1, 0, 0),
|
||||||
@ -93,7 +91,7 @@ class IRBackendExecutableContractTest {
|
|||||||
void jumpAndLabelContractMustRequireNames() {
|
void jumpAndLabelContractMustRequireNames() {
|
||||||
assertThrows(IllegalArgumentException.class, () -> new IRBackendExecutableFunction.Instruction(
|
assertThrows(IllegalArgumentException.class, () -> new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.LABEL,
|
IRBackendExecutableFunction.InstructionKind.LABEL,
|
||||||
"",
|
ModuleId.none(),
|
||||||
"",
|
"",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@ -106,7 +104,7 @@ class IRBackendExecutableContractTest {
|
|||||||
|
|
||||||
assertThrows(IllegalArgumentException.class, () -> new IRBackendExecutableFunction.Instruction(
|
assertThrows(IllegalArgumentException.class, () -> new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.JMP,
|
IRBackendExecutableFunction.InstructionKind.JMP,
|
||||||
"",
|
ModuleId.none(),
|
||||||
"",
|
"",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
@ -125,7 +123,6 @@ class IRBackendExecutableContractTest {
|
|||||||
ReadOnlyList.empty(),
|
ReadOnlyList.empty(),
|
||||||
ReadOnlyList.from(new IRBackendExecutableFunction(
|
ReadOnlyList.from(new IRBackendExecutableFunction(
|
||||||
new FileId(1),
|
new FileId(1),
|
||||||
"app/main",
|
|
||||||
"entry",
|
"entry",
|
||||||
new CallableId(0),
|
new CallableId(0),
|
||||||
0,
|
0,
|
||||||
@ -137,21 +134,18 @@ class IRBackendExecutableContractTest {
|
|||||||
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.HALT,
|
IRBackendExecutableFunction.InstructionKind.HALT,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Span.none())),
|
Span.none())),
|
||||||
Span.none())),
|
Span.none())),
|
||||||
IRReservedMetadata.empty(),
|
IRReservedMetadata.empty(),
|
||||||
ReadOnlyList.from(new CallableSignatureRef("app/main", "entry", 0, "() -> unit")),
|
ReadOnlyList.from(new CallableSignatureRef("entry", 0, "() -> unit")),
|
||||||
ReadOnlyList.empty());
|
ReadOnlyList.empty());
|
||||||
final var fileB = new IRBackendFile(
|
final var fileB = new IRBackendFile(
|
||||||
new FileId(2),
|
new FileId(2),
|
||||||
ReadOnlyList.empty(),
|
ReadOnlyList.empty(),
|
||||||
ReadOnlyList.from(new IRBackendExecutableFunction(
|
ReadOnlyList.from(new IRBackendExecutableFunction(
|
||||||
new FileId(2),
|
new FileId(2),
|
||||||
"app/main",
|
|
||||||
"aux",
|
"aux",
|
||||||
new CallableId(0),
|
new CallableId(0),
|
||||||
11,
|
11,
|
||||||
@ -163,14 +157,12 @@ class IRBackendExecutableContractTest {
|
|||||||
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Span.none())),
|
Span.none())),
|
||||||
Span.none())),
|
Span.none())),
|
||||||
IRReservedMetadata.empty(),
|
IRReservedMetadata.empty(),
|
||||||
ReadOnlyList.from(new CallableSignatureRef("app/main", "aux", 0, "() -> unit")),
|
ReadOnlyList.from(new CallableSignatureRef("aux", 0, "() -> unit")),
|
||||||
ReadOnlyList.empty());
|
ReadOnlyList.empty());
|
||||||
|
|
||||||
final var aggregator = IRBackend.aggregator();
|
final var aggregator = IRBackend.aggregator();
|
||||||
@ -213,7 +205,6 @@ class IRBackendExecutableContractTest {
|
|||||||
ReadOnlyList.empty(),
|
ReadOnlyList.empty(),
|
||||||
ReadOnlyList.from(new IRBackendExecutableFunction(
|
ReadOnlyList.from(new IRBackendExecutableFunction(
|
||||||
new FileId(1),
|
new FileId(1),
|
||||||
"app/main",
|
|
||||||
"entry",
|
"entry",
|
||||||
new CallableId(0),
|
new CallableId(0),
|
||||||
0,
|
0,
|
||||||
@ -225,20 +216,18 @@ class IRBackendExecutableContractTest {
|
|||||||
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_INTRINSIC,
|
IRBackendExecutableFunction.InstructionKind.CALL_INTRINSIC,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
new IRBackendExecutableFunction.IntrinsicCallMetadata("core.color.pack", 1, new IntrinsicId(0)),
|
new IRBackendExecutableFunction.IntrinsicCallMetadata("core.color.pack", 1, new IntrinsicId(0)),
|
||||||
Span.none())),
|
Span.none())),
|
||||||
Span.none())),
|
Span.none())),
|
||||||
IRReservedMetadata.empty(),
|
IRReservedMetadata.empty(),
|
||||||
ReadOnlyList.from(new CallableSignatureRef("app/main", "entry", 0, "() -> unit")),
|
ReadOnlyList.from(new CallableSignatureRef("entry", 0, "() -> unit")),
|
||||||
ReadOnlyList.from(new IntrinsicReference("core.color.pack", 1)));
|
ReadOnlyList.from(new IntrinsicReference("core.color.pack", 1)));
|
||||||
final var fileB = new IRBackendFile(
|
final var fileB = new IRBackendFile(
|
||||||
new FileId(2),
|
new FileId(2),
|
||||||
ReadOnlyList.empty(),
|
ReadOnlyList.empty(),
|
||||||
ReadOnlyList.from(new IRBackendExecutableFunction(
|
ReadOnlyList.from(new IRBackendExecutableFunction(
|
||||||
new FileId(2),
|
new FileId(2),
|
||||||
"app/main",
|
|
||||||
"aux",
|
"aux",
|
||||||
new CallableId(0),
|
new CallableId(0),
|
||||||
11,
|
11,
|
||||||
@ -250,13 +239,12 @@ class IRBackendExecutableContractTest {
|
|||||||
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.CALL_INTRINSIC,
|
IRBackendExecutableFunction.InstructionKind.CALL_INTRINSIC,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
new IRBackendExecutableFunction.IntrinsicCallMetadata("core.color.pack", 1, new IntrinsicId(0)),
|
new IRBackendExecutableFunction.IntrinsicCallMetadata("core.color.pack", 1, new IntrinsicId(0)),
|
||||||
Span.none())),
|
Span.none())),
|
||||||
Span.none())),
|
Span.none())),
|
||||||
IRReservedMetadata.empty(),
|
IRReservedMetadata.empty(),
|
||||||
ReadOnlyList.from(new CallableSignatureRef("app/main", "aux", 0, "() -> unit")),
|
ReadOnlyList.from(new CallableSignatureRef("aux", 0, "() -> unit")),
|
||||||
ReadOnlyList.from(new IntrinsicReference("core.color.pack", 1)));
|
ReadOnlyList.from(new IntrinsicReference("core.color.pack", 1)));
|
||||||
|
|
||||||
final var aggregator = IRBackend.aggregator();
|
final var aggregator = IRBackend.aggregator();
|
||||||
@ -280,7 +268,6 @@ class IRBackendExecutableContractTest {
|
|||||||
ReadOnlyList.empty(),
|
ReadOnlyList.empty(),
|
||||||
ReadOnlyList.from(new IRBackendExecutableFunction(
|
ReadOnlyList.from(new IRBackendExecutableFunction(
|
||||||
new FileId(7),
|
new FileId(7),
|
||||||
"app/main",
|
|
||||||
"main",
|
"main",
|
||||||
new CallableId(0),
|
new CallableId(0),
|
||||||
10,
|
10,
|
||||||
@ -292,13 +279,12 @@ class IRBackendExecutableContractTest {
|
|||||||
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
instructionSpan)),
|
instructionSpan)),
|
||||||
functionSpan)),
|
functionSpan)),
|
||||||
IRReservedMetadata.empty(),
|
IRReservedMetadata.empty(),
|
||||||
ReadOnlyList.from(new CallableSignatureRef("app/main", "main", 0, "() -> unit")),
|
ReadOnlyList.from(new CallableSignatureRef("main", 0, "() -> unit")),
|
||||||
ReadOnlyList.empty());
|
ReadOnlyList.empty());
|
||||||
|
|
||||||
final var aggregator = IRBackend.aggregator();
|
final var aggregator = IRBackend.aggregator();
|
||||||
@ -323,7 +309,6 @@ class IRBackendExecutableContractTest {
|
|||||||
ReadOnlyList.from(new IRBackendExecutableFunction(
|
ReadOnlyList.from(new IRBackendExecutableFunction(
|
||||||
new FileId(1),
|
new FileId(1),
|
||||||
new ModuleId(0),
|
new ModuleId(0),
|
||||||
"app:mod/a",
|
|
||||||
"entry",
|
"entry",
|
||||||
new CallableId(0),
|
new CallableId(0),
|
||||||
0,
|
0,
|
||||||
@ -335,14 +320,13 @@ class IRBackendExecutableContractTest {
|
|||||||
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Span.none())),
|
Span.none())),
|
||||||
Span.none())),
|
Span.none())),
|
||||||
IRReservedMetadata.empty(),
|
IRReservedMetadata.empty(),
|
||||||
ReadOnlyList.from(new ModuleReference("app", ReadOnlyList.from("mod", "a"))),
|
ReadOnlyList.from(new ModuleReference("app", ReadOnlyList.from("mod", "a"))),
|
||||||
ReadOnlyList.from(new CallableSignatureRef(new ModuleId(0), "app:mod/a", "entry", 0, "() -> unit")),
|
ReadOnlyList.from(new CallableSignatureRef(new ModuleId(0), "entry", 0, "() -> unit")),
|
||||||
ReadOnlyList.empty());
|
ReadOnlyList.empty());
|
||||||
final var fileB = new IRBackendFile(
|
final var fileB = new IRBackendFile(
|
||||||
new FileId(2),
|
new FileId(2),
|
||||||
@ -350,7 +334,6 @@ class IRBackendExecutableContractTest {
|
|||||||
ReadOnlyList.from(new IRBackendExecutableFunction(
|
ReadOnlyList.from(new IRBackendExecutableFunction(
|
||||||
new FileId(2),
|
new FileId(2),
|
||||||
new ModuleId(0),
|
new ModuleId(0),
|
||||||
"app:mod/b",
|
|
||||||
"aux",
|
"aux",
|
||||||
new CallableId(0),
|
new CallableId(0),
|
||||||
6,
|
6,
|
||||||
@ -362,14 +345,13 @@ class IRBackendExecutableContractTest {
|
|||||||
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
||||||
IRBackendExecutableFunction.InstructionKind.RET,
|
IRBackendExecutableFunction.InstructionKind.RET,
|
||||||
"",
|
"",
|
||||||
"",
|
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
Span.none())),
|
Span.none())),
|
||||||
Span.none())),
|
Span.none())),
|
||||||
IRReservedMetadata.empty(),
|
IRReservedMetadata.empty(),
|
||||||
ReadOnlyList.from(new ModuleReference("app", ReadOnlyList.from("mod", "b"))),
|
ReadOnlyList.from(new ModuleReference("app", ReadOnlyList.from("mod", "b"))),
|
||||||
ReadOnlyList.from(new CallableSignatureRef(new ModuleId(0), "app:mod/b", "aux", 0, "() -> unit")),
|
ReadOnlyList.from(new CallableSignatureRef(new ModuleId(0), "aux", 0, "() -> unit")),
|
||||||
ReadOnlyList.empty());
|
ReadOnlyList.empty());
|
||||||
|
|
||||||
final var aggregator = IRBackend.aggregator();
|
final var aggregator = IRBackend.aggregator();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user