Esempio n. 1
0
  void ckThreadGroupValue(Value retValue) {
    Field theValueField = targetClass.fieldByName("ethreadGroupValue");
    ThreadGroupReference vv = (ThreadGroupReference) targetClass.getValue(theValueField);

    ThreadGroupReference rv = (ThreadGroupReference) retValue;
    if (vv != rv) {
      failure("failure: ThreadgGroup: expected " + vv + ", got " + rv);
    } else {
      System.out.println("Passed: ThreadGroup: " + rv);
      earlyReturns++;
    }
  }
Esempio n. 2
0
  void ckClassLoaderValue(Value retValue) {
    Field theValueField = targetClass.fieldByName("eclassLoaderValue");
    ClassLoaderReference vv = (ClassLoaderReference) targetClass.getValue(theValueField);

    ClassLoaderReference rv = (ClassLoaderReference) retValue;
    if (vv != rv) {
      failure("failure: ClassLoader: expected " + vv + ", got " + rv);
    } else {
      System.out.println("Passed: ClassLoader: " + rv);
      earlyReturns++;
    }
  }
Esempio n. 3
0
  void ckObjectValue(Value retValue) {
    ObjectReference theRetValue = (ObjectReference) retValue;

    Field theIVarField = targetClass.fieldByName("eobjectValue");
    ObjectReference theRetValField = (ObjectReference) targetClass.getValue(theIVarField);

    if (!theRetValue.equals(theRetValField)) {
      failure("failure: Object: expected " + theIVarField + ", got " + theRetValField);
    } else {
      System.out.println("Passed: Object: " + theRetValField);
      earlyReturns++;
    }
  }
Esempio n. 4
0
  void ckStringValue(Value retValue) {
    Field theValueField = targetClass.fieldByName("estringValue");
    StringReference theValue = (StringReference) targetClass.getValue(theValueField);

    String vv = theValue.value();
    String rv = ((StringReference) retValue).value();
    if (vv != rv) {
      failure("failure: String: expected " + vv + ", got " + rv);
    } else {
      System.out.println("Passed: String: " + rv);
      earlyReturns++;
    }
  }
Esempio n. 5
0
  void ckShortValue(Value retValue) {
    Field theValueField = targetClass.fieldByName("eshortValue");
    ShortValue theValue = (ShortValue) targetClass.getValue(theValueField);

    short vv = theValue.value();
    short rv = ((ShortValue) retValue).value();
    if (vv != rv) {
      failure("failure: short: expected " + vv + ", got " + rv);
    } else {
      System.out.println("Passed: short " + rv);
      earlyReturns++;
    }
  }
Esempio n. 6
0
  void ckBooleanValue(Value retValue) {
    Field theValueField = targetClass.fieldByName("ebooleanValue");
    BooleanValue theValue = (BooleanValue) targetClass.getValue(theValueField);

    boolean vv = theValue.value();
    boolean rv = ((BooleanValue) retValue).value();
    if (vv != rv) {
      failure("failure: boolean: expected " + vv + ", got " + rv);
    } else {
      System.out.println("Passed: boolean " + rv);
      earlyReturns++;
    }
  }
Esempio n. 7
0
  void ckLongValue(Value retValue) {
    Field theValueField = targetClass.fieldByName("elongValue");
    LongValue theValue = (LongValue) targetClass.getValue(theValueField);

    long vv = theValue.value();
    long rv = ((LongValue) retValue).value();
    if (vv != rv) {
      failure("failure: long: expected " + vv + ", got " + rv);
    } else {
      System.out.println("Passed: long " + rv);
      earlyReturns++;
    }
  }
Esempio n. 8
0
  void ckIntValue(Value retValue) {
    Field theValueField = targetClass.fieldByName("eintValue");
    IntegerValue theValue = (IntegerValue) targetClass.getValue(theValueField);

    int vv = theValue.value();
    int rv = ((IntegerValue) retValue).value();
    if (vv != rv) {
      failure("failure: int: expected " + vv + ", got " + rv);
    } else {
      System.out.println("Passed: int " + rv);
      earlyReturns++;
    }
  }
Esempio n. 9
0
  void ckFloatValue(Value retValue) {
    Field theValueField = targetClass.fieldByName("efloatValue");
    FloatValue theValue = (FloatValue) targetClass.getValue(theValueField);

    float vv = theValue.value();
    float rv = ((FloatValue) retValue).value();
    if (vv != rv) {
      failure("failure: float: expected " + vv + ", got " + rv);
    } else {
      System.out.println("Passed: float " + rv);
      earlyReturns++;
    }
  }
Esempio n. 10
0
  void ckDoubleValue(Value retValue) {
    Field theValueField = targetClass.fieldByName("edoubleValue");
    DoubleValue theValue = (DoubleValue) targetClass.getValue(theValueField);

    double vv = theValue.value();
    double rv = ((DoubleValue) retValue).value();
    if (vv != rv) {
      failure("failure: double: expected " + vv + ", got " + rv);
    } else {
      System.out.println("Passed: double " + rv);
      earlyReturns++;
    }
  }
Esempio n. 11
0
  void ckCharValue(Value retValue) {
    Field theValueField = targetClass.fieldByName("echarValue");
    CharValue theValue = (CharValue) targetClass.getValue(theValueField);

    char vv = theValue.value();
    char rv = ((CharValue) retValue).value();
    if (vv != rv) {
      failure("failure: char: expected " + vv + ", got " + rv);
    } else {
      System.out.println("Passed: char " + rv);
      earlyReturns++;
    }
  }
