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

Hao Sun haosun at openjdk.org
Fri Dec 1 05:24:08 UTC 2023


On Wed, 29 Nov 2023 22:40:35 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`.
>> 
>> # Testing status
>> 
>> ## tier1
>> 
>> |          |   Win   |   Mac   |  Linux  |
>> |----------|---------|---------|---------|
>> | ARM64    |         |         |         |
>> | ARM32    |         |         |         |
>> | x86      |         |         |         |
>> | x64      |         |         |         |
>> | PPC64    |         |         |         |
>> | S390x    |         |         |         |
>> | RiscV    |         |         |         |
>
> 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 five commits:
> 
>  - Fix merge
>  - Catch up with master branch.
>    
>    Merge remote-tracking branch 'origin/master' into reuse-macroasm
>  - Some inst_mark fixes; Catch up with master.
>  - Catch up with changes on master
>  - Reuse same C2_MacroAssembler object to emit instructions.

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

> 1244:     if (_next_call_type == INVOKESTATIC || _next_call_type == INVOKESPECIAL) {
> 1245:       // Need a static call stub for transitions from compiled to interpreted.
> 1246:       C2_MacroAssembler masm(&buffer);

Hi, I encountered one build failure: JDK build **without C2** fails on Linux/AArch64.

The configure I used


--with-debug-level=release --with-jvm-features=-compiler2 --disable-precompiled-headers


The error log


=== Output from failing command(s) repeated here ===
* For target hotspot_variant-server_libjvm_gtest_objs_BUILD_GTEST_LIBJVM_link:
/usr/bin/ld: /tmp/build-release/hotspot/variant-server/libjvm/objs/jvmciCodeInstaller.o: in function `C2_MacroAssembler::C2_MacroAssembler(CodeBuffer*)':
make/hotspot/src/hotspot/share/opto/c2_MacroAssembler.hpp:38: undefined reference to `vtable for C2_MacroAssembler'
/usr/bin/ld: make/hotspot/src/hotspot/share/opto/c2_MacroAssembler.hpp:38: undefined reference to `vtable for C2_MacroAssembler'
collect2: error: ld returned 1 exit status
* For target hotspot_variant-server_libjvm_objs_BUILD_LIBJVM_link:
/usr/bin/ld: /tmp/build-release/hotspot/variant-server/libjvm/objs/jvmciCodeInstaller.o: in function `C2_MacroAssembler::C2_MacroAssembler(CodeBuffer*)':
make/hotspot/src/hotspot/share/opto/c2_MacroAssembler.hpp:38: undefined reference to `vtable for C2_MacroAssembler'
/usr/bin/ld: make/hotspot/src/hotspot/share/opto/c2_MacroAssembler.hpp:38: undefined reference to `vtable for C2_MacroAssembler'
collect2: error: ld returned 1 exit status

* All command lines available in /tmp/build-release/make-support/failure-logs.
=== End of repeated output ===


I suggest making the following change:

Suggestion:

      MacroAssembler masm(&buffer);

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16484#discussion_r1411551297


More information about the shenandoah-dev mailing list