mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-09 00:14:10 -08:00
Fix bugs in emit API
This commit is contained in:
parent
0be4ca336d
commit
e95b537687
|
@ -119,7 +119,7 @@ public interface ClassReaderSource {
|
|||
return Optional.of(true);
|
||||
}
|
||||
ClassReader cls = get(subType);
|
||||
if (subType == null) {
|
||||
if (cls == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
if (cls.getParent() != null && !cls.getParent().equals(cls.getName())) {
|
||||
|
|
|
@ -345,6 +345,9 @@ public final class ProgramEmitter {
|
|||
}
|
||||
|
||||
public void addInstruction(Instruction insn) {
|
||||
if (escapes()) {
|
||||
throw new EmitException("This block has already escaped");
|
||||
}
|
||||
if (currentLocation != null) {
|
||||
insn.setLocation(currentLocation);
|
||||
}
|
||||
|
|
|
@ -39,8 +39,10 @@ public class StringChooseEmitter {
|
|||
this.insn = insn;
|
||||
this.joinBlock = joinBlock;
|
||||
this.otherwiseBlock = pe.prepareBlock();
|
||||
this.testValue = testValue;
|
||||
insn.setCondition(testValue.invokeVirtual("hashCode", int.class).getVariable());
|
||||
insn.setDefaultTarget(otherwiseBlock);
|
||||
pe.addInstruction(insn);
|
||||
pe.enter(otherwiseBlock);
|
||||
pe.jump(joinBlock);
|
||||
pe.enter(joinBlock);
|
||||
|
@ -62,7 +64,7 @@ public class StringChooseEmitter {
|
|||
}
|
||||
|
||||
pe.enter(block);
|
||||
fork = testValue.invokeVirtual("equals", boolean.class, testValue.cast(Object.class))
|
||||
fork = testValue.invokeVirtual("equals", boolean.class, pe.constant(value).cast(Object.class))
|
||||
.fork(BranchingCondition.NOT_EQUAL);
|
||||
hashForks.put(hash, fork);
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ public class InstructionStringifier implements InstructionReader {
|
|||
sb.append("; ");
|
||||
}
|
||||
SwitchTableEntryReader entry = table.get(i);
|
||||
sb.append("case ").append(entry.getCondition()).append(": goto $").append(entry.getTarget());
|
||||
sb.append("case ").append(entry.getCondition()).append(": goto $").append(entry.getTarget().getIndex());
|
||||
}
|
||||
sb.append(", default: goto $").append(defaultTarget.getIndex());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user