hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
changeset 41066 e8c366069761
parent 40899 d7140c75c2c6
parent 41052 3362c4368286
child 41330 8b2580e63aa0
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Fri Sep 02 16:45:16 2016 +0200
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Sep 08 23:43:45 2016 -0400
@@ -2410,6 +2410,15 @@
 #endif // INCLUDE_ALL_GCS
 
   if (x->is_volatile() && os::is_MP()) __ membar_acquire();
+
+  /* Normalize boolean value returned by unsafe operation, i.e., value  != 0 ? value = true : value false. */
+  if (type == T_BOOLEAN) {
+    LabelObj* equalZeroLabel = new LabelObj();
+    __ cmp(lir_cond_equal, value, 0);
+    __ branch(lir_cond_equal, T_BOOLEAN, equalZeroLabel->label());
+    __ move(LIR_OprFact::intConst(1), value);
+    __ branch_destination(equalZeroLabel->label());
+  }
 }