Fix class initializer compilation for WASI target

This commit is contained in:
Alexey Andreev 2024-02-17 19:04:37 +01:00
parent 8db406c603
commit ab253fd34a

View File

@ -548,7 +548,13 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
} }
} }
addInitializersToEntryPoint(classes, new MethodReference(entryPoint, CLINIT_DESC)); var initializers = target.getInitializerMethods();
if (initializers == null) {
initializers = List.of(new MethodReference(entryPoint, CLINIT_DESC));
}
for (var initializer : initializers) {
addInitializersToEntryPoint(classes, initializer);
}
} }
private void addInitializersToEntryPoint(ClassHolderSource classes, MethodReference methodRef) { private void addInitializersToEntryPoint(ClassHolderSource classes, MethodReference methodRef) {