[External] : AOTClassLocationConfig::_max_used_index == 0 with -jar despite classes loading from AOTCache
Hi, My record+create run is as follows: ``` java -XX:-BackgroundCompilation -XX:AOTCacheOutput=sub.aot -jar target/sub-1.0-SNAPSHOT.jar ``` During my production run: ``` java -XX:-BackgroundCompilation -XX:AOTCache=sub.aot -jar target/sub-1.0-SNAPSHOT.jar ``` I observe that need_to_check_app_classpath<https://github.com/openjdk/jdk/blob/62c7e9aefd4320d9d0cd8fa10610f59abb4de670/src/hotspot/share/cds/aotClassLocation.cpp#L1000> returns false because _max_used_index (0) >= app_cp_start_index() (1)<https://github.com/openjdk/jdk/blob/62c7e9aefd4320d9d0cd8fa10610f59abb4de670/src/hotspot/share/cds/aotClassLocation.hpp#L199>. I wonder why _max_used_index is 0 here because when I do: ``` java -Xlog:class+load -XX:AOTCache=sub/sub.aot -jar sub/target/sub-1.0-SNAPSHOT.jar | grep "example"
[0.021s][info][class,load] com.example.Subtractor source: shared objects file
``` The class+load logs suggest that it has been loaded from AOTCache. However, when I do look up the ro region for symbols for classes, I don't see "com.example.Subtractor". So the situation appears somewhat contradictory: * class+load logs indicate the class is loaded from the AOT cache. * The class symbol for com.example.Subtractor does not appear in the RO region of AOTCache, indicating that the class is not in AOTCache. Code snippets required and packaging it using maven-shade-plugin package com.example; public class Subtractor { public int subtract(int a, int b) { return a - b; } public long subtract(long a, long b) { return a - b; } public static void main(String[] args) { Subtractor s = new Subtractor(); // Warm up so the JIT compiles these methods long result = 0; for (int i = 0; i < 500_000; i++) { result += s.subtract(i, i / 2); } System.out.println("Subtractor warmup complete. Result: " + result); } } Regards, Aman Sharma PhD Student KTH Royal Institute of Technology School of Electrical Engineering and Computer Science (EECS) Department of Theoretical Computer Science (TCS) <http://www.kth.se><https://www.kth.se/profile/amansha><https://www.kth.se/profile/amansha> <https://www.kth.se/profile/amansha>https://algomaster99.github.io/
participants (1)
-
Aman Sharma