RFR (XS): 8065134: Need WhiteBox::allocateCodeBlob(long, int) method to be implemented
David Holmes
david.holmes at oracle.com
Fri Dec 5 05:00:12 UTC 2014
On 5/12/2014 2:33 PM, Chris Plummer wrote:
> On 12/4/14 7:50 PM, David Holmes wrote:
>> On 5/12/2014 1:08 PM, Chris Plummer wrote:
>>> Why not do it from java?
>>>
>>> public long allocateCodeBlob(long size, int type) {
>>> allocateCodeBlob((int)size, type);
>>> }
>>>
>>> It will make it a bit more obvious to the caller what is going on,
>>> rather than letting hidden C++ code implicitly truncate it.
>>
>> Why is this even needed in the first place? It is simply an invitation
>> for errors if you pass a long where only an int is expected. The
>> caller of the API needs to know they should be passing an int.
>
> [For some reason my posts aren't making it to the alias]
Weird - I can see that on the archive too.
> From the CR:
>
> " currently only WhiteBox::allocateCodeBlob(int, int) is present, which
> is inconvenient while working with MemoryPoolMXBean, which returns long
> values for memory parameters, thus, a type cast has to be done in
> various cases"
>
> So it looks like this is being done for convenience purposes. At some
> point the long needs to be converted to an int. It can be done at the
> lowest layer (C++ as Tatiana has done), a layer up in WhiteBox.java as I
> proposed, in a allocateCodeBlob() wrapper API closer to the code working
> with MemoryPoolMXBean, or at each allocateCodeBlob() call site.
I'd vote for the callsite. And I have a hard time seeing how values from
MemoryPoolMXBean end up being used for allocateCodeBlob ??
David
> Chris
>>
>> David
>>
>>> Chris
>>>
>>> On 12/4/14 5:23 PM, Vitaly Davidovich wrote:
>>>> This is just for convenience for calling from java code, it seems,
>>>> and not
>>>> because code blob size actually needs to be larger than int (that
>>>> would be
>>>> scary!).
>>>>
>>>> Sent from my phone
>>>> On Dec 4, 2014 8:12 PM, "David Holmes"<david.holmes at oracle.com> wrote:
>>>>
>>>>> Hi Tatiana,
>>>>>
>>>>> On 5/12/2014 12:30 AM, Tatiana Pivovarova wrote:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> please review this small patch
>>>>>>
>>>>>> bugid:https://bugs.openjdk.java.net/browse/JDK-8065134
>>>>>> webrev:http://cr.openjdk.java.net/~iignatyev/tpivovarova/8065134/
>>>>>> webrev.00
>>>>>>
>>>>>> Problem:
>>>>>> Need WhiteBox::allocateCodeBlob(long, int), currently only
>>>>>> WhiteBox::allocateCodeBlob(int, int) exist.
>>>>>>
>>>>>> Solution:
>>>>>> Just change function signature WhiteBox::allocateCodeBlob(int,
>>>>>> int) ->
>>>>>> WhiteBox::allocateCodeBlob(long, int)
>>>>>>
>>>>> But this gets truncated to an int again:
>>>>>
>>>>> CodeBlob* WhiteBox::allocate_code_blob(int size, int blob_type)
>>>>>
>>>>> David
>>>>>
>>>>> Test: jprt
>>>>>> Thanks,
>>>>>> Tatiana
>>>>>>
>>>
>
More information about the hotspot-dev
mailing list