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

Fei Yang fyang at openjdk.org
Mon Mar 25 02:09:25 UTC 2024


On Fri, 3 Nov 2023 04:44:40 GMT, Fei Yang <fyang 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`.
>
> Hello, I guess you might want to merge latest jdk master and add more changes.
> I witnessed some build errors when building the latest jdk master with this patch on linux-riscv64:
> 
> /home/fyang/jdk/src/hotspot/cpu/riscv/riscv.ad: In member function 'virtual void UdivINode::emit(C2_MacroAssembler*, PhaseRegAlloc*) const':
> /home/fyang/jdk/src/hotspot/cpu/riscv/riscv.ad:2412:30: error: 'cbuf' was not declared in this scope
>  2412 |     C2_MacroAssembler _masm(&cbuf);
>       |                              ^~~~
> /home/fyang/jdk/src/hotspot/cpu/riscv/riscv.ad: In member function 'virtual void UdivLNode::emit(C2_MacroAssembler*, PhaseRegAlloc*) const':
> /home/fyang/jdk/src/hotspot/cpu/riscv/riscv.ad:2427:30: error: 'cbuf' was not declared in this scope
>  2427 |     C2_MacroAssembler _masm(&cbuf);
>       |                              ^~~~
> /home/fyang/jdk/src/hotspot/cpu/riscv/riscv.ad: In member function 'virtual void UmodINode::emit(C2_MacroAssembler*, PhaseRegAlloc*) const':
> /home/fyang/jdk/src/hotspot/cpu/riscv/riscv.ad:2442:30: error: 'cbuf' was not declared in this scope
>  2442 |     C2_MacroAssembler _masm(&cbuf);
>       |                              ^~~~
> /home/fyang/jdk/src/hotspot/cpu/riscv/riscv.ad: In member function 'virtual void UmodLNode::emit(C2_MacroAssembler*, PhaseRegAlloc*) const':
> /home/fyang/jdk/src/hotspot/cpu/riscv/riscv.ad:2457:30: error: 'cbuf' was not declared in this scope
>  2457 |     C2_MacroAssembler _masm(&cbuf);

> @RealFYang - Thanks for the note. I'll do that and update the PR.

Thanks for the update. The RISC-V part looks fine to me. I did release release build and ran tier1-3 tests on linux-riscv64 platform.

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

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


More information about the shenandoah-dev mailing list