RFR: JDK-8320368: Per-CPU optimization of Klass range reservation [v2]

Andrew Haley aph at openjdk.org
Wed Nov 22 11:18:07 UTC 2023


On Wed, 22 Nov 2023 09:59:59 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> src/hotspot/cpu/aarch64/compressedKlass_aarch64.cpp line 49:
>> 
>>> 47:   }
>>> 48: 
>>> 49:   // If that failed, attempt to allocate at any 4G-aligned address. Let the system decide where. For ASLR,
>> 
>> One small nit here: encoding in MOVK mode may require more instructions than XOR mode because XOR is `eor dst, src, 0x800000000` but MOVK is `mov dst, src; eor dst, src, 0x800000000`. XOR is always the best, and we should perhaps try it first.
>
> Oh, you are right. Okay, I will add that. Being able to do CPU-specific stuff without ifdef is like a breath of fresh air.

The coding scheme is rather weird, making it a little bit tricky to find valid XOR encodings.  I don't think we cover all of the single-instruction possibilities.

They are:

0x000100000000, 0x000200000000, 0x000300000000, 0x000400000000, 0x000600000000, 0x000700000000, 
0x000800000000, 0x000c00000000, 0x000e00000000, 0x000f00000000, 0x001000000000, 0x001800000000, 
0x001c00000000, 0x001e00000000, 0x001f00000000, 0x002000000000, 0x003000000000, 0x003800000000, 
0x003c00000000, 0x003e00000000, 0x003f00000000, 0x004000000000, 0x006000000000, 0x007000000000, 
0x007800000000, 0x007c00000000, 0x007e00000000, 0x007f00000000, 0x008000000000, 0x00c000000000, 
0x00e000000000, 0x00f000000000, 0x00f800000000, 0x00fc00000000, 0x00fe00000000, 0x00ff00000000, 
0x010000000000, 0x018000000000, 0x01c000000000, 0x01e000000000, 0x01f000000000, 0x01f800000000, 
0x01fc00000000, 0x01fe00000000, 0x01ff00000000, 0x020000000000, 0x030000000000, 0x038000000000, 
0x03c000000000, 0x03e000000000, 0x03f000000000, 0x03f800000000, 0x03fc00000000, 0x03fe00000000, 
0x03ff00000000, 0x040000000000, 0x060000000000, 0x070000000000, 0x078000000000, 0x07c000000000, 
0x07e000000000, 0x07f000000000, 0x07f800000000, 0x07fc00000000, 0x07fe00000000, 0x07ff00000000, 
0x080000000000, 0x0c0000000000, 0x0e0000000000, 0x0f0000000000, 0x0f8000000000, 0x0fc000000000, 
0x0fe000000000, 0x0ff000000000, 0x0ff800000000, 0x0ffc00000000, 0x0ffe00000000, 0x0fff00000000, 
0x100000000000, 0x180000000000, 0x1c0000000000, 0x1e0000000000, 0x1f0000000000, 0x1f8000000000, 
0x1fc000000000, 0x1fe000000000, 0x1ff000000000, 0x1ff800000000, 0x1ffc00000000, 0x1ffe00000000, 
0x1fff00000000, 0x200000000000, 0x300000000000, 0x380000000000, 0x3c0000000000, 0x3e0000000000, 
0x3f0000000000, 0x3f8000000000, 0x3fc000000000, 0x3fe000000000, 0x3ff000000000, 0x3ff800000000, 
0x3ffc00000000, 0x3ffe00000000, 0x3fff00000000, 0x400000000000, 0x600000000000, 0x700000000000, 
0x780000000000, 0x7c0000000000, 0x7e0000000000, 0x7f0000000000, 0x7f8000000000, 0x7fc000000000, 
0x7fe000000000, 0x7ff000000000, 0x7ff800000000, 0x7ffc00000000, 0x7ffe00000000, 0x7fff00000000, 
0x800000000000, 0xc00000000000, 0xe00000000000, 0xf00000000000, 0xf80000000000, 0xfc0000000000, 
0xfe0000000000, 0xff0000000000, 0xff8000000000, 0xffc000000000, 0xffe000000000, 0xfff000000000, 
0xfff800000000, 0xfffc00000000, 0xfffe00000000, 0xffff00000000

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16743#discussion_r1401892068


More information about the hotspot-dev mailing list