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

Cesar Soares Lucas cslucas at openjdk.org
Mon Nov 6 22:22:30 UTC 2023


On Fri, 3 Nov 2023 02:04:13 GMT, Dean Long <dlong at openjdk.org> wrote:

>> src/hotspot/cpu/x86/gc/z/z_x86_64.ad line 37:
>> 
>>> 35: #include "gc/z/zBarrierSetAssembler.hpp"
>>> 36: 
>>> 37: static void z_color(MacroAssembler* masm, const MachNode* node, Register ref) {
>> 
>> For files already using MacroAssembler& _masm, the only change needed is this at the top:
>> 
>> undef __
>> #define __ _masm.
>
> I guess that doesn't work because different files are concatenated together, causing a conflict if some files expect MacroAssembler *masm.  To reduce the number of changes, couldn't we use MacroAssembler& _masm everywhere?

Because some places were using `if (cbuf)` I ended up opting to make the parameter also a pointer instead of a reference.

> For files already using MacroAssembler& _masm, the only change needed is this at the top:

My opinion would be to use Reference or Pointer everywhere and not mix the two - to prevent confusion. But if you folks think it's best to go that way, I'm fine with it.

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

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


More information about the shenandoah-dev mailing list