コード例 #1
0
 void checkLargeUnsigned(oop result, unsigned int expected) {
   char message[200];
   ASSERT_TRUE_M(result->is_byteArray(), "Should be integer");
   bool ok;
   unsigned int actual = byteArrayOop(result)->number().as_unsigned_int(ok);
   ASSERT_TRUE_M(ok, "should be integer");
   sprintf(message, "wrong value. expected: %d, was: %d", expected, actual);
   ASSERT_EQUALS_M(expected, actual, message);
 }
コード例 #2
0
 void checkLargeInteger(oop result, int expected) {
   char message[200];
   ASSERT_TRUE_M(result->is_byteArray(), "Should be integer");
   bool ok;
   int actual = asInteger(result, ok);
   ASSERT_TRUE_M(ok, "should be integer");
   sprintf(message, "wrong value. expected: %d, was: %d", expected, actual);
   ASSERT_EQUALS_M(expected, actual, message);
 }
コード例 #3
0
int asInt(bool &ok, oop intOop) {
  ok = true;
  if (intOop->is_smi())
    return smiOop(intOop)->value();
  if (!intOop->is_byteArray()) {
    ok = false;
    return 0;
  }
  return byteArrayOop(intOop)->number().as_int(ok);
}
コード例 #4
0
PRIM_DECL_2(behaviorPrimitives::printMethod, oop receiver, oop name){
  PROLOGUE_2("printMethod", receiver, name);
  ASSERT_RECEIVER;
  if (!name->is_byteArray())
    return markSymbol(vmSymbols::first_argument_has_wrong_type());

  methodOop m = klassOop(receiver)->klass_part()->lookup(symbolOop(name));
  if (!m) return markSymbol(vmSymbols::not_found());
  m->print_codes();
  return receiver;
}
コード例 #5
0
PRIM_DECL_2(doubleByteArrayPrimitives::compare, oop receiver, oop argument) {
  PROLOGUE_2("compare", receiver, argument);
  ASSERT_RECEIVER;

  if(receiver == argument)
    return as_smiOop(0);

  if (argument->is_doubleByteArray())
    return as_smiOop(doubleByteArrayOop(receiver)->compare(doubleByteArrayOop(argument)));

  if (argument->is_byteArray())
    return as_smiOop(- byteArrayOop(argument)->compare_doubleBytes(doubleByteArrayOop(receiver)));

  return markSymbol(vmSymbols::first_argument_has_wrong_type());
}