< prev index next >
src/share/vm/c1/c1_Runtime1.cpp
Print this page
*** 329,339 ****
JRT_ENTRY(void, Runtime1::new_instance(JavaThread* thread, Klass* klass))
NOT_PRODUCT(_new_instance_slowcase_cnt++;)
assert(klass->is_klass(), "not a class");
Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
! instanceKlassHandle h(thread, klass);
h->check_valid_for_instantiation(true, CHECK);
// make sure klass is initialized
h->initialize(CHECK);
// allocate instance and return via TLS
oop obj = h->allocate_instance(CHECK);
--- 329,339 ----
JRT_ENTRY(void, Runtime1::new_instance(JavaThread* thread, Klass* klass))
NOT_PRODUCT(_new_instance_slowcase_cnt++;)
assert(klass->is_klass(), "not a class");
Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
! InstanceKlass* h = InstanceKlass::cast(klass);
h->check_valid_for_instantiation(true, CHECK);
// make sure klass is initialized
h->initialize(CHECK);
// allocate instance and return via TLS
oop obj = h->allocate_instance(CHECK);
*** 855,866 ****
// this is used by assertions in the access_field_patching_id
BasicType patch_field_type = T_ILLEGAL;
bool deoptimize_for_volatile = false;
bool deoptimize_for_atomic = false;
int patch_field_offset = -1;
! KlassHandle init_klass(THREAD, NULL); // klass needed by load_klass_patching code
! KlassHandle load_klass(THREAD, NULL); // klass needed by load_klass_patching code
Handle mirror(THREAD, NULL); // oop needed by load_mirror_patching code
Handle appendix(THREAD, NULL); // oop needed by appendix_patching code
bool load_klass_or_mirror_patch_id =
(stub_id == Runtime1::load_klass_patching_id || stub_id == Runtime1::load_mirror_patching_id);
--- 855,866 ----
// this is used by assertions in the access_field_patching_id
BasicType patch_field_type = T_ILLEGAL;
bool deoptimize_for_volatile = false;
bool deoptimize_for_atomic = false;
int patch_field_offset = -1;
! Klass* init_klass = NULL; // klass needed by load_klass_patching code
! Klass* load_klass = NULL; // klass needed by load_klass_patching code
Handle mirror(THREAD, NULL); // oop needed by load_mirror_patching code
Handle appendix(THREAD, NULL); // oop needed by appendix_patching code
bool load_klass_or_mirror_patch_id =
(stub_id == Runtime1::load_klass_patching_id || stub_id == Runtime1::load_mirror_patching_id);
*** 903,913 ****
Klass* k = NULL;
switch (code) {
case Bytecodes::_putstatic:
case Bytecodes::_getstatic:
{ Klass* klass = resolve_field_return_klass(caller_method, bci, CHECK);
! init_klass = KlassHandle(THREAD, klass);
mirror = Handle(THREAD, klass->java_mirror());
}
break;
case Bytecodes::_new:
{ Bytecode_new bnew(caller_method(), caller_method->bcp_from(bci));
--- 903,913 ----
Klass* k = NULL;
switch (code) {
case Bytecodes::_putstatic:
case Bytecodes::_getstatic:
{ Klass* klass = resolve_field_return_klass(caller_method, bci, CHECK);
! init_klass = klass;
mirror = Handle(THREAD, klass->java_mirror());
}
break;
case Bytecodes::_new:
{ Bytecode_new bnew(caller_method(), caller_method->bcp_from(bci));
*** 943,954 ****
mirror = Handle(THREAD, m);
}
break;
default: fatal("unexpected bytecode for load_klass_or_mirror_patch_id");
}
! // convert to handle
! load_klass = KlassHandle(THREAD, k);
} else if (stub_id == load_appendix_patching_id) {
Bytecode_invoke bytecode(caller_method, bci);
Bytecodes::Code bc = bytecode.invoke_code();
CallInfo info;
--- 943,953 ----
mirror = Handle(THREAD, m);
}
break;
default: fatal("unexpected bytecode for load_klass_or_mirror_patch_id");
}
! load_klass = k;
} else if (stub_id == load_appendix_patching_id) {
Bytecode_invoke bytecode(caller_method, bci);
Bytecodes::Code bc = bytecode.invoke_code();
CallInfo info;
*** 1065,1075 ****
// place until initialization is complete. In this case the
// patch site is setup so that any threads besides the
// initializing thread are forced to come into the VM and
// block.
do_patch = (code != Bytecodes::_getstatic && code != Bytecodes::_putstatic) ||
! InstanceKlass::cast(init_klass())->is_initialized();
NativeGeneralJump* jump = nativeGeneralJump_at(instr_pc);
if (jump->jump_destination() == being_initialized_entry) {
assert(do_patch == true, "initialization must be complete at this point");
} else {
// patch the instruction <move reg, klass>
--- 1064,1074 ----
// place until initialization is complete. In this case the
// patch site is setup so that any threads besides the
// initializing thread are forced to come into the VM and
// block.
do_patch = (code != Bytecodes::_getstatic && code != Bytecodes::_putstatic) ||
! InstanceKlass::cast(init_klass)->is_initialized();
NativeGeneralJump* jump = nativeGeneralJump_at(instr_pc);
if (jump->jump_destination() == being_initialized_entry) {
assert(do_patch == true, "initialization must be complete at this point");
} else {
// patch the instruction <move reg, klass>
*** 1077,1088 ****
assert(n_copy->data() == 0 ||
n_copy->data() == (intptr_t)Universe::non_oop_word(),
"illegal init value");
if (stub_id == Runtime1::load_klass_patching_id) {
! assert(load_klass() != NULL, "klass not set");
! n_copy->set_data((intx) (load_klass()));
} else {
assert(mirror() != NULL, "klass not set");
// Don't need a G1 pre-barrier here since we assert above that data isn't an oop.
n_copy->set_data(cast_from_oop<intx>(mirror()));
}
--- 1076,1087 ----
assert(n_copy->data() == 0 ||
n_copy->data() == (intptr_t)Universe::non_oop_word(),
"illegal init value");
if (stub_id == Runtime1::load_klass_patching_id) {
! assert(load_klass != NULL, "klass not set");
! n_copy->set_data((intx) (load_klass));
} else {
assert(mirror() != NULL, "klass not set");
// Don't need a G1 pre-barrier here since we assert above that data isn't an oop.
n_copy->set_data(cast_from_oop<intx>(mirror()));
}
*** 1129,1139 ****
found = true;
} else if (mds.type() == relocInfo::metadata_type) {
assert(stub_id == Runtime1::load_klass_patching_id, "wrong stub id");
metadata_Relocation* r = mds.metadata_reloc();
Metadata** metadata_adr = r->metadata_addr();
! *metadata_adr = load_klass();
r->fix_metadata_relocation();
found = true;
}
}
assert(found, "the metadata must exist!");
--- 1128,1138 ----
found = true;
} else if (mds.type() == relocInfo::metadata_type) {
assert(stub_id == Runtime1::load_klass_patching_id, "wrong stub id");
metadata_Relocation* r = mds.metadata_reloc();
Metadata** metadata_adr = r->metadata_addr();
! *metadata_adr = load_klass;
r->fix_metadata_relocation();
found = true;
}
}
assert(found, "the metadata must exist!");
< prev index next >