private void emit_relevance() { b.loadLocal(scoreParam); // push the textualScore parameter }
public void loadThis() { if (mThisReference != null) { loadLocal(mThisReference); } else { throw new IllegalStateException ("Attempt to load \"this\" reference in a static method"); } }
private void emit_age() { b.loadLocal(ageParam); // push the age parameter b.convert(TypeDesc.INT, TypeDesc.DOUBLE); }
private void emit_queryVar() { b.loadLocal(queryVarParam); // push the queryVar parameter b.swap(); // swap the top two words on the stack, so the var id is on top params = new TypeDesc[] {TypeDesc.INT}; // the type of the id parameter (int) b.invokeInterface(queryVarType, "getValue", TypeDesc.DOUBLE, params); }
private void emit_docVar() { b.loadLocal(docVarParam); // push the docVar parameter b.swap(); // swap the top two words on the stack, so the var id is on top params = new TypeDesc[] {TypeDesc.INT}; // the type of the id parameter (int) b.invokeInterface(docVarType, "getBoost", TypeDesc.FLOAT, params); b.convert(TypeDesc.FLOAT, TypeDesc.DOUBLE); }
public void integerIncrement(LocalVariable local, int amount) { if (local == null) { throw new IllegalArgumentException("No local variable specified"); } if (-32768 <= amount && amount <= 32767) { mInstructions.new ShortIncrementInstruction(local, (short)amount); } else { // Amount can't possibly fit in a 16-bit value, so use regular // instructions instead. loadLocal(local); loadConstant(amount); math(Opcode.IADD); storeLocal(local); } }
private static ThrowUnchecked generateImpl() { RuntimeClassFile cf = new RuntimeClassFile(null, ThrowUnchecked.class.getName()); cf.addDefaultConstructor(); CodeBuilder b = new CodeBuilder (cf.addMethod(Modifiers.PROTECTED, "doFire", null, new TypeDesc[] {TypeDesc.forClass(Throwable.class)})); b.loadLocal(b.getParameter(0)); b.throwObject(); try { return (ThrowUnchecked) cf.defineClass().newInstance(); } catch (Exception e) { throw new Error(e); } }
mBuilder.loadLocal(mIndexLocal); mBuilder.storeLocal(savedIndex); mBuilder.loadLocal(mPositionsLocal); mBuilder.loadConstant(posIndex); mBuilder.loadLocal(mIndexLocal); if (depth > 0) { mBuilder.loadConstant(depth); generateWildcard((PatternNode)subNodes.get(i), depth, posIndex + 2); mBuilder.loadLocal(savedIndex); mBuilder.storeLocal(mIndexLocal); mBuilder.loadLocal(tempChar); mTempLocals.push(tempChar); } else { mBuilder.loadLocal(mLookupLocal); mBuilder.loadLocal(mIndexLocal); if (depth > 0) { mBuilder.loadConstant(depth);
private void generateAddMatchResult(PatternNode node) { mBuilder.mapLineNumber(++mReferenceLine); mBuilder.loadLocal(mLimitLocal); mBuilder.loadLocal(mResultsLocal); mBuilder.loadConstant(node.mPattern); mBuilder.loadThis(); mBuilder.loadField("mValues", TypeDesc.OBJECT.toArrayType()); mBuilder.loadConstant(node.mOrder); mBuilder.loadFromArray(TypeDesc.OBJECT); mBuilder.loadLocal(mPositionsLocal); mBuilder.loadConstant(node.getWildcardCount() * 2); TypeDesc[] params = { mIntType, mListType, mStringType, mObjectType, mIntArrayType, mIntType }; mBuilder.invokeStatic(PatternMatcher.class.getName(), "addMatchResult", mBooleanType, params); mBuilder.ifZeroComparisonBranch(mReturnLabel, "=="); } }
int count = b.getParameterCount(); for (int i=0; i<count; i++) { b.loadLocal(b.getParameter(i));
builder.loadLocal(a); builder.loadLocal(b); builder.math(Opcode.FCMPG); Label label = builder.createLabel(); builder.loadLocal(a); builder.loadLocal(b); builder.math(Opcode.FCMPL); label = builder.createLabel(); builder.loadLocal(a); builder.invoke(floatToIntBits); builder.convert(TypeDesc.INT, TypeDesc.LONG); builder.loadLocal(b); builder.invoke(floatToIntBits); builder.convert(TypeDesc.INT, TypeDesc.LONG); builder.loadLocal(a); builder.loadLocal(b); done = builder.createLabel(); builder.math(Opcode.DCMPG); builder.loadLocal(a); builder.loadLocal(b); builder.math(Opcode.DCMPL); label = builder.createLabel(); builder.loadLocal(a); builder.invoke(doubleToLongBits);
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(); }
b.invokeSuperConstructor(null); b.loadThis(); b.loadLocal(b.getParameter(0)); b.storeField(REF_FIELD_NAME, atomicRefType); b.returnVoid();
b.loadLocal(beanVar); b.checkCast(TypeDesc.forClass(beanType)); b.storeLocal(beanVar); b.loadLocal(valueVar); Label searchNotNull = b.createLabel(); b.ifNullBranch(searchNotNull, false); b.loadLocal(beanVar); b.invoke(bp.getReadMethod()); b.loadLocal(valueVar); b.loadLocal(beanVar); b.invoke(bp.getReadMethod()); b.convert(TypeDesc.forClass(bp.getType()), TypeDesc.OBJECT);
mBuilder = new CodeBuilder(mi); mBuilder.loadThis(); mBuilder.loadLocal(mBuilder.getParameter(0)); mBuilder.invokeSuperConstructor(params); mBuilder.returnVoid();
b.loadLocal(beanVar); b.checkCast(TypeDesc.forClass(beanType)); b.storeLocal(beanVar); b.loadLocal(propertyVar); b.invokeVirtual(String.class.getName(), "hashCode", TypeDesc.INT, null); b.loadConstant(0x7fffffff); b.loadLocal(propertyVar); b.invokeVirtual(String.class.getName(), "equals", TypeDesc.BOOLEAN, params); b.loadLocal(beanVar); b.invoke(bp.getReadMethod()); TypeDesc type = TypeDesc.forClass(bp.getType()); b.loadLocal(beanVar); b.loadLocal(valueVar); TypeDesc type = TypeDesc.forClass(bp.getType()); b.checkCast(type.toObjectType()); b.newObject(TypeDesc.forClass(NoSuchPropertyException.class)); b.dup(); b.loadLocal(propertyVar); b.loadConstant(methodType == READ_METHOD);