RFR: 8296967: JVMCI] rationalize relationship between getCodeSize and getCode in ResolvedJavaMethod
Doug Simon
dnsimon at openjdk.org
Mon Nov 14 21:12:07 UTC 2022
When `ResolvedJavaMethod.getCodeSize()` returns a value > 0, `ResolvedJavaMethod.getCode()` will return `null` if the declaring class is not linked, contrary to the intuition of most JVMCI API users.
This PR rationalizes the API such that:
ResolvedJavaMethod m = ...;
ResolvedJavaType c = m.getDeclaringClass();
assert (m.getCodeSize() > 0) == (m.getCode() != null); // m is a non-abstract, non-native method whose declaring class is linked in the current runtime
assert (m.getCodeSize() == 0) == (m.getCode() == null); // m is an abstract or native method
assert c.isLinked() == (m.getCodeSize() >= 0); // m's code size will always be >= 0 if its declaring class is linked in the current runtime
-------------
Commit messages:
- getCodeSize and hasBytecodes in ResolvedJavaMethod now return -1 and false for concrete methods in unlinked classes (GR-41977)
Changes: https://git.openjdk.org/jdk/pull/11147/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11147&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8296967
Stats: 317 lines in 8 files changed: 232 ins; 38 del; 47 mod
Patch: https://git.openjdk.org/jdk/pull/11147.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/11147/head:pull/11147
PR: https://git.openjdk.org/jdk/pull/11147
More information about the hotspot-compiler-dev
mailing list