changeset 3668:46f211fe010c

Removed global handle usage in ci interface.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 18 Nov 2011 13:30:47 +0100
parents e755289380e3
children 53636e2c9d03
files src/share/vm/ci/ciInstanceKlass.cpp src/share/vm/ci/ciInstanceKlass.hpp src/share/vm/ci/ciObject.cpp src/share/vm/ci/ciObject.hpp src/share/vm/graal/graalCodeInstaller.cpp src/share/vm/graal/graalCodeInstaller.hpp
diffstat 6 files changed, 14 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/ci/ciInstanceKlass.cpp	Fri Nov 18 13:07:25 2011 +0100
+++ b/src/share/vm/ci/ciInstanceKlass.cpp	Fri Nov 18 13:30:47 2011 +0100
@@ -64,7 +64,7 @@
   }
 
   Thread *thread = Thread::current();
-  if (ciObjectFactory::is_initialized() && !UseGraal) {
+  if (ciObjectFactory::is_initialized()) {
     _loader = JNIHandles::make_local(thread, ik->class_loader());
     _protection_domain = JNIHandles::make_local(thread, ik->protection_domain());
     _is_shared = false;
--- a/src/share/vm/ci/ciInstanceKlass.hpp	Fri Nov 18 13:07:25 2011 +0100
+++ b/src/share/vm/ci/ciInstanceKlass.hpp	Fri Nov 18 13:30:47 2011 +0100
@@ -71,19 +71,6 @@
 
   GrowableArray<ciField*>* _non_static_fields;
 
-public:
-  virtual void cleanup() {
-    ciObject::cleanup();
-    if (!_is_shared) {
-      if (JNIHandles::is_global_handle(_loader)) {
-        JNIHandles::destroy_global(_loader);
-      }
-      if (JNIHandles::is_global_handle(_protection_domain)) {
-        JNIHandles::destroy_global(_protection_domain);
-      }
-    }
-  }
-
 protected:
   ciInstanceKlass(KlassHandle h_k);
   ciInstanceKlass(ciSymbol* name, jobject loader, jobject protection_domain);
--- a/src/share/vm/ci/ciObject.cpp	Fri Nov 18 13:07:25 2011 +0100
+++ b/src/share/vm/ci/ciObject.cpp	Fri Nov 18 13:30:47 2011 +0100
@@ -52,19 +52,13 @@
 ciObject::ciObject(oop o) {
   ASSERT_IN_VM;
   if (ciObjectFactory::is_initialized()) {
-    if (UseGraal) {
-      _handle = JNIHandles::make_global(o);
-      _temp_global = true;
-    } else {
-      _handle = JNIHandles::make_local(o);
-    }
+    _handle = JNIHandles::make_local(o);
   } else {
     _handle = JNIHandles::make_global(o);
   }
   _klass = NULL;
   _ident = 0;
   init_flags_from(o);
-  _temp_global = false;
 }
 
 // ------------------------------------------------------------------
@@ -80,7 +74,6 @@
   _klass = NULL;
   _ident = 0;
   init_flags_from(h());
-  _temp_global = false;
 }
 
 // ------------------------------------------------------------------
@@ -94,7 +87,6 @@
   _handle = NULL;
   _klass = klass;
   _ident = 0;
-  _temp_global = false;
 }
 
 // ------------------------------------------------------------------
@@ -106,7 +98,6 @@
   _handle = NULL;
   _klass = NULL;
   _ident = 0;
-  _temp_global = false;
 }
 
 // ------------------------------------------------------------------
--- a/src/share/vm/ci/ciObject.hpp	Fri Nov 18 13:07:25 2011 +0100
+++ b/src/share/vm/ci/ciObject.hpp	Fri Nov 18 13:30:47 2011 +0100
@@ -58,7 +58,6 @@
   jobject  _handle;
   ciKlass* _klass;
   uint     _ident;
-  bool     _temp_global;
 
   enum { FLAG_BITS   = 2 };
   enum {
@@ -72,11 +71,6 @@
   ciObject(ciKlass* klass);
 
 public:
-  virtual void cleanup() {
-    if (_temp_global && _handle != NULL && JNIHandles::is_global_handle(_handle)) {
-      JNIHandles::destroy_global(_handle);
-    }
-  }
   jobject      handle()  const { return _handle; }
   // Get the VM oop that this object holds.
   oop get_oop() const {
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Fri Nov 18 13:07:25 2011 +0100
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Fri Nov 18 13:30:47 2011 +0100
@@ -187,7 +187,6 @@
     oop type = CiVirtualObject::type(value);
     int id = CiVirtualObject::id(value);
     instanceKlass* klass = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)));
-    assert(klass->is_instance_klass() || klass->is_array_klass(), "Not supported allocation.");
 
     for (jint i = 0; i < objects->length(); i++) {
       ObjectValue* obj = (ObjectValue*) objects->at(i);
@@ -230,12 +229,7 @@
   return NULL;
 }
 
-// constructor used to create a method
-CodeInstaller::CodeInstaller(Handle& target_method, nmethod*& nm, bool install_code) {
-  _env = CURRENT_ENV;
-  GraalCompiler::initialize_buffer_blob();
-  CodeBuffer buffer(JavaThread::current()->get_buffer_blob());
-  
+void CodeInstaller::initialize_assumptions(Handle& target_method) {
   _oop_recorder = new OopRecorder(_env->arena());
   _env->set_oop_recorder(_oop_recorder);
   _env->set_dependencies(_dependencies);
@@ -257,6 +251,14 @@
       }
     }
   }
+}
+
+// constructor used to create a method
+CodeInstaller::CodeInstaller(Handle& target_method, nmethod*& nm, bool install_code) {
+  _env = CURRENT_ENV;
+  GraalCompiler::initialize_buffer_blob();
+  CodeBuffer buffer(JavaThread::current()->get_buffer_blob());
+  initialize_assumptions(target_method);
 
   {
     No_Safepoint_Verifier no_safepoint;
@@ -295,7 +297,7 @@
   id = VmIds::addStub(blob->code_begin());
 }
 
-void CodeInstaller::initialize_fields(Handle target_method) {
+void CodeInstaller::initialize_fields(Handle& target_method) {
   _citarget_method = HotSpotTargetMethod::targetMethod(target_method);
   _hotspot_method = HotSpotTargetMethod::method(target_method);
   if (_hotspot_method != NULL) {
--- a/src/share/vm/graal/graalCodeInstaller.hpp	Fri Nov 18 13:07:25 2011 +0100
+++ b/src/share/vm/graal/graalCodeInstaller.hpp	Fri Nov 18 13:30:47 2011 +0100
@@ -91,7 +91,8 @@
 
 private:
   // extract the fields of the CiTargetMethod
-  void initialize_fields(Handle target_method);
+  void initialize_fields(Handle& target_method);
+  void initialize_assumptions(Handle& target_method);
 
   // perform data and call relocation on the CodeBuffer
   void initialize_buffer(CodeBuffer& buffer);