public static void genLoadParametersDirect(int argumentIndex, MethodVisitor mv, BytecodeHelper helper, Method method) { Class<?>[] parameters = method.getParameterTypes(); int size = parameters.length; for (int i = 0; i < size; i++) { mv.visitVarInsn(Opcodes.ALOAD, argumentIndex+i); // cast argument to parameter class, inclusive unboxing // for methods with primitive types Class type = parameters[i]; if (type.isPrimitive()) { helper.unbox(type); } else { helper.doCast(type); } } }
public void unbox(BytecodeHelper helper) { helper.unbox(getTheClass()); }
public void unbox(BytecodeHelper helper) { helper.unbox(getTheClass()); }
public void unbox(BytecodeHelper helper) { helper.unbox(getTheClass()); }
public static void genLoadParametersDirect(int argumentIndex, MethodVisitor mv, BytecodeHelper helper, Method method) { Class<?>[] parameters = method.getParameterTypes(); int size = parameters.length; for (int i = 0; i < size; i++) { mv.visitVarInsn(Opcodes.ALOAD, argumentIndex+i); // cast argument to parameter class, inclusive unboxing // for methods with primitive types Class type = parameters[i]; if (type.isPrimitive()) { helper.unbox(type); } else { helper.doCast(type); } } }
public void doCast(Class type) { if (type != Object.class) { if (type.isPrimitive() && type != Void.TYPE) { unbox(type); } else { mv.visitTypeInsn( CHECKCAST, type.isArray() ? getTypeDescription(type) : getClassInternalName(type.getName())); } } }
public void doCast(Class type) { if (type != Object.class) { if (type.isPrimitive() && type != Void.TYPE) { unbox(type); } else { mv.visitTypeInsn( CHECKCAST, type.isArray() ? getTypeDescription(type) : getClassInternalName(type.getName())); } } }
public static void genLoadParameters(int argumentIndex, MethodVisitor mv, BytecodeHelper helper, Method method) { Class<?>[] parameters = method.getParameterTypes(); int size = parameters.length; for (int i = 0; i < size; i++) { // unpack argument from Object[] mv.visitVarInsn(Opcodes.ALOAD, argumentIndex); helper.pushConstant(i); mv.visitInsn(Opcodes.AALOAD); // cast argument to parameter class, inclusive unboxing // for methods with primitive types Class type = parameters[i]; if (type.isPrimitive()) { helper.unbox(type); } else { helper.doCast(type); } } }
public void doCast(Class type) { if (type != Object.class) { if (type.isPrimitive() && type != Void.TYPE) { unbox(type); } else { mv.visitTypeInsn( CHECKCAST, type.isArray() ? getTypeDescription(type) : getClassInternalName(type.getName())); } } }
public void unbox(ClassNode type) { if (type.isPrimaryClassNode()) return; unbox(type.getTypeClass()); }
public void unbox(ClassNode type) { if (type.isPrimaryClassNode()) return; unbox(type.getTypeClass()); }
public void unbox(ClassNode type) { if (type.isPrimaryClassNode()) return; unbox(type.getTypeClass()); }
public void doCast(ClassNode type) { if (type == ClassHelper.OBJECT_TYPE) return; if (ClassHelper.isPrimitiveType(type) && type != ClassHelper.VOID_TYPE) { unbox(type); } else { mv.visitTypeInsn( CHECKCAST, type.isArray() ? getTypeDescription(type) : getClassInternalName(type)); } }
public void doCast(ClassNode type) { if (type == ClassHelper.OBJECT_TYPE) return; if (ClassHelper.isPrimitiveType(type) && type != ClassHelper.VOID_TYPE) { unbox(type); } else { mv.visitTypeInsn( CHECKCAST, type.isArray() ? getTypeDescription(type) : getClassInternalName(type)); } }
public void visitNotExpression(NotExpression expression) { Expression subExpression = expression.getExpression(); subExpression.visit(this); // if we do !object, then the cast to boolean will // do the conversion of Object to boolean. so a simple // call to unbox is enough here. if ( !isComparisonExpression(subExpression) && !(subExpression instanceof BooleanExpression)) { helper.unbox(boolean.class); } helper.negateBoolean(); }
public void visitNotExpression(NotExpression expression) { Expression subExpression = expression.getExpression(); subExpression.visit(this); // if we do !object, then the cast to boolean will // do the conversion of Object to boolean. so a simple // call to unbox is enough here. if ( !isComparisonExpression(subExpression) && !(subExpression instanceof BooleanExpression)) { helper.unbox(boolean.class); } helper.negateBoolean(); }
public void visitNotExpression(NotExpression expression) { Expression subExpression = expression.getExpression(); subExpression.visit(this); // if we do !object, then the cast to boolean will // do the conversion of Object to boolean. so a simple // call to unbox is enough here. if ( !isComparisonExpression(subExpression) && !(subExpression instanceof BooleanExpression)) { helper.unbox(boolean.class); } helper.negateBoolean(); }
public void doCast(ClassNode type) { if (type == ClassHelper.OBJECT_TYPE) return; if (ClassHelper.isPrimitiveType(type) && type != ClassHelper.VOID_TYPE) { unbox(type); } else { mv.visitTypeInsn( CHECKCAST, type.isArray() ? getTypeDescription(type) : getClassInternalName(type)); } }
/** * return a primitive boolean value of the BooleanExpresion. * * @param expression */ public void visitBooleanExpression(BooleanExpression expression) { compileStack.pushBooleanExpression(); expression.getExpression().visit(this); if (!isComparisonExpression(expression.getExpression())) { // comment out for optimization when boolean values are not autoboxed for eg. function calls. // Class typeClass = expression.getExpression().getTypeClass(); // if (typeClass != null && typeClass != boolean.class) { helper.unbox(boolean.class); // to return a primitive boolean // } } compileStack.pop(); }
/** * return a primitive boolean value of the BooleanExpresion. * * @param expression */ public void visitBooleanExpression(BooleanExpression expression) { compileStack.pushBooleanExpression(); expression.getExpression().visit(this); if (!isComparisonExpression(expression.getExpression())) { // comment out for optimization when boolean values are not autoboxed for eg. function calls. // Class typeClass = expression.getExpression().getTypeClass(); // if (typeClass != null && typeClass != boolean.class) { helper.unbox(boolean.class); // to return a primitive boolean // } } compileStack.pop(); }