On Tue, 2 Dec 2025 01:09:59 GMT, Chen Liang <[email protected]> wrote:

>> test/hotspot/jtreg/compiler/c2/irTests/TestGetAndAdd.java line 78:
>> 
>>> 76:     @IR(counts = {IRNode.X86_LOCK_XADDB, "3"}, phase = 
>>> CompilePhase.FINAL_CODE)
>>> 77:     public static void addB() {
>>> 78:         var _ = (byte) B.getAndAdd(b2);
>> 
>>> Since I removed the return type dropping VarHandle bypass, TestGetAndAdd 
>>> became affected because it can no longer access the x86 assembly. 
>> 
>> It has performance implications for user code, doesn't it?
>
> The performance is measured by the existing 
> `org.openjdk.bench.java.lang.invoke.VarHandleExact` benchmark, which 
> originally expects  `generic_genericInvocation` to be much slower. Now it 
> instead has a performance on par with the exact invocations.
> 
> The constant folding ability is verified with the new 
> `VarHandleMismatchedTypeFold` IR test.

If I understand the IR test logic correctly, C2 was able to compile `(void) 
B.getAndAdd(b2)` call down to the desired instruction sequence. Is it still the 
case after the fix? What happens if you keep `TestGetAndAdd.java
` intact?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2579300293

Reply via email to