src/hotspot/share/oops/method.cpp
changeset 58668 eda750f21308
parent 58545 725244418646
child 58679 9c3209ff7550
child 58775 ba524a5f7cc2
--- a/src/hotspot/share/oops/method.cpp	Mon Oct 14 11:36:17 2019 +0200
+++ b/src/hotspot/share/oops/method.cpp	Thu Oct 17 07:35:22 2019 -0400
@@ -118,11 +118,6 @@
 void Method::deallocate_contents(ClassLoaderData* loader_data) {
   MetadataFactory::free_metadata(loader_data, constMethod());
   set_constMethod(NULL);
-#if INCLUDE_JVMCI
-  if (method_data()) {
-    FailedSpeculation::free_failed_speculations(method_data()->get_failed_speculations_address());
-  }
-#endif
   MetadataFactory::free_metadata(loader_data, method_data());
   set_method_data(NULL);
   MetadataFactory::free_metadata(loader_data, method_counters());
@@ -131,6 +126,16 @@
   if (code() != NULL) _code = NULL;
 }
 
+void Method::release_C_heap_structures() {
+  if (method_data()) {
+#if INCLUDE_JVMCI
+    FailedSpeculation::free_failed_speculations(method_data()->get_failed_speculations_address());
+#endif
+    // Destroy MethodData
+    method_data()->~MethodData();
+  }
+}
+
 address Method::get_i2c_entry() {
   assert(adapter() != NULL, "must have");
   return adapter()->get_i2c_entry();