When might a CodeBuffer be moved?
Tom Rodriguez
Thomas.Rodriguez at Sun.COM
Fri Jun 12 08:49:59 PDT 2009
Yes. That's all correct. I was just suggesting that if you were
going do any trickery that relied on a code blob not needing to be
relocatable that you explicitly use a BufferBlob instead of hanging
onto a CodeBuffer.
tom
On Jun 12, 2009, at 2:00 AM, Gary Benson wrote:
> The only place I explicitly create one is in Shark, I think. Shark
> compiles the method into it, then passes it to ciEnv::register_method
> along with everything else. After that, as I understand it, the code
> is relocated into a more permanent area, and the original CodeBuffer
> gets freed automagically when the frame it's in exits (it's a
> StackObj, right?)
>
> Cheers,
> Gary
>
> Tom Rodriguez wrote:
>> You wouldn't want to just build a CodeBuffer and keep it around.
>> Normally we use BufferBlobs for any piece of code that we want to
>> generate but which doesn't need to be relocatable. The interpreter
>> for instance is constructed this way as are a lot of helper snippers
>> of various kinds. You wouldn't want to just build a CodeBuffer and
>> keep it around. The preferred way would be the make a BufferBlob
>> and then build a CodeBuffer on top of it to use for code generation.
>> You'd just drop the CodeBuffer onces you were done with code
>> generation and build a new one if you needed it.
>>
>> tom
>>
>> On Jun 11, 2009, at 2:18 AM, Gary Benson wrote:
>>> Oh, that's excellent news. Now to figure out if I can use it! ;)
>>>
>>> Cheers,
>>> Gary
>>>
>>> Tom Rodriguez wrote:
>>>> CodeBlobs are never moved automatically by anything.
>>>> CodeBuffers have support for resizing the code generation buffer
>>>> by moving the instructions from one CodeBlob to a new larger one
>>>> but you have to ask for that using
>>>> maybe_expand_to_ensure_remaining. nmethod can be reclaimed by
>>>> the sweeper once they are no longer referenced as a result of
>>>> being made not entrant or zombie.
>>>>
>>>> tom
>>>>
>>>> On Jun 10, 2009, at 6:55 AM, Gary Benson wrote:
>>>>> Hi all,
>>>>>
>>>>> I know CodeBuffers aren't moved by the garbage collector, but
>>>>> can they move at all? I remember someone (Steve Goldman?)
>>>>> telling me about a code compactor once, but can't remember the
>>>>> details. Can a code buffer move at any safepoint?
>>>>>
>>>>> Cheers,
>>>>> Gary
>>>>>
>>>>> --
>>>>> http://gbenson.net/
More information about the hotspot-dev
mailing list