[10] RFR(M): 8176506: C2: loop unswitching and unsafe accesses cause crash

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Tue Mar 28 15:14:31 UTC 2017


> Here is an updated webrev with Vladimir's tweaks/fixes:
>
> http://cr.openjdk.java.net/~roland/8176506/webrev.01/

src/share/vm/opto/library_call.cpp:
    } else {
+    // We know it's an on heap access so base can't be null
+    base = must_be_not_null(base, true);
      return basic_plus_adr(base, offset);
    }

Why do you unconditionally apply GK::must_be_not_null() even when base 
is provably non-null?

Another thing I noticed is that the following check isn't strong enough:

2072 LibraryCallKit::classify_unsafe_addr(Node* &base, Node* &offset) {

2085   } else if (base_type->isa_oopptr()) {
2086     // Base is never null => always a heap address.
2087     if (base_type->ptr() == TypePtr::NotNull) {

It doesn't cover TypePtr::Constant case. Fixed it with:
-    if (base_type->ptr() == TypePtr::NotNull) {
+    if (!TypePtr::NULL_PTR->higher_equal(base_type)) {

Otherwise, looks good for 10.

Best regards,
Vladimir Ivanov


More information about the hotspot-compiler-dev mailing list