RFR: JDK-8241503: C2: Share MacroAssembler between mach nodes during code emission [v11]
Boris Ulasevich
bulasevich at openjdk.org
Mon Apr 8 06:12:07 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
Do you need help understanding the problem? The crash occurred because you removed the line `fprintf(fp, " cbuf.set_insts_mark();\n");` from the generator of AD nodes ::emit() methods. That is why emit_call_reloc finds cbuf.insts->_mark unitialized.
// Call Runtime Instruction
instruct CallRuntimeDirect(method meth) %{
match(CallRuntime);
effect(USE meth);
ins_cost(CALL_COST);
format %{ "CALL,runtime" %}
ins_encode( Java_To_Runtime( meth ),
call_epilog );
ins_pipe(simple_call);
%}
-->
void CallRuntimeDirectNode::emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const {
cbuf.set_insts_mark();
// Start at oper_input_base() and count operands
unsigned idx0 = 1;
unsigned idx1 = 1; //
{
#line 1217 "/home/boris/jdk-bulasevich/src/hotspot/cpu/arm/arm.ad"
// CALL directly to the runtime
emit_call_reloc(cbuf, as_MachCall(), opnd_array(1), runtime_call_Relocation::spec());
#line 999999
}
{
#line 1213 "/home/boris/jdk-bulasevich/src/hotspot/cpu/arm/arm.ad"
// nothing
#line 999999
}
}
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16484#issuecomment-2041935047
More information about the shenandoah-dev
mailing list