changeset 3653:6aef50c6d967

Handlize to fix GC issue.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 17 Nov 2011 00:01:56 +0100
parents aac12c75f805
children 4123781869da
files src/share/vm/graal/graalCompiler.cpp src/share/vm/graal/graalCompiler.hpp src/share/vm/graal/graalEnv.cpp src/share/vm/graal/graalEnv.hpp src/share/vm/graal/graalVMEntries.cpp
diffstat 5 files changed, 79 insertions(+), 79 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/graal/graalCompiler.cpp	Wed Nov 16 23:35:10 2011 +0100
+++ b/src/share/vm/graal/graalCompiler.cpp	Thu Nov 17 00:01:56 2011 +0100
@@ -139,11 +139,11 @@
   TRACE_graal_1("GraalCompiler::print_timers");
 }
 
-oop GraalCompiler::get_RiType(Symbol* klass_name, TRAPS) {
+Handle GraalCompiler::get_RiType(Symbol* klass_name, TRAPS) {
    return VMExits::createRiTypeUnresolved(VmIds::toString<Handle>(klass_name, THREAD), THREAD);
 }
 
-oop GraalCompiler::get_RiTypeFromSignature(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) {
+Handle GraalCompiler::get_RiTypeFromSignature(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) {
   
   Symbol* signature = cp->symbol_at(index);
   BasicType field_type = FieldType::basic_type(signature);
@@ -161,7 +161,7 @@
   }
 }
 
-oop GraalCompiler::get_RiType(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) {
+Handle GraalCompiler::get_RiType(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) {
   bool is_accessible = false;
 
   KlassHandle klass = GraalEnv::get_klass_by_index(cp, index, is_accessible, loading_klass);
@@ -189,17 +189,17 @@
   }
 }
 
-oop GraalCompiler::get_RiType(KlassHandle klass, TRAPS) {
+Handle GraalCompiler::get_RiType(KlassHandle klass, TRAPS) {
   Handle name = VmIds::toString<Handle>(klass->name(), THREAD);
   return createHotSpotTypeResolved(klass, name, CHECK_NULL);
 }
 
-oop GraalCompiler::get_RiField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, Bytecodes::Code byteCode, TRAPS) {
+Handle GraalCompiler::get_RiField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, Bytecodes::Code byteCode, TRAPS) {
   Handle name = VmIds::toString<Handle>(field_name, CHECK_NULL);
   return VMExits::createRiField(field_holder, name, field_type, offset, flags, CHECK_NULL);
 }
 
-oop GraalCompiler::createHotSpotTypeResolved(KlassHandle klass, Handle name, TRAPS) {
+Handle GraalCompiler::createHotSpotTypeResolved(KlassHandle klass, Handle name, TRAPS) {
   if (klass->graal_mirror() != NULL) {
     return klass->graal_mirror();
   }
@@ -239,10 +239,10 @@
 
   klass->set_graal_mirror(obj());
 
-  return obj();
+  return obj;
 }
 
-oop GraalCompiler::createHotSpotMethodResolved(methodHandle method, TRAPS) {
+Handle GraalCompiler::createHotSpotMethodResolved(methodHandle method, TRAPS) {
   if (method->graal_mirror() != NULL) {
     assert(method->graal_mirror()->is_a(HotSpotMethodResolved::klass()), "unexpected class...");
     return method->graal_mirror();
@@ -262,8 +262,8 @@
   
   KlassHandle klass = method->method_holder();
   Handle holder_name = VmIds::toString<Handle>(klass->name(), CHECK_NULL);
-  oop holder = GraalCompiler::createHotSpotTypeResolved(klass, holder_name, CHECK_NULL);
-  HotSpotMethodResolved::set_holder(obj, holder);
+  Handle holder = GraalCompiler::createHotSpotTypeResolved(klass, holder_name, CHECK_NULL);
+  HotSpotMethodResolved::set_holder(obj, holder());
   
   HotSpotMethodResolved::set_codeSize(obj, method->code_size());
   HotSpotMethodResolved::set_accessFlags(obj, method->access_flags().as_int());
--- a/src/share/vm/graal/graalCompiler.hpp	Wed Nov 16 23:35:10 2011 +0100
+++ b/src/share/vm/graal/graalCompiler.hpp	Thu Nov 17 00:01:56 2011 +0100
@@ -59,14 +59,14 @@
   // Print compilation timers and statistics
   virtual void print_timers();
   
-  static oop get_RiTypeFromSignature(constantPoolHandle cp, int index, KlassHandle accessor, TRAPS);
-  static oop get_RiType(constantPoolHandle cp, int index, KlassHandle accessor, TRAPS);
-  static oop get_RiType(Symbol* klass_name, TRAPS);
-  static oop get_RiType(KlassHandle klass, TRAPS);
-  static oop get_RiField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, Bytecodes::Code byteCode, TRAPS);
+  static Handle get_RiTypeFromSignature(constantPoolHandle cp, int index, KlassHandle accessor, TRAPS);
+  static Handle get_RiType(constantPoolHandle cp, int index, KlassHandle accessor, TRAPS);
+  static Handle get_RiType(Symbol* klass_name, TRAPS);
+  static Handle get_RiType(KlassHandle klass, TRAPS);
+  static Handle get_RiField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, Bytecodes::Code byteCode, TRAPS);
 
-  static oop createHotSpotTypeResolved(KlassHandle klass, Handle name, TRAPS);
-  static oop createHotSpotMethodResolved(methodHandle method, TRAPS);
+  static Handle createHotSpotTypeResolved(KlassHandle klass, Handle name, TRAPS);
+  static Handle createHotSpotMethodResolved(methodHandle method, TRAPS);
 
   void exit();
 
--- a/src/share/vm/graal/graalEnv.cpp	Wed Nov 16 23:35:10 2011 +0100
+++ b/src/share/vm/graal/graalEnv.cpp	Thu Nov 17 00:01:56 2011 +0100
@@ -297,14 +297,12 @@
 //
 // Perform an appropriate method lookup based on accessor, holder,
 // name, signature, and bytecode.
-methodOop GraalEnv::lookup_method(instanceKlass*  accessor,
-                               instanceKlass*  holder,
+methodHandle GraalEnv::lookup_method(instanceKlassHandle  h_accessor,
+                               instanceKlassHandle  h_holder,
                                Symbol*       name,
                                Symbol*       sig,
                                Bytecodes::Code bc) {
   EXCEPTION_CONTEXT;
-  KlassHandle h_accessor(THREAD, accessor);
-  KlassHandle h_holder(THREAD, holder);
   LinkResolver::check_klass_accessability(h_accessor, h_holder, KILL_COMPILE_ON_FATAL_(NULL));
   methodHandle dest_method;
   switch (bc) {
@@ -329,7 +327,7 @@
   default: ShouldNotReachHere();
   }
 
-  return dest_method();
+  return dest_method;
 }
 
 
@@ -337,25 +335,25 @@
 // ciEnv::get_method_by_index_impl
 methodHandle GraalEnv::get_method_by_index_impl(constantPoolHandle cpool,
                                           int index, Bytecodes::Code bc,
-                                          instanceKlass* accessor) {
+                                          instanceKlassHandle accessor) {
   int holder_index = cpool->klass_ref_index_at(index);
   bool holder_is_accessible;
-  KlassHandle holder = get_klass_by_index_impl(cpool, holder_index, holder_is_accessible, KlassHandle(Thread::current(), accessor));
+  KlassHandle holder = get_klass_by_index_impl(cpool, holder_index, holder_is_accessible, accessor);
 
   // Get the method's name and signature.
   Symbol* name_sym = cpool->name_ref_at(index);
   Symbol* sig_sym  = cpool->signature_ref_at(index);
 
   if (holder_is_accessible) { // Our declared holder is loaded.
-    instanceKlass* lookup = get_instance_klass_for_declared_method_holder(holder);
-    methodOop m = lookup_method(accessor, lookup, name_sym, sig_sym, bc);
-    if (m != NULL &&
+    instanceKlassHandle lookup = get_instance_klass_for_declared_method_holder(holder);
+    methodHandle m = lookup_method(accessor, lookup, name_sym, sig_sym, bc);
+    if (!m.is_null() &&
         (bc == Bytecodes::_invokestatic
          ?  instanceKlass::cast(m->method_holder())->is_not_initialized()
          : !instanceKlass::cast(m->method_holder())->is_loaded())) {
       m = NULL;
     }
-    if (m != NULL) {
+    if (!m.is_null()) {
       // We found the method.
       return m;
     }
@@ -370,7 +368,7 @@
 
 // ------------------------------------------------------------------
 // ciEnv::get_instance_klass_for_declared_method_holder
-instanceKlass* GraalEnv::get_instance_klass_for_declared_method_holder(KlassHandle method_holder) {
+instanceKlassHandle GraalEnv::get_instance_klass_for_declared_method_holder(KlassHandle method_holder) {
   // For the case of <array>.clone(), the method holder can be a ciArrayKlass
   // instead of a ciInstanceKlass.  For that case simply pretend that the
   // declared holder is Object.clone since that's where the call will bottom out.
@@ -380,9 +378,9 @@
   // only occurs for clone() the more extensive fix seems like overkill so
   // instead we simply smear the array type into Object.
   if (method_holder->oop_is_instance()) {
-    return instanceKlass::cast(method_holder());
+    return instanceKlassHandle(method_holder());
   } else if (method_holder->oop_is_array()) {
-    return instanceKlass::cast(SystemDictionary::Object_klass());
+    return instanceKlassHandle(SystemDictionary::Object_klass());
   } else {
     ShouldNotReachHere();
   }
@@ -394,7 +392,7 @@
 // ciEnv::get_method_by_index
 methodHandle GraalEnv::get_method_by_index(constantPoolHandle cpool,
                                      int index, Bytecodes::Code bc,
-                                     instanceKlass* accessor) {
+                                     instanceKlassHandle accessor) {
   ResourceMark rm;
   assert(bc != Bytecodes::_invokedynamic, "invokedynamic not yet supported");
   return get_method_by_index_impl(cpool, index, bc, accessor);
--- a/src/share/vm/graal/graalEnv.hpp	Wed Nov 16 23:35:10 2011 +0100
+++ b/src/share/vm/graal/graalEnv.hpp	Thu Nov 17 00:01:56 2011 +0100
@@ -71,7 +71,7 @@
                                 int field_index);
   static methodHandle  get_method_by_index(constantPoolHandle cpool,
                                  int method_index, Bytecodes::Code bc,
-                                 instanceKlass* loading_klass);
+                                 instanceKlassHandle loading_klass);
 
 private:
 
@@ -88,12 +88,12 @@
                                      int field_index);
   static methodHandle  get_method_by_index_impl(constantPoolHandle cpool,
                                       int method_index, Bytecodes::Code bc,
-                                      instanceKlass* loading_klass);
+                                      instanceKlassHandle loading_klass);
 
   // Helper methods
   static bool       check_klass_accessibility(klassOop accessing_klass, klassOop resolved_klassOop);
-  static methodOop  lookup_method(instanceKlass*  accessor,
-                           instanceKlass*  holder,
+  static methodHandle  lookup_method(instanceKlassHandle  accessor,
+                           instanceKlassHandle  holder,
                            Symbol*         name,
                            Symbol*         sig,
                            Bytecodes::Code bc);
@@ -135,7 +135,7 @@
   // ciInstanceKlass*.  This is needed since the holder of a method in
   // the bytecodes could be an array type.  Basically this converts
   // array types into java/lang/Object and other types stay as they are.
-  static instanceKlass* get_instance_klass_for_declared_method_holder(KlassHandle klass);
+  static instanceKlassHandle get_instance_klass_for_declared_method_holder(KlassHandle klass);
 };
 
 #endif // SHARE_VM_GRAAL_GRAALENV_HPP
--- a/src/share/vm/graal/graalVMEntries.cpp	Wed Nov 16 23:35:10 2011 +0100
+++ b/src/share/vm/graal/graalVMEntries.cpp	Thu Nov 17 00:01:56 2011 +0100
@@ -90,8 +90,8 @@
     } else {
       constantPoolOop cp = instanceKlass::cast(method->method_holder())->constants();
       KlassHandle loading_klass = method->method_holder();
-      oop catch_class = GraalCompiler::get_RiType(cp, catch_class_index, loading_klass, CHECK_NULL);
-      HotSpotExceptionHandler::set_catchClass(entry, catch_class);
+      Handle catch_class = GraalCompiler::get_RiType(cp, catch_class_index, loading_klass, CHECK_NULL);
+      HotSpotExceptionHandler::set_catchClass(entry, catch_class());
     }
     array->obj_at_put(i, entry());
   }
@@ -136,8 +136,8 @@
   int slot = java_lang_reflect_Method::slot(reflection_method);
   klassOop holder = java_lang_Class::as_klassOop(reflection_holder);
   methodOop method = instanceKlass::cast(holder)->method_with_idnum(slot);
-  oop ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL);
-  return JNIHandles::make_local(THREAD, ret);
+  Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL);
+  return JNIHandles::make_local(THREAD, ret());
 }
 
 // public boolean RiMethod_uniqueConcreteMethod(long vmId);
@@ -145,9 +145,9 @@
   TRACE_graal_3("VMEntries::RiMethod_uniqueConcreteMethod");
 
   VM_ENTRY_MARK;
-  methodOop method = getMethodFromHotSpotMethod(hotspot_method);
-  klassOop holder = method->method_holder();
-  if (holder->klass_part()->is_interface()) {
+  methodHandle method = getMethodFromHotSpotMethod(hotspot_method);
+  KlassHandle holder = method->method_holder();
+  if (holder->is_interface()) {
     // Cannot trust interfaces. Because of:
     // interface I { void foo(); }
     // class A { public void foo() {} }
@@ -157,25 +157,24 @@
     // Would lead to identify C.foo() as the unique concrete method for I.foo() without seeing A.foo().
     return false;
   }
-  methodOop unique_concrete;
+  methodHandle unique_concrete;
   {
     ResourceMark rm;
     MutexLocker locker(Compile_lock);
-    unique_concrete = Dependencies::find_unique_concrete_method(holder, method);
+    unique_concrete = Dependencies::find_unique_concrete_method(holder(), method());
   }
-  if (unique_concrete == NULL) {
+  if (unique_concrete.is_null()) {
     return NULL;
   } else {
-    oop method_resolved = GraalCompiler::createHotSpotMethodResolved(unique_concrete, CHECK_NULL);
-    return JNIHandles::make_local(THREAD, method_resolved);
+    Handle method_resolved = GraalCompiler::createHotSpotMethodResolved(unique_concrete, CHECK_NULL);
+    return JNIHandles::make_local(THREAD, method_resolved());
   }
 }
 
 // public native int RiMethod_invocationCount(long vmId);
 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiMethod_1invocationCount(JNIEnv *, jobject, jobject hotspot_method) {
   TRACE_graal_3("VMEntries::RiMethod_invocationCount");
-  methodOop method = getMethodFromHotSpotMethod(hotspot_method);
-  return method->invocation_count();
+  return getMethodFromHotSpotMethod(hotspot_method)->invocation_count();
 }
 
 // public native int RiMethod_exceptionProbability(long vmId, int bci);
@@ -183,8 +182,8 @@
   TRACE_graal_3("VMEntries::RiMethod_exceptionProbability");
   VM_ENTRY_MARK;
   ResourceMark rm;
-  methodOop method = getMethodFromHotSpotMethod(hotspot_method);
-  methodDataOop method_data = method->method_data();
+  methodHandle method = getMethodFromHotSpotMethod(hotspot_method);
+  methodDataHandle method_data = method->method_data();
   if (method_data == NULL || !method_data->is_mature()) {
     return -1;
   }
@@ -268,10 +267,10 @@
           if (receiver.is_null())  continue;
 
           float prob = recv->receiver_count(i) / (float) total_count;
-          oop type = GraalCompiler::get_RiType(receiver, CHECK_NULL);
+          Handle type = GraalCompiler::get_RiType(receiver, CHECK_NULL);
 
           probabilities->float_at_put(pos, prob);
-          types->obj_at_put(pos, type);
+          types->obj_at_put(pos, type());
 
           pos++;
         }
@@ -291,8 +290,8 @@
 JNIEXPORT jdouble JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiMethod_2branchProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) {
   TRACE_graal_3("VMEntries::RiMethod_typeProfile");
   ResourceMark rm;
-  methodOop method = getMethodFromHotSpotMethod(hotspot_method);
-  methodDataOop method_data = method->method_data();
+  methodHandle method = getMethodFromHotSpotMethod(hotspot_method);
+  methodDataHandle method_data = method->method_data();
 
   if (method_data == NULL || !method_data->is_mature()) return -1;
   method_data->bci_to_data(bci);
@@ -325,8 +324,8 @@
   TRACE_graal_3("VMEntries::RiMethod_typeProfile");
   VM_ENTRY_MARK;
   ResourceMark rm;
-  methodOop method = getMethodFromHotSpotMethod(hotspot_method);
-  methodDataOop method_data = method->method_data();
+  methodHandle method = getMethodFromHotSpotMethod(hotspot_method);
+  methodDataHandle method_data = method->method_data();
 
   if (method_data == NULL || !method_data->is_mature()) return NULL;
 
@@ -362,8 +361,7 @@
 // public native boolean RiMethod_hasCompiledCode(HotSpotMethodResolved method);
 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiMethod_1hasCompiledCode(JNIEnv *, jobject, jobject hotspot_method) {
   TRACE_graal_3("VMEntries::RiMethod_hasCompiledCode");
-  methodOop method = getMethodFromHotSpotMethod(hotspot_method);
-  return method->has_compiled_code();
+  return getMethodFromHotSpotMethod(hotspot_method)->has_compiled_code();
 }
 
 // public RiType RiSignature_lookupType(String returnType, HotSpotTypeResolved accessingClass);
@@ -409,9 +407,11 @@
       }
     }
     if (resolved_type != NULL) {
-      result = GraalCompiler::createHotSpotTypeResolved(resolved_type, name, CHECK_NULL);
+      Handle type = GraalCompiler::createHotSpotTypeResolved(resolved_type, name, CHECK_NULL);
+      result = type();
     } else {
-      result = VMExits::createRiTypeUnresolved(name, THREAD);
+      Handle type = VMExits::createRiTypeUnresolved(name, THREAD);
+      result = type();
     }
   }
 
