mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
C backend: fix bug Class implementation. Don't emit unnecessary Object.monitor field
This commit is contained in:
parent
da68fa0083
commit
8a45dc300c
|
@ -153,6 +153,7 @@ public class TClass<T> extends TObject implements TAnnotatedElement {
|
||||||
return Address.ofObject(this).<RuntimeClass>toStructure().simpleName;
|
return Address.ofObject(this).<RuntimeClass>toStructure().simpleName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DelegateTo("setSimpleNameCacheLowLevel")
|
||||||
private void setSimpleNameCache(String value) {
|
private void setSimpleNameCache(String value) {
|
||||||
simpleName = value;
|
simpleName = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,9 +248,10 @@ public class ClassGenerator {
|
||||||
FieldReference[] instanceFields = new FieldReference[cls.getFields().size()];
|
FieldReference[] instanceFields = new FieldReference[cls.getFields().size()];
|
||||||
int instanceIndex = 0;
|
int instanceIndex = 0;
|
||||||
for (FieldHolder field : cls.getFields()) {
|
for (FieldHolder field : cls.getFields()) {
|
||||||
if (field.hasModifier(ElementModifier.STATIC)) {
|
if (field.hasModifier(ElementModifier.STATIC) || isMonitorField(field.getReference())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String fieldName = context.getNames().forMemberField(field.getReference());
|
String fieldName = context.getNames().forMemberField(field.getReference());
|
||||||
structWriter.printStrictType(field.getType()).print(" ").print(fieldName).println(";");
|
structWriter.printStrictType(field.getType()).print(" ").print(fieldName).println(";");
|
||||||
if (isReferenceType(field.getType())) {
|
if (isReferenceType(field.getType())) {
|
||||||
|
@ -267,6 +268,10 @@ public class ClassGenerator {
|
||||||
structWriter.outdent().print("} ").print(name).println(";");
|
structWriter.outdent().print("} ").print(name).println(";");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isMonitorField(FieldReference field) {
|
||||||
|
return field.getClassName().equals("java.lang.Object") && field.getFieldName().equals("monitor");
|
||||||
|
}
|
||||||
|
|
||||||
private void generateClassStaticFields(ClassHolder cls) {
|
private void generateClassStaticFields(ClassHolder cls) {
|
||||||
CodeWriter fieldsWriter = structuresWriter.fragment();
|
CodeWriter fieldsWriter = structuresWriter.fragment();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user