8143897: Weblogic12medrec assert(handler_address == SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true)) failed: Must be the same
authorthartmann
Thu, 04 Feb 2016 12:33:31 +0100
changeset 35822 d04be2a635f2
parent 35761 a900c9e65458
child 35823 59a847ec6ee3
8143897: Weblogic12medrec assert(handler_address == SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true)) failed: Must be the same Summary: ExceptionCache read is lock-free and assume strong memory ordering in write code. Added storestore memory barrier in write path to handle this. Reviewed-by: kvn, thartmann, dlong Contributed-by: Jamsheed Mohammed <jamsheed.c.m@oracle.com>
hotspot/src/share/vm/code/nmethod.cpp
--- a/hotspot/src/share/vm/code/nmethod.cpp	Wed Feb 03 17:51:47 2016 +0100
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Thu Feb 04 12:33:31 2016 +0100
@@ -321,9 +321,12 @@
 
 bool ExceptionCache::add_address_and_handler(address addr, address handler) {
   if (test_address(addr) == handler) return true;
-  if (count() < cache_size) {
-    set_pc_at(count(),addr);
-    set_handler_at(count(), handler);
+
+  int index = count();
+  if (index < cache_size) {
+    set_pc_at(index, addr);
+    set_handler_at(index, handler);
+    OrderAccess::storestore();
     increment_count();
     return true;
   }