@@ -450,7 +450,8 @@
     }
     result = VMExits::createCiConstantObject(string, CHECK_0);
   } else if (tag.is_klass() || tag.is_unresolved_klass()) {
-    result = GraalCompiler::get_RiType(cp, index, cp->pool_holder(), CHECK_NULL);
+    Handle type = GraalCompiler::get_RiType(cp, index, cp->pool_holder(), CHECK_NULL);
+    result = type();
   } else if (tag.is_object()) {
     oop obj = cp->object_at(index);
     assert(obj->is_instance(), "must be an instance");
@@ -470,10 +471,10 @@
   constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants();
 
   Bytecodes::Code bc = (Bytecodes::Code) (((int) byteCode) & 0xFF);
-  methodHandle method = GraalEnv::get_method_by_index(cp, index, bc, instanceKlass::cast(cp->pool_holder()));
+  methodHandle method = GraalEnv::get_method_by_index(cp, index, bc, cp->pool_holder());
   if (!method.is_null()) {
-    oop ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL);
-    return JNIHandles::make_local(THREAD, ret);
+    Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL);
+    return JNIHandles::make_local(THREAD, ret());
   } else {
     // Get the method's name and signature.
     Handle name = VmIds::toString<Handle>(cp->name_ref_at(index), CHECK_NULL);
@@ -490,8 +491,8 @@
   VM_ENTRY_MARK;
 
   constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants();
-  oop result = GraalCompiler::get_RiType(cp, index, cp->pool_holder(), CHECK_NULL);
-  return JNIHandles::make_local(THREAD, result);
+  Handle result = GraalCompiler::get_RiType(cp, index, cp->pool_holder(), CHECK_NULL);
+  return JNIHandles::make_local(THREAD, result());
 }
 
 // public void RiConstantPool_loadReferencedType(long vmId, int cpi);
