mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-08 16:04:10 -08:00
C: fix initialization order of system classes
This commit is contained in:
parent
7831fd328f
commit
2c67cc3eb9
|
@ -122,6 +122,7 @@ import org.teavm.runtime.CallSiteLocation;
|
||||||
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;
|
||||||
|
@ -739,7 +740,17 @@ public class CTarget implements TeaVMTarget, TeaVMCHost {
|
||||||
private void generateStaticInitializerCalls(GenerationContext context, CodeWriter writer, IncludeManager includes,
|
private void generateStaticInitializerCalls(GenerationContext context, CodeWriter writer, IncludeManager includes,
|
||||||
ListableClassReaderSource classes) {
|
ListableClassReaderSource classes) {
|
||||||
MethodDescriptor clinitDescriptor = new MethodDescriptor("<clinit>", ValueType.VOID);
|
MethodDescriptor clinitDescriptor = new MethodDescriptor("<clinit>", ValueType.VOID);
|
||||||
|
if (classes.getClassNames().contains(GC.class.getName())) {
|
||||||
|
includes.includeClass(GC.class.getName());
|
||||||
|
String clinitName = context.getNames().forMethod(new MethodReference(GC.class.getName(),
|
||||||
|
clinitDescriptor));
|
||||||
|
writer.println(clinitName + "();");
|
||||||
|
}
|
||||||
|
|
||||||
for (String className : classes.getClassNames()) {
|
for (String className : classes.getClassNames()) {
|
||||||
|
if (className.equals(GC.class.getName())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ClassReader cls = classes.get(className);
|
ClassReader cls = classes.get(className);
|
||||||
if (!context.getCharacteristics().isStaticInit(cls.getName())
|
if (!context.getCharacteristics().isStaticInit(cls.getName())
|
||||||
&& !context.getCharacteristics().isStructure(cls.getName())) {
|
&& !context.getCharacteristics().isStructure(cls.getName())) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user