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

src/share/vm/ci/ciField.cpp

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

*** 205,215 **** _holder = CURRENT_ENV->get_instance_klass(fd->field_holder()); // Check to see if the field is constant. bool is_final = this->is_final(); bool is_stable = FoldStableValues && this->is_stable(); ! if (_holder->is_initialized() && (is_final || is_stable)) { if (!this->is_static()) { // A field can be constant if it's a final static field or if // it's a final non-static field of a trusted class (classes in // java.lang.invoke and sun.invoke packages and subpackages). if (is_stable || trust_final_non_static_fields(_holder)) { --- 205,215 ---- _holder = CURRENT_ENV->get_instance_klass(fd->field_holder()); // Check to see if the field is constant. bool is_final = this->is_final(); bool is_stable = FoldStableValues && this->is_stable(); ! if (_holder->is_initialized() && ((is_final && !has_initialized_final_update()) || is_stable)) { if (!this->is_static()) { // A field can be constant if it's a final static field or if // it's a final non-static field of a trusted class (classes in // java.lang.invoke and sun.invoke packages and subpackages). if (is_stable || trust_final_non_static_fields(_holder)) {
src/share/vm/ci/ciField.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File