RFR: 8373495: C2: Aggressively fold loads from objects that have not escaped [v16]

Roberto Castañeda Lozano rcastanedalo at openjdk.org
Tue Jan 13 09:53:34 UTC 2026


On Mon, 12 Jan 2026 14:58:43 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> src/hotspot/share/opto/memnode.cpp line 708:
>> 
>>> 706: 
>>> 707:   Node* mem = in(MemNode::Memory);   // start searching here...
>>> 708: 
>> 
>> Would it make sense to check and bail out early for some trivial non-candidates here? It feels a bit wasteful e.g. to run the LocalEA machinery for loads from `ThreadLocal`.
>
> That seems reasonable. I added an early return case when the base that is accessed is not an oop.

Thanks! Could the early return case be hoisted to `MemNode::find_previous_store` so that we avoid constructing `local_ea`? Or is there any case where `base` is not an OOP and `find_previous_store` would still find something useful?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28812#discussion_r2685661054


More information about the hotspot-compiler-dev mailing list