mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-08 07:54:11 -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 {
|
||||
MethodReader clinit = classSource.get(cls.getName()).getMethod(CLINIT_METHOD);
|
||||
|
||||
if (clinit != null) {
|
||||
if (clinit != null && context.isDynamicInitializer(cls.getName())) {
|
||||
renderCallClinit(clinit, cls);
|
||||
}
|
||||
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.ClassInitializerInfo;
|
||||
import org.teavm.model.instructions.InitClassInstruction;
|
||||
import org.teavm.model.instructions.InvokeInstruction;
|
||||
import org.teavm.model.optimization.ArrayUnwrapMotion;
|
||||
import org.teavm.model.optimization.ClassInitElimination;
|
||||
import org.teavm.model.optimization.ConstantConditionElimination;
|
||||
|
@ -522,9 +523,9 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
|
|||
BasicBlock block = program.basicBlockAt(0);
|
||||
Instruction first = block.getFirstInstruction();
|
||||
for (String className : classInitializerInfo.getInitializationOrder()) {
|
||||
InitClassInstruction clinit = new InitClassInstruction();
|
||||
clinit.setClassName(className);
|
||||
first.insertPrevious(clinit);
|
||||
InvokeInstruction invoke = new InvokeInstruction();
|
||||
invoke.setMethod(new MethodReference(className, "<clinit>", ValueType.VOID));
|
||||
first.insertPrevious(invoke);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user