RFR: 8286314: Trampoline not created for far runtime targets outside small CodeCache

Andrew Haley aph at openjdk.org
Wed Jun 22 13:28:39 UTC 2022


On Wed, 22 Jun 2022 11:50:36 GMT, Evgeny Astigeevich <duke at openjdk.org> wrote:

> `relocInfo::runtime_call_type` calls can have targets inside or outside CodeCache. If offsets to the targets are not in range, trampoline calls must be used. Currently trampolines for calls are generated based on the size of CodeCache and the maximum possible branch range. If the size of CodeCache is smaller than the range, no trampoline is generated. This works well if a target is inside CodeCache. It does not work if a target is outside CodeCache and CodeCache size is smaller than the maximum possible branch range.
> 
> ### Solution
> Runtime call sites are always in CodeCache. In case of a target outside small CodeCache, we can find the start of the longest possible branch from CodeCache. Then we check with `reachable_from_branch_at` whether a target is reachable. If not, a trampoline is needed.
> 
> ### Testing
> It is tested with the release and fastdebug builds. Release builds have the maximum possible branch range 128M. Fastdebug builds have it 2M for the purpose of testing trampolines.
> Results:
> - `gtest`: Passed
> - `tier1`: Passed

Looks good. Nice commenting too.

I guess we'll need backports. Has this bug ever materialized on old releases?

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

Marked as reviewed by aph (Reviewer).

PR: https://git.openjdk.org/jdk/pull/9235


More information about the hotspot-compiler-dev mailing list