On Mon, 21 Sep 2026 15:50:01 GMT, Jorn Vernee <[email protected]> wrote:

>> See the JBS issue for the full explanation of the issue.
>> 
>> Now that https://github.com/openjdk/jdk/pull/25315 was integrated, we are 
>> able to reliably scan for session oops in a frame, and only deoptimize those 
>> frames where the oop is live.
>> 
>> I ran the `ConcurrentClose` benchmark before and after this patch, and these 
>> were the results:
>> 
>> 
>> Before:
>> 
>> Benchmark                                        Mode  Cnt   Score   Error  
>> Units
>> ConcurrentClose.sharedClose                      avgt   10  10.139 ± 0.416  
>> us/op
>> ConcurrentClose.sharedClose:closing              avgt   10  29.288 ± 1.257  
>> us/op
>> ConcurrentClose.sharedClose:memorySegmentAccess  avgt   10   0.651 ± 0.030  
>> us/op
>> ConcurrentClose.sharedClose:otherAccess          avgt   10   0.478 ± 0.026  
>> us/op
>> 
>> After:
>> 
>> Benchmark                                        Mode  Cnt   Score   Error  
>> Units
>> ConcurrentClose.sharedClose                      avgt   10   9.860 ± 0.387  
>> us/op
>> ConcurrentClose.sharedClose:closing              avgt   10  28.641 ± 1.175  
>> us/op
>> ConcurrentClose.sharedClose:memorySegmentAccess  avgt   10   0.470 ± 0.013  
>> us/op
>> ConcurrentClose.sharedClose:otherAccess          avgt   10   0.468 ± 0.015  
>> us/op
>> 
>> 
>> We can see that now the unrelated memory access in `memorySegmentAccess` is 
>> no longer being affected by a scope being closed in another thread.
>> 
>> Testing: `jdk_foreign` suite, and I repeat ran 
>> `java/foreign/TestHandshake.java` 50 times as well, which is our stress test 
>> for shared scopes.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Jorn Vernee has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Avoid accidental deopts due to scope closure in warmup

Overall, looks good.

Minor comments follow.

src/hotspot/share/prims/scopedMemoryAccess.cpp line 120:

> 118: }
> 119: 
> 120: static frame get_last_frame(JavaThread* jt, RegisterMap* register_map) {

Nit: why is it a pointer and not a reference?

src/hotspot/share/prims/whitebox.cpp line 1770:

> 1768: WB_END
> 1769: 
> 1770: WB_ENTRY(jboolean, WB_HasScopedAccess(JNIEnv* env, jobject o, jobject 
> method))

Have you considered exposing `has_scoped_access` bit through 
`jdk.test.whitebox.code.NMethod` and `WB_GetNMethod`?

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

PR Review: https://git.openjdk.org/jdk/pull/30926#pullrequestreview-5295029801
PR Review Comment: https://git.openjdk.org/jdk/pull/30926#discussion_r4085812002
PR Review Comment: https://git.openjdk.org/jdk/pull/30926#discussion_r4085879373

Reply via email to