public void loadField(TypeDesc classDesc, String fieldName, TypeDesc type) { loadField(getClassName(classDesc), fieldName, type); }
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, "=="); } }
public void loadField(TypeDesc classDesc, String fieldName, TypeDesc type) { loadField(getClassName(classDesc), fieldName, type); }
if (bc.mUsingComparator != null) { builder.loadThis(); builder.loadField("mUsingComparators", comparatorArrayType); builder.loadConstant(0); builder.loadFromArray(TypeDesc.forClass(Comparator.class)); builder.loadField("mUsingComparators", comparatorArrayType); builder.loadConstant(i); builder.loadFromArray(TypeDesc.forClass(Comparator.class)); builder.loadField("mCollators", comparatorArrayType); builder.loadConstant(i); builder.loadFromArray(TypeDesc.forClass(Comparator.class));
private void genFinishedAsync(CodeBuilder b, LocalVariable channelVar) { b.loadThis(); b.loadField(SUPPORT_FIELD_NAME, SKEL_SUPPORT_TYPE); b.loadLocal(channelVar); b.invokeInterface(SKEL_SUPPORT_TYPE, "finishedAsync", null, new TypeDesc[] {INV_CHANNEL_TYPE}); }
/** * Generates code to push the JDBCSupport instance on the stack. */ private void pushJDBCSupport(CodeBuilder b) { b.loadThis(); b.loadField(StorableGenerator.SUPPORT_FIELD_NAME, TypeDesc.forClass(TriggerSupport.class)); b.checkCast(TypeDesc.forClass(JDBCSupport.class)); }
private void genFinished(CodeBuilder b, LocalVariable channelVar, boolean reset) { b.loadThis(); b.loadField(SUPPORT_FIELD_NAME, SKEL_SUPPORT_TYPE); b.loadLocal(channelVar); b.loadConstant(reset); b.invokeInterface(SKEL_SUPPORT_TYPE, "finished", TypeDesc.INT, new TypeDesc[] {INV_CHANNEL_TYPE, TypeDesc.BOOLEAN}); }
private void genWaitForNext(CodeBuilder b, LocalVariable sequenceVar) { TypeDesc orderedInvokerType = TypeDesc.forClass(OrderedInvoker.class); b.loadThis(); b.loadField(ORDERED_INVOKER_FIELD_NAME, orderedInvokerType); b.loadLocal(sequenceVar); b.invokeVirtual(orderedInvokerType, "waitForNext", TypeDesc.BOOLEAN, new TypeDesc[] {TypeDesc.INT}); }
/** * Generates code to push the JDBCSupport instance on the stack. */ private void pushJDBCSupport(CodeBuilder b) { b.loadThis(); b.loadField(StorableGenerator.SUPPORT_FIELD_NAME, TypeDesc.forClass(TriggerSupport.class)); b.checkCast(TypeDesc.forClass(JDBCSupport.class)); }
void makeCopy(CodeBuilder b) { b.loadThis(); b.loadField(property.getName(), copyVar.getType()); b.storeLocal(copyVar); }
private void genIsNext(CodeBuilder b, LocalVariable sequenceVar) { TypeDesc orderedInvokerType = TypeDesc.forClass(OrderedInvoker.class); b.loadThis(); b.loadField(ORDERED_INVOKER_FIELD_NAME, orderedInvokerType); b.loadLocal(sequenceVar); b.invokeVirtual(orderedInvokerType, "isNext", TypeDesc.BOOLEAN, new TypeDesc[] {TypeDesc.INT}); }
void makeCopy(CodeBuilder b) { b.loadThis(); b.loadField(property.getName(), copyVar.getType()); b.storeLocal(copyVar); }
/** * @param sequenceVar if non-null, calls OrderedInvoker.finished. */ private void genExceptionHandler(CodeBuilder b, Label tryStart, Label tryEnd, LocalVariable sequenceVar) { b.exceptionHandler(tryStart, tryEnd, Throwable.class.getName()); if (sequenceVar != null) { TypeDesc orderedInvokerType = TypeDesc.forClass(OrderedInvoker.class); b.loadThis(); b.loadField(ORDERED_INVOKER_FIELD_NAME, orderedInvokerType); b.loadLocal(sequenceVar); b.invokeVirtual(orderedInvokerType, "finished", null, new TypeDesc[] {TypeDesc.INT}); } }
/** * Generates code to branch if a property is dirty. * * @param propNumber property number from all properties map * @param target branch target * @param when true, branch if dirty; when false, branch when not dirty */ private void branchIfDirty(CodeBuilder b, int propNumber, Label target, boolean branchIfDirty) { String stateFieldName = StorableGenerator.PROPERTY_STATE_FIELD_NAME + (propNumber >> 4); b.loadThis(); b.loadField(stateFieldName, TypeDesc.INT); int shift = (propNumber & 0xf) * 2; b.loadConstant(StorableGenerator.PROPERTY_STATE_MASK << shift); b.math(Opcode.IAND); b.loadConstant(StorableGenerator.PROPERTY_STATE_DIRTY << shift); b.ifComparisonBranch(target, branchIfDirty ? "==" : "!="); }
/** * Generates code to branch if a property is dirty. * * @param propNumber property number from all properties map * @param target branch target * @param when true, branch if dirty; when false, branch when not dirty */ private void branchIfDirty(CodeBuilder b, int propNumber, Label target, boolean branchIfDirty) { String stateFieldName = StorableGenerator.PROPERTY_STATE_FIELD_NAME + (propNumber >> 4); b.loadThis(); b.loadField(stateFieldName, TypeDesc.INT); int shift = (propNumber & 0xf) * 2; b.loadConstant(StorableGenerator.PROPERTY_STATE_MASK << shift); b.math(Opcode.IAND); b.loadConstant(StorableGenerator.PROPERTY_STATE_DIRTY << shift); b.ifComparisonBranch(target, branchIfDirty ? "==" : "!="); }
/** * Loads the property value of the current storable onto the stack. If the * property is derived the read method is used, otherwise it just loads the * value from the appropriate field. * * entry stack: [ * exit stack: [value * * @param b - {@link CodeBuilder} to which to add the load code * @param property - property to load * @param type - type of the property */ private void loadThisProperty(CodeBuilder b, StorableProperty property, TypeDesc type) { b.loadThis(); if (property.isDerived()) { b.invoke(property.getReadMethod()); } else { b.loadField(property.getName(), type); } }
/** * Loads the property value of the current storable onto the stack. If the * property is derived the read method is used, otherwise it just loads the * value from the appropriate field. * * entry stack: [ * exit stack: [value * * @param b - {@link CodeBuilder} to which to add the load code * @param property - property to load * @param type - type of the property */ private void loadThisProperty(CodeBuilder b, StorableProperty property, TypeDesc type) { b.loadThis(); if (property.isDerived()) { b.invoke(property.getReadMethod()); } else { b.loadField(property.getName(), type); } }
private void generateDelegatedMethod(String masterMethodName, String supportMethodName) { TypeDesc triggerSupportType = TypeDesc.forClass(TriggerSupport.class); TypeDesc delegateSupportType = TypeDesc.forClass(DelegateSupport.class); TypeDesc[] storableParam = {TypeDesc.forClass(Storable.class)}; MethodInfo mi = mClassFile.addMethod (Modifiers.PROTECTED, masterMethodName, TypeDesc.BOOLEAN, null); CodeBuilder b = new CodeBuilder(mi); b.loadThis(); b.loadField(StorableGenerator.SUPPORT_FIELD_NAME, triggerSupportType); b.checkCast(delegateSupportType); b.loadThis(); b.invokeInterface(delegateSupportType, supportMethodName, TypeDesc.BOOLEAN, storableParam); b.returnValue(TypeDesc.BOOLEAN); } }
private void generateDelegatedMethod(String masterMethodName, String supportMethodName) { TypeDesc triggerSupportType = TypeDesc.forClass(TriggerSupport.class); TypeDesc delegateSupportType = TypeDesc.forClass(DelegateSupport.class); TypeDesc[] storableParam = {TypeDesc.forClass(Storable.class)}; MethodInfo mi = mClassFile.addMethod (Modifiers.PROTECTED, masterMethodName, TypeDesc.BOOLEAN, null); CodeBuilder b = new CodeBuilder(mi); b.loadThis(); b.loadField(StorableGenerator.SUPPORT_FIELD_NAME, triggerSupportType); b.checkCast(delegateSupportType); b.loadThis(); b.invokeInterface(delegateSupportType, supportMethodName, TypeDesc.BOOLEAN, storableParam); b.returnValue(TypeDesc.BOOLEAN); } }