Example #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();
}
Example #2
0
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()];
}
Example #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();
}