8019324: assert(_f2 == 0 || _f2 == f2) failed: illegal field change
authorrbackman
Mon, 15 Jul 2013 11:35:10 +0200
changeset 18934 2586dea2051e
parent 18932 b7e3e41cc9cd
child 18935 10110aabe1eb
8019324: assert(_f2 == 0 || _f2 == f2) failed: illegal field change Reviewed-by: dholmes, rbackman Contributed-by: David Simms <david.simms@oracle.com>
hotspot/src/share/vm/oops/cpCache.hpp
--- a/hotspot/src/share/vm/oops/cpCache.hpp	Fri Jul 12 20:47:23 2013 +0200
+++ b/hotspot/src/share/vm/oops/cpCache.hpp	Mon Jul 15 11:35:10 2013 +0200
@@ -140,8 +140,15 @@
     _f1 = f1;
   }
   void release_set_f1(Metadata* f1);
-  void set_f2(intx f2)                           { assert(_f2 == 0 || _f2 == f2,            "illegal field change"); _f2 = f2; }
-  void set_f2_as_vfinal_method(Method* f2)     { assert(_f2 == 0 || _f2 == (intptr_t) f2, "illegal field change"); assert(is_vfinal(), "flags must be set"); _f2 = (intptr_t) f2; }
+  void set_f2(intx f2) {
+    intx existing_f2 = _f2; // read once
+    assert(existing_f2 == 0 || existing_f2 == f2, "illegal field change");
+    _f2 = f2;
+  }
+  void set_f2_as_vfinal_method(Method* f2) {
+    assert(is_vfinal(), "flags must be set");
+    set_f2((intx)f2);
+  }
   int make_flags(TosState state, int option_bits, int field_index_or_method_params);
   void set_flags(intx flags)                     { _flags = flags; }
   bool init_flags_atomic(intx flags);