hotspot/src/share/vm/oops/methodData.cpp
changeset 28365 ccf31849c7a4
parent 27685 26a697375de3
child 28650 772aaab2582f
--- a/hotspot/src/share/vm/oops/methodData.cpp	Thu Dec 18 04:56:27 2014 +0000
+++ b/hotspot/src/share/vm/oops/methodData.cpp	Thu Dec 18 16:15:21 2014 -0500
@@ -1283,6 +1283,11 @@
          DataLayout::compute_size_in_bytes(SpeculativeTrapData::static_cell_count()),
          "code needs to be adjusted");
 
+  // Do not create one of these if method has been redefined.
+  if (m != NULL && m->is_old()) {
+    return NULL;
+  }
+
   DataLayout* dp  = extra_data_base();
   DataLayout* end = args_data_limit();
 
@@ -1554,9 +1559,7 @@
 class CleanExtraDataMethodClosure : public CleanExtraDataClosure {
 public:
   CleanExtraDataMethodClosure() {}
-  bool is_live(Method* m) {
-    return !m->is_old() || m->on_stack();
-  }
+  bool is_live(Method* m) { return !m->is_old(); }
 };
 
 
@@ -1658,3 +1661,16 @@
   clean_extra_data(&cl);
   verify_extra_data_clean(&cl);
 }
+
+#ifdef ASSERT
+void MethodData::verify_clean_weak_method_links() {
+  for (ProfileData* data = first_data();
+       is_valid(data);
+       data = next_data(data)) {
+    data->verify_clean_weak_method_links();
+  }
+
+  CleanExtraDataMethodClosure cl;
+  verify_extra_data_clean(&cl);
+}
+#endif // ASSERT