private void emit_return() { b.returnValue(TypeDesc.DOUBLE); }
b.returnValue(TypeDesc.OBJECT);
b.ifEqualBranch(notEqual, false); b.loadConstant(true); b.returnValue(TypeDesc.BOOLEAN); b.returnValue(TypeDesc.BOOLEAN); b.returnVoid(); } else { b.returnValue(TypeDesc.forClass(m.getReturnType()));
b.ifNullBranch(noMatch, false); b.loadConstant(true); b.returnValue(TypeDesc.BOOLEAN); b.returnValue(TypeDesc.BOOLEAN); b.ifZeroComparisonBranch(noMatch, "=="); b.loadConstant(true); b.returnValue(TypeDesc.BOOLEAN); b.returnValue(TypeDesc.BOOLEAN);
TypeDesc type = TypeDesc.forClass(bp.getType()); b.convert(type, type.toObjectType()); b.returnValue(TypeDesc.OBJECT); break; } else { b.loadConstant(true); b.returnValue(TypeDesc.BOOLEAN); b.returnValue(TypeDesc.BOOLEAN); break; b.returnValue(TypeDesc.BOOLEAN); } else if (methodType == TRY_READ_METHOD) { b.loadNull(); b.returnValue(TypeDesc.OBJECT); } else { b.newObject(TypeDesc.forClass(NoSuchPropertyException.class));
builder.ifNullBranch(label, false); builder.loadConstant(nullHigh ? 1 : -1); builder.returnValue(TypeDesc.INT); label.setLocation(); label = builder.createLabel(); builder.ifNullBranch(label, false); builder.loadConstant(nullHigh ? -1 : 1); builder.returnValue(TypeDesc.INT); label.setLocation(); builder.ifZeroComparisonBranch(label, "=="); builder.loadLocal(result); builder.returnValue(TypeDesc.INT); label.setLocation(); builder.ifNullBranch(label, false); builder.loadConstant(nullHigh ? 1 : -1); builder.returnValue(TypeDesc.INT); label.setLocation(); label = builder.createLabel(); builder.ifNullBranch(label, false); builder.loadConstant(nullHigh ? -1 : 1); builder.returnValue(TypeDesc.INT); label.setLocation(); builder.returnValue(TypeDesc.INT);
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 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); } }
/** * Branch to the fail location if the value on the stack is * null. When choice is false, fail on non-null. * * @param choice if true, fail when null, else fail when not null */ void failIfNull(CodeBuilder b, boolean choice) { if (mFailLocation != null) { b.ifNullBranch(mFailLocation, choice); } else { Label pass = b.createLabel(); b.ifNullBranch(pass, !choice); b.loadConstant(false); b.returnValue(BOOLEAN); pass.setLocation(); } }
/** * Branch to the success location if the value on the stack is * null. When choice is false, success on non-null. * * @param choice if true, success when null, else success when not null */ void successIfNull(CodeBuilder b, boolean choice) { if (mSuccessLocation != null) { b.ifNullBranch(mSuccessLocation, choice); } else { Label pass = b.createLabel(); b.ifNullBranch(pass, !choice); b.loadConstant(true); b.returnValue(BOOLEAN); pass.setLocation(); } }
/** * Branch to the fail location if the value on the stack is * null. When choice is false, fail on non-null. * * @param choice if true, fail when null, else fail when not null */ void failIfNull(CodeBuilder b, boolean choice) { if (mFailLocation != null) { b.ifNullBranch(mFailLocation, choice); } else { Label pass = b.createLabel(); b.ifNullBranch(pass, !choice); b.loadConstant(false); b.returnValue(BOOLEAN); pass.setLocation(); } }
void successIfComparisonElseFail(CodeBuilder b, RelOp relOp) { if (mSuccessLocation != null) { b.ifComparisonBranch(mSuccessLocation, relOpToChoice(relOp)); fail(b); } else if (mFailLocation != null) { b.ifComparisonBranch(mFailLocation, relOpToChoice(relOp.reverse())); success(b); } else { Label success = b.createLabel(); b.ifComparisonBranch(success, relOpToChoice(relOp)); b.loadConstant(false); b.returnValue(BOOLEAN); success.setLocation(); b.loadConstant(true); b.returnValue(BOOLEAN); } }
private void addPropertyMapMethod() { TypeDesc mapType = TypeDesc.forClass(Map.class); MethodInfo mi = addMethodIfNotFinal(Modifiers.PUBLIC, PROPERTY_MAP, mapType, null); if (mi == null) { return; } CodeBuilder b = new CodeBuilder(mi); TypeDesc propertyMapType = TypeDesc.forClass(StorablePropertyMap.class); b.loadConstant(TypeDesc.forClass(mStorableType)); b.loadThis(); b.invokeStatic(propertyMapType, "createMap", propertyMapType, new TypeDesc[] {TypeDesc.forClass(Class.class), TypeDesc.forClass(Storable.class)}); b.returnValue(mapType); }
private void addPropertyMapMethod() { TypeDesc mapType = TypeDesc.forClass(Map.class); MethodInfo mi = addMethodIfNotFinal(Modifiers.PUBLIC, PROPERTY_MAP, mapType, null); if (mi == null) { return; } CodeBuilder b = new CodeBuilder(mi); TypeDesc propertyMapType = TypeDesc.forClass(StorablePropertyMap.class); b.loadConstant(TypeDesc.forClass(mStorableType)); b.loadThis(); b.invokeStatic(propertyMapType, "createMap", propertyMapType, new TypeDesc[] {TypeDesc.forClass(Class.class), TypeDesc.forClass(Storable.class)}); b.returnValue(mapType); }
private void addUnmatchedProperty(StorableProperty<W> wrapperProp, TypeDesc wrapperPropType) { Method m = canDefine(wrapperProp.getReadMethod()); if (m != null) { CodeBuilder b = new CodeBuilder(mClassFile.addMethod(m)); CodeBuilderUtil.blankValue(b, wrapperPropType); b.returnValue(wrapperPropType); } m = canDefine(wrapperProp.getWriteMethod()); if (m != null) { CodeBuilder b = new CodeBuilder(mClassFile.addMethod(m)); b.returnVoid(); } }
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); } }
private void addUnmatchedProperty(StorableProperty<W> wrapperProp, TypeDesc wrapperPropType) { Method m = canDefine(wrapperProp.getReadMethod()); if (m != null) { CodeBuilder b = new CodeBuilder(mClassFile.addMethod(m)); CodeBuilderUtil.blankValue(b, wrapperPropType); b.returnValue(wrapperPropType); } m = canDefine(wrapperProp.getWriteMethod()); if (m != null) { CodeBuilder b = new CodeBuilder(mClassFile.addMethod(m)); b.returnVoid(); } }