RFR: 8296967: [JVMCI] rationalize relationship between getCodeSize and getCode in ResolvedJavaMethod
Tom Rodriguez
never at openjdk.org
Wed Nov 16 19:43:00 UTC 2022
On Mon, 14 Nov 2022 21:03:19 GMT, Doug Simon <dnsimon at openjdk.org> wrote:
> 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
Marked as reviewed by never (Reviewer).
-------------
PR: https://git.openjdk.org/jdk/pull/11147
More information about the hotspot-compiler-dev
mailing list