RFR: JDK-8241503: C2: Share MacroAssembler between mach nodes during code emission [v11]

Boris Ulasevich bulasevich at openjdk.org
Wed Mar 27 16:15:28 UTC 2024


On Tue, 26 Mar 2024 19:02:42 GMT, Cesar Soares Lucas <cslucas at openjdk.org> wrote:

>> # Description
>> 
>> Please review this PR with a patch to re-use the same C2_MacroAssembler object to emit all instructions in the same compilation unit.
>> 
>> Overall, the change is pretty simple. However, due to the renaming of the variable to access C2_MacroAssembler, from `_masm.` to `masm->`, and also some method prototype changes, the patch became quite large.
>> 
>> # Help Needed for Testing
>> 
>> I don't have access to all platforms necessary to test this. I hope some other folks can help with testing on `S390`, `RISC-V` and `PPC`.
>
> Cesar Soares Lucas has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 12 commits:
> 
>  - Merge remote-tracking branch 'origin/master' into reuse-macroasm
>  - Fix AArch64 build & improve comment about InstructionMark
>  - Catching up with changes in master
>  - Catching up with origin/master
>  - Catch up with origin/master
>  - Merge with origin/master
>  - Fix build, copyright dates, m4 files.
>  - Fix merge
>  - Catch up with master branch.
>    
>    Merge remote-tracking branch 'origin/master' into reuse-macroasm
>  - Some inst_mark fixes; Catch up with master.
>  - ... and 2 more: https://git.openjdk.org/jdk/compare/89e0889a...b4d73c98

FYI. Something goes wrong with the change on ARM32.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/ws/workspace/jdk-dev/label/linux-arm/type/b11/jdk/src/hotspot/share/asm/codeBuffer.hpp:163), pid=10782, tid=10796
#  assert(_mark != nullptr) failed: not an offset
#
# JRE version: OpenJDK Runtime Environment (23.0) (fastdebug build 23-commit8fc9097b-adhoc.re.jdk)
# Java VM: OpenJDK Server VM (fastdebug 23-commit8fc9097b-adhoc.re.jdk, mixed mode, g1 gc, linux-arm)
# Problematic frame:
# V  [libjvm.so+0x136ccc]  emit_call_reloc(C2_MacroAssembler*, MachCallNode const*, MachOper*, RelocationHolder const&)+0x2ac
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P %E" (or dumping to /ws/workspace/jdk-dev-jtreg/label/linux-arm/suite/jdk-tier1/type/t11/core.10782)
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

---------------  S U M M A R Y ------------

Command Line:

Host: vm-ubuntu-16v4-aarch64-1, ARM, 4 cores, 7G, Ubuntu 16.04.7 LTS
Time: Wed Mar 27 07:16:41 2024 UTC elapsed time: 0.097440 seconds (0d 0h 0m 0s)

---------------  T H R E A D  ---------------

Current thread (0xb120cd10):  JavaThread "C2 CompilerThread0" daemon [_thread_in_vm, id=10796, stack(0xb1090000,0xb1110000) (512K)]

Stack: [0xb1090000,0xb1110000],  sp=0xb110d200,  free space=500k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x136ccc]  emit_call_reloc(C2_MacroAssembler*, MachCallNode const*, MachOper*, RelocationHolder const&)+0x2ac  (codeBuffer.hpp:163)
V  [libjvm.so+0x14ca28]  CallRuntimeDirectNode::emit(C2_MacroAssembler*, PhaseRegAlloc*) const+0x80
V  [libjvm.so+0x10ed850]  PhaseOutput::scratch_emit_size(Node const*)+0x37c
V  [libjvm.so+0x10e5f64]  PhaseOutput::shorten_branches(unsigned int*)+0x274
V  [libjvm.so+0x10f6dcc]  PhaseOutput::Output()+0x488
V  [libjvm.so+0x699b54]  Compile::Code_Gen()+0x424
V  [libjvm.so+0x69a87c]  Compile::Compile(ciEnv*, TypeFunc const* (*)(), unsigned char*, char const*, int, bool, bool, DirectiveSet*)+0xb3c
V  [libjvm.so+0x122e73c]  OptoRuntime::generate_stub(ciEnv*, TypeFunc const* (*)(), unsigned char*, char const*, int, bool, bool)+0xb4
V  [libjvm.so+0x122ec68]  OptoRuntime::generate(ciEnv*)+0x50
V  [libjvm.so+0x4994cc]  C2Compiler::init_c2_runtime()+0x104
V  [libjvm.so+0x4996dc]  C2Compiler::initialize()+0x9c
V  [libjvm.so+0x6a371c]  CompileBroker::init_compiler_runtime()+0x35c
V  [libjvm.so+0x6ab90c]  CompileBroker::compiler_thread_loop()+0x178
V  [libjvm.so+0xb30c94]  JavaThread::thread_main_inner()+0x27c
V  [libjvm.so+0x13b3aa0]  Thread::call_run()+0x130
V  [libjvm.so+0x10c98bc]  thread_native_entry(Thread*)+0x13c

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

PR Comment: https://git.openjdk.org/jdk/pull/16484#issuecomment-2023165642


More information about the shenandoah-dev mailing list