示例#1
0
ReturnOop WeakRefArray::create(int length JVM_TRAPS) {
  GUARANTEE(length > 0, "Invalid length");
  // Reserve the first element for null references
  Array::Raw array = Universe::new_int_array(length + 1 JVM_CHECK_0);
  address base = array().base_address();
  memset(base + sizeof(jint), -1, length * sizeof(jint));
  return array.obj();
}
示例#2
0
文件: sni.cpp 项目: sfsy1989/j2me
void *SNI_GetRawArrayPointer(kjarray array) {
  Array::Raw oop = *(OopDesc**) array;
  GUARANTEE(oop.not_null(), "null argument to SNI_GetRawArrayPointer()");
  return &((char*)oop.obj())[oop().base_offset()];
}
示例#3
0
//
// Array operations
//
KNIEXPORT jsize KNI_GetArrayLength(jarray arrayHandle) {
  Array::Raw a = kni_read_handle(arrayHandle);
  return (jsize)a.is_null() ? -1 : a().length();
}