hotspot/src/share/vm/opto/library_call.cpp
changeset 41052 3362c4368286
parent 40881 a4955213b573
child 41066 e8c366069761
child 41323 ddd5600d4762
--- a/hotspot/src/share/vm/opto/library_call.cpp	Mon Aug 29 17:15:20 2016 +0000
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Tue Aug 30 09:30:16 2016 +0200
@@ -2471,6 +2471,28 @@
       // load value
       switch (type) {
       case T_BOOLEAN:
+      {
+        // Normalize the value returned by getBoolean in the following cases
+        if (mismatched ||
+            heap_base_oop == top() ||                            // - heap_base_oop is NULL or
+            (can_access_non_heap && alias_type->field() == NULL) // - heap_base_oop is potentially NULL
+                                                                 //   and the unsafe access is made to large offset
+                                                                 //   (i.e., larger than the maximum offset necessary for any
+                                                                 //   field access)
+            ) {
+          IdealKit ideal = IdealKit(this);
+#define __ ideal.
+          IdealVariable normalized_result(ideal);
+          __ declarations_done();
+          __ set(normalized_result, p);
+          __ if_then(p, BoolTest::ne, ideal.ConI(0));
+          __ set(normalized_result, ideal.ConI(1));
+          ideal.end_if();
+          final_sync(ideal);
+          p = __ value(normalized_result);
+#undef __
+        }
+      }
       case T_CHAR:
       case T_BYTE:
       case T_SHORT: