RFR: 8336489: Track scoped accesses in JVMCI compiled code [v5]

Doug Simon dnsimon at openjdk.org
Mon Aug 5 09:04:40 UTC 2024


On Fri, 26 Jul 2024 17:16:02 GMT, Carlo Refice <duke at openjdk.org> wrote:

>> This PR adds JVMCI support to scoped access tracking introduced in #20158.
>> 
>> In this PR:
>> * The `Method::is_scoped` flag is now exposed in JVMCI as `HotSpotResolvedJavaMethod.isScoped()`, and serialized to / deserialized from the JVMCI compiled code stream as a boolean flag.
>> * To determine whether a compiled method has a scoped access, we simply check `HotSpotResolvedJavaMethod.isScoped()` returns `true` for the root method or any of the methods that were inlined in the compilation.
>> * The above check is implemented as the method `HotSpotCompiledNMethod.hasScopedAccess()`, instead of as an explicit flag set in a the constructor of `HotSpotCompiledNMethod`. This keeps the change isolated to JVMCI, without requiring coordinated changes to the Graal compiler. No other changes in the compiler are necessary to benefit from the optimization.
>
> Carlo Refice has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
> 
>  - Add test for ResolvedJavaMethod#isScoped()
>  - Pull HotSpotResolvedJavaMethod#isScoped() to ResolvedJavaMethod
>  - Fix truncation of Method and ConstMethod flags in HotSpotResolvedJavaMethodImpl
>  - Clarify HotSpotResolvedJavaMethod#isScoped javadoc
>  - Track scoped accesses in JVMCI compiled code

Marked as reviewed by dnsimon (Reviewer).

src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotResolvedJavaMethod.java line 2:

> 1: /*
> 2:  * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.

No need for copyright update as this source is not otherwise modified.

test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaMethod.java line 485:

> 483:             ResolvedJavaMethod m = e.getValue();
> 484:             Method key = e.getKey();
> 485:             boolean expect = key.isAnnotationPresent(scopedAnnotationClass);

Please add an assertion after the loop that `expect` was true at least once.

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

PR Review: https://git.openjdk.org/jdk/pull/20256#pullrequestreview-2218382563
PR Review Comment: https://git.openjdk.org/jdk/pull/20256#discussion_r1703752873
PR Review Comment: https://git.openjdk.org/jdk/pull/20256#discussion_r1703783605


More information about the graal-dev mailing list