implements PR-O4.1
This commit is contained in:
+24
-14
@@ -17,10 +17,10 @@ class LowerToIRVMServiceTest {
|
||||
void lowerMustAssignEntrypointIdZeroAndSortRemainingDeterministically() {
|
||||
final var backend = IRBackend.builder()
|
||||
.executableFunctions(ReadOnlyList.from(
|
||||
fn("aux", "app", ReadOnlyList.from(
|
||||
callFunc("app", "main"),
|
||||
fn("aux", "app", 11, ReadOnlyList.from(
|
||||
callFunc("app", "main", 10),
|
||||
ret())),
|
||||
fn("main", "app", ReadOnlyList.from(
|
||||
fn("main", "app", 10, ReadOnlyList.from(
|
||||
ret()))))
|
||||
.build();
|
||||
|
||||
@@ -37,7 +37,7 @@ class LowerToIRVMServiceTest {
|
||||
void lowerMustMapHostAndIntrinsicCallsites() {
|
||||
final var backend = IRBackend.builder()
|
||||
.executableFunctions(ReadOnlyList.from(
|
||||
fn("main", "app", ReadOnlyList.from(
|
||||
fn("main", "app", 10, ReadOnlyList.from(
|
||||
callHost("gfx", "draw_pixel", 1, 2, 0),
|
||||
callIntrinsic("core.color.pack", 1, 0x2001),
|
||||
ret()))))
|
||||
@@ -59,8 +59,8 @@ class LowerToIRVMServiceTest {
|
||||
void lowerMustRejectUnterminatedFunction() {
|
||||
final var backend = IRBackend.builder()
|
||||
.executableFunctions(ReadOnlyList.from(
|
||||
fn("main", "app", ReadOnlyList.from(
|
||||
callFunc("app", "main")))))
|
||||
fn("main", "app", 10, ReadOnlyList.from(
|
||||
callFunc("app", "main", 10)))))
|
||||
.build();
|
||||
|
||||
final var thrown = assertThrows(IRVMValidationException.class, () -> new LowerToIRVMService().lower(backend));
|
||||
@@ -71,8 +71,8 @@ class LowerToIRVMServiceTest {
|
||||
void lowerMustRejectMissingCallee() {
|
||||
final var backend = IRBackend.builder()
|
||||
.executableFunctions(ReadOnlyList.from(
|
||||
fn("main", "app", ReadOnlyList.from(
|
||||
callFunc("app", "missing"),
|
||||
fn("main", "app", 10, ReadOnlyList.from(
|
||||
callFunc("app", "missing", 77),
|
||||
ret()))))
|
||||
.build();
|
||||
|
||||
@@ -84,9 +84,9 @@ class LowerToIRVMServiceTest {
|
||||
void lowerMustRejectCallArgSlotMismatch() {
|
||||
final var backend = IRBackend.builder()
|
||||
.executableFunctions(ReadOnlyList.from(
|
||||
fn("callee", "app", ReadOnlyList.from(ret())),
|
||||
fn("main", "app", ReadOnlyList.from(
|
||||
callFuncWithExpected("app", "callee", 2, 0),
|
||||
fn("callee", "app", 20, ReadOnlyList.from(ret())),
|
||||
fn("main", "app", 10, ReadOnlyList.from(
|
||||
callFuncWithExpected("app", "callee", 20, 2, 0),
|
||||
ret()))))
|
||||
.build();
|
||||
|
||||
@@ -98,7 +98,7 @@ class LowerToIRVMServiceTest {
|
||||
void lowerMustResolveJumpTargetsFromLabels() {
|
||||
final var backend = IRBackend.builder()
|
||||
.executableFunctions(ReadOnlyList.from(
|
||||
fn("main", "app", ReadOnlyList.from(
|
||||
fn("main", "app", 10, ReadOnlyList.from(
|
||||
label("entry"),
|
||||
jmp("exit"),
|
||||
label("exit"),
|
||||
@@ -117,7 +117,7 @@ class LowerToIRVMServiceTest {
|
||||
void lowerMustRejectMissingJumpTargetLabel() {
|
||||
final var backend = IRBackend.builder()
|
||||
.executableFunctions(ReadOnlyList.from(
|
||||
fn("main", "app", ReadOnlyList.from(
|
||||
fn("main", "app", 10, ReadOnlyList.from(
|
||||
jmp("missing"),
|
||||
ret()))))
|
||||
.build();
|
||||
@@ -129,11 +129,13 @@ class LowerToIRVMServiceTest {
|
||||
private static IRBackendExecutableFunction fn(
|
||||
final String name,
|
||||
final String moduleKey,
|
||||
final int callableId,
|
||||
final ReadOnlyList<IRBackendExecutableFunction.Instruction> instructions) {
|
||||
return new IRBackendExecutableFunction(
|
||||
new FileId(0),
|
||||
moduleKey,
|
||||
name,
|
||||
callableId,
|
||||
0,
|
||||
10,
|
||||
0,
|
||||
@@ -154,11 +156,15 @@ class LowerToIRVMServiceTest {
|
||||
Span.none());
|
||||
}
|
||||
|
||||
private static IRBackendExecutableFunction.Instruction callFunc(final String moduleKey, final String name) {
|
||||
private static IRBackendExecutableFunction.Instruction callFunc(
|
||||
final String moduleKey,
|
||||
final String name,
|
||||
final int calleeCallableId) {
|
||||
return new IRBackendExecutableFunction.Instruction(
|
||||
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
||||
moduleKey,
|
||||
name,
|
||||
calleeCallableId,
|
||||
null,
|
||||
null,
|
||||
Span.none());
|
||||
@@ -167,12 +173,14 @@ class LowerToIRVMServiceTest {
|
||||
private static IRBackendExecutableFunction.Instruction callFuncWithExpected(
|
||||
final String moduleKey,
|
||||
final String name,
|
||||
final int calleeCallableId,
|
||||
final int expectedArgSlots,
|
||||
final int expectedRetSlots) {
|
||||
return new IRBackendExecutableFunction.Instruction(
|
||||
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
||||
moduleKey,
|
||||
name,
|
||||
calleeCallableId,
|
||||
null,
|
||||
null,
|
||||
expectedArgSlots,
|
||||
@@ -215,6 +223,7 @@ class LowerToIRVMServiceTest {
|
||||
"",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
label,
|
||||
"",
|
||||
null,
|
||||
@@ -229,6 +238,7 @@ class LowerToIRVMServiceTest {
|
||||
"",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"",
|
||||
target,
|
||||
null,
|
||||
|
||||
+1
@@ -178,6 +178,7 @@ class BackendGateIIntegrationTest {
|
||||
new FileId(1),
|
||||
"app/main",
|
||||
name,
|
||||
1,
|
||||
0,
|
||||
10,
|
||||
0,
|
||||
|
||||
+3
@@ -29,6 +29,7 @@ class BackendSafetyGateSUTest {
|
||||
new FileId(1),
|
||||
"app",
|
||||
"main",
|
||||
1,
|
||||
0,
|
||||
10,
|
||||
0,
|
||||
@@ -40,6 +41,7 @@ class BackendSafetyGateSUTest {
|
||||
IRBackendExecutableFunction.InstructionKind.CALL_FUNC,
|
||||
"app",
|
||||
"missing",
|
||||
99,
|
||||
null,
|
||||
null,
|
||||
0,
|
||||
@@ -112,6 +114,7 @@ class BackendSafetyGateSUTest {
|
||||
new FileId(1),
|
||||
"app",
|
||||
"main",
|
||||
1,
|
||||
0,
|
||||
10,
|
||||
0,
|
||||
|
||||
+1
@@ -38,6 +38,7 @@ class LowerToIRVMPipelineStageTest {
|
||||
new FileId(0),
|
||||
"app",
|
||||
"main",
|
||||
1,
|
||||
0,
|
||||
10,
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user