RFR: 8000617: It should be possible to allocate memory without the VM dying.
Keith McGuigan
keith.mcguigan at oracle.com
Wed Oct 10 16:43:45 PDT 2012
On 10/10/2012 4:53 PM, John Rose wrote:
> On Oct 10, 2012, at 1:46 PM, Vitaly Davidovich wrote:
>
>> Instead of bool true/false, could use an enum to make it more readable.
>
> It would also be more type-safe.
>
> I don't like the reference external addressible object (¬hrow,
> &dothrow), despite the fact that apparently it is part of std.
>
> The reason is that this forces allocation sites to materialize an
> additional externally linked constant. Such constants are not free,
> especially in PIC code. Many allocation sites (esp. resource-based
> ones) are performance-sensitive, and adding an extra reference to a
> global symbol is a backwards move. (We added 'THREAD' arguments most
> places to fix a similar though worse problem getting Thread::current.)
> I would prefer a boolean, enum, fake pointer, or struct, instead of a
> reference to a global.
The reference to the global would only be used in the exceeding rare
case where memory allocation failed. In fact, until now this only
happened right before a VM abort. We wouldn't be materializing a global
reference at each allocation, for instance.
But I'm not a big fan of using a global either. I was hoping there was
some way to create a std::nothrow_t instance that would always be '!='
to std::nothrow.
--
- Keith
More information about the hotspot-dev
mailing list