mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Made some changes based on Alexey's comments of previous changes. Still getting same error on build.
This commit is contained in:
parent
e2b6b7b2df
commit
68aa193728
|
@ -597,12 +597,24 @@ public class ProgramIO {
|
|||
|
||||
@Override
|
||||
public void visit(MonitorEnterInstruction insn) {
|
||||
|
||||
try {
|
||||
output.writeByte(39);
|
||||
output.writeShort(insn.getObjectRef().getIndex());
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new IOExceptionWrapper(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(MonitorExitInstruction insn) {
|
||||
|
||||
try {
|
||||
output.writeByte(40);
|
||||
output.writeShort(insn.getObjectRef().getIndex());
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new IOExceptionWrapper(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -908,6 +920,16 @@ public class ProgramIO {
|
|||
insn.setValue(program.variableAt(input.readShort()));
|
||||
return insn;
|
||||
}
|
||||
case 39: {
|
||||
MonitorEnterInstruction insn = new MonitorEnterInstruction();
|
||||
insn.setObjectRef(program.variableAt(input.readShort()));
|
||||
return insn;
|
||||
}
|
||||
case 40: {
|
||||
MonitorExitInstruction insn = new MonitorExitInstruction();
|
||||
insn.setObjectRef(program.variableAt(input.readShort()));
|
||||
return insn;
|
||||
}
|
||||
default:
|
||||
throw new RuntimeException("Unknown instruction type: " + insnType);
|
||||
}
|
||||
|
|
|
@ -490,5 +490,19 @@ class DependencyGraphBuilder {
|
|||
new CallLocation(caller.getMethod(), currentLocation)).use();
|
||||
currentExceptionConsumer.consume(dependencyChecker.getType("java.lang.NullPointerException"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void monitorEnter(VariableReader objectRef) {
|
||||
dependencyChecker.linkMethod(
|
||||
new MethodReference(Object.class, "monitorEnter", Object.class, void.class),
|
||||
new CallLocation(caller.getMethod(), currentLocation)).use();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void monitorExit(VariableReader objectRef) {
|
||||
dependencyChecker.linkMethod(
|
||||
new MethodReference(Object.class, "monitorExit", Object.class, void.class),
|
||||
new CallLocation(caller.getMethod(), currentLocation)).use();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.teavm.javascript.ast;
|
|||
public class MonitorEnterStatement extends Statement {
|
||||
|
||||
private NodeLocation location;
|
||||
private VariableExpr objectRef;
|
||||
private Expr objectRef;
|
||||
|
||||
@Override
|
||||
public void acceptVisitor(StatementVisitor visitor) {
|
||||
|
@ -46,14 +46,14 @@ public class MonitorEnterStatement extends Statement {
|
|||
/**
|
||||
* @return the objectRef
|
||||
*/
|
||||
public VariableExpr getObjectRef() {
|
||||
public Expr getObjectRef() {
|
||||
return objectRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param objectRef the objectRef to set
|
||||
*/
|
||||
public void setObjectRef(VariableExpr objectRef) {
|
||||
public void setObjectRef(Expr objectRef) {
|
||||
this.objectRef = objectRef;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.teavm.javascript.ast;
|
|||
public class MonitorExitStatement extends Statement {
|
||||
|
||||
private NodeLocation location;
|
||||
private VariableExpr objectRef;
|
||||
private Expr objectRef;
|
||||
|
||||
@Override
|
||||
public void acceptVisitor(StatementVisitor visitor) {
|
||||
|
@ -46,14 +46,14 @@ public class MonitorExitStatement extends Statement {
|
|||
/**
|
||||
* @return the objectRef
|
||||
*/
|
||||
public VariableExpr getObjectRef() {
|
||||
public Expr getObjectRef() {
|
||||
return objectRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param objectRef the objectRef to set
|
||||
*/
|
||||
public void setObjectRef(VariableExpr objectRef) {
|
||||
public void setObjectRef(Expr objectRef) {
|
||||
this.objectRef = objectRef;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,4 +100,8 @@ public interface InstructionReader {
|
|||
void initClass(String className);
|
||||
|
||||
void nullCheck(VariableReader receiver, VariableReader value);
|
||||
|
||||
void monitorEnter(VariableReader objectRef);
|
||||
|
||||
void monitorExit(VariableReader objectRef);
|
||||
}
|
||||
|
|
|
@ -352,4 +352,14 @@ public class InstructionStringifier implements InstructionReader {
|
|||
public void nullCheck(VariableReader receiver, VariableReader value) {
|
||||
sb.append("@").append(receiver.getIndex()).append(" := nullCheck @").append(value.getIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void monitorEnter(VariableReader objectRef) {
|
||||
sb.append("monitorenter @").append(objectRef.getIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void monitorExit(VariableReader objectRef) {
|
||||
sb.append("monitorexit @").append(objectRef.getIndex());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -495,5 +495,21 @@ public final class ProgramUtils {
|
|||
copy = insnCopy;
|
||||
copy.setLocation(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void monitorEnter(VariableReader objectRef) {
|
||||
MonitorEnterInstruction insnCopy = new MonitorEnterInstruction();
|
||||
insnCopy.setObjectRef(copyVar(objectRef));
|
||||
copy = insnCopy;
|
||||
copy.setLocation(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void monitorExit(VariableReader objectRef) {
|
||||
MonitorExitInstruction insnCopy = new MonitorExitInstruction();
|
||||
insnCopy.setObjectRef(copyVar(objectRef));
|
||||
copy = insnCopy;
|
||||
copy.setLocation(location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,4 +88,14 @@ class ProgramSourceAggregator implements InstructionReader {
|
|||
@Override public void isInstance(VariableReader receiver, VariableReader value, ValueType type) { }
|
||||
@Override public void initClass(String className) { }
|
||||
@Override public void nullCheck(VariableReader receiver, VariableReader value) { }
|
||||
|
||||
@Override
|
||||
public void monitorEnter(VariableReader objectRef) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void monitorExit(VariableReader objectRef) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user