RFR: 8347248: Fingerprinter::size_of_parameters() should not be used for getting number of parameters

Ioi Lam iklam at openjdk.org
Tue Nov 18 21:43:31 UTC 2025


On Tue, 18 Nov 2025 20:12:20 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

> The method size_of_parameters() is sometimes used as if it represents the number of arguments rather than the size in bytes of the arguments. This patch changes some of these instances to the correct result or renames some of the variables to the desired result. Verified with tier 1-5 tests.

src/hotspot/share/jvmci/jvmciCodeInstaller.cpp line 857:

> 855: void CodeInstaller::initialize_fields(HotSpotCompiledCodeStream* stream, u1 code_flags, methodHandle& method, CodeBuffer& buffer, JVMCI_TRAPS) {
> 856:   if (!method.is_null()) {
> 857:     _parameter_count = method->number_of_parameters();

_parameter_count is used to create a OopMap, so it must be in the number of words that are ocupied by all the arguments, not the number of parameters.

https://github.com/openjdk/jdk/blob/27a38d9093958ae4851bc61b8d3f0d71dc780823/src/hotspot/share/jvmci/jvmciCodeInstaller.cpp#L263

src/hotspot/share/prims/jni.cpp line 871:

> 869:   ResourceMark rm(THREAD);
> 870:   int size_of_parameters = method->size_of_parameters();
> 871:   JavaCallArguments java_args(size_of_parameters);

The original code was harmless. It creates the JavaCallArguments with more space than necessary, but doesn't affect the actual number of parameters that are passed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28380#discussion_r2539653885
PR Review Comment: https://git.openjdk.org/jdk/pull/28380#discussion_r2539631698


More information about the graal-dev mailing list