implements one-shot PBS boot guard in published wrapper lowering
This commit is contained in:
+11
-5
@@ -369,15 +369,21 @@ class PBSFrontendPhaseServiceTest {
|
||||
.orElseThrow();
|
||||
assertTrue(bootGuard.isHidden());
|
||||
assertTrue(bootGuard.name().startsWith("__pbs.boot_guard$m"));
|
||||
assertEquals(1, bootGuard.slot());
|
||||
final var wrapper = irBackend.getExecutableFunctions().stream()
|
||||
.filter(function -> irBackend.getEntryPointCallableName().equals(function.callableName()))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
assertEquals(4, wrapper.instructions().size());
|
||||
assertTrue(wrapper.instructions().get(0).calleeCallableName().startsWith("__pbs.module_init$m"));
|
||||
assertTrue(wrapper.instructions().get(1).calleeCallableName().startsWith("__pbs.project_init$m"));
|
||||
assertEquals("frame", wrapper.instructions().get(2).calleeCallableName());
|
||||
assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.RET, wrapper.instructions().get(3).kind());
|
||||
assertEquals(9, wrapper.instructions().size());
|
||||
assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.GET_GLOBAL, wrapper.instructions().get(0).kind());
|
||||
assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.JMP_IF_TRUE, wrapper.instructions().get(1).kind());
|
||||
assertTrue(wrapper.instructions().get(2).calleeCallableName().startsWith("__pbs.module_init$m"));
|
||||
assertTrue(wrapper.instructions().get(3).calleeCallableName().startsWith("__pbs.project_init$m"));
|
||||
assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.PUSH_BOOL, wrapper.instructions().get(4).kind());
|
||||
assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.SET_GLOBAL, wrapper.instructions().get(5).kind());
|
||||
assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.LABEL, wrapper.instructions().get(6).kind());
|
||||
assertEquals("frame", wrapper.instructions().get(7).calleeCallableName());
|
||||
assertEquals(p.studio.compiler.models.IRBackendExecutableFunction.InstructionKind.RET, wrapper.instructions().get(8).kind());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user