本文整理汇总了C++中oop::is_smi方法的典型用法代码示例。如果您正苦于以下问题:C++ oop::is_smi方法的具体用法?C++ oop::is_smi怎么用?C++ oop::is_smi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oop
的用法示例。
在下文中一共展示了oop::is_smi方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: markSymbol
PRIM_DECL_3(doubleByteArrayPrimitives::atPut, oop receiver, oop index, oop value) {
PROLOGUE_3("atPut", receiver, index, value);
ASSERT_RECEIVER;
// check index type
if (!index->is_smi())
return markSymbol(vmSymbols::first_argument_has_wrong_type());
// check value type
if (!value->is_smi())
return markSymbol(vmSymbols::second_argument_has_wrong_type());
// check index value
if (!doubleByteArrayOop(receiver)->is_within_bounds(smiOop(index)->value()))
return markSymbol(vmSymbols::out_of_bounds());
// check value as double byte
unsigned int v = (unsigned int) smiOop(value)->value();
if (v >= (1<<16))
return markSymbol(vmSymbols::value_out_of_range());
// do the operation
doubleByteArrayOop(receiver)->doubleByte_at_put(smiOop(index)->value(), v);
return receiver;
}
示例2: checkSmallInteger
void checkSmallInteger(oop result, int expected) {
char message[200];
ASSERT_TRUE_M(result->is_smi(), "Should be small integer");
int actual = smiOop(result)->value();
sprintf(message, "wrong value. expected: %d, was: %d", expected, actual);
ASSERT_EQUALS_M(expected, actual, message);
}
示例3: markSymbol
PRIM_DECL_2(doubleValueArrayPrimitives::allocateSize, oop receiver, oop argument) {
PROLOGUE_2("allocateSize", receiver, argument)
assert(receiver->is_klass() && klassOop(receiver)->klass_part()->oop_is_doubleValueArray(),
"receiver must double byte array class");
if (!argument->is_smi())
markSymbol(vmSymbols::first_argument_has_wrong_type());
if (smiOop(argument)->value() < 0)
return markSymbol(vmSymbols::negative_size());
int length = smiOop(argument)->value();
klassOop k = klassOop(receiver);
int ni_size = k->klass_part()->non_indexable_size();
int obj_size = ni_size + 1 + roundTo(length * sizeof(double), oopSize) / oopSize;
// allocate
doubleValueArrayOop obj = as_doubleValueArrayOop(Universe::allocate(obj_size, (memOop*)&k));
// header
memOop(obj)->initialize_header(true, k);
// instance variables
memOop(obj)->initialize_body(memOopDesc::header_size(), ni_size);
obj->set_length(length);
for (int index = 1; index <= length; index++) {
obj->double_at_put(index, 0.0);
}
return obj;
}
示例4: ov_at_put_prim
oop objVectorOopClass::ov_at_put_prim(oop rcvr, oop indexOop, oop contents) {
if (!rcvr->is_objVector()) return ErrorCodes::vmString_prim_error(BADTYPEERROR);
if (!indexOop->is_smi()) return ErrorCodes::vmString_prim_error(BADTYPEERROR);
smi index = smiOop(indexOop)->value();
if (unsigned(index) >= unsigned(objVectorOop(rcvr)->length()))
return ErrorCodes::vmString_prim_error(BADINDEXERROR);
objVectorOop(rcvr)->obj_at_put(index, contents);
return rcvr;
}
示例5: asInt
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);
}
示例6: markSymbol
PRIM_DECL_2(behaviorPrimitives::classVariableAt, oop behavior, oop index) {
PROLOGUE_2("classVariableAt", behavior, index);
if (!behavior->is_klass())
return markSymbol(vmSymbols::first_argument_has_wrong_type());
if (!index->is_smi())
return markSymbol(vmSymbols::second_argument_has_wrong_type());
int i = smiOop(index)->value();
if (i > 0 && i <= klassOop(behavior)->klass_part()->number_of_classVars())
return klassOop(behavior)->klass_part()->classVar_at(i);
return markSymbol(vmSymbols::out_of_bounds());
}
示例7: printEvent_prim
oop printEvent_prim(oop rcvr, oop arg) {
if (!arg->is_smi()) return VMString[BADTYPEERROR];
eventLog->printPartial(smiOop(arg)->value());
return rcvr;
}