8157181: Compilers accept modification of final fields outside initializer methods

Track initialized final field updates; disable constant folding if an update is detected. Enforce final field update rules introduced by JVMS-7 (but only for JDK 9).

Reviewed-by: vlivanov, dnsimon, forax, never, kvn, coleenp
This commit is contained in:
Zoltan Majo 2016-06-15 14:27:58 +02:00
parent 2ade029123
commit cdc436922a
32 changed files with 284 additions and 75 deletions

View file

@ -1600,7 +1600,7 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
ValueType* type = as_ValueType(field_type);
// call will_link again to determine if the field is valid.
const bool needs_patching = !holder->is_loaded() ||
!field->will_link(method()->holder(), code) ||
!field->will_link(method(), code) ||
PatchALot;
ValueStack* state_before = NULL;