changeset 7351:b67cf1387c96

8062247: [TESTBUG] Allow WhiteBox test to access JVM offsets Reviewed-by: coleenp, iklam, mseledtsov Contributed-by: yumin.qi@oracle.com
author minqi
date Fri, 07 Nov 2014 12:48:09 -0800
parents 1dd30951315a
children 8666e625f2a4
files test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Fri Nov 07 13:50:55 2014 +0100
+++ b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Fri Nov 07 12:48:09 2014 -0800
@@ -207,4 +207,13 @@
                        .findAny()
                        .orElse(null);
   }
+  public native int getOffsetForName0(String name);
+  public int getOffsetForName(String name) throws Exception {
+    int offset = getOffsetForName0(name);
+    if (offset == -1) {
+      throw new RuntimeException(name + " not found");
+    }
+    return offset;
+  }
+
 }