RFR: 8291752: AArch64: Remove check_emit_size parameter from trampoline_call [v3]

Evgeny Astigeevich duke at openjdk.org
Mon Aug 8 15:25:55 UTC 2022


> `MacroAssembler::trampoline_call` can skip generation of a trampoline stub if C2 phase output is in the checking emitted code size mode. If it is not C2 compilation, `trampoline_call` always generates a trampoline stub. 
> 
> `gen_continuation_enter` as a part of C2 compilation needed to disable the functionality above. Now `trampoline_call` has the `check_emit_size` which allows to disable the functionality completely. Its default value is `true` which means the functionality is enabled.
> 
> There are problems:
> - C2 specific code which must be properly guarded if it is not C2 compilation. The code has the risk of undefined behaviour (UB). It is done with `is_c2_compile`. [JDK-8291654](https://bugs.openjdk.org/browse/JDK-8291654) is an example of changes caused UB.
> - The default value of `check_emit_size`. The current value `true` allows C1 to access the C2 specific code. Setting the default value to `false` will require to review and to update every existing use of `trampoline_call`. It will complicate uses of `trampoline_call`: each time a decision needs to be done - use or not use the default.
> 
> Summary of changes:
> - Have a virtual `in_scratch_emit_size` returning `false` by default. It is privately overridden in `C2_MacroAssembler`. The overridden  version returns `true` if C2 phase output is in the checking emitted code size mode.
> - `check_emit_size` is removed because it is not needed any more.
> 
> Tested with fastdebug/release builds:
> - `gtest`: Passed.
> - `tier1`...`tier4`: Passed.

Evgeny Astigeevich has updated the pull request incrementally with one additional commit since the last revision:

  Add virtual in_scratch_emit_size instead of emit_trampoline_stub

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/9782/files
  - new: https://git.openjdk.org/jdk/pull/9782/files/2e5e4aee..71a1ef00

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=9782&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=9782&range=01-02

  Stats: 36 lines in 6 files changed: 10 ins; 8 del; 18 mod
  Patch: https://git.openjdk.org/jdk/pull/9782.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9782/head:pull/9782

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


More information about the hotspot-compiler-dev mailing list