--- a/indy.compiler.patch Tue Jun 30 17:35:33 2009 +0200
+++ b/indy.compiler.patch Wed Jul 01 13:28:18 2009 +0200
@@ -354,7 +354,7 @@ diff --git a/src/share/vm/ci/ciEnv.cpp b
ciInstanceKlass* ciEnv::_Object;
ciInstanceKlass* ciEnv::_Throwable;
ciInstanceKlass* ciEnv::_Thread;
-@@ -687,6 +688,32 @@ ciMethod* ciEnv::get_method_by_index_imp
+@@ -687,6 +688,30 @@ ciMethod* ciEnv::get_method_by_index_imp
// ------------------------------------------------------------------
@@ -377,8 +377,6 @@ diff --git a/src/share/vm/ci/ciEnv.cpp b
+ assert(method_oop != NULL, "sanity");
+ assert(method_oop->is_method_handle_invoke(), "consistent");
+
-+ // Get a fake invokedynamic ciMethod.
-+// return get_fake_invokedynamic_method(method_oop);
+ return get_object(method_oop)->as_method();
+}
+
@@ -387,7 +385,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 +735,18 @@ ciInstanceKlass* ciEnv::get_instance_kla
+@@ -708,15 +733,18 @@ ciInstanceKlass* ciEnv::get_instance_kla
}
@@ -429,19 +427,7 @@ diff --git a/src/share/vm/ci/ciEnv.hpp b
// Helper methods
bool check_klass_accessibility(ciKlass* accessing_klass,
-@@ -166,6 +169,11 @@ private:
- return _factory->get_unloaded_method(holder, name, signature);
- }
-
-+ // Get a fake ciMethod for an invokedynamic callsite.
-+ ciMethod* get_fake_invokedynamic_method(methodOop method_oop) {
-+ return _factory->get_fake_invokedynamic_method(method_oop);
-+ }
-+
- // Get a ciKlass representing an unloaded klass.
- // Ensures uniqueness of the result.
- ciKlass* get_unloaded_klass(ciKlass* accessing_klass,
-@@ -269,6 +277,9 @@ public:
+@@ -269,6 +272,9 @@ public:
ciInstanceKlass* ClassCastException_klass() {
return _ClassCastException;
}
@@ -454,55 +440,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
-@@ -131,6 +131,47 @@ ciMethod::ciMethod(ciInstanceKlass* hold
-
-
- // ------------------------------------------------------------------
-+// ciMethod::ciMethod
-+//
-+// Fake invokedynamic method.
-+//
-+// Note: We initialize ciObject with the methodOop so that
-+// ciObject.is_loaded() returns true.
-+ciMethod::ciMethod(methodOop method_oop) : ciObject(method_oop) {
-+ ciEnv* cienv = CURRENT_ENV;
-+
-+ ciInstanceKlass* holder = cienv->InvokeDynamic_klass(); // This is always java.dyn.InvokeDynamic
-+
-+ symbolOop name_symbol = method_oop->name();
-+ symbolOop signature_symbol = method_oop->signature();
-+ ciSymbol* name = cienv->get_object(name_symbol)->as_symbol();
-+ ciSymbol* signature = cienv->get_object(signature_symbol)->as_symbol();
-+
-+ // invokedynamics are treated as invokestatics in the compiler
-+ // (e.g. static R InvokeDynamic.#"Q"(SIG)).
-+ int flags_bits = (JVM_MH_INVOKE_BITS | JVM_ACC_PUBLIC | JVM_ACC_FINAL | JVM_ACC_STATIC);
-+ AccessFlags flags = accessFlags_from(flags_bits);
-+
-+ // These fields are important.
-+ _flags = ciFlags(flags);
-+ _name = name;
-+ _holder = holder;
-+ _signature = new (cienv->arena()) ciSignature(_holder, signature);
-+
-+ // Default values.
-+ _intrinsic_id = vmIntrinsics::_none;
-+ _liveness = NULL;
-+ _can_be_statically_bound = false;
-+ _bcea = NULL;
-+ _method_blocks = NULL;
-+ _method_data = NULL;
-+#ifdef COMPILER2
-+ _flow = NULL;
-+#endif // COMPILER2
-+}
-+
-+
-+// ------------------------------------------------------------------
- // ciMethod::load_code
- //
- // Load the bytecodes and exception handler table for this method.
-@@ -677,7 +718,7 @@ int ciMethod::scale_count(int count, flo
+@@ -677,7 +677,7 @@ int ciMethod::scale_count(int count, flo
// ------------------------------------------------------------------
// invokedynamic support
//
@@ -514,15 +452,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
-@@ -75,6 +75,7 @@ class ciMethod : public ciObject {
-
- ciMethod(methodHandle h_m);
- ciMethod(ciInstanceKlass* holder, ciSymbol* name, ciSymbol* signature);
-+ ciMethod(methodOop method_oop);
-
- methodOop get_methodOop() const {
- methodOop m = (methodOop)get_oop();
-@@ -207,7 +208,7 @@ class ciMethod : public ciObject {
+@@ -207,7 +207,7 @@ class ciMethod : public ciObject {
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
@@ -577,64 +507,6 @@ diff --git a/src/share/vm/ci/ciObjectFac
}
// The oop is of some type not supported by the compiler interface.
-@@ -368,6 +375,44 @@ ciMethod* ciObjectFactory::get_unloaded_
- }
-
- //------------------------------------------------------------------
-+// ciObjectFactory::get_fake_invokedynamic_method
-+//
-+// Get the ciMethod representing a fake invokedynamic method.
-+//
-+// Implementation note: unloaded methods are currently stored in
-+// an unordered array, requiring a linear-time lookup for each
-+// unloaded method. This may need to change.
-+ciMethod* ciObjectFactory::get_fake_invokedynamic_method(methodOop method_oop) {
-+ ciEnv* cienv = CURRENT_ENV;
-+
-+ ciInstanceKlass* holder = cienv->InvokeDynamic_klass(); // This is always java.dyn.InvokeDynamic
-+
-+ symbolOop name_symbol = method_oop->name();
-+ symbolOop signature_symbol = method_oop->signature();
-+ ciSymbol* name = cienv->get_object(name_symbol)->as_symbol();
-+ ciSymbol* signature = cienv->get_object(signature_symbol)->as_symbol();
-+
-+ for (int i = 0; i < _unloaded_methods->length(); i++) {
-+ ciMethod* entry = _unloaded_methods->at(i);
-+ if (entry->holder()->equals(holder) &&
-+ entry->name()->equals(name) &&
-+ entry->signature()->as_symbol()->equals(signature)) {
-+ // We've found a match.
-+ return entry;
-+ }
-+ }
-+
-+ // This is a new fake invokedynamic method. Create it and stick it
-+ // in the cache.
-+ ciMethod* new_method = new (arena()) ciMethod(method_oop);
-+
-+ init_ident_of(new_method);
-+ _unloaded_methods->append(new_method);
-+
-+ return new_method;
-+}
-+
-+//------------------------------------------------------------------
- // ciObjectFactory::get_unloaded_klass
- //
- // Get a ciKlass representing an unloaded klass.
-diff --git a/src/share/vm/ci/ciObjectFactory.hpp b/src/share/vm/ci/ciObjectFactory.hpp
---- a/src/share/vm/ci/ciObjectFactory.hpp
-+++ b/src/share/vm/ci/ciObjectFactory.hpp
-@@ -93,6 +93,9 @@ public:
- ciSymbol* name,
- ciSymbol* signature);
-
-+ // Get the ciMethod representing a fake invokedynamic method.
-+ ciMethod* get_fake_invokedynamic_method(methodOop method_oop);
-+
- // Get a ciKlass representing an unloaded klass.
- ciKlass* get_unloaded_klass(ciKlass* accessing_klass,
- ciSymbol* name,
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