RFR (XL): 8152664 - Support non-continuous CodeBlobs in HotSpot

Andrew Dinn adinn at redhat.com
Mon Apr 11 14:26:16 UTC 2016


On 11/04/16 15:16, Volker Simonis wrote:
> I'm afraid all this hacks can not work. It doesn't help to make
> CompiledMethod::consts_begin() non-virtual and then calling a virtual
> function from it. The problem ist that at the point where you call
> consts_begin_v(), the vtable of 'this' is still the one of CodeBlob and
> this results in calling yet another arbitrary function:

Yes, the root of this is that virtual calls don't virtualise below the
current class when called in a constructor. Essentially, you are trying
to call a subclass method before the subclass fields have had a chance
to be initialised.

C++ deliberately stops you doing that by only giving you a vtable for
super S when initialising at super level S. If you try to call a virtual
method it executes the implementation belonging to S.

Of course, if you cast to a subclass and try to call a subclass method
(as is happening here) you get the sort of chaos you would expect if you
cast to some totally unrelated type and call a virtual method. Arguably
this code was broke in the first place even when it called a non-virtual
method.

> I think we really need to rework this as proposed by Andrew in his last
> mail. I'm working on such a fix.

Ok, so I will wait for you to fix it and throw my 2 cents in then :-)
Thanks for looking at it, Volker.

regards,


Andrew Dinn
-----------



More information about the hotspot-dev mailing list