CodeBuilder::allocateLocal

Brian Goetz brian.goetz at oracle.com
Fri Mar 31 14:51:25 UTC 2023


Yes, really this is shorthand for allocating a local _slot_.  And this 
really is allocation -- its a slab allocator with stack-based 
allocation/deallocation of sub-slabs.

Names like "newLocal" don't really capture what's going on, because 
we're not, for example, making a data structure that represents a local, 
we're reserving a slot for it.

I had considered "allocateSlot" which is more accurate but I thought 
"slot" by itself might be obvious.  Other options include:

     allocateLocalSlot
     reserveLocal
     reserveLocalSlot
     more?

On 3/31/2023 7:54 AM, Maurizio Cimadamore wrote:
> Hi,
> while reviewing this:
>
> https://git.openjdk.org/jdk/pull/13247
>
> I couldn't help but getting rubbed the wrong way seeing "allocate" 
> next to "Local". I realize this might be a subjective bias (I've been 
> staring at memory allocators for too long :-) ), but I don't think 
> that the concept of "allocation" belongs to local variables? I think a 
> more neutral "newLocal", "makeLocal", "createLocal" might work better 
> in this regard.
>
> Cheers
> Maurizio
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/classfile-api-dev/attachments/20230331/0f8259f7/attachment.htm>


More information about the classfile-api-dev mailing list