feat(pbs): add explicit guest lifecycle hooks

This commit is contained in:
2026-10-28 09:12:48 +00:00
parent eb7d6a2398
commit 9504f4694a
41 changed files with 1209 additions and 24 deletions
@@ -161,6 +161,23 @@ class PbxRegistryConformanceTest {
var duplicated=ReadOnlyList.from(functions.get(0),functions.get(1),new BytecodeModule.FunctionMeta(4,2,0,0,0,0,pause));
assertThrows(BytecodeMarshalingException.class,()->new BytecodeModule(0,null,duplicated,m.code(),null,null,null,m.registry()).serialize());
}
@Test void pauseAndResumeRejectTypedParametersResultsAndCaptures() {
var integer = TypeRef.builtin(0x10);
for (var role : List.of(Role.BEFORE_PAUSE, Role.BEFORE_RESUME)) {
var signatures = List.of(
new Signature(ReadOnlyList.from(new NamedType(integer,"unexpected")),null),
new Signature(null,ReadOnlyList.from(integer)), Signature.empty());
for (int n=0;n<signatures.size();n++) {
var metadata=new FunctionMetadata(signatures.get(n),n==2?ReadOnlyList.from(integer):null,role);
var functions=ReadOnlyList.from(
new BytecodeModule.FunctionMeta(0,2,0,0,0,0,FunctionMetadata.empty()),
new BytecodeModule.FunctionMeta(2,2,n==0?1:0,0,n==1?1:0,1,metadata));
var invalid=new BytecodeModule(0,null,functions,instructions(op(0x51),op(0x51)),null,null,null,registry(0x10));
var failure=assertThrows(BytecodeMarshalingException.class,invalid::serialize);
assertTrue(failure.getMessage().contains(n==2?"invalid lifecycle target":"pause/resume signature"),failure.getMessage());
}
}
}
@Test void joinsWidenFactsAndLoopsReachFixedPoint() throws Exception {
// bool; branch to alternate scalar; equal-height join becomes Unknown, then POP.
byte[] code=instructions(op(0x10,0),op(0x03,24),op(0x17,1),op(0x02,30),op(0x10,1),op(0x11),op(1));