--- a/indy.compiler.patch Sat Jul 04 00:12:52 2009 -0700
+++ b/indy.compiler.patch Sat Jul 04 04:02:22 2009 -0700
@@ -1,7 +1,7 @@ diff --git a/src/cpu/x86/vm/frame_x86.cp
diff --git a/src/cpu/x86/vm/frame_x86.cpp b/src/cpu/x86/vm/frame_x86.cpp
--- a/src/cpu/x86/vm/frame_x86.cpp
+++ b/src/cpu/x86/vm/frame_x86.cpp
-@@ -307,6 +307,13 @@ void frame::interpreter_frame_set_last_s
+@@ -307,6 +307,13 @@
}
#endif // CC_INTERP
@@ -15,7 +15,7 @@ diff --git a/src/cpu/x86/vm/frame_x86.cp
frame frame::sender_for_entry_frame(RegisterMap* map) const {
assert(map != NULL, "map must be set");
// Java frame called from C; skip all C frames and return top C
-@@ -331,6 +338,10 @@ frame frame::sender_for_interpreter_fram
+@@ -331,6 +338,10 @@
// This is the sp before any possible extension (adapter/locals).
intptr_t* unextended_sp = interpreter_frame_sender_sp();
@@ -26,7 +26,7 @@ diff --git a/src/cpu/x86/vm/frame_x86.cp
// The interpreter and compiler(s) always save EBP/RBP in a known
// location on entry. We must record where that location is
// so this if EBP/RBP was live on callout from c2 we can find
-@@ -353,7 +364,7 @@ frame frame::sender_for_interpreter_fram
+@@ -353,7 +364,7 @@
#endif // AMD64
}
#endif /* COMPILER2 */
@@ -35,7 +35,7 @@ diff --git a/src/cpu/x86/vm/frame_x86.cp
}
-@@ -376,6 +387,14 @@ frame frame::sender_for_compiled_frame(R
+@@ -376,6 +387,14 @@
intptr_t *saved_fp = (intptr_t*)*(sender_sp - frame::sender_sp_offset);
@@ -50,7 +50,7 @@ diff --git a/src/cpu/x86/vm/frame_x86.cp
if (map->update_map()) {
// Tell GC to use argument oopmaps for some runtime stubs that need it.
// For C1, the runtime stub might not have oop maps, so set this flag
-@@ -400,7 +419,7 @@ frame frame::sender_for_compiled_frame(R
+@@ -400,7 +419,7 @@
}
assert(sender_sp != sp(), "must have changed");
@@ -62,7 +62,7 @@ diff --git a/src/cpu/x86/vm/templateInte
diff --git a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
--- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
+++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
-@@ -1489,7 +1489,10 @@ int AbstractInterpreter::layout_activati
+@@ -1489,7 +1489,10 @@
if (interpreter_frame != NULL) {
#ifdef ASSERT
@@ -77,7 +77,7 @@ diff --git a/src/cpu/x86/vm/x86_32.ad b/
diff --git a/src/cpu/x86/vm/x86_32.ad b/src/cpu/x86/vm/x86_32.ad
--- a/src/cpu/x86/vm/x86_32.ad
+++ b/src/cpu/x86/vm/x86_32.ad
-@@ -268,22 +268,36 @@ static jlong *double_signmask_pool = dou
+@@ -268,22 +268,36 @@
static jlong *float_signflip_pool = double_quadword(&fp_signmask_pool[3*2], CONST64(0x8000000080000000), CONST64(0x8000000080000000));
static jlong *double_signflip_pool = double_quadword(&fp_signmask_pool[4*2], CONST64(0x8000000000000000), CONST64(0x8000000000000000));
@@ -117,7 +117,7 @@ diff --git a/src/cpu/x86/vm/x86_32.ad b/
}
// Indicate if the safepoint node needs the polling page as an input.
-@@ -299,8 +313,16 @@ bool SafePointNode::needs_polling_addres
+@@ -299,8 +313,16 @@
// The address of the call instruction needs to be 4-byte aligned to
// ensure that it does not span a cache line so that it can be patched.
int CallStaticJavaDirectNode::compute_padding(int current_offset) const {
@@ -136,7 +136,7 @@ diff --git a/src/cpu/x86/vm/x86_32.ad b/
current_offset += 1; // skip call opcode byte
return round_to(current_offset, alignment_required()) - current_offset;
}
-@@ -308,8 +330,7 @@ int CallStaticJavaDirectNode::compute_pa
+@@ -308,8 +330,7 @@
// The address of the call instruction needs to be 4-byte aligned to
// ensure that it does not span a cache line so that it can be patched.
int CallDynamicJavaDirectNode::compute_padding(int current_offset) const {
@@ -146,7 +146,7 @@ diff --git a/src/cpu/x86/vm/x86_32.ad b/
current_offset += 5; // skip MOV instruction
current_offset += 1; // skip call opcode byte
return round_to(current_offset, alignment_required()) - current_offset;
-@@ -1765,10 +1786,13 @@ encode %{
+@@ -1765,10 +1786,13 @@
enc_class pre_call_FPU %{
// If method sets FPU control word restore it here
@@ -160,7 +160,7 @@ diff --git a/src/cpu/x86/vm/x86_32.ad b/
%}
enc_class post_call_FPU %{
-@@ -1779,6 +1803,21 @@ encode %{
+@@ -1779,6 +1803,21 @@
}
%}
@@ -182,7 +182,7 @@ diff --git a/src/cpu/x86/vm/x86_32.ad b/
enc_class Java_Static_Call (method meth) %{ // JAVA STATIC CALL
// CALL to fixup routine. Fixup routine uses ScopeDesc info to determine
// who we intended to call.
-@@ -13495,6 +13534,7 @@ instruct cmovXX_reg_LEGT(cmpOp_commute c
+@@ -13495,6 +13534,7 @@
// compute_padding() functions will have to be adjusted.
instruct CallStaticJavaDirect(method meth) %{
match(CallStaticJava);
@@ -190,7 +190,7 @@ diff --git a/src/cpu/x86/vm/x86_32.ad b/
effect(USE meth);
ins_cost(300);
-@@ -13509,6 +13549,30 @@ instruct CallStaticJavaDirect(method met
+@@ -13509,6 +13549,30 @@
ins_alignment(4);
%}
@@ -225,7 +225,7 @@ new file mode 100644
new file mode 100644
--- /dev/null
+++ b/src/share/vm/ci/ciCPCache.cpp
-@@ -0,0 +1,56 @@
+@@ -0,0 +1,48 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -258,18 +258,10 @@ new file mode 100644
+// ------------------------------------------------------------------
+// ciCPCache::get_f1_offset
+size_t ciCPCache::get_f1_offset(int index) {
-+ int entry_index;
-+ // If the index is a secondary index, decode it.
-+ if (constantPoolCacheOopDesc::is_secondary_index(index))
-+ entry_index = constantPoolCacheOopDesc::decode_secondary_index(index);
-+ else
-+ entry_index = index;
-+
+ // Calculate the offset from the constantPoolCacheOop to the f1
+ // field.
+ ByteSize f1_offset =
-+ constantPoolCacheOopDesc::base_offset() +
-+ ConstantPoolCacheEntry::size_in_bytes() * entry_index +
++ constantPoolCacheOopDesc::entry_offset(index) +
+ ConstantPoolCacheEntry::f1_offset();
+
+ return in_bytes(f1_offset);
@@ -346,7 +338,7 @@ diff --git a/src/share/vm/ci/ciEnv.cpp b
diff --git a/src/share/vm/ci/ciEnv.cpp b/src/share/vm/ci/ciEnv.cpp
--- a/src/share/vm/ci/ciEnv.cpp
+++ b/src/share/vm/ci/ciEnv.cpp
-@@ -41,6 +41,7 @@ ciObjArrayKlassKlass* ciEnv::_obj_array
+@@ -41,6 +41,7 @@
ciInstanceKlass* ciEnv::_ArrayStoreException;
ciInstanceKlass* ciEnv::_Class;
ciInstanceKlass* ciEnv::_ClassCastException;
@@ -354,7 +346,7 @@ diff --git a/src/share/vm/ci/ciEnv.cpp b
ciInstanceKlass* ciEnv::_Object;
ciInstanceKlass* ciEnv::_Throwable;
ciInstanceKlass* ciEnv::_Thread;
-@@ -687,6 +688,30 @@ ciMethod* ciEnv::get_method_by_index_imp
+@@ -685,6 +686,28 @@
// ------------------------------------------------------------------
@@ -366,10 +358,8 @@ diff --git a/src/share/vm/ci/ciEnv.cpp b
+ constantPoolHandle cpool = accessor->get_instanceKlass()->constants();
+
+ // Get the CallSite from the constant pool cache.
-+ assert(constantPoolCacheOopDesc::is_secondary_index(index), "must be secondary index");
-+ int call_site_index = constantPoolCacheOopDesc::decode_secondary_index(index);
-+ ConstantPoolCacheEntry* cpc_entry = cpool->cache()->entry_at(call_site_index);
-+ assert(cpc_entry != NULL, "sanity");
++ ConstantPoolCacheEntry* cpc_entry = cpool->cache()->entry_at(index);
++ assert(cpc_entry != NULL && cpc_entry->is_secondary_entry(), "sanity");
+ Handle call_site = cpc_entry->f1();
+
+ // Get the methodOop from the CallSite.
@@ -385,7 +375,7 @@ diff --git a/src/share/vm/ci/ciEnv.cpp b
// ciEnv::get_instance_klass_for_declared_method_holder
ciInstanceKlass* ciEnv::get_instance_klass_for_declared_method_holder(ciKlass* method_holder) {
// For the case of <array>.clone(), the method holder can be a ciArrayKlass
-@@ -708,15 +733,18 @@ ciInstanceKlass* ciEnv::get_instance_kla
+@@ -706,15 +729,18 @@
}
@@ -410,7 +400,7 @@ diff --git a/src/share/vm/ci/ciEnv.hpp b
diff --git a/src/share/vm/ci/ciEnv.hpp b/src/share/vm/ci/ciEnv.hpp
--- a/src/share/vm/ci/ciEnv.hpp
+++ b/src/share/vm/ci/ciEnv.hpp
-@@ -65,6 +65,7 @@ private:
+@@ -65,6 +65,7 @@
static ciInstanceKlass* _ArrayStoreException;
static ciInstanceKlass* _Class;
static ciInstanceKlass* _ClassCastException;
@@ -418,7 +408,7 @@ diff --git a/src/share/vm/ci/ciEnv.hpp b
static ciInstanceKlass* _Object;
static ciInstanceKlass* _Throwable;
static ciInstanceKlass* _Thread;
-@@ -133,6 +134,8 @@ private:
+@@ -133,6 +134,8 @@
int field_index);
ciMethod* get_method_by_index_impl(ciInstanceKlass* loading_klass,
int method_index, Bytecodes::Code bc);
@@ -427,7 +417,7 @@ diff --git a/src/share/vm/ci/ciEnv.hpp b
// Helper methods
bool check_klass_accessibility(ciKlass* accessing_klass,
-@@ -269,6 +272,9 @@ public:
+@@ -269,6 +272,9 @@
ciInstanceKlass* ClassCastException_klass() {
return _ClassCastException;
}
@@ -440,7 +430,7 @@ diff --git a/src/share/vm/ci/ciMethod.cp
diff --git a/src/share/vm/ci/ciMethod.cpp b/src/share/vm/ci/ciMethod.cpp
--- a/src/share/vm/ci/ciMethod.cpp
+++ b/src/share/vm/ci/ciMethod.cpp
-@@ -677,7 +677,7 @@ int ciMethod::scale_count(int count, flo
+@@ -677,7 +677,7 @@
// ------------------------------------------------------------------
// invokedynamic support
//
@@ -452,7 +442,7 @@ diff --git a/src/share/vm/ci/ciMethod.hp
diff --git a/src/share/vm/ci/ciMethod.hpp b/src/share/vm/ci/ciMethod.hpp
--- a/src/share/vm/ci/ciMethod.hpp
+++ b/src/share/vm/ci/ciMethod.hpp
-@@ -207,7 +207,7 @@ class ciMethod : public ciObject {
+@@ -207,7 +207,7 @@
bool check_call(int refinfo_index, bool is_static) const;
void build_method_data(); // make sure it exists in the VM also
int scale_count(int count, float prof_factor = 1.); // make MDO count commensurate with IIC
@@ -464,7 +454,7 @@ diff --git a/src/share/vm/ci/ciObject.hp
diff --git a/src/share/vm/ci/ciObject.hpp b/src/share/vm/ci/ciObject.hpp
--- a/src/share/vm/ci/ciObject.hpp
+++ b/src/share/vm/ci/ciObject.hpp
-@@ -113,6 +113,7 @@ public:
+@@ -113,6 +113,7 @@
// What kind of ciObject is this?
virtual bool is_null_object() const { return false; }
@@ -472,7 +462,7 @@ diff --git a/src/share/vm/ci/ciObject.hp
virtual bool is_instance() { return false; }
virtual bool is_method() { return false; }
virtual bool is_method_data() { return false; }
-@@ -167,6 +168,10 @@ public:
+@@ -167,6 +168,10 @@
assert(is_null_object(), "bad cast");
return (ciNullObject*)this;
}
@@ -486,7 +476,7 @@ diff --git a/src/share/vm/ci/ciObjectFac
diff --git a/src/share/vm/ci/ciObjectFactory.cpp b/src/share/vm/ci/ciObjectFactory.cpp
--- a/src/share/vm/ci/ciObjectFactory.cpp
+++ b/src/share/vm/ci/ciObjectFactory.cpp
-@@ -153,6 +153,10 @@ void ciObjectFactory::init_shared_object
+@@ -153,6 +153,10 @@
ciEnv::_ClassCastException =
get(SystemDictionary::ClassCastException_klass())
->as_instance_klass();
@@ -497,7 +487,7 @@ diff --git a/src/share/vm/ci/ciObjectFac
ciEnv::_Object =
get(SystemDictionary::object_klass())
->as_instance_klass();
-@@ -329,6 +333,9 @@ ciObject* ciObjectFactory::create_new_ob
+@@ -329,6 +333,9 @@
} else if (o->is_typeArray()) {
typeArrayHandle h_ta(THREAD, (typeArrayOop)o);
return new (arena()) ciTypeArray(h_ta);
@@ -510,7 +500,7 @@ diff --git a/src/share/vm/ci/ciStreams.c
diff --git a/src/share/vm/ci/ciStreams.cpp b/src/share/vm/ci/ciStreams.cpp
--- a/src/share/vm/ci/ciStreams.cpp
+++ b/src/share/vm/ci/ciStreams.cpp
-@@ -321,7 +321,7 @@ int ciBytecodeStream::get_method_index()
+@@ -321,7 +321,7 @@
//
// If this is a method invocation bytecode, get the invoked method.
ciMethod* ciBytecodeStream::get_method(bool& will_link) {
@@ -519,7 +509,7 @@ diff --git a/src/share/vm/ci/ciStreams.c
will_link = m->is_loaded();
return m;
}
-@@ -339,9 +339,9 @@ ciMethod* ciBytecodeStream::get_method(b
+@@ -339,9 +339,9 @@
// for checking linkability when retrieving the associated method.
ciKlass* ciBytecodeStream::get_declared_method_holder() {
bool ignore;
@@ -531,7 +521,7 @@ diff --git a/src/share/vm/ci/ciStreams.c
return CURRENT_ENV->get_klass_by_index(_holder, get_method_holder_index(), ignore);
}
-@@ -370,3 +370,14 @@ int ciBytecodeStream::get_method_signatu
+@@ -370,3 +370,14 @@
int name_and_type_index = cpool->name_and_type_ref_index_at(method_index);
return cpool->signature_ref_index_at(name_and_type_index);
}
@@ -549,7 +539,7 @@ diff --git a/src/share/vm/ci/ciStreams.h
diff --git a/src/share/vm/ci/ciStreams.hpp b/src/share/vm/ci/ciStreams.hpp
--- a/src/share/vm/ci/ciStreams.hpp
+++ b/src/share/vm/ci/ciStreams.hpp
-@@ -232,6 +232,8 @@ public:
+@@ -232,6 +232,8 @@
int get_method_holder_index();
int get_method_signature_index();
@@ -561,7 +551,7 @@ diff --git a/src/share/vm/ci/ciTypeFlow.
diff --git a/src/share/vm/ci/ciTypeFlow.cpp b/src/share/vm/ci/ciTypeFlow.cpp
--- a/src/share/vm/ci/ciTypeFlow.cpp
+++ b/src/share/vm/ci/ciTypeFlow.cpp
-@@ -1292,8 +1292,8 @@ bool ciTypeFlow::StateVector::apply_one_
+@@ -1292,8 +1292,8 @@
case Bytecodes::_invokeinterface: do_invoke(str, true); break;
case Bytecodes::_invokespecial: do_invoke(str, true); break;
case Bytecodes::_invokestatic: do_invoke(str, false); break;
@@ -574,7 +564,7 @@ diff --git a/src/share/vm/classfile/syst
diff --git a/src/share/vm/classfile/systemDictionary.cpp b/src/share/vm/classfile/systemDictionary.cpp
--- a/src/share/vm/classfile/systemDictionary.cpp
+++ b/src/share/vm/classfile/systemDictionary.cpp
-@@ -1952,7 +1952,7 @@ void SystemDictionary::initialize_preloa
+@@ -1952,7 +1952,7 @@
scan = WKID(meth_group_end+1);
}
WKID indy_group_start = WK_KLASS_ENUM_NAME(Linkage_klass);
@@ -583,7 +573,7 @@ diff --git a/src/share/vm/classfile/syst
initialize_wk_klasses_until(indy_group_start, scan, CHECK);
if (EnableInvokeDynamic) {
initialize_wk_klasses_through(indy_group_start, scan, CHECK);
-@@ -2308,6 +2308,8 @@ methodOop SystemDictionary::find_method_
+@@ -2308,6 +2308,8 @@
SymbolPropertyEntry* spe = invoke_method_table()->find_entry(index, hash, signature);
if (spe == NULL || spe->property_oop() == NULL) {
// Must create lots of stuff here, but outside of the SystemDictionary lock.
@@ -595,7 +585,7 @@ diff --git a/src/share/vm/classfile/syst
diff --git a/src/share/vm/classfile/systemDictionary.hpp b/src/share/vm/classfile/systemDictionary.hpp
--- a/src/share/vm/classfile/systemDictionary.hpp
+++ b/src/share/vm/classfile/systemDictionary.hpp
-@@ -144,7 +144,7 @@ class SymbolPropertyTable;
+@@ -144,7 +144,7 @@
template(WrongMethodTypeException_klass, java_dyn_WrongMethodTypeException, Opt) \
template(Linkage_klass, java_dyn_Linkage, Opt) \
template(CallSite_klass, java_dyn_CallSite, Opt) \
@@ -619,7 +609,7 @@ diff --git a/src/share/vm/compiler/metho
diff --git a/src/share/vm/compiler/methodLiveness.cpp b/src/share/vm/compiler/methodLiveness.cpp
--- a/src/share/vm/compiler/methodLiveness.cpp
+++ b/src/share/vm/compiler/methodLiveness.cpp
-@@ -782,6 +782,7 @@ void MethodLiveness::BasicBlock::compute
+@@ -782,6 +782,7 @@
case Bytecodes::_invokespecial:
case Bytecodes::_invokestatic:
case Bytecodes::_invokeinterface:
@@ -630,7 +620,7 @@ diff --git a/src/share/vm/includeDB_comp
diff --git a/src/share/vm/includeDB_compiler2 b/src/share/vm/includeDB_compiler2
--- a/src/share/vm/includeDB_compiler2
+++ b/src/share/vm/includeDB_compiler2
-@@ -154,6 +154,7 @@ callGenerator.cpp
+@@ -154,6 +154,7 @@
callGenerator.cpp cfgnode.hpp
callGenerator.cpp compileLog.hpp
callGenerator.cpp connode.hpp
@@ -641,7 +631,7 @@ diff --git a/src/share/vm/includeDB_core
diff --git a/src/share/vm/includeDB_core b/src/share/vm/includeDB_core
--- a/src/share/vm/includeDB_core
+++ b/src/share/vm/includeDB_core
-@@ -532,6 +532,12 @@ ciConstantPoolCache.cpp
+@@ -532,6 +532,12 @@
ciConstantPoolCache.hpp growableArray.hpp
ciConstantPoolCache.hpp resourceArea.hpp
@@ -654,7 +644,7 @@ diff --git a/src/share/vm/includeDB_core
ciEnv.cpp allocation.inline.hpp
ciEnv.cpp ciConstant.hpp
ciEnv.cpp ciEnv.hpp
-@@ -755,6 +761,7 @@ ciObject.hpp
+@@ -755,6 +761,7 @@
ciObject.hpp jniHandles.hpp
ciObjectFactory.cpp allocation.inline.hpp
@@ -665,7 +655,7 @@ diff --git a/src/share/vm/interpreter/by
diff --git a/src/share/vm/interpreter/bytecode.cpp b/src/share/vm/interpreter/bytecode.cpp
--- a/src/share/vm/interpreter/bytecode.cpp
+++ b/src/share/vm/interpreter/bytecode.cpp
-@@ -102,7 +102,9 @@ methodHandle Bytecode_invoke::static_tar
+@@ -102,7 +102,9 @@
KlassHandle resolved_klass;
constantPoolHandle constants(THREAD, _method->constants());
@@ -679,7 +669,7 @@ diff --git a/src/share/vm/interpreter/by
diff --git a/src/share/vm/interpreter/bytecode.hpp b/src/share/vm/interpreter/bytecode.hpp
--- a/src/share/vm/interpreter/bytecode.hpp
+++ b/src/share/vm/interpreter/bytecode.hpp
-@@ -210,7 +210,8 @@ class Bytecode_invoke: public ResourceOb
+@@ -210,7 +210,8 @@
bool is_valid() const { return is_invokeinterface() ||
is_invokevirtual() ||
is_invokestatic() ||
@@ -692,7 +682,7 @@ diff --git a/src/share/vm/interpreter/by
diff --git a/src/share/vm/interpreter/bytecodes.cpp b/src/share/vm/interpreter/bytecodes.cpp
--- a/src/share/vm/interpreter/bytecodes.cpp
+++ b/src/share/vm/interpreter/bytecodes.cpp
-@@ -357,7 +357,7 @@ void Bytecodes::initialize() {
+@@ -357,7 +357,7 @@
def(_invokespecial , "invokespecial" , "bjj" , NULL , T_ILLEGAL, -1, true);
def(_invokestatic , "invokestatic" , "bjj" , NULL , T_ILLEGAL, 0, true);
def(_invokeinterface , "invokeinterface" , "bjj__", NULL , T_ILLEGAL, -1, true);
@@ -704,7 +694,7 @@ diff --git a/src/share/vm/interpreter/li
diff --git a/src/share/vm/interpreter/linkResolver.cpp b/src/share/vm/interpreter/linkResolver.cpp
--- a/src/share/vm/interpreter/linkResolver.cpp
+++ b/src/share/vm/interpreter/linkResolver.cpp
-@@ -82,6 +82,14 @@ void CallInfo::set_common(KlassHandle re
+@@ -82,6 +82,14 @@
// don't force compilation, resolve was on behalf of compiler
return;
}
@@ -719,7 +709,7 @@ diff --git a/src/share/vm/interpreter/li
CompileBroker::compile_method(selected_method, InvocationEntryBci,
methodHandle(), 0, "mustBeCompiled", CHECK);
}
-@@ -223,6 +231,21 @@ void LinkResolver::resolve_method(method
+@@ -223,6 +231,18 @@
resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, true, CHECK);
}
@@ -729,10 +719,7 @@ diff --git a/src/share/vm/interpreter/li
+
+ symbolHandle method_name = vmSymbolHandles::invoke_name();
+
-+ assert(constantPoolCacheOopDesc::is_secondary_index(index), "must be secondary index");
-+ int nt_index = pool->map_instruction_operand_to_index(index);
-+
-+ symbolHandle method_signature(THREAD, pool->nt_signature_ref_at(nt_index));
++ symbolHandle method_signature(THREAD, pool->signature_ref_at(index));
+ KlassHandle current_klass (THREAD, pool->pool_holder());
+
+ resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, true, CHECK);
@@ -744,7 +731,7 @@ diff --git a/src/share/vm/interpreter/li
diff --git a/src/share/vm/interpreter/linkResolver.hpp b/src/share/vm/interpreter/linkResolver.hpp
--- a/src/share/vm/interpreter/linkResolver.hpp
+++ b/src/share/vm/interpreter/linkResolver.hpp
-@@ -133,6 +133,7 @@ class LinkResolver: AllStatic {
+@@ -133,6 +133,7 @@
// static resolving for all calls except interface calls
static void resolve_method (methodHandle& method_result, KlassHandle& klass_result, constantPoolHandle pool, int index, TRAPS);
@@ -752,17 +739,6 @@ diff --git a/src/share/vm/interpreter/li
static void resolve_interface_method(methodHandle& method_result, KlassHandle& klass_result, constantPoolHandle pool, int index, TRAPS);
// runtime/static resolving for fields
-diff --git a/src/share/vm/oops/cpCacheOop.hpp b/src/share/vm/oops/cpCacheOop.hpp
---- a/src/share/vm/oops/cpCacheOop.hpp
-+++ b/src/share/vm/oops/cpCacheOop.hpp
-@@ -251,6 +251,7 @@ class ConstantPoolCacheEntry VALUE_OBJ_C
-
- // Code generation support
- static WordSize size() { return in_WordSize(sizeof(ConstantPoolCacheEntry) / HeapWordSize); }
-+ static ByteSize size_in_bytes() { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); }
- static ByteSize indices_offset() { return byte_offset_of(ConstantPoolCacheEntry, _indices); }
- static ByteSize f1_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f1); }
- static ByteSize f2_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f2); }
diff --git a/src/share/vm/opto/callGenerator.cpp b/src/share/vm/opto/callGenerator.cpp
--- a/src/share/vm/opto/callGenerator.cpp
+++ b/src/share/vm/opto/callGenerator.cpp
@@ -773,7 +749,7 @@ diff --git a/src/share/vm/opto/callGener
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
-@@ -127,6 +127,8 @@ JVMState* DirectCallGenerator::generate(
+@@ -127,6 +127,8 @@
}
// Mark the call node as virtual, sort of:
call->set_optimized_virtual(true);
@@ -782,7 +758,7 @@ diff --git a/src/share/vm/opto/callGener
}
kit.set_arguments_for_java_call(call);
kit.set_edges_for_java_call(call);
-@@ -135,6 +137,71 @@ JVMState* DirectCallGenerator::generate(
+@@ -135,6 +137,71 @@
return kit.transfer_exceptions_into_jvms();
}
@@ -854,7 +830,7 @@ diff --git a/src/share/vm/opto/callGener
class VirtualCallGenerator : public CallGenerator {
private:
int _vtable_index;
-@@ -149,8 +216,6 @@ public:
+@@ -149,8 +216,6 @@
virtual JVMState* generate(JVMState* jvms);
};
@@ -863,7 +839,7 @@ diff --git a/src/share/vm/opto/callGener
JVMState* VirtualCallGenerator::generate(JVMState* jvms) {
GraphKit kit(jvms);
Node* receiver = kit.argument(0);
-@@ -243,8 +308,14 @@ CallGenerator* CallGenerator::for_direct
+@@ -243,8 +308,14 @@
return new DirectCallGenerator(m);
}
@@ -881,7 +857,7 @@ diff --git a/src/share/vm/opto/callGener
diff --git a/src/share/vm/opto/callGenerator.hpp b/src/share/vm/opto/callGenerator.hpp
--- a/src/share/vm/opto/callGenerator.hpp
+++ b/src/share/vm/opto/callGenerator.hpp
-@@ -93,6 +93,7 @@ class CallGenerator : public ResourceObj
+@@ -93,6 +93,7 @@
// How to generate vanilla out-of-line call sites:
static CallGenerator* for_direct_call(ciMethod* m); // static, special
@@ -892,7 +868,7 @@ diff --git a/src/share/vm/opto/callnode.
diff --git a/src/share/vm/opto/callnode.hpp b/src/share/vm/opto/callnode.hpp
--- a/src/share/vm/opto/callnode.hpp
+++ b/src/share/vm/opto/callnode.hpp
-@@ -526,12 +526,15 @@ protected:
+@@ -526,12 +526,15 @@
virtual uint size_of() const; // Size is bigger
bool _optimized_virtual;
@@ -909,7 +885,7 @@ diff --git a/src/share/vm/opto/callnode.
{
init_class_id(Class_CallJava);
}
-@@ -541,6 +544,8 @@ public:
+@@ -541,6 +544,8 @@
void set_method(ciMethod *m) { _method = m; }
void set_optimized_virtual(bool f) { _optimized_virtual = f; }
bool is_optimized_virtual() const { return _optimized_virtual; }
@@ -921,7 +897,7 @@ diff --git a/src/share/vm/opto/doCall.cp
diff --git a/src/share/vm/opto/doCall.cpp b/src/share/vm/opto/doCall.cpp
--- a/src/share/vm/opto/doCall.cpp
+++ b/src/share/vm/opto/doCall.cpp
-@@ -222,6 +222,12 @@ CallGenerator* Compile::call_generator(c
+@@ -222,6 +222,12 @@
// Use a more generic tactic, like a simple call.
if (call_is_virtual) {
return CallGenerator::for_virtual_call(call_method, vtable_index);
@@ -934,7 +910,7 @@ diff --git a/src/share/vm/opto/doCall.cp
} else {
// Class Hierarchy Analysis or Type Profile reveals a unique target,
// or it is a static or special call.
-@@ -240,7 +246,7 @@ bool Parse::can_not_compile_call_site(ci
+@@ -240,7 +246,7 @@
// Interface classes can be loaded & linked and never get around to
// being initialized. Uncommon-trap for not-initialized static or
// v-calls. Let interface calls happen.
@@ -943,7 +919,7 @@ diff --git a/src/share/vm/opto/doCall.cp
if (!holder_klass->is_initialized() &&
!holder_klass->is_interface()) {
uncommon_trap(Deoptimization::Reason_uninitialized,
-@@ -248,14 +254,6 @@ bool Parse::can_not_compile_call_site(ci
+@@ -248,14 +254,6 @@
holder_klass);
return true;
}
@@ -958,7 +934,7 @@ diff --git a/src/share/vm/opto/doCall.cp
assert(dest_method->will_link(method()->holder(), klass, bc()), "dest_method: typeflow responsibility");
return false;
-@@ -274,6 +272,7 @@ void Parse::do_call() {
+@@ -274,6 +272,7 @@
bool is_virtual = bc() == Bytecodes::_invokevirtual;
bool is_virtual_or_interface = is_virtual || bc() == Bytecodes::_invokeinterface;
bool has_receiver = is_virtual_or_interface || bc() == Bytecodes::_invokespecial;
@@ -966,7 +942,7 @@ diff --git a/src/share/vm/opto/doCall.cp
// Find target being called
bool will_link;
-@@ -282,7 +281,8 @@ void Parse::do_call() {
+@@ -282,7 +281,8 @@
ciKlass* holder = iter().get_declared_method_holder();
ciInstanceKlass* klass = ciEnv::get_instance_klass_for_declared_method_holder(holder);
@@ -976,7 +952,7 @@ diff --git a/src/share/vm/opto/doCall.cp
// uncommon-trap when callee is unloaded, uninitialized or will not link
// bailout when too many arguments for register representation
-@@ -296,7 +296,7 @@ void Parse::do_call() {
+@@ -296,7 +296,7 @@
return;
}
assert(holder_klass->is_loaded(), "");
@@ -988,7 +964,7 @@ diff --git a/src/share/vm/opto/graphKit.
diff --git a/src/share/vm/opto/graphKit.cpp b/src/share/vm/opto/graphKit.cpp
--- a/src/share/vm/opto/graphKit.cpp
+++ b/src/share/vm/opto/graphKit.cpp
-@@ -950,14 +950,19 @@ bool GraphKit::compute_stack_effects(int
+@@ -950,14 +950,19 @@
case Bytecodes::_invokedynamic:
case Bytecodes::_invokeinterface:
{
@@ -1013,7 +989,7 @@ diff --git a/src/share/vm/opto/machnode.
diff --git a/src/share/vm/opto/machnode.hpp b/src/share/vm/opto/machnode.hpp
--- a/src/share/vm/opto/machnode.hpp
+++ b/src/share/vm/opto/machnode.hpp
-@@ -662,6 +662,7 @@ public:
+@@ -662,6 +662,7 @@
ciMethod* _method; // Method being direct called
int _bci; // Byte Code index of call byte code
bool _optimized_virtual; // Tells if node is a static call or an optimized virtual
@@ -1024,7 +1000,7 @@ diff --git a/src/share/vm/opto/matcher.c
diff --git a/src/share/vm/opto/matcher.cpp b/src/share/vm/opto/matcher.cpp
--- a/src/share/vm/opto/matcher.cpp
+++ b/src/share/vm/opto/matcher.cpp
-@@ -985,6 +985,7 @@ MachNode *Matcher::match_sfpt( SafePoint
+@@ -985,6 +985,7 @@
CallNode *call;
const TypeTuple *domain;
ciMethod* method = NULL;
@@ -1032,7 +1008,7 @@ diff --git a/src/share/vm/opto/matcher.c
if( sfpt->is_Call() ) {
call = sfpt->as_Call();
domain = call->tf()->domain();
-@@ -1009,6 +1010,8 @@ MachNode *Matcher::match_sfpt( SafePoint
+@@ -1009,6 +1010,8 @@
mcall_java->_method = method;
mcall_java->_bci = call_java->_bci;
mcall_java->_optimized_virtual = call_java->is_optimized_virtual();
@@ -1041,7 +1017,7 @@ diff --git a/src/share/vm/opto/matcher.c
if( mcall_java->is_MachCallStaticJava() )
mcall_java->as_MachCallStaticJava()->_name =
call_java->as_CallStaticJava()->_name;
-@@ -1122,6 +1125,15 @@ MachNode *Matcher::match_sfpt( SafePoint
+@@ -1122,6 +1125,15 @@
mcall->_argsize = out_arg_limit_per_call - begin_out_arg_area;
}
@@ -1060,7 +1036,7 @@ diff --git a/src/share/vm/opto/type.cpp
diff --git a/src/share/vm/opto/type.cpp b/src/share/vm/opto/type.cpp
--- a/src/share/vm/opto/type.cpp
+++ b/src/share/vm/opto/type.cpp
-@@ -2391,7 +2391,7 @@ const TypeOopPtr* TypeOopPtr::make_from_
+@@ -2391,7 +2391,7 @@
//------------------------------make_from_constant-----------------------------
// Make a java pointer from an oop constant
const TypeOopPtr* TypeOopPtr::make_from_constant(ciObject* o) {
@@ -1069,7 +1045,7 @@ diff --git a/src/share/vm/opto/type.cpp
// Treat much like a typeArray of bytes, like below, but fake the type...
assert(o->has_encoding(), "must be a perm space object");
const Type* etype = (Type*)get_const_basic_type(T_BYTE);
-@@ -3903,7 +3903,7 @@ const TypeFunc *TypeFunc::make(ciMethod*
+@@ -3903,7 +3903,7 @@
const TypeFunc* tf = C->last_tf(method); // check cache
if (tf != NULL) return tf; // The hit rate here is almost 50%.
const TypeTuple *domain;
@@ -1081,7 +1057,7 @@ diff --git a/src/share/vm/runtime/shared
diff --git a/src/share/vm/runtime/sharedRuntime.cpp b/src/share/vm/runtime/sharedRuntime.cpp
--- a/src/share/vm/runtime/sharedRuntime.cpp
+++ b/src/share/vm/runtime/sharedRuntime.cpp
-@@ -801,7 +801,7 @@ Handle SharedRuntime::find_callee_info_h
+@@ -801,7 +801,7 @@
#ifdef ASSERT
// Check that the receiver klass is of the right subtype and that it is initialized for virtual calls
@@ -1093,7 +1069,7 @@ diff --git a/src/share/vm/runtime/thread
diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp
--- a/src/share/vm/runtime/thread.cpp
+++ b/src/share/vm/runtime/thread.cpp
-@@ -3050,6 +3050,12 @@ jint Threads::create_vm(JavaVMInitArgs*
+@@ -3050,6 +3050,12 @@
warning("java.lang.ArithmeticException has not been initialized");
warning("java.lang.StackOverflowError has not been initialized");
}
--- a/indy.patch Sat Jul 04 00:12:52 2009 -0700
+++ b/indy.patch Sat Jul 04 04:02:22 2009 -0700
@@ -3,7 +3,7 @@ diff --git a/src/cpu/sparc/vm/templateIn
diff --git a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp
--- a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp
+++ b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp
-@@ -150,8 +150,7 @@ address TemplateInterpreterGenerator::ge
+@@ -150,8 +150,7 @@
}
@@ -16,7 +16,7 @@ diff --git a/src/cpu/x86/vm/templateInte
diff --git a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
--- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
+++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp
-@@ -156,15 +156,8 @@ address TemplateInterpreterGenerator::ge
+@@ -156,15 +156,8 @@
}
@@ -33,7 +33,7 @@ diff --git a/src/cpu/x86/vm/templateInte
Label interpreter_entry;
address compiled_entry = __ pc();
-@@ -217,46 +210,6 @@ address TemplateInterpreterGenerator::ge
+@@ -217,46 +210,6 @@
__ restore_bcp();
__ restore_locals();
@@ -80,7 +80,7 @@ diff --git a/src/cpu/x86/vm/templateInte
Label L_got_cache, L_giant_index;
if (EnableInvokeDynamic) {
__ cmpb(Address(rsi, 0), Bytecodes::_invokedynamic);
-@@ -264,32 +217,6 @@ address TemplateInterpreterGenerator::ge
+@@ -264,32 +217,6 @@
}
__ get_cache_and_index_at_bcp(rbx, rcx, 1, false);
__ bind(L_got_cache);
@@ -113,7 +113,7 @@ diff --git a/src/cpu/x86/vm/templateInte
__ movl(rbx, Address(rbx, rcx,
Address::times_ptr, constantPoolCacheOopDesc::base_offset() +
ConstantPoolCacheEntry::flags_offset()));
-@@ -302,14 +229,6 @@ address TemplateInterpreterGenerator::ge
+@@ -302,14 +229,6 @@
__ bind(L_giant_index);
__ get_cache_and_index_at_bcp(rbx, rcx, 1, true);
__ jmp(L_got_cache);
@@ -131,7 +131,7 @@ diff --git a/src/cpu/x86/vm/templateInte
diff --git a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp
--- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp
+++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp
-@@ -166,8 +166,7 @@ address TemplateInterpreterGenerator::ge
+@@ -166,8 +166,7 @@
address TemplateInterpreterGenerator::generate_return_entry_for(TosState state,
@@ -144,7 +144,7 @@ diff --git a/src/cpu/x86/vm/templateTabl
diff --git a/src/cpu/x86/vm/templateTable_x86_32.cpp b/src/cpu/x86/vm/templateTable_x86_32.cpp
--- a/src/cpu/x86/vm/templateTable_x86_32.cpp
+++ b/src/cpu/x86/vm/templateTable_x86_32.cpp
-@@ -2890,9 +2890,6 @@ void TemplateTable::count_calls(Register
+@@ -2890,9 +2890,6 @@
void TemplateTable::prepare_invoke(Register method, Register index, int byte_no) {
@@ -154,7 +154,7 @@ diff --git a/src/cpu/x86/vm/templateTabl
// determine flags
Bytecodes::Code code = bytecode();
const bool is_invokeinterface = code == Bytecodes::_invokeinterface;
-@@ -2907,8 +2904,6 @@ void TemplateTable::prepare_invoke(Regis
+@@ -2907,8 +2904,6 @@
const Register flags = rdx;
assert_different_registers(method, index, recv, flags);
@@ -163,7 +163,7 @@ diff --git a/src/cpu/x86/vm/templateTabl
// save 'interpreter return address'
__ save_bcp();
-@@ -2944,9 +2939,7 @@ void TemplateTable::prepare_invoke(Regis
+@@ -2944,9 +2939,7 @@
// load return address
{
address table_addr;
@@ -174,7 +174,7 @@ diff --git a/src/cpu/x86/vm/templateTabl
table_addr = (address)Interpreter::return_5_addrs_by_index_table();
else
table_addr = (address)Interpreter::return_3_addrs_by_index_table();
-@@ -3154,53 +3147,10 @@ void TemplateTable::invokedynamic(int by
+@@ -3154,53 +3147,10 @@
}
Label handle_unlinked_site;
@@ -230,10 +230,25 @@ diff --git a/src/cpu/x86/vm/templateTabl
}
//----------------------------------------------------------------------------------------------------
+diff --git a/src/share/vm/ci/ciEnv.cpp b/src/share/vm/ci/ciEnv.cpp
+--- a/src/share/vm/ci/ciEnv.cpp
++++ b/src/share/vm/ci/ciEnv.cpp
+@@ -662,10 +662,8 @@
+ ciInstanceKlass* declared_holder = get_instance_klass_for_declared_method_holder(holder);
+
+ // Get the method's name and signature.
+- int nt_index = cpool->name_and_type_ref_index_at(index);
+- int sig_index = cpool->signature_ref_index_at(nt_index);
+ symbolOop name_sym = cpool->name_ref_at(index);
+- symbolOop sig_sym = cpool->symbol_at(sig_index);
++ symbolOop sig_sym = cpool->signature_ref_at(index);
+
+ if (holder_is_accessible) { // Our declared holder is loaded.
+ instanceKlass* lookup = declared_holder->get_instanceKlass();
diff --git a/src/share/vm/classfile/javaClasses.cpp b/src/share/vm/classfile/javaClasses.cpp
--- a/src/share/vm/classfile/javaClasses.cpp
+++ b/src/share/vm/classfile/javaClasses.cpp
-@@ -2430,15 +2430,15 @@ oop java_dyn_MethodTypeForm::erasedType(
+@@ -2430,15 +2430,15 @@
}
@@ -255,7 +270,7 @@ diff --git a/src/share/vm/classfile/java
if (k != NULL) {
compute_offset(_type_offset, k, vmSymbols::type_name(), vmSymbols::java_dyn_MethodType_signature(), true);
compute_offset(_target_offset, k, vmSymbols::target_name(), vmSymbols::java_dyn_MethodHandle_signature(), true);
-@@ -2446,23 +2446,23 @@ void sun_dyn_CallSiteImpl::compute_offse
+@@ -2446,23 +2446,23 @@
}
}
@@ -284,7 +299,7 @@ diff --git a/src/share/vm/classfile/java
site->obj_field_put(_vmmethod_offset, ref);
}
-@@ -2811,7 +2811,7 @@ void JavaClasses::compute_offsets() {
+@@ -2811,7 +2811,7 @@
java_dyn_MethodTypeForm::compute_offsets();
}
if (EnableInvokeDynamic) {
@@ -296,7 +311,7 @@ diff --git a/src/share/vm/classfile/java
diff --git a/src/share/vm/classfile/javaClasses.hpp b/src/share/vm/classfile/javaClasses.hpp
--- a/src/share/vm/classfile/javaClasses.hpp
+++ b/src/share/vm/classfile/javaClasses.hpp
-@@ -1061,9 +1061,9 @@ class java_dyn_MethodTypeForm: AllStatic
+@@ -1061,9 +1061,9 @@
};
@@ -311,7 +326,7 @@ diff --git a/src/share/vm/classfile/syst
diff --git a/src/share/vm/classfile/systemDictionary.cpp b/src/share/vm/classfile/systemDictionary.cpp
--- a/src/share/vm/classfile/systemDictionary.cpp
+++ b/src/share/vm/classfile/systemDictionary.cpp
-@@ -2386,7 +2386,7 @@ Handle SystemDictionary::make_dynamic_ca
+@@ -2386,7 +2386,7 @@
methodHandle mh_invdyn,
TRAPS) {
Handle empty;
@@ -320,7 +335,7 @@ diff --git a/src/share/vm/classfile/syst
oop name_str_oop = StringTable::intern(name(), CHECK_(empty)); // not a handle!
JavaCallArguments args(Handle(THREAD, caller->java_mirror()));
args.push_oop(name_str_oop);
-@@ -2395,11 +2395,11 @@ Handle SystemDictionary::make_dynamic_ca
+@@ -2395,11 +2395,11 @@
args.push_int(caller_bci);
JavaValue result(T_OBJECT);
JavaCalls::call_static(&result,
@@ -337,7 +352,7 @@ diff --git a/src/share/vm/classfile/syst
diff --git a/src/share/vm/classfile/systemDictionary.hpp b/src/share/vm/classfile/systemDictionary.hpp
--- a/src/share/vm/classfile/systemDictionary.hpp
+++ b/src/share/vm/classfile/systemDictionary.hpp
-@@ -144,7 +144,6 @@ class SymbolPropertyTable;
+@@ -144,7 +144,6 @@
template(WrongMethodTypeException_klass, java_dyn_WrongMethodTypeException, Opt) \
template(Linkage_klass, java_dyn_Linkage, Opt) \
template(CallSite_klass, java_dyn_CallSite, Opt) \
@@ -345,6 +360,29 @@ diff --git a/src/share/vm/classfile/syst
template(Dynamic_klass, java_dyn_Dynamic, Opt) \
/* Note: MethodHandle must be first, and Dynamic last in group */ \
\
+diff --git a/src/share/vm/classfile/verifier.cpp b/src/share/vm/classfile/verifier.cpp
+--- a/src/share/vm/classfile/verifier.cpp
++++ b/src/share/vm/classfile/verifier.cpp
+@@ -1902,17 +1902,8 @@
+ verify_cp_type(index, cp, types, CHECK_VERIFY(this));
+
+ // Get method name and signature
+- symbolHandle method_name;
+- symbolHandle method_sig;
+- if (opcode == Bytecodes::_invokedynamic) {
+- int name_index = cp->name_ref_index_at(index);
+- int sig_index = cp->signature_ref_index_at(index);
+- method_name = symbolHandle(THREAD, cp->symbol_at(name_index));
+- method_sig = symbolHandle(THREAD, cp->symbol_at(sig_index));
+- } else {
+- method_name = symbolHandle(THREAD, cp->name_ref_at(index));
+- method_sig = symbolHandle(THREAD, cp->signature_ref_at(index));
+- }
++ symbolHandle method_name(THREAD, cp->name_ref_at(index));
++ symbolHandle method_sig(THREAD, cp->signature_ref_at(index));
+
+ if (!SignatureVerifier::is_valid_method_signature(method_sig)) {
+ class_format_error(
diff --git a/src/share/vm/classfile/vmSymbols.hpp b/src/share/vm/classfile/vmSymbols.hpp
--- a/src/share/vm/classfile/vmSymbols.hpp
+++ b/src/share/vm/classfile/vmSymbols.hpp
@@ -360,10 +398,21 @@ diff --git a/src/share/vm/classfile/vmSy
template(makeSite_signature, "(Ljava/lang/Class;Ljava/lang/String;Ljava/dyn/MethodType;II)Ljava/dyn/CallSite;") \
template(findBootstrapMethod_name, "findBootstrapMethod") \
template(findBootstrapMethod_signature, "(Ljava/lang/Class;Ljava/lang/Class;)Ljava/dyn/MethodHandle;") \
+diff --git a/src/share/vm/includeDB_core b/src/share/vm/includeDB_core
+--- a/src/share/vm/includeDB_core
++++ b/src/share/vm/includeDB_core
+@@ -1293,6 +1293,7 @@
+ cpCacheOop.cpp markSweep.inline.hpp
+ cpCacheOop.cpp objArrayOop.hpp
+ cpCacheOop.cpp oop.inline.hpp
++cpCacheOop.cpp rewriter.hpp
+ cpCacheOop.cpp universe.inline.hpp
+
+ cpCacheOop.hpp allocation.hpp
diff --git a/src/share/vm/interpreter/bytecodeTracer.cpp b/src/share/vm/interpreter/bytecodeTracer.cpp
--- a/src/share/vm/interpreter/bytecodeTracer.cpp
+++ b/src/share/vm/interpreter/bytecodeTracer.cpp
-@@ -282,18 +282,24 @@ void BytecodePrinter::print_field_or_met
+@@ -282,18 +282,21 @@
constantPoolOop constants = method()->constants();
constantTag tag = constants->tag_at(i);
@@ -373,10 +422,7 @@ diff --git a/src/share/vm/interpreter/by
case JVM_CONSTANT_InterfaceMethodref:
case JVM_CONSTANT_Methodref:
case JVM_CONSTANT_Fieldref:
-+ nt_index = constants->uncached_name_and_type_ref_index_at(i);
-+ break;
+ case JVM_CONSTANT_NameAndType:
-+ nt_index = i;
break;
default:
st->print_cr(" bad tag=%d at %d", tag.value(), i);
@@ -385,15 +431,39 @@ diff --git a/src/share/vm/interpreter/by
- symbolOop name = constants->name_ref_at(orig_i);
- symbolOop signature = constants->signature_ref_at(orig_i);
-+ symbolOop name = constants->nt_name_ref_at(nt_index);
-+ symbolOop signature = constants->nt_signature_ref_at(nt_index);
++ symbolOop name = constants->uncached_name_ref_at(i);
++ symbolOop signature = constants->uncached_signature_ref_at(i);
st->print_cr(" %d <%s> <%s> ", i, name->as_C_string(), signature->as_C_string());
}
+diff --git a/src/share/vm/interpreter/interpreter.cpp b/src/share/vm/interpreter/interpreter.cpp
+--- a/src/share/vm/interpreter/interpreter.cpp
++++ b/src/share/vm/interpreter/interpreter.cpp
+@@ -371,6 +371,20 @@
+ break;
+ }
+
++ case Bytecodes::_invokedynamic: {
++ Thread *thread = Thread::current();
++ ResourceMark rm(thread);
++ methodHandle mh(thread, method);
++ type = Bytecode_invoke_at(mh, bci)->result_type(thread);
++ // since the cache entry might not be initialized:
++ // (NOT needed for the old calling convension)
++ if (!is_top_frame) {
++ int index = Bytes::get_native_u4(bcp+1);
++ method->constants()->cache()->entry_at(index)->set_parameter_size(callee_parameters);
++ }
++ break;
++ }
++
+ case Bytecodes::_ldc :
+ type = constant_pool_type( method, *(bcp+1) );
+ break;
diff --git a/src/share/vm/interpreter/interpreterRuntime.cpp b/src/share/vm/interpreter/interpreterRuntime.cpp
--- a/src/share/vm/interpreter/interpreterRuntime.cpp
+++ b/src/share/vm/interpreter/interpreterRuntime.cpp
-@@ -681,7 +681,7 @@ IRT_ENTRY(void, InterpreterRuntime::reso
+@@ -681,7 +681,7 @@
IRT_END
@@ -402,7 +472,48 @@ diff --git a/src/share/vm/interpreter/in
IRT_ENTRY(void, InterpreterRuntime::resolve_invokedynamic(JavaThread* thread)) {
ResourceMark rm(thread);
-@@ -758,56 +758,6 @@ IRT_ENTRY(void, InterpreterRuntime::reso
+@@ -708,21 +708,16 @@
+ constantPoolHandle pool(thread, caller_method->constants());
+ pool->set_invokedynamic(); // mark header to flag active call sites
+
+- int raw_index = four_byte_index(thread);
+- assert(constantPoolCacheOopDesc::is_secondary_index(raw_index), "invokedynamic indexes marked specially");
+-
+- // there are two CPC entries that are of interest:
+- int site_index = constantPoolCacheOopDesc::decode_secondary_index(raw_index);
+- int main_index = pool->cache()->entry_at(site_index)->main_entry_index();
+- // and there is one CP entry, a NameAndType:
+- int nt_index = pool->map_instruction_operand_to_index(raw_index);
++ int site_index = four_byte_index(thread);
++ // there is a second CPC entries that is of interest; it caches signature info:
++ int main_index = pool->cache()->secondary_entry_at(site_index)->main_entry_index();
+
+ // first resolve the signature to a MH.invoke methodOop
+ if (!pool->cache()->entry_at(main_index)->is_resolved(bytecode)) {
+ JvmtiHideSingleStepping jhss(thread);
+ CallInfo info;
+ LinkResolver::resolve_invoke(info, Handle(), pool,
+- raw_index, bytecode, CHECK);
++ site_index, bytecode, CHECK);
+ // The main entry corresponds to a JVM_CONSTANT_NameAndType, and serves
+ // as a common reference point for all invokedynamic call sites with
+ // that exact call descriptor. We will link it in the CP cache exactly
+@@ -741,7 +736,7 @@
+ assert(mh_invdyn.not_null() && mh_invdyn->is_method() && mh_invdyn->is_method_handle_invoke(),
+ "correct result from LinkResolver::resolve_invokedynamic");
+
+- symbolHandle call_site_name(THREAD, pool->nt_name_ref_at(nt_index));
++ symbolHandle call_site_name(THREAD, pool->name_ref_at(site_index));
+ Handle call_site
+ = SystemDictionary::make_dynamic_call_site(caller_method->method_holder(),
+ caller_method->method_idnum(),
+@@ -753,61 +748,11 @@
+ // In the secondary entry, the f1 field is the call site, and the f2 (index)
+ // field is some data about the invoke site.
+ int extra_data = 0;
+- pool->cache()->entry_at(site_index)->set_dynamic_call(call_site(), extra_data);
++ pool->cache()->secondary_entry_at(site_index)->set_dynamic_call(call_site(), extra_data);
+ }
IRT_END
@@ -462,7 +573,7 @@ diff --git a/src/share/vm/interpreter/in
diff --git a/src/share/vm/interpreter/interpreterRuntime.hpp b/src/share/vm/interpreter/interpreterRuntime.hpp
--- a/src/share/vm/interpreter/interpreterRuntime.hpp
+++ b/src/share/vm/interpreter/interpreterRuntime.hpp
-@@ -88,7 +88,6 @@ class InterpreterRuntime: AllStatic {
+@@ -88,7 +88,6 @@
// Calls
static void resolve_invoke (JavaThread* thread, Bytecodes::Code bytecode);
static void resolve_invokedynamic(JavaThread* thread);
@@ -470,10 +581,96 @@ diff --git a/src/share/vm/interpreter/in
// Breakpoints
static void _breakpoint(JavaThread* thread, methodOopDesc* method, address bcp);
+diff --git a/src/share/vm/interpreter/linkResolver.cpp b/src/share/vm/interpreter/linkResolver.cpp
+--- a/src/share/vm/interpreter/linkResolver.cpp
++++ b/src/share/vm/interpreter/linkResolver.cpp
+@@ -1015,11 +1015,8 @@
+
+ // This guy is reached from InterpreterRuntime::resolve_invokedynamic.
+
+- assert(constantPoolCacheOopDesc::is_secondary_index(raw_index), "must be secondary index");
+- int nt_index = pool->map_instruction_operand_to_index(raw_index);
+-
+ // At this point, we only need the signature, and can ignore the name.
+- symbolHandle method_signature(THREAD, pool->nt_signature_ref_at(nt_index));
++ symbolHandle method_signature(THREAD, pool->signature_ref_at(raw_index)); // raw_index works directly
+ symbolHandle method_name = vmSymbolHandles::invoke_name();
+ KlassHandle resolved_klass = SystemDictionaryHandles::MethodHandle_klass();
+
+diff --git a/src/share/vm/interpreter/rewriter.cpp b/src/share/vm/interpreter/rewriter.cpp
+--- a/src/share/vm/interpreter/rewriter.cpp
++++ b/src/share/vm/interpreter/rewriter.cpp
+@@ -48,16 +48,6 @@
+ }
+
+
+-int Rewriter::add_extra_cp_cache_entry(int main_entry) {
+- // Hack: We put it on the map as an encoded value.
+- // The only place that consumes this is ConstantPoolCacheEntry::set_initial_state
+- int encoded = constantPoolCacheOopDesc::encode_secondary_index(main_entry);
+- int plain_secondary_index = _cp_cache_map.append(encoded);
+- return constantPoolCacheOopDesc::encode_secondary_index(plain_secondary_index);
+-}
+-
+-
+-
+ // Creates a constant pool cache given a CPC map
+ // This creates the constant pool cache initially in a state
+ // that is unsafe for concurrent GC processing but sets it to
+@@ -127,7 +117,7 @@
+ assert(p[-1] == Bytecodes::_invokedynamic, "");
+ int cp_index = Bytes::get_Java_u2(p);
+ int cpc = maybe_add_cp_cache_entry(cp_index); // add lazily
+- int cpc2 = add_extra_cp_cache_entry(cpc);
++ int cpc2 = add_secondary_cp_cache_entry(cpc);
+
+ // Replace the trailing four bytes with a CPC index for the dynamic
+ // call site. Unlike other CPC entries, there is one per bytecode,
+@@ -137,7 +127,7 @@
+ // all these entries. That is the main reason invokedynamic
+ // must have a five-byte instruction format. (Of course, other JVM
+ // implementations can use the bytes for other purposes.)
+- Bytes::put_native_u4(p, cpc2);
++ Bytes::put_native_u4(p, constantPoolCacheOopDesc::encode_secondary_index(cpc2));
+ // Note: We use native_u4 format exclusively for 4-byte indexes.
+ }
+
+diff --git a/src/share/vm/interpreter/rewriter.hpp b/src/share/vm/interpreter/rewriter.hpp
+--- a/src/share/vm/interpreter/rewriter.hpp
++++ b/src/share/vm/interpreter/rewriter.hpp
+@@ -43,13 +43,18 @@
+ bool has_cp_cache(int i) { return (uint)i < (uint)_cp_map.length() && _cp_map[i] >= 0; }
+ int maybe_add_cp_cache_entry(int i) { return has_cp_cache(i) ? _cp_map[i] : add_cp_cache_entry(i); }
+ int add_cp_cache_entry(int cp_index) {
++ assert((cp_index & _secondary_entry_tag) == 0, "bad tag");
+ assert(_cp_map[cp_index] == -1, "not twice on same cp_index");
+ int cache_index = _cp_cache_map.append(cp_index);
+ _cp_map.at_put(cp_index, cache_index);
+ assert(cp_entry_to_cp_cache(cp_index) == cache_index, "");
+ return cache_index;
+ }
+- int add_extra_cp_cache_entry(int main_entry);
++ int add_secondary_cp_cache_entry(int main_cpc_entry) {
++ assert(main_cpc_entry < _cp_cache_map.length(), "must be earlier CP cache entry");
++ int cache_index = _cp_cache_map.append(main_cpc_entry | _secondary_entry_tag);
++ return cache_index;
++ }
+
+ // All the work goes in here:
+ Rewriter(instanceKlassHandle klass, TRAPS);
+@@ -65,4 +70,8 @@
+ public:
+ // Driver routine:
+ static void rewrite(instanceKlassHandle klass, TRAPS);
++
++ enum {
++ _secondary_entry_tag = nth_bit(30)
++ };
+ };
diff --git a/src/share/vm/interpreter/templateInterpreter.cpp b/src/share/vm/interpreter/templateInterpreter.cpp
--- a/src/share/vm/interpreter/templateInterpreter.cpp
+++ b/src/share/vm/interpreter/templateInterpreter.cpp
-@@ -178,14 +178,12 @@ EntryPoint TemplateInterpreter::_trace_c
+@@ -178,14 +178,12 @@
#endif // !PRODUCT
EntryPoint TemplateInterpreter::_return_entry[TemplateInterpreter::number_of_return_entries];
EntryPoint TemplateInterpreter::_earlyret_entry;
@@ -488,7 +685,7 @@ diff --git a/src/share/vm/interpreter/te
DispatchTable TemplateInterpreter::_active_table;
DispatchTable TemplateInterpreter::_normal_table;
-@@ -253,22 +251,6 @@ void TemplateInterpreterGenerator::gener
+@@ -253,22 +251,6 @@
}
}
@@ -511,7 +708,7 @@ diff --git a/src/share/vm/interpreter/te
{ CodeletMark cm(_masm, "earlyret entry points");
Interpreter::_earlyret_entry =
EntryPoint(
-@@ -319,8 +301,6 @@ void TemplateInterpreterGenerator::gener
+@@ -319,8 +301,6 @@
int index = Interpreter::TosState_as_index(states[j]);
Interpreter::_return_3_addrs_by_index[index] = Interpreter::return_entry(states[j], 3);
Interpreter::_return_5_addrs_by_index[index] = Interpreter::return_entry(states[j], 5);
@@ -520,7 +717,7 @@ diff --git a/src/share/vm/interpreter/te
}
{ CodeletMark cm(_masm, "continuation entry points");
-@@ -547,18 +527,6 @@ address TemplateInterpreter::return_entr
+@@ -547,18 +527,6 @@
}
@@ -542,7 +739,7 @@ diff --git a/src/share/vm/interpreter/te
diff --git a/src/share/vm/interpreter/templateInterpreter.hpp b/src/share/vm/interpreter/templateInterpreter.hpp
--- a/src/share/vm/interpreter/templateInterpreter.hpp
+++ b/src/share/vm/interpreter/templateInterpreter.hpp
-@@ -110,14 +110,12 @@ class TemplateInterpreter: public Abstra
+@@ -110,14 +110,12 @@
#endif // !PRODUCT
static EntryPoint _return_entry[number_of_return_entries]; // entry points to return to from a call
static EntryPoint _earlyret_entry; // entry point to return early from a call
@@ -557,7 +754,7 @@ diff --git a/src/share/vm/interpreter/te
static DispatchTable _active_table; // the active dispatch table (used by the interpreter for dispatch)
static DispatchTable _normal_table; // the normal dispatch table (used to set the active table in normal mode)
-@@ -160,12 +158,10 @@ class TemplateInterpreter: public Abstra
+@@ -160,12 +158,10 @@
// Support for invokes
static address* return_3_addrs_by_index_table() { return _return_3_addrs_by_index; }
static address* return_5_addrs_by_index_table() { return _return_5_addrs_by_index; }
@@ -573,7 +770,7 @@ diff --git a/src/share/vm/interpreter/te
diff --git a/src/share/vm/interpreter/templateInterpreterGenerator.hpp b/src/share/vm/interpreter/templateInterpreterGenerator.hpp
--- a/src/share/vm/interpreter/templateInterpreterGenerator.hpp
+++ b/src/share/vm/interpreter/templateInterpreterGenerator.hpp
-@@ -51,10 +51,7 @@ class TemplateInterpreterGenerator: publ
+@@ -51,10 +51,7 @@
address generate_WrongMethodType_handler();
address generate_ArrayIndexOutOfBounds_handler(const char* name);
address generate_continuation_for(TosState state);
@@ -585,10 +782,150 @@ diff --git a/src/share/vm/interpreter/te
address generate_earlyret_entry_for(TosState state);
address generate_deopt_entry_for(TosState state, int step);
address generate_safept_entry_for(TosState state, address runtime_entry);
+diff --git a/src/share/vm/oops/constantPoolOop.cpp b/src/share/vm/oops/constantPoolOop.cpp
+--- a/src/share/vm/oops/constantPoolOop.cpp
++++ b/src/share/vm/oops/constantPoolOop.cpp
+@@ -262,25 +262,48 @@
+
+
+ int constantPoolOopDesc::impl_name_and_type_ref_index_at(int which, bool uncached) {
+- jint ref_index = field_or_method_at(which, uncached);
++ int i = which;
++ if (!uncached && cache() != NULL) {
++ if (constantPoolCacheOopDesc::is_secondary_index(which))
++ // Invokedynamic indexes are always processed in native order
++ // so there is no question of reading a native u2 in Java order here.
++ return cache()->main_entry_at(which)->constant_pool_index();
++ // change byte-ordering and go via cache
++ i = remap_instruction_operand_from_cache(which);
++ } else {
++ if (tag_at(which).is_name_and_type())
++ // invokedynamic index is a simple name-and-type
++ return which;
++ }
++ assert(tag_at(i).is_field_or_method(), "Corrupted constant pool");
++ jint ref_index = *int_at_addr(i);
+ return extract_high_short_from_int(ref_index);
+ }
+
+
+ int constantPoolOopDesc::impl_klass_ref_index_at(int which, bool uncached) {
+- jint ref_index = field_or_method_at(which, uncached);
++ guarantee(!constantPoolCacheOopDesc::is_secondary_index(which),
++ "an invokedynamic instruction does not have a klass");
++ int i = which;
++ if (!uncached && cache() != NULL) {
++ // change byte-ordering and go via cache
++ i = remap_instruction_operand_from_cache(which);
++ }
++ assert(tag_at(i).is_field_or_method(), "Corrupted constant pool");
++ jint ref_index = *int_at_addr(i);
+ return extract_low_short_from_int(ref_index);
+ }
+
+
+
+-int constantPoolOopDesc::map_instruction_operand_to_index(int operand) {
+- if (constantPoolCacheOopDesc::is_secondary_index(operand)) {
+- return cache()->main_entry_at(operand)->constant_pool_index();
+- }
++int constantPoolOopDesc::remap_instruction_operand_from_cache(int operand) {
++ // Operand was fetched by a stream using get_Java_u2, yet was stored
++ // by Rewriter::rewrite_member_reference in native order.
++ // So now we have to fix the damage by swapping back to native order.
+ assert((int)(u2)operand == operand, "clean u2");
+- int index = Bytes::swap_u2(operand);
+- return cache()->entry_at(index)->constant_pool_index();
++ int cpc_index = Bytes::swap_u2(operand);
++ int member_index = cache()->entry_at(cpc_index)->constant_pool_index();
++ return member_index;
+ }
+
+
+diff --git a/src/share/vm/oops/constantPoolOop.hpp b/src/share/vm/oops/constantPoolOop.hpp
+--- a/src/share/vm/oops/constantPoolOop.hpp
++++ b/src/share/vm/oops/constantPoolOop.hpp
+@@ -342,12 +342,14 @@
+ }
+
+ // The following methods (name/signature/klass_ref_at, klass_ref_at_noresolve,
+- // name_and_type_ref_index_at) all expect constant pool indices
+- // from the bytecodes to be passed in, which are actually potentially byte-swapped
+- // or rewritten constant pool cache indices. They all call map_instruction_operand_to_index.
+- int map_instruction_operand_to_index(int operand);
++ // name_and_type_ref_index_at) all expect to be passed indices obtained
++ // directly from the bytecode, and extracted according to java byte order.
++ // If the indices are meant to refer to fields or methods, they are
++ // actually potentially byte-swapped, rewritten constant pool cache indices.
++ // The routine remap_instruction_operand_from_cache manages the adjustment
++ // of these values back to constant pool indices.
+
+- // There are also "uncached" versions which do not map the operand index; see below.
++ // There are also "uncached" versions which do not adjust the operand index; see below.
+
+ // Lookup for entries consisting of (klass_index, name_and_type index)
+ klassOop klass_ref_at(int which, TRAPS);
+@@ -361,8 +363,6 @@
+ // Lookup for entries consisting of (name_index, signature_index)
+ int name_ref_index_at(int which_nt); // == low-order jshort of name_and_type_at(which_nt)
+ int signature_ref_index_at(int which_nt); // == high-order jshort of name_and_type_at(which_nt)
+- symbolOop nt_name_ref_at(int which_nt) { return symbol_at(name_ref_index_at(which_nt)); }
+- symbolOop nt_signature_ref_at(int which_nt) { return symbol_at(signature_ref_index_at(which_nt)); }
+
+ BasicType basic_type_for_signature_at(int which);
+
+@@ -425,18 +425,7 @@
+ int impl_klass_ref_index_at(int which, bool uncached);
+ int impl_name_and_type_ref_index_at(int which, bool uncached);
+
+- // Takes either a constant pool cache index in possibly byte-swapped
+- // byte order (which comes from the bytecodes after rewriting) or,
+- // if "uncached" is true, a vanilla constant pool index
+- jint field_or_method_at(int which, bool uncached) {
+- int i = which;
+- if (!uncached && cache() != NULL) {
+- // change byte-ordering and go via cache
+- i = map_instruction_operand_to_index(which);
+- }
+- assert(tag_at(i).is_field_or_method(), "Corrupted constant pool");
+- return *int_at_addr(i);
+- }
++ int remap_instruction_operand_from_cache(int operand);
+
+ // Used while constructing constant pool (only by ClassFileParser)
+ jint klass_index_at(int which) {
diff --git a/src/share/vm/oops/cpCacheOop.cpp b/src/share/vm/oops/cpCacheOop.cpp
--- a/src/share/vm/oops/cpCacheOop.cpp
+++ b/src/share/vm/oops/cpCacheOop.cpp
-@@ -223,10 +223,10 @@ void ConstantPoolCacheEntry::set_interfa
+@@ -28,21 +28,17 @@
+
+ // Implememtation of ConstantPoolCacheEntry
+
+-void ConstantPoolCacheEntry::set_initial_state(int index) {
+- if (constantPoolCacheOopDesc::is_secondary_index(index)) {
+- // Hack: The rewriter is trying to say that this entry itself
+- // will be a secondary entry.
+- int main_index = constantPoolCacheOopDesc::decode_secondary_index(index);
+- assert(0 <= main_index && main_index < 0x10000, "sanity check");
+- _indices = (main_index << 16);
+- assert(main_entry_index() == main_index, "");
+- return;
+- }
++void ConstantPoolCacheEntry::initialize_entry(int index) {
+ assert(0 < index && index < 0x10000, "sanity check");
+ _indices = index;
+ assert(constant_pool_index() == index, "");
+ }
+
++void ConstantPoolCacheEntry::initialize_secondary_entry(int main_index) {
++ assert(0 <= main_index && main_index < 0x10000, "sanity check");
++ _indices = (main_index << 16);
++ assert(main_entry_index() == main_index, "");
++}
+
+ int ConstantPoolCacheEntry::as_flags(TosState state, bool is_final,
+ bool is_vfinal, bool is_volatile,
+@@ -223,10 +219,10 @@
void ConstantPoolCacheEntry::set_dynamic_call(Handle call_site, int extra_data) {
@@ -601,10 +938,126 @@ diff --git a/src/share/vm/oops/cpCacheOo
param_size -= 1; // do not count MH.this; it is not stacked for invokedynamic
if (Atomic::cmpxchg_ptr(call_site(), &_f1, NULL) == NULL) {
// racing threads might be trying to install their own favorites
+@@ -439,7 +435,18 @@
+
+ void constantPoolCacheOopDesc::initialize(intArray& inverse_index_map) {
+ assert(inverse_index_map.length() == length(), "inverse index map must have same length as cache");
+- for (int i = 0; i < length(); i++) entry_at(i)->set_initial_state(inverse_index_map[i]);
++ for (int i = 0; i < length(); i++) {
++ ConstantPoolCacheEntry* e = entry_at(i);
++ int original_index = inverse_index_map[i];
++ if ((original_index & Rewriter::_secondary_entry_tag) != 0) {
++ int main_index = (original_index - Rewriter::_secondary_entry_tag);
++ assert(!entry_at(main_index)->is_secondary_entry(), "valid main index");
++ e->initialize_secondary_entry(main_index);
++ } else {
++ e->initialize_entry(original_index);
++ }
++ assert(entry_at(i) == e, "sanity");
++ }
+ }
+
+ // RedefineClasses() API support:
+diff --git a/src/share/vm/oops/cpCacheOop.hpp b/src/share/vm/oops/cpCacheOop.hpp
+--- a/src/share/vm/oops/cpCacheOop.hpp
++++ b/src/share/vm/oops/cpCacheOop.hpp
+@@ -154,7 +154,8 @@
+ };
+
+ // Initialization
+- void set_initial_state(int index); // sets entry to initial state
++ void initialize_entry(int original_index); // initialize primary entry
++ void initialize_secondary_entry(int main_index); // initialize secondary entry
+
+ void set_field( // sets entry to resolved field state
+ Bytecodes::Code get_code, // the bytecode used for reading the field
+@@ -251,6 +252,7 @@
+
+ // Code generation support
+ static WordSize size() { return in_WordSize(sizeof(ConstantPoolCacheEntry) / HeapWordSize); }
++ static ByteSize size_in_bytes() { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); }
+ static ByteSize indices_offset() { return byte_offset_of(ConstantPoolCacheEntry, _indices); }
+ static ByteSize f1_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f1); }
+ static ByteSize f2_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f2); }
+@@ -321,6 +323,7 @@
+ ConstantPoolCacheEntry* base() const { return (ConstantPoolCacheEntry*)((address)this + in_bytes(base_offset())); }
+
+ friend class constantPoolCacheKlass;
++ friend class ConstantPoolCacheEntry;
+
+ public:
+ // Initialization
+@@ -329,7 +332,8 @@
+ // Secondary indexes.
+ // They must look completely different from normal indexes.
+ // The main reason is that byte swapping is sometimes done on normal indexes.
+- // Also, it is helpful for debugging to tell the two apart.
++ // Also, some of the CP accessors do different things for secondary indexes.
++ // Finally, it is helpful for debugging to tell the two apart.
+ static bool is_secondary_index(int i) { return (i < 0); }
+ static int decode_secondary_index(int i) { assert(is_secondary_index(i), ""); return ~i; }
+ static int encode_secondary_index(int i) { assert(!is_secondary_index(i), ""); return ~i; }
+@@ -337,18 +341,35 @@
+ // Accessors
+ void set_constant_pool(constantPoolOop pool) { oop_store_without_check((oop*)&_constant_pool, (oop)pool); }
+ constantPoolOop constant_pool() const { return _constant_pool; }
+- ConstantPoolCacheEntry* entry_at(int i) const { assert(0 <= i && i < length(), "index out of bounds"); return base() + i; }
++ // Fetches the entry at the given index.
++ // The entry may be either primary or secondary.
++ // In either case the index must not be encoded or byte-swapped in any way.
++ ConstantPoolCacheEntry* entry_at(int i) const {
++ assert(0 <= i && i < length(), "index out of bounds");
++ return base() + i;
++ }
++ // Fetches the secondary entry referred to by index.
++ // The index may be a secondary index, and must not be byte-swapped.
++ ConstantPoolCacheEntry* secondary_entry_at(int i) const {
++ int raw_index = i;
++ if (is_secondary_index(i)) { // correct these on the fly
++ raw_index = decode_secondary_index(i);
++ }
++ assert(entry_at(raw_index)->is_secondary_entry(), "not a secondary entry");
++ return entry_at(raw_index);
++ }
++ // Given a primary or secondary index, fetch the corresponding primary entry.
++ // Indirect through the secondary entry, if the index is encoded as a secondary index.
++ // The index must not be byte-swapped.
+ ConstantPoolCacheEntry* main_entry_at(int i) const {
+- ConstantPoolCacheEntry* e;
++ int primary_index = i;
+ if (is_secondary_index(i)) {
+ // run through an extra level of indirection:
+- i = decode_secondary_index(i);
+- e = entry_at(i);
+- i = e->main_entry_index();
++ int raw_index = decode_secondary_index(i);
++ primary_index = entry_at(raw_index)->main_entry_index();
+ }
+- e = entry_at(i);
+- assert(!e->is_secondary_entry(), "only one level of indirection");
+- return e;
++ assert(!entry_at(primary_index)->is_secondary_entry(), "only one level of indirection");
++ return entry_at(primary_index);
+ }
+
+ // GC support
+@@ -359,6 +380,12 @@
+
+ // Code generation
+ static ByteSize base_offset() { return in_ByteSize(sizeof(constantPoolCacheOopDesc)); }
++ static ByteSize entry_offset(int raw_index) {
++ int index = raw_index;
++ if (is_secondary_index(raw_index))
++ index = decode_secondary_index(raw_index);
++ return (base_offset() + ConstantPoolCacheEntry::size_in_bytes() * index);
++ }
+
+ // RedefineClasses() API support:
+ // If any entry of this constantPoolCache points to any of
diff --git a/src/share/vm/oops/generateOopMap.cpp b/src/share/vm/oops/generateOopMap.cpp
--- a/src/share/vm/oops/generateOopMap.cpp
+++ b/src/share/vm/oops/generateOopMap.cpp
-@@ -1556,13 +1556,13 @@ void GenerateOopMap::interp1(BytecodeStr
+@@ -1556,13 +1556,13 @@
case Bytecodes::_getfield: do_field(true, false, itr->get_index_big(), itr->bci()); break;
case Bytecodes::_putfield: do_field(false, false, itr->get_index_big(), itr->bci()); break;
@@ -625,7 +1078,7 @@ diff --git a/src/share/vm/oops/generateO
case Bytecodes::_checkcast: do_checkcast(); break;
case Bytecodes::_arraylength:
case Bytecodes::_instanceof: pp(rCTS, vCTS); break;
-@@ -1900,11 +1900,17 @@ void GenerateOopMap::do_field(int is_get
+@@ -1900,11 +1900,9 @@
}
void GenerateOopMap::do_method(int is_static, int is_interface, int idx, int bci) {
@@ -636,22 +1089,41 @@ diff --git a/src/share/vm/oops/generateO
- symbolOop signature = cp->symbol_at(signatureIdx);
+ // Dig up signature for field in constant pool
+ constantPoolOop cp = _method->constants();
-+
-+ // invokedynamic has a secondary index.
-+ int nameAndTypeIdx;
-+ if (constantPoolCacheOopDesc::is_secondary_index(idx))
-+ nameAndTypeIdx = cp->map_instruction_operand_to_index(idx);
-+ else
-+ nameAndTypeIdx = cp->name_and_type_ref_index_at(idx);
-+
-+ symbolOop signature = cp->nt_signature_ref_at(nameAndTypeIdx);
++ symbolOop signature = cp->signature_ref_at(idx);
// Parse method signature
CellTypeState out[4];
+diff --git a/src/share/vm/prims/jvm.cpp b/src/share/vm/prims/jvm.cpp
+--- a/src/share/vm/prims/jvm.cpp
++++ b/src/share/vm/prims/jvm.cpp
+@@ -2221,10 +2221,8 @@
+ switch (cp->tag_at(cp_index).value()) {
+ case JVM_CONSTANT_InterfaceMethodref:
+ case JVM_CONSTANT_Methodref:
++ case JVM_CONSTANT_NameAndType: // for invokedynamic
+ return cp->uncached_name_ref_at(cp_index)->as_utf8();
+- case JVM_CONSTANT_NameAndType:
+- // for invokedynamic
+- return cp->nt_name_ref_at(cp_index)->as_utf8();
+ default:
+ fatal("JVM_GetCPMethodNameUTF: illegal constant");
+ }
+@@ -2241,10 +2239,8 @@
+ switch (cp->tag_at(cp_index).value()) {
+ case JVM_CONSTANT_InterfaceMethodref:
+ case JVM_CONSTANT_Methodref:
++ case JVM_CONSTANT_NameAndType: // for invokedynamic
+ return cp->uncached_signature_ref_at(cp_index)->as_utf8();
+- case JVM_CONSTANT_NameAndType:
+- // for invokedynamic
+- return cp->nt_signature_ref_at(cp_index)->as_utf8();
+ default:
+ fatal("JVM_GetCPMethodSignatureUTF: illegal constant");
+ }
diff --git a/src/share/vm/prims/methodHandles.cpp b/src/share/vm/prims/methodHandles.cpp
--- a/src/share/vm/prims/methodHandles.cpp
+++ b/src/share/vm/prims/methodHandles.cpp
-@@ -2346,9 +2346,9 @@ JVM_END
+@@ -2346,9 +2346,9 @@
JVM_ENTRY(void, MH_linkCallSite(JNIEnv *env, jobject igcls, jobject site_jh, jobject target_jh)) {
// No special action required, yet.
oop site_oop = JNIHandles::resolve(site_jh);
@@ -663,7 +1135,7 @@ diff --git a/src/share/vm/prims/methodHa
}
JVM_END
-@@ -2364,6 +2364,7 @@ JVM_END
+@@ -2364,6 +2364,7 @@
#define OBJ LANG"Object;"
#define CLS LANG"Class;"
#define STRG LANG"String;"
@@ -671,7 +1143,7 @@ diff --git a/src/share/vm/prims/methodHa
#define MT JDYN"MethodType;"
#define MH JDYN"MethodHandle;"
#define MHI IDYN"MethodHandleImpl;"
-@@ -2371,7 +2372,6 @@ JVM_END
+@@ -2371,7 +2372,6 @@
#define AMH IDYN"AdapterMethodHandle;"
#define BMH IDYN"BoundMethodHandle;"
#define DMH IDYN"DirectMethodHandle;"
@@ -679,7 +1151,7 @@ diff --git a/src/share/vm/prims/methodHa
#define CC (char*) /*cast a literal from (const char*)*/
#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f)
-@@ -2397,7 +2397,7 @@ static JNINativeMethod methods[] = {
+@@ -2397,7 +2397,7 @@
// More entry points specifically for EnableInvokeDynamic.
static JNINativeMethod methods2[] = {