--- old/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorRecentTest.java 2017-10-06 14:50:18.554615182 -0700 +++ new/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorRecentTest.java 2017-10-06 14:50:18.162616500 -0700 @@ -31,10 +31,7 @@ * @run main/othervm/native -agentlib:HeapMonitor MyPackage.HeapMonitorRecentTest */ -import java.io.PrintStream; - public class HeapMonitorRecentTest { - static { try { System.loadLibrary("HeapMonitor"); @@ -46,15 +43,13 @@ } } - native static int checkLiveOrRecentFrames(Frame[] frames); - native static int checkLiveAndRecentFrames(Frame[] frames); - native static int enableSampling(); - - public static int cnt; - public static int g_tmp[]; - public int array[]; + private static int g_tmp[]; + + private native static int checkLiveOrRecentFrames(Frame[] frames); + private native static int checkLiveAndRecentFrames(Frame[] frames); + private native static int enableSampling(); - public static int helper() { + private static int helper() { int sum = 0; // Let us assume that the array is 24 bytes of memory. for (int i = 0; i < 127000 / 6; i++) { @@ -66,7 +61,7 @@ return sum; } - public static void runner(int max) { + private static void runner(int max) { int sum = 0; for (int j = 0; j < max; j++) { sum += helper(); @@ -76,9 +71,9 @@ public static void main(String[] args) { Frame[] frames = new Frame[3]; - frames[0] = new Frame("helper", "()I", "HeapMonitorRecentTest.java", 61); - frames[1] = new Frame("runner", "(I)V", "HeapMonitorRecentTest.java", 72); - frames[2] = new Frame("main", "([Ljava/lang/String;)V", "HeapMonitorRecentTest.java", 86); + frames[0] = new Frame("helper", "()I", "HeapMonitorRecentTest.java", 56); + frames[1] = new Frame("runner", "(I)V", "HeapMonitorRecentTest.java", 67); + frames[2] = new Frame("main", "([Ljava/lang/String;)V", "HeapMonitorRecentTest.java", 81); enableSampling(); // We are testing for the recent garbage sampler: @@ -96,7 +91,7 @@ } // Change the last frame only since the rest is identical. - frames[2].lineNumber = 90; + frames[2].lineNumber = 85; // We should see those new frames. status = checkLiveAndRecentFrames(frames);