public void jsr(Location location) { // Adjust the stack by one to make room for the return address. branch(1, location, Opcode.JSR); }
public void branch(Location location) { branch(0, location, Opcode.GOTO); }
public void ifNullBranch(Location location, boolean choice) { branch(-1, location, choice ? Opcode.IFNULL : Opcode.IFNONNULL); }
public void ifEqualBranch(Location location, boolean choice) { branch(-2, location, choice ? Opcode.IF_ACMPEQ : Opcode.IF_ACMPNE); }
public void ifZeroComparisonBranch(Location location, String choice) throws IllegalArgumentException { choice = choice.intern(); byte opcode; if (choice == "==") { opcode = Opcode.IFEQ; } else if (choice == "!=") { opcode = Opcode.IFNE; } else if (choice == "<") { opcode = Opcode.IFLT; } else if (choice == ">=") { opcode = Opcode.IFGE; } else if (choice == ">") { opcode = Opcode.IFGT; } else if (choice == "<=") { opcode = Opcode.IFLE; } else { throw new IllegalArgumentException ("Invalid comparision choice: " + choice); } branch(-1, location, opcode); }
public void ifComparisonBranch(Location location, String choice) throws IllegalArgumentException { choice = choice.intern(); byte opcode; if (choice == "==") { opcode = Opcode.IF_ICMPEQ; } else if (choice == "!=") { opcode = Opcode.IF_ICMPNE; } else if (choice == "<") { opcode = Opcode.IF_ICMPLT; } else if (choice == ">=") { opcode = Opcode.IF_ICMPGE; } else if (choice == ">") { opcode = Opcode.IF_ICMPGT; } else if (choice == "<=") { opcode = Opcode.IF_ICMPLE; } else { throw new IllegalArgumentException ("Invalid comparision choice: " + choice); } branch(-2, location, opcode); }
private void emit_cond(String comp) { Label lbl1 = b.createLabel(); Label lbl2 = b.createLabel(); b.ifComparisonBranch(lbl1, comp, TypeDesc.DOUBLE); b.loadConstant(1); b.branch(lbl2); lbl1.setLocation(); b.loadConstant(0); lbl2.setLocation(); }
private void nullConvert(Label end) { LocalVariable temp = createLocalVariable("temp", TypeDesc.OBJECT); storeLocal(temp); loadLocal(temp); Label notNull = createLabel(); ifNullBranch(notNull, false); loadNull(); branch(end); notNull.setLocation(); loadLocal(temp); }
public void jsr(Location location) { // Adjust the stack by one to make room for the return address. branch(1, location, Opcode.JSR); }
public void ifNullBranch(Location location, boolean choice) { branch(-1, location, choice ? Opcode.IFNULL : Opcode.IFNONNULL); }
private void toBoolean(boolean box) { if (box && mTarget >= 0x00010004) { // Call the new valueOf method. invokeStatic("java.lang.Boolean", "valueOf", TypeDesc.BOOLEAN.toObjectType(), new TypeDesc[] {TypeDesc.BOOLEAN}); return; } Label nonZero = createLabel(); Label done = createLabel(); ifZeroComparisonBranch(nonZero, "!="); if (box) { TypeDesc newType = TypeDesc.BOOLEAN.toObjectType(); loadStaticField(newType.getRootName(), "FALSE", newType); branch(done); nonZero.setLocation(); loadStaticField(newType.getRootName(), "TRUE", newType); } else { loadConstant(false); branch(done); nonZero.setLocation(); loadConstant(true); } done.setLocation(); }
private void emit_if() { LocalVariable var1 = b.createLocalVariable("var1", TypeDesc.DOUBLE); LocalVariable var2 = b.createLocalVariable("var2", TypeDesc.DOUBLE); b.storeLocal(var2); b.storeLocal(var1); Label lbl1 = b.createLabel(); Label lbl2 = b.createLabel(); b.ifZeroComparisonBranch(lbl1, "!="); b.loadLocal(var1); b.branch(lbl2); lbl1.setLocation(); b.loadLocal(var2); lbl2.setLocation(); }
builder.ifZeroComparisonBranch(label, ">="); builder.loadConstant(-1); builder.branch(done); builder.ifZeroComparisonBranch(label, "<="); builder.loadConstant(1); builder.branch(done); builder.ifZeroComparisonBranch(label, ">="); builder.loadConstant(-1); builder.branch(done); builder.ifZeroComparisonBranch(label, "<="); builder.loadConstant(1); builder.branch(done);
mBuilder.branch(loopStart); loopEnd.setLocation();
void fail(CodeBuilder b) { if (mFailLocation != null) { b.branch(mFailLocation); } else { b.loadConstant(false); b.returnValue(BOOLEAN); } }
void success(CodeBuilder b) { if (mSuccessLocation != null) { b.branch(mSuccessLocation); } else { b.loadConstant(true); b.returnValue(BOOLEAN); } }
void fail(CodeBuilder b) { if (mFailLocation != null) { b.branch(mFailLocation); } else { b.loadConstant(false); b.returnValue(BOOLEAN); } }
void success(CodeBuilder b) { if (mSuccessLocation != null) { b.branch(mSuccessLocation); } else { b.loadConstant(true); b.returnValue(BOOLEAN); } }
private void nullConvert(Label end) { LocalVariable temp = createLocalVariable("temp", TypeDesc.OBJECT); storeLocal(temp); loadLocal(temp); Label notNull = createLabel(); ifNullBranch(notNull, false); loadNull(); branch(end); notNull.setLocation(); loadLocal(temp); }