API to create a new Allocate node?
Cesar Soares Lucas
Divino.Cesar at microsoft.com
Fri Apr 29 20:44:03 UTC 2022
Thank you for taking the time to write a detailed explanation, John. That helps a lot!
One thing that perhaps I left implicit in my original comment: this new allocation shouldn't be part of the final code emitted by C2. The allocation will be used just to remove the phi node merging other objects and therefore EA+SR should be able to remove all allocations involved. Please, take a look at the example below.
C2 can't remove the allocations in the code below because of the Phi merging the objects:
if (...)
p0 = new Point();
else
p1 = new Point();
p = phi(p0, p1);
return p.x;
What I'm proposing is to replace the Phi *temporarily* with an allocation like shown below. C2 should be able to scalar replace all three objects in the example.
if (...)
p0 = new Point(0);
else
p1 = new Point(1);
p = new Point(phi(p0.x, p1.x));
return p.x;
In the final code we shouldn't have any allocation (and so no need to pick up a JVMS?!):
if (...)
x0 = 0;
else
x1 = 1;
px = phi(x0, x1);
return px;
Best regards,
Cesar
More information about the hotspot-compiler-dev
mailing list