void ConstantPoolCacheEntry::set_bytecode_2(Bytecodes::Code code) { #ifdef ASSERT // Read once. volatile Bytecodes::Code c = bytecode_2(); assert(c == 0 || c == code || code == 0, "update must be consistent"); #endif // Need to flush pending stores here before bytecode is written. OrderAccess::release_store_ptr(&_indices, _indices | ((u_char)code << 24)); }
void ConstantPoolCacheEntry::print(outputStream* st, int index) const { // print separator if (index == 0) tty->print_cr(" -------------"); // print entry tty->print_cr("%3d (%08x) [%02x|%02x|%5d]", index, this, bytecode_2(), bytecode_1(), constant_pool_index()); tty->print_cr(" [ %08x]", _f1); tty->print_cr(" [ %08x]", _f2); tty->print_cr(" [ %08x]", _flags); tty->print_cr(" -------------"); }
void ConstantPoolCacheEntry::print(outputStream* st, int index) const { // print separator if (index == 0) st->print_cr(" -------------"); // print entry st->print("%3d ("PTR_FORMAT") ", index, (intptr_t)this); if (is_secondary_entry()) st->print_cr("[%5d|secondary]", main_entry_index()); else st->print_cr("[%02x|%02x|%5d]", bytecode_2(), bytecode_1(), constant_pool_index()); st->print_cr(" [ "PTR_FORMAT"]", (intptr_t)(oop)_f1); st->print_cr(" [ "PTR_FORMAT"]", (intptr_t)_f2); st->print_cr(" [ "PTR_FORMAT"]", (intptr_t)_flags); st->print_cr(" -------------"); }
methodOop ConstantPoolCacheEntry::method_if_resolved(constantPoolHandle cpool) { if (is_secondary_entry()) { if (!is_f1_null()) return f2_as_vfinal_method(); return NULL; } // Decode the action of set_method and set_interface_call Bytecodes::Code invoke_code = bytecode_1(); if (invoke_code != (Bytecodes::Code)0) { oop f1 = _f1; if (f1 != NULL) { switch (invoke_code) { case Bytecodes::_invokeinterface: assert(f1->is_klass(), ""); return klassItable::method_for_itable_index(klassOop(f1), f2_as_index()); case Bytecodes::_invokestatic: case Bytecodes::_invokespecial: assert(!has_appendix(), ""); assert(f1->is_method(), ""); return methodOop(f1); } } } invoke_code = bytecode_2(); if (invoke_code != (Bytecodes::Code)0) { switch (invoke_code) { case Bytecodes::_invokevirtual: if (is_vfinal()) { // invokevirtual methodOop m = f2_as_vfinal_method(); assert(m->is_method(), ""); return m; } else { int holder_index = cpool->uncached_klass_ref_index_at(constant_pool_index()); if (cpool->tag_at(holder_index).is_klass()) { klassOop klass = cpool->resolved_klass_at(holder_index); if (!Klass::cast(klass)->oop_is_instance()) klass = SystemDictionary::Object_klass(); return instanceKlass::cast(klass)->method_at_vtable(f2_as_index()); } } break; case Bytecodes::_invokehandle: case Bytecodes::_invokedynamic: return f2_as_vfinal_method(); } } return NULL; }
Method* ConstantPoolCacheEntry::method_if_resolved(constantPoolHandle cpool) { // Decode the action of set_method and set_interface_call Bytecodes::Code invoke_code = bytecode_1(); if (invoke_code != (Bytecodes::Code)0) { Metadata* f1 = f1_ord(); if (f1 != NULL) { switch (invoke_code) { case Bytecodes::_invokeinterface: assert(f1->is_klass(), ""); return klassItable::method_for_itable_index((Klass*)f1, f2_as_index()); case Bytecodes::_invokestatic: case Bytecodes::_invokespecial: assert(!has_appendix(), ""); case Bytecodes::_invokehandle: case Bytecodes::_invokedynamic: assert(f1->is_method(), ""); return (Method*)f1; } } } invoke_code = bytecode_2(); if (invoke_code != (Bytecodes::Code)0) { switch (invoke_code) { case Bytecodes::_invokevirtual: if (is_vfinal()) { // invokevirtual Method* m = f2_as_vfinal_method(); assert(m->is_method(), ""); return m; } else { int holder_index = cpool->uncached_klass_ref_index_at(constant_pool_index()); if (cpool->tag_at(holder_index).is_klass()) { Klass* klass = cpool->resolved_klass_at(holder_index); if (!klass->oop_is_instance()) klass = SystemDictionary::Object_klass(); return InstanceKlass::cast(klass)->method_at_vtable(f2_as_index()); } } break; } } return NULL; }