RFR: 8062247: Allow WhiteBox test to access JVM offsets

Yumin Qi yumin.qi at oracle.com
Tue Nov 4 00:11:21 UTC 2014


I have made change to the function name in WhiteBox.
New webrev at

http://cr.openjdk.java.net/~minqi/8062247/webrev01/

The function getOffsetForName(String name), takes a form of 
"FileMapHead::_magic" as in vm, if there is no name present in vm for 
search its offset, a RuntimeExcetion with message "<offsetname> not 
found" will be thrown.

tests: JPRT, jtreg

Thanks
Yumin


On 11/3/2014 1:34 PM, Mikhailo Seledtsov wrote:
> Yumin,
>
>  OK, I see you chose to pass the name of the struct implicitly instead 
> of using an explicit parameter. I have no strong objection to that.
> Please make sure to clarify this in the comments.
>
> Thank you,
> Misha
>
> On 11/3/2014 1:15 PM, Yumin Qi wrote:
>> If you check the name passed to this function, it already told (I 
>> just changed to getOffsetForName and in testing):
>>
>> wb.getOffsetForName("FileMapHeader::_crc")
>>
>> Do not need to give type info(that will need build a list for type 
>> info like in vmStructs). This is a simple code fore testing purpose, 
>> I think we should keep it simple. I added that if the offsetname not 
>> supported, throw exception instead. Will post webrev today after jprt 
>> finished.
>>
>> Thanks
>> Yumin
>>
>> On 11/3/2014 12:05 PM, Mikhailo Seledtsov wrote:
>>> Hi Yumin,
>>>
>>>  If this API is intended to get offsets for various data structures, 
>>> I would expect a data  structure type identified to be passed as a 
>>> parameter. For instance,
>>>
>>> public native int getOffset(String dataStructureId, String fieldName)
>>>     where
>>>         dataStructureId would be some kind of ID for data structure, 
>>> either data structure name or internal alias
>>>         fieldName - the name of the field for which the offset value 
>>> is returned
>>>       A specific error code could be returned for unsupported 
>>> dataStructureId
>>>
>>> Alternatively, this could be an API specific to a given 
>>> data-structure. E.g. getMySpecifiedDatastructOffset(String fieldName)
>>>
>>> Thank you,
>>> Misha
>>>
>>>
>>> On 11/2/2014 9:52 PM, Yumin Qi wrote:
>>>> Misha,
>>>>
>>>>   It is a generic name, now it only targets on FileMapHeader, it 
>>>> can add other data structure of vm if needed in future. Maybe a 
>>>> name like getOffsetForName(String name) is better?
>>>>
>>>> Thanks
>>>> Yumin
>>>>
>>>> On 10/31/2014 11:56 AM, Mikhailo Seledtsov wrote:
>>>>> Hi Yumin,
>>>>>
>>>>>  The name getOffsets() seems too generic. Perhaps, we could rename 
>>>>> it to be more specific to the task.
>>>>>
>>>>> Thank you,
>>>>> Misha
>>>>>
>>>>> On 10/29/2014 5:46 PM, Yumin Qi wrote:
>>>>>> Please review the new changeset at same location.
>>>>>> New API supply an interface to get data member offset by it's name.
>>>>>> http://cr.openjdk.java.net/~minqi/8062247/webrev00/
>>>>>>
>>>>>> Thanks
>>>>>> Yumin
>>>>>>
>>>>>> On 10/27/2014 9:01 PM, Yumin Qi wrote:
>>>>>>> Please review
>>>>>>>
>>>>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8062247
>>>>>>> webrev: http://cr.openjdk.java.net/~minqi/8062247/webrev00/
>>>>>>>
>>>>>>> Summary: Internal test failed since the variable offsets changed 
>>>>>>> in hotspot. The way to get offset in the test is hard-coded. To 
>>>>>>> reduce the risk of future changes of hotspot offsets, the fix 
>>>>>>> add a WhiteBox API function to get a map for FileMapHeaderInfo, 
>>>>>>> which return the members' offsets in a Hashtable.
>>>>>>>
>>>>>>> Tests: JPRT, jtreg.
>>>>>>>
>>>>>>> Thanks
>>>>>>> Yumin
>>>>>>
>>>>>
>>>>
>>>
>>
>



More information about the hotspot-runtime-dev mailing list