RFR: 8062247: Allow WhiteBox test to access JVM offsets

Mikhailo Seledtsov mikhailo.seledtsov at oracle.com
Tue Oct 28 23:11:48 UTC 2014


Hi Yumin,

I searched for WhiteBox API facility in the closed part of JVM sources, 
and found that it exists on both 9 and 8u; however I have not use it 
before. Here are my findings (I picked "printRegionInfo" as an example 
to follow):

hg/jdk8u/work01/hs-dev/hotspot$ grep -R  WB_PrintRegionInfo *
     src/closed/share/vm/prims/whitebox_ext.cpp:WB_ENTRY(void, 
WB_PrintRegionInfo(JNIEnv* env, jobject o, jint context))
     src/closed/share/vm/prims/whitebox_ext.cpp: {CC"printRegionInfo", 
CC"(I)V", (void*)&WB_PrintRegionInfo},
hg/jdk8u/work01/hs-dev/hotspot$ grep -R printRegionInfo *
     src/closed/share/vm/prims/whitebox_ext.cpp: {CC"printRegionInfo", 
CC"(I)V", (void*)&WB_PrintRegionInfo},
     test/closed/gc/resource/TestOutOfMemory.java: wb.printRegionInfo(1);
     test/closed/gc/resource/BaseResman.java: wb.printRegionInfo(ctx);
     test/testlibrary/whitebox/sun/hotspot/WhiteBox.java:  public native 
void printRegionInfo(int context);


hg/9/work01/hs-rt/hotspot$ grep -R WB_PrintRegionInfo *
     src/closed/share/vm/prims/whitebox_ext.cpp:WB_ENTRY(void, 
WB_PrintRegionInfo(JNIEnv* env, jobject o, jint context))
     src/closed/share/vm/prims/whitebox_ext.cpp: {CC"printRegionInfo", 
CC"(I)V", (void*)&WB_PrintRegionInfo},
hg/9/work01/hs-rt/hotspot$ grep -R printRegionInfo *
     src/closed/share/vm/prims/whitebox_ext.cpp: {CC"printRegionInfo", 
CC"(I)V", (void*)&WB_PrintRegionInfo},
     test/closed/gc/resource/TestOutOfMemory.java: wb.printRegionInfo(1);
     test/closed/gc/resource/BaseResman.java: wb.printRegionInfo(ctx);
     test/testlibrary/whitebox/sun/hotspot/WhiteBox.java:  public native 
void printRegionInfo(int context);

Let me know if you have any questions.

Misha

On 10/28/2014 11:41 AM, Yumin Qi wrote:
> We have vmStructs, which define the data types for SA, 
> FileMapHeaderInfo is not in it or we can use that for return offset info.
> So we can have WhiteBox.java
>
> static private int getOffSet(String name);
>
> Better is: getOffsetName(String typeName, String memberName);
>
> I will try to get a new version.
>
> Thanks
> Yumin
>
>
>
> On 10/28/2014 11:21 AM, Christian Tornqvist wrote:
>> I agree with Coleen, we shouldn't create and pass a Java hash table 
>> back. There has to be a better solution using native data structures.
>>
>> Thanks.
>> Christian
>>
>> -----Original Message-----
>> From: hotspot-runtime-dev 
>> [mailto:hotspot-runtime-dev-bounces at openjdk.java.net] On Behalf Of 
>> Coleen Phillimore
>> Sent: Tuesday, October 28, 2014 2:10 PM
>> To: hotspot-runtime-dev at openjdk.java.net
>> Subject: Re: RFR: 8062247: Allow WhiteBox test to access JVM offsets
>>
>>
>> Hi Yumin,
>>
>> Can you not create Java hashtables from C++?  This is really 
>> convoluted.  I think there may be a more direct way to encode these 
>> offsets and get their values.  Eg.  Have a WB API to
>> get_offset("value")  and have a table coded in the WB api to 
>> associate the value string with the offset.  At worst, use a C++ 
>> hashtable to perform this association.
>>
>> Because the WB api calls up to Java for each hashtable insert, it's 
>> not like calling back to WB api for the offset is going to be less 
>> efficient.
>>
>> I don't like this change.
>>
>> Thanks,
>> Coleen
>>
>> On 10/28/2014 12:01 AM, 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