/** * Calls the constructor {@code constructor} using {@code args} and assigns * the new instance to {@code target}. */ public <T> void newInstance(Local<T> target, MethodId<T, Void> constructor, Local<?>... args) { if (target == null) { throw new IllegalArgumentException(); } addInstruction(new ThrowingCstInsn(Rops.NEW_INSTANCE, sourcePosition, RegisterSpecList.EMPTY, catches, constructor.declaringType.constant)); moveResult(target, true); invokeDirect(constructor, null, target, args); }
private <D, R> void invoke(Rop rop, MethodId<D, R> method, Local<? super R> target, Local<? extends D> object, Local<?>... args) { addInstruction(new ThrowingCstInsn(rop, sourcePosition, concatenate(object, args), catches, method.constant)); if (target != null) { moveResult(target, false); } }
/** * Copies the value in the static field {@code fieldId} to {@code target}. */ public <V> void sget(FieldId<?, ? extends V> fieldId, Local<V> target) { addInstruction(new ThrowingCstInsn(Rops.opGetStatic(target.type.ropType), sourcePosition, RegisterSpecList.EMPTY, catches, fieldId.constant)); moveResult(target, true); }
/** * Tests if the value in {@code source} is assignable to {@code type}. If it * is, {@code target} is assigned to 1; otherwise {@code target} is assigned * to 0. */ public void instanceOfType(Local<?> target, Local<?> source, TypeId<?> type) { addInstruction(new ThrowingCstInsn(Rops.INSTANCE_OF, sourcePosition, RegisterSpecList.make(source.spec()), catches, type.constant)); moveResult(target, true); }
/** * Copies the value in {@code source} to the static field {@code fieldId}. */ public <V> void sput(FieldId<?, V> fieldId, Local<? extends V> source) { addInstruction(new ThrowingCstInsn(Rops.opPutStatic(source.type.ropType), sourcePosition, RegisterSpecList.make(source.spec()), catches, fieldId.constant)); }
/** * Assigns {@code target} to a newly allocated array of length {@code * length}. The array's type is the same as {@code target}'s type. */ public <T> void newArray(Local<T> target, Local<Integer> length) { addInstruction(new ThrowingCstInsn(Rops.opNewArray(target.type.ropType), sourcePosition, RegisterSpecList.make(length.spec()), catches, target.type.constant)); moveResult(target, true); }
/** * Copies the value in instance field {@code fieldId} of {@code instance} to * {@code target}. */ public <D, V> void iget(FieldId<D, ? extends V> fieldId, Local<V> target, Local<D> instance) { addInstruction(new ThrowingCstInsn(Rops.opGetField(target.type.ropType), sourcePosition, RegisterSpecList.make(instance.spec()), catches, fieldId.constant)); moveResult(target, true); }
/** * Copies the value in {@code source} to the instance field {@code fieldId} * of {@code instance}. */ public <D, V> void iput(FieldId<D, V> fieldId, Local<? extends D> instance, Local<? extends V> source) { addInstruction(new ThrowingCstInsn(Rops.opPutField(source.type.ropType), sourcePosition, RegisterSpecList.make(source.spec(), instance.spec()), catches, fieldId.constant)); }
/** * Copies the constant value {@code value} to {@code target}. The constant * must be a primitive, String, Class, TypeId, or null. */ public <T> void loadConstant(Local<T> target, T value) { Rop rop = value == null ? Rops.CONST_OBJECT_NOTHROW : Rops.opConst(target.type.ropType); if (rop.getBranchingness() == BRANCH_NONE) { addInstruction(new PlainCstInsn(rop, sourcePosition, target.spec(), RegisterSpecList.EMPTY, Constants.getConstant(value))); } else { addInstruction(new ThrowingCstInsn(rop, sourcePosition, RegisterSpecList.EMPTY, catches, Constants.getConstant(value))); moveResult(target, true); } }
addInstruction(new ThrowingCstInsn(Rops.CHECK_CAST, sourcePosition, RegisterSpecList.make(source.spec()), catches, target.type.constant)); moveResult(target, true);
/** * Copies the value in the static field {@code fieldId} to {@code target}. */ public <V> void sget(FieldId<?, V> fieldId, Local<V> target) { addInstruction(new ThrowingCstInsn(Rops.opGetStatic(target.type.ropType), sourcePosition, RegisterSpecList.EMPTY, catches, fieldId.constant)); moveResult(target, true); }
/** * Copies the value in {@code source} to the static field {@code fieldId}. */ public <V> void sput(FieldId<?, V> fieldId, Local<? extends V> source) { addInstruction(new ThrowingCstInsn(Rops.opPutStatic(source.type.ropType), sourcePosition, RegisterSpecList.make(source.spec()), catches, fieldId.constant)); }
public void typeCast(Local<?> source, Local<?> target) { addInstruction(new ThrowingCstInsn(Rops.CHECK_CAST, sourcePosition, RegisterSpecList.make(source.spec()), catches, target.type.constant)); moveResult(target, true); }
/** * Tests if the value in {@code source} is assignable to {@code type}. If it is, {@code target} is assigned to 1; otherwise {@code target} is assigned to 0. */ public void instanceOfType(Local<?> target, Local<?> source, TypeId<?> type) { addInstruction(new ThrowingCstInsn(Rops.INSTANCE_OF, sourcePosition, RegisterSpecList.make(source.spec()), catches, type.constant)); moveResult(target, true); }
/** {@inheritDoc} */ @Override public Insn withRegisterOffset(int delta) { return new ThrowingCstInsn(getOpcode(), getPosition(), getSources().withOffset(delta), catches, getConstant()); }
/** {@inheritDoc} */ @Override public Insn withAddedCatch(Type type) { return new ThrowingCstInsn(getOpcode(), getPosition(), getSources(), catches.withAddedType(type), getConstant()); }
/** {@inheritDoc} */ @Override public Insn withRegisterOffset(int delta) { return new ThrowingCstInsn(getOpcode(), getPosition(), getSources().withOffset(delta), catches, getConstant()); }
/** {@inheritDoc} */ @Override public Insn withRegisterOffset(int delta) { return new ThrowingCstInsn(getOpcode(), getPosition(), getSources().withOffset(delta), catches, getConstant()); }
/** {@inheritDoc} */ @Override public Insn withAddedCatch(Type type) { return new ThrowingCstInsn(getOpcode(), getPosition(), getSources(), catches.withAddedType(type), getConstant()); }
/** {@inheritDoc} */ @Override public Insn withRegisterOffset(int delta) { return new ThrowingCstInsn(getOpcode(), getPosition(), getSources().withOffset(delta), catches, getConstant()); }