wasm gc: fix issue with dependency initialization order

This commit is contained in:
Alexey Andreev 2024-10-02 20:18:04 +02:00
parent 802efd49c6
commit 68a1b2efae
2 changed files with 7 additions and 5 deletions

View File

@ -410,10 +410,12 @@ public abstract class DependencyAnalyzer implements DependencyInfo {
reachedMethods.add(dep.getReference());
dep.activated = true;
if (!dep.isMissing()) {
for (DependencyListener listener : listeners) {
defer(() -> {
for (var listener : listeners) {
listener.methodReached(agent, dep);
}
activateDependencyPlugin(dep);
});
}
}
return dep;

View File

@ -388,8 +388,8 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
cancelled |= progressListener.progressReached(progress) != TeaVMProgressFeedback.CONTINUE;
return !cancelled;
});
dependencyAnalyzer.initDependencies();
target.contributeDependencies(dependencyAnalyzer);
dependencyAnalyzer.initDependencies();
if (target.needsSystemArrayCopyOptimization()) {
dependencyAnalyzer.addDependencyListener(new StdlibDependencyListener());
}