changeset 19727:72a3e3995879

Fix possible race in assertion
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Mon, 09 Mar 2015 12:17:28 -0700
parents 3f7cd3c36734
children f3eed864acdc
files src/cpu/x86/vm/compiledIC_x86.cpp
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/x86/vm/compiledIC_x86.cpp	Mon Mar 09 17:49:57 2015 +0100
+++ b/src/cpu/x86/vm/compiledIC_x86.cpp	Mon Mar 09 12:17:28 2015 -0700
@@ -135,10 +135,15 @@
   NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);
   NativeJump*        jump          = nativeJump_at(method_holder->next_instruction_address());
 
-  assert(method_holder->data() == 0 || method_holder->data() == (intptr_t)callee(),
+#ifdef ASSERT
+  // read the value once
+  intptr_t data = method_holder->data();
+  address destination = jump->jump_destination();
+  assert(data == 0 || data == (intptr_t)callee(),
          "a) MT-unsafe modification of inline cache");
-  assert(jump->jump_destination() == (address)-1 || jump->jump_destination() == entry,
+  assert(destination == (address)-1 || destination == entry,
          "b) MT-unsafe modification of inline cache");
+#endif
 
   // Update stub.
   method_holder->set_data((intptr_t)callee());