Integrated: 8296967: [JVMCI] rationalize relationship between getCodeSize and getCode in ResolvedJavaMethod
Doug Simon
dnsimon at openjdk.org
Wed Nov 16 20:30:06 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
This pull request has now been integrated.
Changeset: 37848a9c
Author: Doug Simon <dnsimon at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/37848a9ca2ab3021e7b3b2e112bab4631fbe1d99
Stats: 317 lines in 8 files changed: 232 ins; 38 del; 47 mod
8296967: [JVMCI] rationalize relationship between getCodeSize and getCode in ResolvedJavaMethod
Reviewed-by: never
-------------
PR: https://git.openjdk.org/jdk/pull/11147
More information about the hotspot-compiler-dev
mailing list