@@ -635,7 +636,7 @@
   klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(resolved_type));
   Symbol* name_symbol = VmIds::toSymbol(name);
   Symbol* signature_symbol = VmIds::toSymbol(signature);
-  methodOop method = klass->klass_part()->lookup_method(name_symbol, signature_symbol);
+  methodHandle method = klass->klass_part()->lookup_method(name_symbol, signature_symbol);
   if (method == NULL) {
     if (TraceGraal >= 3) {
       ResourceMark rm;
@@ -643,8 +644,8 @@
     }
     return NULL;
   }
-  oop ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL);
-  return JNIHandles::make_local(THREAD, ret);
+  Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL);
+  return JNIHandles::make_local(THREAD, ret());
 }
 
 // public boolean RiType_isSubtypeOf(HotSpotTypeResolved klass, RiType other);
@@ -673,7 +674,7 @@
   assert(array_klass->oop_is_objArray(), "just checking");
   klassOop element_type = objArrayKlass::cast(array_klass())->element_klass();
   assert(JNIHandles::resolve(klass) != NULL, "");
-  return JNIHandles::make_local(GraalCompiler::get_RiType(element_type, THREAD));
+  return JNIHandles::make_local(GraalCompiler::get_RiType(element_type, THREAD)());
 }
 
 // public RiType RiType_superType(HotSpotResolvedType klass);
@@ -691,7 +692,7 @@
   }
 
   if (k != NULL) {
-    return JNIHandles::make_local(GraalCompiler::get_RiType(k, THREAD));
+    return JNIHandles::make_local(GraalCompiler::get_RiType(k, THREAD)());
   } else {
     return NULL;
   }
@@ -704,7 +705,7 @@
   KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)));
   Klass *up_cast = klass_handle->up_cast_abstract();
   if (up_cast->is_leaf_class()) {
-    return JNIHandles::make_local(GraalCompiler::get_RiType(up_cast, THREAD));
+    return JNIHandles::make_local(GraalCompiler::get_RiType(up_cast, THREAD)());
   }
   return NULL;
 }
@@ -725,7 +726,7 @@
   KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)));
   KlassHandle array = klass_handle->array_klass(THREAD);
   Handle name = VmIds::toString<Handle>(array->name(), CHECK_NULL);
-  return JNIHandles::make_local(THREAD, GraalCompiler::createHotSpotTypeResolved(array, name, THREAD));
+  return JNIHandles::make_local(THREAD, GraalCompiler::createHotSpotTypeResolved(array, name, THREAD)());
 }
 
 // public RiField[] RiType_fields(HotSpotTypeResolved klass);
@@ -768,7 +769,8 @@
   VM_ENTRY_MARK;
   BasicType type = GraalCompiler::kindToBasicType(CiKind::typeChar(kind));
   assert(type != T_OBJECT, "primitive type expecteds");
-  return JNIHandles::make_local(THREAD, GraalCompiler::get_RiType(Universe::typeArrayKlassObj(type), THREAD));
+  Handle result = GraalCompiler::get_RiType(Universe::typeArrayKlassObj(type), CHECK_NULL);
+  return JNIHandles::make_local(THREAD, result());
 }
 
 // public long getMaxCallTargetOffset(CiRuntimeCall rtcall);
@@ -800,8 +802,8 @@
     KlassHandle klass = java_lang_Class::as_klassOop(javaClassOop);
     Handle name = java_lang_String::create_from_symbol(klass->name(), CHECK_NULL);
 
-    oop type = GraalCompiler::createHotSpotTypeResolved(klass, name, CHECK_NULL);
-    return JNIHandles::make_local(THREAD, type);
+    Handle type = GraalCompiler::createHotSpotTypeResolved(klass, name, CHECK_NULL);
+    return JNIHandles::make_local(THREAD, type());
   }
 }