mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-09 08:24:10 -08:00
Partially revert previous <clinit> commit.
Generate calls to <clinit> methods, since corresponding analyzer guarantees proper initialization order.
This commit is contained in:
parent
cd008f8a52
commit
103affa392
|
@ -379,7 +379,7 @@ public class Renderer implements RenderingManager {
|
||||||
try {
|
try {
|
||||||
MethodReader clinit = classSource.get(cls.getName()).getMethod(CLINIT_METHOD);
|
MethodReader clinit = classSource.get(cls.getName()).getMethod(CLINIT_METHOD);
|
||||||
|
|
||||||
if (clinit != null) {
|
if (clinit != null && context.isDynamicInitializer(cls.getName())) {
|
||||||
renderCallClinit(clinit, cls);
|
renderCallClinit(clinit, cls);
|
||||||
}
|
}
|
||||||
if (!cls.getClassHolder().getModifiers().contains(ElementModifier.INTERFACE)) {
|
if (!cls.getClassHolder().getModifiers().contains(ElementModifier.INTERFACE)) {
|
||||||
|
|
|
@ -75,6 +75,7 @@ import org.teavm.model.ValueType;
|
||||||
import org.teavm.model.analysis.ClassInitializerAnalysis;
|
import org.teavm.model.analysis.ClassInitializerAnalysis;
|
||||||
import org.teavm.model.analysis.ClassInitializerInfo;
|
import org.teavm.model.analysis.ClassInitializerInfo;
|
||||||
import org.teavm.model.instructions.InitClassInstruction;
|
import org.teavm.model.instructions.InitClassInstruction;
|
||||||
|
import org.teavm.model.instructions.InvokeInstruction;
|
||||||
import org.teavm.model.optimization.ArrayUnwrapMotion;
|
import org.teavm.model.optimization.ArrayUnwrapMotion;
|
||||||
import org.teavm.model.optimization.ClassInitElimination;
|
import org.teavm.model.optimization.ClassInitElimination;
|
||||||
import org.teavm.model.optimization.ConstantConditionElimination;
|
import org.teavm.model.optimization.ConstantConditionElimination;
|
||||||
|
@ -522,9 +523,9 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
|
||||||
BasicBlock block = program.basicBlockAt(0);
|
BasicBlock block = program.basicBlockAt(0);
|
||||||
Instruction first = block.getFirstInstruction();
|
Instruction first = block.getFirstInstruction();
|
||||||
for (String className : classInitializerInfo.getInitializationOrder()) {
|
for (String className : classInitializerInfo.getInitializationOrder()) {
|
||||||
InitClassInstruction clinit = new InitClassInstruction();
|
InvokeInstruction invoke = new InvokeInstruction();
|
||||||
clinit.setClassName(className);
|
invoke.setMethod(new MethodReference(className, "<clinit>", ValueType.VOID));
|
||||||
first.insertPrevious(clinit);
|
first.insertPrevious(invoke);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user