mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Better optimization of <clinit> when reading other's class static final fields
This commit is contained in:
parent
a30702aa70
commit
8d1eb3fcc6
|
@ -33,6 +33,7 @@ import org.teavm.model.BasicBlockReader;
|
||||||
import org.teavm.model.ClassHierarchy;
|
import org.teavm.model.ClassHierarchy;
|
||||||
import org.teavm.model.ClassReader;
|
import org.teavm.model.ClassReader;
|
||||||
import org.teavm.model.ElementModifier;
|
import org.teavm.model.ElementModifier;
|
||||||
|
import org.teavm.model.FieldReader;
|
||||||
import org.teavm.model.FieldReference;
|
import org.teavm.model.FieldReference;
|
||||||
import org.teavm.model.ListableClassReaderSource;
|
import org.teavm.model.ListableClassReaderSource;
|
||||||
import org.teavm.model.MethodDescriptor;
|
import org.teavm.model.MethodDescriptor;
|
||||||
|
@ -220,6 +221,13 @@ public class ClassInitializerAnalysis implements ClassInitializerInfo {
|
||||||
@Override
|
@Override
|
||||||
public void putField(VariableReader instance, FieldReference field, VariableReader value, ValueType fieldType) {
|
public void putField(VariableReader instance, FieldReference field, VariableReader value, ValueType fieldType) {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
|
ClassReader cls = classes.get(field.getClassName());
|
||||||
|
if (cls != null) {
|
||||||
|
FieldReader fieldReader = cls.getField(field.getFieldName());
|
||||||
|
if (fieldReader != null && fieldReader.hasModifier(ElementModifier.FINAL)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
touchField(field);
|
touchField(field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user