RFR: 8303022: "assert(allocates2(pc)) failed: not in CodeBuffer memory" When linking downcall handle [v3]
Jorn Vernee
jvernee at openjdk.org
Fri Mar 10 14:14:55 UTC 2023
> The issue is that the size of the code buffer is not large enough to hold the whole stub.
>
> Proposed solution is to scale the size of the stub with the number of arguments. I've adjusted sizes for both downcall and upcall stubs. I've also dropped the number of relocations, since we're not really using any for downcalls, and for upcalls we only have 1 AFAICS. (the size of the relocations can not be zero however, as that leads to the relocation section [not being initialized][1], and triggering [an assert][2] later when the code blob is copied).
>
> The way I've determined the new base size and per-argument size for stubs, is by first linking a stub without any arguments to get the required base size, and by then adding 20 `double` arguments to get a rough per-argument size. Both values have wiggle room as well. The sizes can be printed using e.g. `-XX:+LogCompilation`, and then looking for `nep_invoker_blob` and `upcall_stub*` in the log file. This experiment was done on a fastdebug build to account for additional debug code being generated. The included test is designed to try and maximize the size of the generated stub.
>
> I've also updated `CodeBuffer::log_section_sizes` to print the in-use size, rather than just the capacity and free space.
>
> [1]: https://github.com/openjdk/jdk/blob/56512cfe1f0682c98ba3488af3d03ccef632c016/src/hotspot/share/asm/codeBuffer.cpp#L119-L121
> [2]: https://github.com/openjdk/jdk/blob/56512cfe1f0682c98ba3488af3d03ccef632c016/src/hotspot/share/asm/codeBuffer.cpp#L675
Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:
RISCV changes
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/12908/files
- new: https://git.openjdk.org/jdk/pull/12908/files/0a2bc96c..7f467784
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=12908&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=12908&range=01-02
Stats: 14 lines in 2 files changed: 8 ins; 0 del; 6 mod
Patch: https://git.openjdk.org/jdk/pull/12908.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/12908/head:pull/12908
PR: https://git.openjdk.org/jdk/pull/12908
More information about the hotspot-compiler-dev
mailing list