RFR: Save/load nmethod without going through CodeBuffer

Vladimir Kozlov kvn at openjdk.org
Mon Mar 17 11:43:52 UTC 2025


On Wed, 11 Dec 2024 17:27:35 GMT, Ashutosh Mehra <asmehra at openjdk.org> wrote:

>> This is the prototype for storing and loading nmethods without going through the CodeBuffer.
>> The new implementation is protected by the flag -XX:+UseNewCode2.
>> 
>> Some numbers using this implementation:
>> spring-boot-getting-started [0] shows startup improvement of ~ 7.5%% and quarkus-getting-started [1] shows improvement of around ~3.5%.
>> 
>> Numbers for Springboot
>> 
>> Old build = /home/asmehra/data/ashu-mehra/leyden/build/nmethod-single-copy-load-release/images/jdk with options -XX:+UnlockDiagnosticVMOptions -XX:-UseNewCode2
>> New build = /home/asmehra/data/ashu-mehra/leyden/build/nmethod-single-copy-load-release/images/jdk with options -XX:+UnlockDiagnosticVMOptions -XX:+UseNewCode2
>> Run,Old CDS + AOT,New CDS + AOT
>> 1,544,512
>> 2,554,525
>> 3,550,508
>> 4,571,515
>> 5,550,506
>> 6,552,515
>> 7,568,510
>> 8,554,517
>> 9,551,506
>> 10,556,508
>> Geomean,554.94,512.17
>> Stdev,7.90,5.65
>> 
>> Numbers for Quarkus:
>> 
>> Old build = /home/asmehra/data/ashu-mehra/leyden/build/nmethod-single-copy-load-release/images/jdk with options -XX:+UnlockDiagnosticVMOptions -XX:-UseNewCode2
>> New build = /home/asmehra/data/ashu-mehra/leyden/build/nmethod-single-copy-load-release/images/jdk with options -XX:+UnlockDiagnosticVMOptions -XX:+UseNewCode2
>> Run,Old CDS + AOT,New CDS + AOT
>> 1,359,346
>> 2,360,353
>> 3,373,357
>> 4,376,356
>> 5,366,353
>> 6,360,356
>> 7,361,361
>> 8,347,349
>> 9,355,336
>> 10,374,342
>> Geomean,363.00,350.82
>> Stdev,8.70,7.27
>> 
>> 
>> -Xlog:init logs the load time from AOT code cache at JVM exit.
>> For spring-boot-getting-started without `UseNewCode2`:
>> 
>> [3.459s][info][init]     SC Load Time:           0.202 s
>> [3.459s][info][init]       nmethod register:       0.135 s
>> [3.459s][info][init]       find cached code:       0.007 s
>> 
>> 
>> For spring-boot-getting-started with `UseNewCode2`:
>> 
>> [3.192s][info][init] 
>> [3.192s][info][init]     SC Load Time:           0.138 s
>> [3.192s][info][init]       nmethod register:       0.111 s
>> [3.192s][info][init]       find cached code:       0.006 s
>> 
>> 
>> For quarkus-getting-started without `UseNewCode2`
>> 
>> [0.392s][info][init]     SC Load Time:           0.060 s
>> [0.392s][info][init]       nmethod register:       0.039 s
>> [0.392s][info][init]       find cached code:       0.002 s
>> 
>> 
>> For quarkus-getting-started with `UseNewCode2`
>> 
>> [0.386s][info][init]     SC Load Time:           0.033 s
>> [0.386s][info][init]       nmethod register:       0.027 s
>> [0.386s][info][init]       find cached code:      ...
>
> @adinn @vnkozlov fyi

Hi @ashu-mehra 
This is good POC.  In general this looks good. My only concern is that `SCnmethod` is "copy" of `nmethod` so you have to copy values. Can you make `SCnmethod` as subclass of `nmethod` so you don't need to allocate it and copy offsets values which don't change?  If it is difficult, please explain why.

I see that you use `apply_relocations()` to update relocations only once. Good.

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

PR Comment: https://git.openjdk.org/leyden/pull/27#issuecomment-2573726777


More information about the leyden-dev mailing list