@MJI
  public void setInt__Ljava_lang_Object_2I__V(
      MJIEnv env, int objRef, int fobjRef, int val, FeatureExpr ctx) {
    FieldInfo fi = getFieldInfo(ctx, env, objRef);
    if (!isAvailable(env, fi, fobjRef, ctx)) {
      return;
    }

    ElementInfo ei =
        getCheckedElementInfo(env, objRef, fi, fobjRef, IntegerFieldInfo.class, "int", true, ctx);
    if (ei != null) {
      ei.setIntField(ctx, fi, One.valueOf(val));
    }
  }
Пример #2
0
/** Load byte or boolean from array ..., arrayref, index => ..., value */
public class BALOAD extends ArrayLoadInstruction {

  private static final One<Byte> nullValue = One.valueOf((byte) 0);

  protected void push(FeatureExpr ctx, StackFrame frame, ElementInfo ei, int index)
      throws ArrayIndexOutOfBoundsExecutiveException {
    ei.checkArrayBounds(ctx, index);

    Conditional<Byte> value;
    Fields f = ei.getFields();
    if (f instanceof ByteArrayFields) {
      value = ei.getByteElement(index);
    } else if (f instanceof BooleanArrayFields) {
      value =
          ei.getBooleanElement(index)
              .mapr(
                  new Function<Boolean, Conditional<Byte>>() {

                    @Override
                    public Conditional<Byte> apply(Boolean v) {
                      return One.valueOf((byte) (v ? 1 : 0));
                    }
                  })
              .simplify();
    } else {
      value = nullValue;
    }

    frame.push(ctx, value);
  }

  public int getByteCode() {
    return 0x33;
  }

  public void accept(InstructionVisitor insVisitor) {
    insVisitor.visit(this);
  }
}
Пример #3
0
 private static One<Integer> One(int i) {
   return One.valueOf(i);
 }