src/share/vm/ci/ciField.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8161987 Cdiff src/share/vm/ci/ciField.hpp

src/share/vm/ci/ciField.hpp

Print this page
rev 8156 : 8157181: Compilers accept modification of final fields outside initializer methods
Summary: Track initialized final field updates; disable constant folding if an update is detected.
Reviewed-by: vlivanov, dnsimon, forax, never, kvn, coleenp

*** 122,147 **** bool is_shared() { // non-static fields of shared holders are cached return _holder->is_shared() && !is_static(); } ! // Is this field a constant? ! // ! // Clarification: A field is considered constant if: ! // 1. The field is both static and final ! // 2. The canonical holder of the field has undergone ! // static initialization. ! // 3. If the field is an object or array, then the oop ! // in question is allocated in perm space. ! // 4. The field is not one of the special static/final ! // non-constant fields. These are java.lang.System.in ! // and java.lang.System.out. Abomination. ! // ! // A field is also considered constant if it is marked @Stable ! // and is non-null (or non-zero, if a primitive). ! // For non-static fields, the null/zero check must be ! // arranged by the user, as constant_value().is_null_or_zero(). bool is_constant() { return _is_constant; } // Get the constant value of this field. ciConstant constant_value() { assert(is_static() && is_constant(), "illegal call to constant_value()"); --- 122,133 ---- bool is_shared() { // non-static fields of shared holders are cached return _holder->is_shared() && !is_static(); } ! // Is this field a constant? See ciField::initialize_from() for details ! // about how a field is determined to be constant. bool is_constant() { return _is_constant; } // Get the constant value of this field. ciConstant constant_value() { assert(is_static() && is_constant(), "illegal call to constant_value()");
*** 174,183 **** --- 160,172 ---- bool is_static () { return flags().is_static(); } bool is_final () { return flags().is_final(); } bool is_stable () { return flags().is_stable(); } bool is_volatile () { return flags().is_volatile(); } bool is_transient () { return flags().is_transient(); } + // The field is modified outside of instance initializer methods + // (or class/initializer methods if the field is static). + bool has_initialized_final_update() { return flags().has_initialized_final_update(); } bool is_call_site_target() { ciInstanceKlass* callsite_klass = CURRENT_ENV->CallSite_klass(); if (callsite_klass == NULL) return false;
src/share/vm/ci/ciField.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File