hardens IRGlobal structural metadata for PBS lifecycle lowering
This commit is contained in:
+3
-7
@@ -5,6 +5,7 @@ import p.studio.compiler.backend.bytecode.BytecodeModule;
|
||||
import p.studio.compiler.models.IRBackend;
|
||||
import p.studio.compiler.models.IRBackendExecutableFunction;
|
||||
import p.studio.compiler.models.IRSyntheticCallableKind;
|
||||
import p.studio.compiler.models.IRHiddenGlobalKind;
|
||||
import p.studio.compiler.source.Span;
|
||||
import p.studio.compiler.source.identifiers.CallableId;
|
||||
import p.studio.compiler.source.identifiers.ModuleId;
|
||||
@@ -501,9 +502,9 @@ public class LowerToIRVMService {
|
||||
"synthetic wrapper entrypoint missing: " + publishedWrapper.callableName());
|
||||
}
|
||||
|
||||
final var expectedBootGuardName = bootGuardName(publishedWrapper.moduleId());
|
||||
final var bootGuardPresent = backend.getGlobals().stream()
|
||||
.anyMatch(global -> expectedBootGuardName.equals(global.name())
|
||||
.anyMatch(global -> global.hiddenKind() == IRHiddenGlobalKind.BOOT_GUARD
|
||||
&& global.isHidden()
|
||||
&& sameModuleIdentity(publishedWrapper.moduleId(), global.moduleId()));
|
||||
if (!bootGuardPresent) {
|
||||
throw new IRVMLoweringException(
|
||||
@@ -531,11 +532,6 @@ public class LowerToIRVMService {
|
||||
return publishedWrapper;
|
||||
}
|
||||
|
||||
private String bootGuardName(final ModuleId moduleId) {
|
||||
final var normalizedModuleId = moduleId == null ? ModuleId.none() : moduleId;
|
||||
return "__pbs.boot_guard$m" + (normalizedModuleId.isNone() ? -1 : normalizedModuleId.getIndex());
|
||||
}
|
||||
|
||||
private boolean sameModuleIdentity(
|
||||
final ModuleId left,
|
||||
final ModuleId right) {
|
||||
|
||||
Reference in New Issue
Block a user