[10] RFR(S) 8183262: noexecstack check in os::dll_load on Linux is too expensive

Vladimir Kozlov vladimir.kozlov at oracle.com
Fri Jun 30 17:07:47 UTC 2017

webrev: http://cr.openjdk.java.net/~kvn/8183262/webrev/

To load AOT library we use os::dll_load() method provided on all platforms.

During investigation why AOT library load takes so long on Linux I found 
that it spend most of time in ElfFile::load_tables() method which looks 
for string tables in library. It is called from ElfFile() constructor 
used in os::dll_load() just to check if library is built with noexecstack:

  if (os::uses_stack_guard_pages() && !os::Linux::_stack_is_executable) {
    ElfFile ef(filename);
    if (!ef.specifies_noexecstack()) {

There is no need for string tables load in such case. Avoiding loads 
helps a lot:

without fix:

[0.047s][info][aot,startuptime] AOT initialization, 0.0424919 secs

with fix:

[0.002s][info][aot,startuptime] AOT initialization, 0.0002087 secs

Note, JDK 9 is not affected because AOT uses system dlopen() since only 
Linux is supported.


More information about the hotspot-runtime-dev mailing list