implements PR-O4.5
This commit is contained in:
+33
@@ -11,6 +11,7 @@ import p.studio.utilities.logs.LogAggregator;
|
||||
import p.studio.utilities.structures.ReadOnlyList;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@@ -62,4 +63,36 @@ class LowerToIRVMPipelineStageTest {
|
||||
assertNotNull(ctx.irvm);
|
||||
assertEquals(1, ctx.irvm.module().functions().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void runMustPropagateConfiguredVmProfileToLowering() {
|
||||
final var ctx = BuilderPipelineContext.compilerContext(new BuilderPipelineConfig(false, ".", "experimental-v1"));
|
||||
ctx.irBackend = IRBackend.builder()
|
||||
.executableFunctions(ReadOnlyList.from(new IRBackendExecutableFunction(
|
||||
new FileId(0),
|
||||
"app",
|
||||
"main",
|
||||
1,
|
||||
0,
|
||||
10,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
ReadOnlyList.from(new IRBackendExecutableFunction.Instruction(
|
||||
IRBackendExecutableFunction.InstructionKind.RET,
|
||||
"",
|
||||
"",
|
||||
null,
|
||||
null,
|
||||
Span.none())),
|
||||
Span.none())))
|
||||
.build();
|
||||
|
||||
final var issues = new LowerToIRVMPipelineStage().run(ctx, LogAggregator.empty());
|
||||
|
||||
assertFalse(issues.hasErrors());
|
||||
assertNotNull(ctx.irvm);
|
||||
assertEquals("experimental-v1", ctx.irvm.module().vmProfile());
|
||||
}
|
||||
}
|
||||
|
||||
+22
@@ -74,4 +74,26 @@ class OptimizeIRVMPipelineStageTest {
|
||||
assertTrue(issues.hasErrors());
|
||||
assertEquals(1, issues.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
void runMustAcceptSupportedNonDefaultVmProfile() {
|
||||
final var ctx = BuilderPipelineContext.compilerContext(new BuilderPipelineConfig(false, ".", "experimental-v1"));
|
||||
ctx.irvm = new IRVMProgram(new IRVMModule(
|
||||
"experimental-v1",
|
||||
ReadOnlyList.from(new IRVMFunction(
|
||||
"main",
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
ReadOnlyList.from(
|
||||
new IRVMInstruction(IRVMOp.HALT, null))))));
|
||||
final var stage = new OptimizeIRVMPipelineStage();
|
||||
|
||||
final var issues = stage.run(ctx, LogAggregator.empty());
|
||||
|
||||
assertFalse(issues.hasErrors());
|
||||
assertNotNull(ctx.optimizedIrvm);
|
||||
assertEquals("experimental-v1", ctx.optimizedIrvm.module().vmProfile());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user