hotspot/src/share/vm/opto/library_call.cpp
changeset 41066 e8c366069761
parent 40899 d7140c75c2c6
parent 41052 3362c4368286
child 41330 8b2580e63aa0
--- a/hotspot/src/share/vm/opto/library_call.cpp	Fri Sep 02 16:45:16 2016 +0200
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Thu Sep 08 23:43:45 2016 -0400
@@ -2475,6 +2475,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: