< prev index next >

src/hotspot/share/jvmci/jvmciEnv.cpp

Print this page

 101   assert(!is_hotspot(), "can only copy saved properties from HotSpot to native image");
 102 
 103   JavaThread* THREAD = JavaThread::current(); // For exception macros.
 104 
 105   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_vm_ci_services_Services(), Handle(), Handle(), true, THREAD);
 106   if (HAS_PENDING_EXCEPTION) {
 107     JVMCIRuntime::fatal_exception(NULL, "Error initializing jdk.vm.ci.services.Services");
 108   }
 109   InstanceKlass* ik = InstanceKlass::cast(k);
 110   if (ik->should_be_initialized()) {
 111     ik->initialize(THREAD);
 112     if (HAS_PENDING_EXCEPTION) {
 113       JVMCIRuntime::fatal_exception(NULL, "Error initializing jdk.vm.ci.services.Services");
 114     }
 115   }
 116 
 117   // Get the serialized saved properties from HotSpot
 118   TempNewSymbol serializeSavedProperties = SymbolTable::new_symbol("serializeSavedProperties");
 119   JavaValue result(T_OBJECT);
 120   JavaCallArguments args;
 121   JavaCalls::call_static(&result, ik, serializeSavedProperties, vmSymbols::serializePropertiesToByteArray_signature(), &args, THREAD);
 122   if (HAS_PENDING_EXCEPTION) {
 123     JVMCIRuntime::fatal_exception(NULL, "Error calling jdk.vm.ci.services.Services.serializeSavedProperties");
 124   }
 125   oop res = result.get_oop();
 126   assert(res->is_typeArray(), "must be");
 127   assert(TypeArrayKlass::cast(res->klass())->element_type() == T_BYTE, "must be");
 128   typeArrayOop ba = typeArrayOop(res);
 129   int serialized_properties_len = ba->length();
 130 
 131   // Copy serialized saved properties from HotSpot object into native buffer
 132   jbyte* serialized_properties = NEW_RESOURCE_ARRAY(jbyte, serialized_properties_len);
 133   memcpy(serialized_properties, ba->byte_at_addr(0), serialized_properties_len);
 134 
 135   // Copy native buffer into shared library object
 136   JVMCIPrimitiveArray buf = new_byteArray(serialized_properties_len, this);
 137   if (has_pending_exception()) {
 138     describe_pending_exception(true);
 139     fatal("Error in copy_saved_properties");
 140   }
 141   copy_bytes_from(serialized_properties, buf, 0, serialized_properties_len);

 101   assert(!is_hotspot(), "can only copy saved properties from HotSpot to native image");
 102 
 103   JavaThread* THREAD = JavaThread::current(); // For exception macros.
 104 
 105   Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_vm_ci_services_Services(), Handle(), Handle(), true, THREAD);
 106   if (HAS_PENDING_EXCEPTION) {
 107     JVMCIRuntime::fatal_exception(NULL, "Error initializing jdk.vm.ci.services.Services");
 108   }
 109   InstanceKlass* ik = InstanceKlass::cast(k);
 110   if (ik->should_be_initialized()) {
 111     ik->initialize(THREAD);
 112     if (HAS_PENDING_EXCEPTION) {
 113       JVMCIRuntime::fatal_exception(NULL, "Error initializing jdk.vm.ci.services.Services");
 114     }
 115   }
 116 
 117   // Get the serialized saved properties from HotSpot
 118   TempNewSymbol serializeSavedProperties = SymbolTable::new_symbol("serializeSavedProperties");
 119   JavaValue result(T_OBJECT);
 120   JavaCallArguments args;
 121   JavaCalls::call_static(&result, ik, serializeSavedProperties, vmSymbols::void_byte_array_signature(), &args, THREAD);
 122   if (HAS_PENDING_EXCEPTION) {
 123     JVMCIRuntime::fatal_exception(NULL, "Error calling jdk.vm.ci.services.Services.serializeSavedProperties");
 124   }
 125   oop res = result.get_oop();
 126   assert(res->is_typeArray(), "must be");
 127   assert(TypeArrayKlass::cast(res->klass())->element_type() == T_BYTE, "must be");
 128   typeArrayOop ba = typeArrayOop(res);
 129   int serialized_properties_len = ba->length();
 130 
 131   // Copy serialized saved properties from HotSpot object into native buffer
 132   jbyte* serialized_properties = NEW_RESOURCE_ARRAY(jbyte, serialized_properties_len);
 133   memcpy(serialized_properties, ba->byte_at_addr(0), serialized_properties_len);
 134 
 135   // Copy native buffer into shared library object
 136   JVMCIPrimitiveArray buf = new_byteArray(serialized_properties_len, this);
 137   if (has_pending_exception()) {
 138     describe_pending_exception(true);
 139     fatal("Error in copy_saved_properties");
 140   }
 141   copy_bytes_from(serialized_properties, buf, 0, serialized_properties_len);
< prev index next >