[9] RFR (L): 8152590: C2: @Stable support doesn't always work w/ incremental inlining

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Tue Apr 5 15:12:19 UTC 2016


http://cr.openjdk.java.net/~vlivanov/8152590/webrev.00
https://bugs.openjdk.java.net/browse/JDK-8152590

Constant folding of stable field loads only happens during parsing. 
During incremental (post-parse) inlining some loads can become foldable, 
but they aren't optimized.

Though the fix is pretty trivial (webrev.00.02), I decided to refactor 
relevant code and get rid of redundant parts.

To ease the review I split the change into 4 parts:

(1) http://cr.openjdk.java.net/~vlivanov/8152590/webrev.00.00

   * extracted all constant-related checks into 
ciField::constant_value()/ciField::constant_value_of();

   * common constant folding logic into 
GraphKit::make_constant_from_field()/Type::make_constant_*():

     Parse::do_get_xxx() / LibraryCallKit::inline_unsafe_access()
       GraphKit::make_constant_from_field(ciField*, Node*)
         Type::make_constant_from_field(ciField*, ...)
           Type::make_from_constant(ciConstant, ...)

   * fold_stable_ary_elem is moved to 
Type::make_constant_from_array_element()

   * check_mismatched_access is moved to type.cpp


(2) http://cr.openjdk.java.net/~vlivanov/8152590/webrev.00.01

Refactored constant folding logic for static final fields and unified 
folding logic with instance fields: is_constant() depends only on the 
flags and caller should check return value from 
ciField::constant_value() for validity (ciConstant.is_valid())


(3) http://cr.openjdk.java.net/~vlivanov/8152590/webrev.00.02

Do constant folding for fields (both static and instance) in 
LoadNode::Value.


(4) http://cr.openjdk.java.net/~vlivanov/8152590/webrev.00.03

Mark CallSite::target field as constant.


Also:

   * fixed test/compiler/unsafe/UnsafeGetStableArrayElement.java

Testing: JPRT, RBT (pit-hs-comp w/ parse time folding on/off), octane.

Thanks!

Best regards,
Vladimir Ivanov


More information about the hotspot-compiler-dev mailing list