RFR(L): 8185265 [MVT] improve performance of return of value types with new calling convention

Roland Westrelin rwestrel at redhat.com
Thu Aug 10 06:56:51 UTC 2017


>  >> I've run this through JPRT and found the following crash during class unloading with some internal test on Solaris and
>  >> Windows:
>  >
>  > Is it because just allocated metadata is not zeroed (patch below)? Not
>  > sure if it is or not but I don't see any code that clears it.
>
> Unfortunately, the problem persists.

Thanks for giving it another try. Maybe a double free for some reason
(see patch below)?

Roland.

diff --git a/src/share/vm/oops/valueKlass.cpp b/src/share/vm/oops/valueKlass.cpp
--- a/src/share/vm/oops/valueKlass.cpp
+++ b/src/share/vm/oops/valueKlass.cpp
@@ -344,6 +344,11 @@
 }
 
 void ValueKlass::initialize_calling_convention() {
+  *((Array<SigEntry>**)adr_extended_sig()) = NULL;
+  *((Array<VMRegPair>**)adr_return_regs()) = NULL;
+  *((address*)adr_pack_handler()) = NULL;
+  *((address*)adr_unpack_handler()) = NULL;
+
   if (ValueTypeReturnedAsFields || ValueTypePassFieldsAsArgs) {
     Thread* THREAD = Thread::current();
     assert(!HAS_PENDING_EXCEPTION, "should have no exception");
@@ -387,11 +392,7 @@
   if (return_regs() != NULL) {
     MetadataFactory::free_array<VMRegPair>(loader_data, return_regs());
   }
-  if (pack_handler() != NULL) {
-    CodeBlob* buffered_blob = CodeCache::find_blob(pack_handler());
-    assert(buffered_blob->is_buffered_value_type_blob(), "bad blob type");
-    BufferBlob::free((BufferBlob*)buffered_blob);
-  }
+  cleanup_blobs();
   InstanceKlass::deallocate_contents(loader_data);
 }
 
@@ -405,6 +406,8 @@
     CodeBlob* buffered_blob = CodeCache::find_blob(pack_handler());
     assert(buffered_blob->is_buffered_value_type_blob(), "bad blob type");
     BufferBlob::free((BufferBlob*)buffered_blob);
+    *((address*)adr_pack_handler()) = NULL;
+    *((address*)adr_unpack_handler()) = NULL;
   }
 }
 


More information about the valhalla-dev mailing list