Esempio n. 12
0
  void ckArrayValue(Value retValue) {
    Field theValueField = targetClass.fieldByName("eintArrayValue");
    ArrayReference theValue = (ArrayReference) targetClass.getValue(theValueField);
    IntegerValue theElem2 = (IntegerValue) theValue.getValue(2);

    ArrayReference theRetValue = (ArrayReference) retValue;
    IntegerValue retElem2 = (IntegerValue) theRetValue.getValue(2);
    int vv = theElem2.value();
    int rv = retElem2.value();
    if (vv != rv) {
      failure("failure: in[2]: expected " + vv + ", got " + rv);
    } else {
      System.out.println("Passed: int[2]: " + rv);
      earlyReturns++;
    }
  }
Esempio n. 13
0
  public void breakpointReached(BreakpointEvent event) {
    String origMethodName = event.location().method().name();
    String methodName = origMethodName.substring(2);
    ThreadReference tr = event.thread();

    if (vm().canForceEarlyReturn()) {

      try {

        if ("bytef".equals(methodName)) {
          Field theValueField = targetClass.fieldByName("ebyteValue");
          ByteValue theValue = (ByteValue) targetClass.getValue(theValueField);
          tr.forceEarlyReturn(theValue);
          /*
           * See what happens if we access the stack after the force
           * and before the resume.  Disabling this since spec says
           * the stack is undefined.  This type of code can be used to
           * pursue just what that means.
           *
           * StackFrame sf = tr.frame(0);
           * List<Value> ll = sf.getArgumentValues();
           * for (Value vv: ll) {
           *     System.out.println("vv = " + vv);
           * }
           */
        } else if ("charf".equals(methodName)) {
          Field theValueField = targetClass.fieldByName("echarValue");
          CharValue theValue = (CharValue) targetClass.getValue(theValueField);
          tr.forceEarlyReturn(theValue);
        } else if ("doublef".equals(methodName)) {
          Field theValueField = targetClass.fieldByName("edoubleValue");
          DoubleValue theValue = (DoubleValue) targetClass.getValue(theValueField);
          tr.forceEarlyReturn(theValue);
        } else if ("floatf".equals(methodName)) {
          Field theValueField = targetClass.fieldByName("efloatValue");
          FloatValue theValue = (FloatValue) targetClass.getValue(theValueField);
          tr.forceEarlyReturn(theValue);
        } else if ("intf".equals(methodName)) {
          Field theValueField = targetClass.fieldByName("eintValue");
          IntegerValue theValue = (IntegerValue) targetClass.getValue(theValueField);
          tr.forceEarlyReturn(theValue);
        } else if ("longf".equals(methodName)) {
          Field theValueField = targetClass.fieldByName("elongValue");
          LongValue theValue = (LongValue) targetClass.getValue(theValueField);
          tr.forceEarlyReturn(theValue);
        } else if ("shortf".equals(methodName)) {
          Field theValueField = targetClass.fieldByName("eshortValue");
          ShortValue theValue = (ShortValue) targetClass.getValue(theValueField);
          tr.forceEarlyReturn(theValue);
        } else if ("booleanf".equals(methodName)) {
          Field theValueField = targetClass.fieldByName("ebooleanValue");
          BooleanValue theValue = (BooleanValue) targetClass.getValue(theValueField);
          tr.forceEarlyReturn(theValue);
        } else if ("stringf".equals(methodName)) {
          Field theValueField = targetClass.fieldByName("estringValue");
          StringReference theValue = (StringReference) targetClass.getValue(theValueField);
          tr.forceEarlyReturn(theValue);
        } else if ("classf".equals(methodName)) {
          Field theValueField = targetClass.fieldByName("eclassValue");
          ClassObjectReference theValue =
              (ClassObjectReference) targetClass.getValue(theValueField);
          tr.forceEarlyReturn(theValue);
        } else if ("classLoaderf".equals(methodName)) {
          Field theValueField = targetClass.fieldByName("eclassLoaderValue");
          ClassLoaderReference theValue =
              (ClassLoaderReference) targetClass.getValue(theValueField);
          tr.forceEarlyReturn(theValue);
        } else if ("threadf".equals(methodName)) {
          Field theValueField = targetClass.fieldByName("ethreadValue");
          ThreadReference theValue = (ThreadReference) targetClass.getValue(theValueField);
          tr.forceEarlyReturn(theValue);
        } else if ("threadGroupf".equals(methodName)) {
          Field theValueField = targetClass.fieldByName("ethreadGroupValue");
          ThreadGroupReference theValue =
              (ThreadGroupReference) targetClass.getValue(theValueField);
          tr.forceEarlyReturn(theValue);
        } else if ("intArrayf".equals(methodName)) {
          Field theValueField = targetClass.fieldByName("eintArrayValue");
          ArrayReference theValue = (ArrayReference) targetClass.getValue(theValueField);
          tr.forceEarlyReturn(theValue);
        } else if ("nullObjectf".equals(methodName)) {
          tr.forceEarlyReturn(null);
        } else if ("objectf".equals(methodName)) {
          Field theValueField = targetClass.fieldByName("eobjectValue");
          ObjectReference theValue = (ObjectReference) targetClass.getValue(theValueField);
          tr.forceEarlyReturn(theValue);
        } else if ("voidf".equals(methodName)) {
          VoidValue theValue = vm().mirrorOfVoid();
          tr.forceEarlyReturn(theValue);
        } else {
          failure("failure: Unknown methodName: " + origMethodName);
        }

      } catch (Exception ex) {
        failure("failure: " + ex.toString());
        ex.printStackTrace();
      }
    } else {
      System.out.println("Cannot force early return for method: " + origMethodName);
    }
  }