RFR: 8348261: assert(n->is_Mem()) failed: memory node required

Vladimir Kozlov kvn at openjdk.org
Fri Mar 7 19:07:54 UTC 2025


On Fri, 7 Mar 2025 09:13:33 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> Add missing check for StrInflatedCopy intrinsic in C2 Escape Analysis.
>> 
>> Very rare case since we not usually use Latin1.inflate(). In failing case we inline both paths in [String.getBytes()](https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/String.java#L4808) and eliminate `TreeMap$EntryIterator allocation:
>> 
>> 
>>         # java.lang.String::getBytes @ bci:40 (line 4812) L[0]=rsp + #64 L[1]=rsp + #132 L[2]=rsp + #120 L[3]=rsp + #124 STK[0]=rsp + #128 STK[1]=#0 STK[2]=rsp + #132 STK[3]=rsp + #120 STK[4]=rsp + #164
>>         # java.lang.AbstractStringBuilder::putStringAt @ bci:15 (line 1754) L[0]=rsp + #0 L[1]=rsp + #120 L[2]=rsp + #64
>>         # java.lang.AbstractStringBuilder::append @ bci:30 (line 592) L[0]=rsp + #0 L[1]=rsp + #64 L[2]=rsp + #28
>>         # java.lang.StringBuilder::append @ bci:2 (line 179) L[0]=rsp + #0 L[1]=rsp + #64
>>         # java.lang.StringBuilder::append @ bci:5 (line 173) L[0]=rsp + #0 L[1]=rsp + #32
>>         # sun.util.locale.LocaleExtensions::toID @ bci:100 (line 206) L[0]=RBP L[1]=rsp + #0 L[2]=rsp + #8 L[3]=#ScObj0 L[4]=rsp + #16 L[5]=rsp + #24 L[6]=rsp + #32
>>         # ScObj0 java/util/TreeMap$EntryIterator={ [expectedModCount :0]=rsp + #140, [next :1]=rsp + #176, [lastReturned :2]=rsp + #16, [this$0 :3]=rsp + #168 }
>> 
>> 
>> Unfortunately I was not able to create standalone test - it seems requires very particular frequencies of executed paths and used features/flags. The fix was verified with compilation replay file from the bug report.
>> 
>> I am running testing and will let you know results.
>
> src/hotspot/share/opto/escape.cpp line 4725:
> 
>> 4723:     } else {
>> 4724: #ifdef ASSERT
>> 4725:       if (!n->is_Mem()) {
> 
> Would it make sense to turn this into a product check? Could we bail-out gracefully at this point?

For first question - may be but we hit it first time since JDK 9. I think we should balance what is really needs to be checked in product and what can be done in debug VM. For this case I think checking in debug is fine.
For second question - not from EA but we can from compilation. We are in `split_unique_types()` where we start modifying graph already.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23938#discussion_r1985557362


More information about the hotspot-compiler-dev mailing list