RFR: 8263718: unused-result warning happens at os_linux.cpp
Magnus Ihse Bursie
ihse at openjdk.java.net
Sat Mar 20 10:23:39 UTC 2021
On Sat, 20 Mar 2021 03:03:09 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:
>>> It would be good to confirm that the alloca is also being elided with
>>> clang and VS.
>>
>> I debug'ed fastdebug JDK on Visual Studio, it seems to work `alloca()`:
>>
>> // Try to randomize the cache line index of hot stack frames.
>> // This helps when threads of the same stack traces evict each other's
>> // cache lines. The threads can be either from the same JVM instance, or
>> // from different JVM instances. The benefit is especially true for
>> // processors with hyperthreading technology.
>> static int counter = 0;
>> int pid = os::current_process_id();
>> 00007FFFDEBDCFF0 add byte ptr [rbx-7A78FEF3h],cl
>> _alloca(((pid ^ counter++) & 7) * 128);
>> 00007FFFDEBDCFF6 add byte ptr [rbx-2FCC2Fh],cl
>> 00007FFFDEBDCFFC ror dword ptr [rcx-7A790AF3h],0
>> 00007FFFDEBDD003 and edx,7
>> 00007FFFDEBDD006 shl edx,7
>> 00007FFFDEBDD009 mov eax,edx
>> 00007FFFDEBDD00B lea rcx,[rdx+0Fh]
>> 00007FFFDEBDD00F cmp rcx,rax
>> 00007FFFDEBDD012 ja thread_native_entry+6Eh (07FFFDEBDD01Eh)
>> 00007FFFDEBDD014 mov rcx,0FFFFFFFFFFFFFF0h
>> 00007FFFDEBDD01E and rcx,0FFFFFFFFFFFFFFF0h
>> 00007FFFDEBDD022 mov rax,rcx
>> 00007FFFDEBDD025 call __chkstk (07FFFDEEFF430h)
>> 00007FFFDEBDD02A sub rsp,rcx
>>
>> `alloca()` is also in os_bsd.cpp and os_aix.cpp, but I cannot check them because I do not have them.
>
>> I debug'ed fastdebug JDK on Visual Studio, it seems to work `alloca()`:
>
> I used cl.exe from Visual Studio 2019 (16.9.1). The generated code might be different by compiler version of course.
@YaSuenag The code generated by debug builds is often significantly different from release builds. You might want to check the latter instead to figure out if this has any effect on what we actually ship.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3042
More information about the hotspot-dev
mailing list