public void mapLineNumber(int lineNumber) { if (mSaveLineNumberInfo) { mCodeAttr.mapLineNumber(createLabel().setLocation(), lineNumber); } }
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(); }
public void exceptionHandler(Location startLocation, Location endLocation, String catchClassName) { if (!(startLocation instanceof InstructionList.LabelInstruction)) { throw new IllegalArgumentException("Start location is not a label instruction"); } if (!(endLocation instanceof InstructionList.LabelInstruction)) { throw new IllegalArgumentException("End location is not a label instruction"); } Location catchLocation = createLabel().setLocation(); ConstantClassInfo catchClass; if (catchClassName == null) { catchClass = null; } else { catchClass = mCp.addConstantClass(catchClassName); } ExceptionHandler<InstructionList.LabelInstruction> handler = new ExceptionHandler<InstructionList.LabelInstruction> ((InstructionList.LabelInstruction)startLocation, (InstructionList.LabelInstruction)endLocation, (InstructionList.LabelInstruction)catchLocation, catchClass); mInstructions.addExceptionHandler(handler); }
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(); }
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); }
goodLabel = builder.createLabel(); locateGoodLabel = true; Label tryStart = builder.createLabel().setLocation(); builder.loadLocal(a); builder.checkCast(comparableType); builder.loadLocal(b); builder.checkCast(comparableType); Label tryEnd = builder.createLabel().setLocation(); builder.invoke(compareToMethod); builder.branch(goodLabel);
private void generateWildcard(PatternNode node, int depth, int posIndex) { Label loopStart = mBuilder.createLabel().setLocation(); Label loopEnd = mBuilder.createLabel(); Label loopContinue = mBuilder.createLabel();
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(); }
b.loadThis(); b.loadLocal(b.getParameter(0)); Label notEqual = b.createLabel(); b.ifEqualBranch(notEqual, false); b.loadConstant(true); Label isInstance = b.createLabel(); b.ifZeroComparisonBranch(isInstance, "!=");
Label noMatch = mBuilder.createLabel();
Label done = builder.createLabel(); Label label = builder.createLabel(); builder.ifZeroComparisonBranch(label, ">="); builder.loadConstant(-1); builder.loadLocal(b); builder.math(Opcode.FCMPL); label = builder.createLabel(); builder.ifZeroComparisonBranch(label, "<="); builder.loadConstant(1); } else if (type == double.class) { Label done = builder.createLabel(); done = builder.createLabel(); builder.math(Opcode.DCMPG); Label label = builder.createLabel(); builder.ifZeroComparisonBranch(label, ">="); builder.loadConstant(-1); builder.loadLocal(b); builder.math(Opcode.DCMPL); label = builder.createLabel(); builder.ifZeroComparisonBranch(label, "<="); builder.loadConstant(1);
mBuilder.storeLocal(mIndexLocal); mTempLocals = new Stack(); mReturnLabel = mBuilder.createLabel();
Label searchNotNull = b.createLabel(); b.ifNullBranch(searchNotNull, false); b.invoke(bp.getReadMethod()); Label noMatch = b.createLabel(); b.ifNullBranch(noMatch, false); b.loadConstant(true); b.invokeVirtual(Object.class.getName(), "equals", TypeDesc.BOOLEAN, params); Label noMatch = b.createLabel(); b.ifZeroComparisonBranch(noMatch, "=="); b.loadConstant(true);
Label endLabel = builder.createLabel(); LocalVariable obj1 = builder.getParameter(0); LocalVariable obj2 = builder.getParameter(1); Label label = builder.createLabel(); builder.loadLocal(obj1); builder.ifNullBranch(label, false); builder.returnValue(TypeDesc.INT); label.setLocation(); label = builder.createLabel(); builder.loadLocal(obj2); builder.ifNullBranch(label, false); builder.storeLocal(result); builder.loadLocal(result); label = builder.createLabel(); builder.ifZeroComparisonBranch(label, "=="); builder.loadLocal(result); Label nextLabel = builder.createLabel(); label = builder.createLabel(); builder.loadLocal(p1); builder.ifNullBranch(label, false); builder.returnValue(TypeDesc.INT); label.setLocation(); label = builder.createLabel();
Label noMatch = b.createLabel(); List[] caseMethods = caseMethods(caseCount, properties); switchLabels[i] = noMatch; } else { switchLabels[i] = b.createLabel(); b.ifZeroComparisonBranch(noMatch, "=="); } else { notEqual = b.createLabel(); b.ifZeroComparisonBranch(notEqual, "==");
public void mapLineNumber(int lineNumber) { if (mSaveLineNumberInfo) { mCodeAttr.mapLineNumber(createLabel().setLocation(), lineNumber); } }
@Override public Object visit(OrFilter<S> filter, Object param) { Label failLocation = mIsAllowedBuilder.createLabel(); // Inherit success location to short-circuit if 'or' test succeeds. mScopeStack.push(new Scope(failLocation, getScope().mSuccessLocation)); filter.getLeftFilter().accept(this, param); failLocation.setLocation(); mScopeStack.pop(); filter.getRightFilter().accept(this, param); return null; }
@Override public Object visit(AndFilter<S> filter, Object param) { Label successLocation = mIsAllowedBuilder.createLabel(); // Inherit fail location to short-circuit if 'and' test fails. mScopeStack.push(new Scope(getScope().mFailLocation, successLocation)); filter.getLeftFilter().accept(this, param); successLocation.setLocation(); mScopeStack.pop(); filter.getRightFilter().accept(this, param); return null; }
Label end = createLabel();
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); }