< prev index next >
src/hotspot/share/interpreter/interpreterRuntime.cpp
Print this page
*** 321,330 ****
--- 321,331 ----
int field_offset = cp_entry->f2_as_offset();
Symbol* field_signature = vklass->field_signature(field_index);
ResourceMark rm(THREAD);
const char* signature = (const char *) field_signature->as_utf8();
BasicType field_type = char2type(signature[0]);
+ int return_offset = (type2size[field_type] + type2size[T_OBJECT]) * AbstractInterpreter::stackElementSize;
// Getting old value
frame& f = last_frame.get_frame();
jint tos_idx = f.interpreter_frame_expression_stack_size() - 1;
int vt_offset = type2size[field_type];
*** 344,367 ****
assert(aoop == NULL || oopDesc::is_oop(aoop),"argument must be a reference type");
new_value_h()->obj_field_put(field_offset, aoop);
} else if (field_type == T_VALUETYPE) {
if (cp_entry->is_flattened()) {
oop vt_oop = *(oop*)f.interpreter_frame_expression_stack_at(tos_idx);
- if (vt_oop == NULL) {
- THROW_(vmSymbols::java_lang_NullPointerException(),
- (type2size[field_type] * AbstractInterpreter::stackElementSize));
- }
assert(vt_oop != NULL && oopDesc::is_oop(vt_oop) && vt_oop->is_value(),"argument must be a value type");
! Klass* field_k = vklass->get_value_field_klass(field_index);
! ValueKlass* field_vk = ValueKlass::cast(field_k);
! assert(field_vk == vt_oop->klass(), "Must match");
! field_vk->value_copy_oop_to_new_payload(vt_oop, ((char*)(oopDesc*)new_value_h()) + field_offset);
} else { // not flattened
oop voop = *(oop*)f.interpreter_frame_expression_stack_at(tos_idx);
if (voop == NULL && cp_entry->is_flattenable()) {
! THROW_(vmSymbols::java_lang_NullPointerException(),
! (type2size[field_type] * AbstractInterpreter::stackElementSize));
}
assert(voop == NULL || oopDesc::is_oop(voop),"checking argument");
new_value_h()->obj_field_put(field_offset, voop);
}
} else { // not T_OBJECT nor T_ARRAY nor T_VALUETYPE
--- 345,362 ----
assert(aoop == NULL || oopDesc::is_oop(aoop),"argument must be a reference type");
new_value_h()->obj_field_put(field_offset, aoop);
} else if (field_type == T_VALUETYPE) {
if (cp_entry->is_flattened()) {
oop vt_oop = *(oop*)f.interpreter_frame_expression_stack_at(tos_idx);
assert(vt_oop != NULL && oopDesc::is_oop(vt_oop) && vt_oop->is_value(),"argument must be a value type");
! ValueKlass* field_vk = ValueKlass::cast(vklass->get_value_field_klass(field_index));
! assert(vt_oop != NULL && field_vk == vt_oop->klass(), "Must match");
! field_vk->write_flattened_field(new_value_h(), offset, vt_oop, CHECK_(return_offset));
} else { // not flattened
oop voop = *(oop*)f.interpreter_frame_expression_stack_at(tos_idx);
if (voop == NULL && cp_entry->is_flattenable()) {
! THROW_(vmSymbols::java_lang_NullPointerException(), return_offset);
}
assert(voop == NULL || oopDesc::is_oop(voop),"checking argument");
new_value_h()->obj_field_put(field_offset, voop);
}
} else { // not T_OBJECT nor T_ARRAY nor T_VALUETYPE
*** 369,379 ****
copy_primitive_argument(addr, new_value_h, field_offset, field_type);
}
// returning result
thread->set_vm_result(new_value_h());
! return (type2size[field_type] + type2size[T_OBJECT]) * AbstractInterpreter::stackElementSize;
JRT_END
JRT_ENTRY(void, InterpreterRuntime::uninitialized_static_value_field(JavaThread* thread, oopDesc* mirror, int index))
// The interpreter tries to access a flattenable static field that has not been initialized.
// This situation can happen in different scenarios:
--- 364,374 ----
copy_primitive_argument(addr, new_value_h, field_offset, field_type);
}
// returning result
thread->set_vm_result(new_value_h());
! return return_offset;
JRT_END
JRT_ENTRY(void, InterpreterRuntime::uninitialized_static_value_field(JavaThread* thread, oopDesc* mirror, int index))
// The interpreter tries to access a flattenable static field that has not been initialized.
// This situation can happen in different scenarios:
*** 433,450 ****
instanceOop res = (instanceOop)field_vklass->default_value();
thread->set_vm_result(res);
JRT_END
JRT_ENTRY(void, InterpreterRuntime::write_flattened_value(JavaThread* thread, oopDesc* value, int offset, oopDesc* rcv))
assert(oopDesc::is_oop(value), "Sanity check");
assert(oopDesc::is_oop(rcv), "Sanity check");
assert(value->is_value(), "Sanity check");
ValueKlass* vklass = ValueKlass::cast(value->klass());
! if (!vklass->is_empty_value()) {
! vklass->value_copy_oop_to_payload(value, ((char*)(oopDesc*)rcv) + offset);
! }
JRT_END
JRT_ENTRY(void, InterpreterRuntime::read_flattened_field(JavaThread* thread, oopDesc* obj, int index, Klass* field_holder))
Handle obj_h(THREAD, obj);
--- 428,444 ----
instanceOop res = (instanceOop)field_vklass->default_value();
thread->set_vm_result(res);
JRT_END
JRT_ENTRY(void, InterpreterRuntime::write_flattened_value(JavaThread* thread, oopDesc* value, int offset, oopDesc* rcv))
+ assert(value != NULL, "Sanity check");
assert(oopDesc::is_oop(value), "Sanity check");
assert(oopDesc::is_oop(rcv), "Sanity check");
assert(value->is_value(), "Sanity check");
ValueKlass* vklass = ValueKlass::cast(value->klass());
! vklass->write_flattened_field(rcv, offset, value, CHECK);
JRT_END
JRT_ENTRY(void, InterpreterRuntime::read_flattened_field(JavaThread* thread, oopDesc* obj, int index, Klass* field_holder))
Handle obj_h(THREAD, obj);
*** 456,473 ****
assert(klass->field_is_flattened(index), "Sanity check");
ValueKlass* field_vklass = ValueKlass::cast(klass->get_value_field_klass(index));
assert(field_vklass->is_initialized(), "Must be initialized at this point");
! instanceOop res = NULL;
! if (field_vklass->is_empty_value()) {
! res = (instanceOop)field_vklass->default_value();
! } else {
! res = field_vklass->allocate_instance(CHECK);
! field_vklass->value_copy_payload_to_new_oop(((char*)(oopDesc*)obj_h()) + klass->field_offset(index), res);
! }
! assert(res != NULL, "Must be set in one of two paths above");
thread->set_vm_result(res);
JRT_END
JRT_ENTRY(void, InterpreterRuntime::newarray(JavaThread* thread, BasicType type, jint size))
oop obj = oopFactory::new_typeArray(type, size, CHECK);
--- 450,460 ----
assert(klass->field_is_flattened(index), "Sanity check");
ValueKlass* field_vklass = ValueKlass::cast(klass->get_value_field_klass(index));
assert(field_vklass->is_initialized(), "Must be initialized at this point");
! oop res = field_vklass->read_flattened_field(obj_h(), klass->field_offset(index), CHECK);
thread->set_vm_result(res);
JRT_END
JRT_ENTRY(void, InterpreterRuntime::newarray(JavaThread* thread, BasicType type, jint size))
oop obj = oopFactory::new_typeArray(type, size, CHECK);
*** 1480,1498 ****
InstanceKlass* ik = InstanceKlass::cast(cp_entry->f1_as_klass());
int index = cp_entry->field_index();
if ((ik->field_access_flags(index) & JVM_ACC_FIELD_ACCESS_WATCHED) == 0) return;
bool is_static = (obj == NULL);
HandleMark hm(thread);
Handle h_obj;
if (!is_static) {
// non-static field accessors have an object, but we need a handle
h_obj = Handle(thread, obj);
}
InstanceKlass* cp_entry_f1 = InstanceKlass::cast(cp_entry->f1_as_klass());
! jfieldID fid = jfieldIDWorkaround::to_jfieldID(cp_entry_f1, cp_entry->f2_as_index(), is_static);
LastFrameAccessor last_frame(thread);
JvmtiExport::post_field_access(thread, last_frame.method(), last_frame.bcp(), cp_entry_f1, h_obj, fid);
JRT_END
JRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread,
--- 1467,1486 ----
InstanceKlass* ik = InstanceKlass::cast(cp_entry->f1_as_klass());
int index = cp_entry->field_index();
if ((ik->field_access_flags(index) & JVM_ACC_FIELD_ACCESS_WATCHED) == 0) return;
bool is_static = (obj == NULL);
+ bool is_flattened = cp_entry->is_flattened();
HandleMark hm(thread);
Handle h_obj;
if (!is_static) {
// non-static field accessors have an object, but we need a handle
h_obj = Handle(thread, obj);
}
InstanceKlass* cp_entry_f1 = InstanceKlass::cast(cp_entry->f1_as_klass());
! jfieldID fid = jfieldIDWorkaround::to_jfieldID(cp_entry_f1, cp_entry->f2_as_index(), is_static, is_flattened);
LastFrameAccessor last_frame(thread);
JvmtiExport::post_field_access(thread, last_frame.method(), last_frame.bcp(), cp_entry_f1, h_obj, fid);
JRT_END
JRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread,
*** 1525,1537 ****
if (cp_entry->flag_state() == atos && ik->field_signature(index)->is_Q_signature()) {
sig_type = 'Q';
}
bool is_static = (obj == NULL);
HandleMark hm(thread);
! jfieldID fid = jfieldIDWorkaround::to_jfieldID(ik, cp_entry->f2_as_index(), is_static);
jvalue fvalue;
#ifdef _LP64
fvalue = *value;
#else
// Long/double values are stored unaligned and also noncontiguously with
--- 1513,1526 ----
if (cp_entry->flag_state() == atos && ik->field_signature(index)->is_Q_signature()) {
sig_type = 'Q';
}
bool is_static = (obj == NULL);
+ bool is_flattened = cp_entry->is_flattened();
HandleMark hm(thread);
! jfieldID fid = jfieldIDWorkaround::to_jfieldID(ik, cp_entry->f2_as_index(), is_static, is_flattened);
jvalue fvalue;
#ifdef _LP64
fvalue = *value;
#else
// Long/double values are stored unaligned and also noncontiguously with
< prev index next >