optimizing acmp in L-World (original) (raw)

John Rose john.r.rose at oracle.com
Fri Feb 9 06:31:23 UTC 2018


On Feb 8, 2018, at 2:58 PM, David Simms <david.simms at oracle.com> wrote:

UseCompressedClassPointers

Ah, right, that's the detail I missed. So the tag bit (for value klasses) is 0x01 for compressed klasses, and a larger power of two otherwise.

FTR, the code already does what I was expecting, and uses a higher bit to tag value-type instanceKlass pointers, using alignment to make detagging unnecessary.

The assembly code for acmp will (probably) need to adjust (down-shift?) the extracted tag bit, so that the perturbed oop pointer doesn't accidentally refer to a nearby heap node.

A variety of perturbations might be workable:

intptr_t x = …; intptr_t tag = x->klass() & color_mask; x = x + (tag >> (exact_log2(color_mask)-1)) //or x = x ^ (-tag); //or x = x | (-tag); //or x = x >> tag; //maybe //etc.

The basic requirement is that, once you perturb the oop by the color bit, that oop pointer is not bitwise-equal to any valid oop in the universe (including the original unperturbed oop). The perturbed pointer should not be null (all zero bits) either.

— John



More information about the valhalla-dev mailing list