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(); }
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()]; }