mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
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:
parent
2ade029123
commit
cdc436922a
32 changed files with 284 additions and 75 deletions
|
@ -558,6 +558,7 @@ void InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecodes::Code byt
|
|||
// resolve field
|
||||
fieldDescriptor info;
|
||||
constantPoolHandle pool(thread, method(thread)->constants());
|
||||
methodHandle m(thread, method(thread));
|
||||
bool is_put = (bytecode == Bytecodes::_putfield || bytecode == Bytecodes::_nofast_putfield ||
|
||||
bytecode == Bytecodes::_putstatic);
|
||||
bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic);
|
||||
|
@ -565,7 +566,7 @@ void InterpreterRuntime::resolve_get_put(JavaThread* thread, Bytecodes::Code byt
|
|||
{
|
||||
JvmtiHideSingleStepping jhss(thread);
|
||||
LinkResolver::resolve_field_access(info, pool, get_index_u2_cpcache(thread, bytecode),
|
||||
bytecode, CHECK);
|
||||
m, bytecode, CHECK);
|
||||
} // end JvmtiHideSingleStepping
|
||||
|
||||
// check if link resolution caused cpCache to be updated
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue