[aarch64-port-dev ] RFR(M): 8233743: AArch64: Make r27 conditionally allocatable

Pengfei Li (Arm Technology China) Pengfei.Li at arm.com
Fri Nov 22 08:45:47 UTC 2019


Hi Andrew,

> > In which file do you think we should add the flag? Can we just check the
> value of CompressedKlassPointers::base() in reg_mask_init() ?
> 
> I would call from the #ifdef AARCH64 code that allocates the memory into a
> static method Assembler::setCompressedBaseAndScale().

Thanks for your suggestion. I have ever tried to set a flag from the metaspace reservation code but now I'm switching back to my another approach. Below is my justification.

The #ifdef code block which allocates metaspace is actually used by both AARCH64 and AIX. Of course, we can add AArch64-specific logic inside with AARCH64_ONLY(), but it doesn't cover all scenarios that r27 isn't used. In klass pointers encoding and decoding, we have a special path called use_XOR_for_compressed_class_base where the metaspace may be not nicely fit but r27 isn't used. [1]

Regarding your suggestion of setting compressed base and shift values into AArch64 assembler, it can solve the problem of covering the use_XOR_for_compressed_class_base path. But we have to do it in Metaspace::set_narrow_klass_base_and_shift() where the base and shift are finally determined and introduce new code block of "#ifdef AARCH64 #endif" in HotSpot shared code.

In my approach, I added a method in aarch64.ad to check the base and shift in reg_mask_init(), and moved the logic of use_XOR_for_compressed_class_base here from the MacroAssembler constructor. I know my implementation has a drawback that the logic of my new method may be mis-aligned with the encoding/decoding logic if someone changes the MacroAssembler code without noticing my code. So I also added a few lines of comments to avoid this happening. See my updated webrev below.

http://cr.openjdk.java.net/~pli/rfr/8233743/webrev.01/

Please let me know if you have any further suggestions or disagreements.

[1] http://hg.openjdk.java.net/jdk/jdk/file/fcd74557a9cc/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#l3918

--
Thanks,
Pengfei



More information about the hotspot-compiler-dev mailing list