implements PR-08.3

This commit is contained in:
2026-03-24 13:42:33 +00:00
parent 0490f64870
commit 2a68d27eca
5 changed files with 118 additions and 5 deletions
@@ -38,6 +38,7 @@ import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
@@ -191,13 +192,26 @@ public class PBSFrontendPhaseService implements FrontendPhaseService {
}
final var blockedModuleIds = blockedModulesByDependency(failedModuleIds, moduleDependencyGraph);
final var entryPointCallableName = PBSDefinitions.PBS.getEntryPointCallableName();
final var entryPointModuleCandidates = new LinkedHashSet<ModuleId>();
for (final var compiledSource : compiledSourceFiles) {
if (blockedModuleIds.contains(compiledSource.moduleId())) {
continue;
}
irBackendAggregator.merge(compiledSource.irBackendFile());
for (final var executable : compiledSource.irBackendFile().executableFunctions()) {
if (!entryPointCallableName.equals(executable.callableName())) {
continue;
}
if (executable.moduleId() != null && !executable.moduleId().isNone()) {
entryPointModuleCandidates.add(executable.moduleId());
}
}
}
irBackendAggregator.entryPointCallableName(entryPointCallableName);
if (entryPointModuleCandidates.size() == 1) {
irBackendAggregator.entryPointModuleId(entryPointModuleCandidates.iterator().next());
}
irBackendAggregator.entryPointCallableName(PBSDefinitions.PBS.getEntryPointCallableName());
final var irBackend = irBackendAggregator.emit();
logs.using(log).debug("PBS frontend lowered to IR BE:\n%s".formatted(irBackend));