RFR: 8276563: Undefined Behaviour in class Assembler

Andrew Haley aph at openjdk.java.net
Tue Nov 9 11:41:34 UTC 2021


On Mon, 8 Nov 2021 14:59:18 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> > In other words: in the current scheme we pass around an integer disguised as a pointer, and then have to cast it to an integer to use it. That seems silly. Let's just pass around the integer instead, wrapped in a value-object, which the compiler should treat the same as if it were just the integer.
> 
> That's worth exploring, but I'm reluctant to start overloading `->`. I'll have a look.

So I implemented this in a proof-of-concept way, and unfortunately GCC does a lot of forcing `Register` instances into memory, even though it's a value-only class with no virtual members.

libjvm size:


Before patch:          18667808
Using array in memory: 18864416 101.05%
Pass by value:         18930040 101.40%



This was definitely worthy of investigation, and I am grateful for the suggestion, but I don't think it's worth pursuing any further. The important thing is to get rid of the UB, and I intend to concentrate on cleaning up Plan A.

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

PR: https://git.openjdk.java.net/jdk/pull/6280


More information about the hotspot-compiler-dev mailing list