mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-07 23:44:11 -08:00
wasm: fix initialization order of system classes
This commit is contained in:
parent
f2bac088f1
commit
6de830d5bd
|
@ -160,6 +160,7 @@ import org.teavm.runtime.Allocator;
|
||||||
import org.teavm.runtime.EventQueue;
|
import org.teavm.runtime.EventQueue;
|
||||||
import org.teavm.runtime.ExceptionHandling;
|
import org.teavm.runtime.ExceptionHandling;
|
||||||
import org.teavm.runtime.Fiber;
|
import org.teavm.runtime.Fiber;
|
||||||
|
import org.teavm.runtime.GC;
|
||||||
import org.teavm.runtime.RuntimeArray;
|
import org.teavm.runtime.RuntimeArray;
|
||||||
import org.teavm.runtime.RuntimeClass;
|
import org.teavm.runtime.RuntimeClass;
|
||||||
import org.teavm.runtime.RuntimeObject;
|
import org.teavm.runtime.RuntimeObject;
|
||||||
|
@ -590,8 +591,18 @@ public class WasmTarget implements TeaVMTarget, TeaVMWasmHost {
|
||||||
new WasmInt32Constant(heapAddress), new WasmInt32Constant(minHeapSize),
|
new WasmInt32Constant(heapAddress), new WasmInt32Constant(minHeapSize),
|
||||||
new WasmInt32Constant(maxHeapSize), new WasmInt32Constant(WasmHeap.DEFAULT_STACK_SIZE)));
|
new WasmInt32Constant(maxHeapSize), new WasmInt32Constant(WasmHeap.DEFAULT_STACK_SIZE)));
|
||||||
|
|
||||||
|
for (Class<?> javaCls : new Class<?>[] { GC.class }) {
|
||||||
|
ClassReader cls = classes.get(javaCls.getName());
|
||||||
|
MethodReader clinit = cls.getMethod(new MethodDescriptor("<clinit>", void.class));
|
||||||
|
if (clinit == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
initFunction.getBody().add(new WasmCall(names.forClassInitializer(cls.getName())));
|
||||||
|
}
|
||||||
|
|
||||||
for (String className : classes.getClassNames()) {
|
for (String className : classes.getClassNames()) {
|
||||||
if (className.equals(WasmRuntime.class.getName()) || className.equals(WasmHeap.class.getName())) {
|
if (className.equals(WasmRuntime.class.getName()) || className.equals(WasmHeap.class.getName())
|
||||||
|
|| className.equals(GC.class.getName())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ClassReader cls = classes.get(className);
|
ClassReader cls = classes.get(className);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user