RFR: 8364490: Fatal error on large SpecTrapLimitExtraEntries value [v2]
Christian Hagedorn
chagedorn at openjdk.org
Tue Nov 25 15:55:11 UTC 2025
On Tue, 25 Nov 2025 14:19:38 GMT, Anton Seoane Ampudia <aseoane at openjdk.org> wrote:
>> This PR addresses VM crashes on very large values for `SpecTrapLimitExtraEntries`.
>>
>> The experimental `SpecTrapLimitExtraEntries` allows for a user-specified number of extra method data trap entries for speculation. Currently, this number is implemented with an `int`, which means that users can specify very large values that will translate into huge `MethodData` objects that cannot be allocated in Metaspace.
>>
>> An `int` range of values should not be allowed, as negative `SpecTrapLimitExtraEntries` do not make any sense, and very high values (such as the ones that cause this crash) are equally nonsensical. This changeset adds a range to the flag values to address these issues.
>>
>> `SpecTrapLimitExtraEntries` is `MAX`ed with HotSpot's computed heuristic, which means that in any case it can only serve as a buffer above the heuristic. Based on benchmarks where I logged heuristic-derived values for extra `DataLayout` cells, even a value of 50 for `SpecTrapLimitExtraEntries` is more than sufficient. To provide some headroom and keep things simple, I have set the upper limit to 100.
>>
>> **Testing:** passes tiers 1-2
>
> Anton Seoane Ampudia has updated the pull request incrementally with one additional commit since the last revision:
>
> Add simple sanity test
Yes, that's perfect, thanks for adding the test!
test/hotspot/jtreg/compiler/arguments/TestSpecTrapLimitExtraEntries.java line 25:
> 23:
> 24: /*
> 25: * @test
You can add the bug number:
Suggestion:
* @test
* @bug 8364490
test/hotspot/jtreg/compiler/arguments/TestSpecTrapLimitExtraEntries.java line 27:
> 25: * @test
> 26: * @summary "Hello world" sanity test for SpecTrapLimitExtraEntries
> 27: * @requires vm.flagless
Is this really required? I would have expected that it also works regardless of the flags being passed in. This gives some more coverage (e.g. running with `-Xcomp` etc.).
-------------
PR Review: https://git.openjdk.org/jdk/pull/28451#pullrequestreview-3505739361
PR Review Comment: https://git.openjdk.org/jdk/pull/28451#discussion_r2560512991
PR Review Comment: https://git.openjdk.org/jdk/pull/28451#discussion_r2560514656
More information about the hotspot-compiler-dev
mailing list