CodeBuilder::allocateLocal

Brian Goetz brian.goetz at oracle.com
Fri Mar 31 15:38:42 UTC 2023


Reserve is probably better than allocate, since a reservation is purely 
advisory -- someone could barge right in and sit down at your 
supposedly-reserved table anyway :)

On 3/31/2023 11:03 AM, Maurizio Cimadamore wrote:
>
>
> On 31/03/2023 15:51, Brian Goetz wrote:
>> 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.
> Not sure I follow what you mean here. All the implementations of this 
> methods just bump an index and return (which is what I'd expect)... am 
> I missing something in the impl?
>>
>> 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?
>
> I guess the "reserve" is a good one, at least subjectively.
>
> Maurizio
>
>>
>> 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/7d610d53/attachment-0001.htm>


More information about the classfile-api-dev mailing list