< prev index next >
test/vmTestbase/nsk/jvmti/PopFrame/popframe001.java
Print this page
*** 37,47 ****
public class popframe001 {
static final int PASSED = 0;
static final int FAILED = 2;
static final int JCK_STATUS_BASE = 95;
- static boolean DEBUG_MODE = false;
static volatile boolean popFdone = false;
static volatile int totRes = PASSED;
private PrintStream out;
private popFrameCls popFrameClsThr;
static Object barrier = new Object();
--- 37,46 ----
*** 56,68 ****
System.getProperty("java.library.path"));
throw e;
}
}
! native static int doPopFrame(int vrb, popFrameCls popFrameClsThr);
! native static int suspThread(int vrb, popFrameCls popFrameClsThr);
! native static int resThread(int vrb, popFrameCls popFrameClsThr);
public static void main(String[] argv) {
argv = nsk.share.jvmti.JVMTITest.commonInit(argv);
System.exit(run(argv, System.out) + JCK_STATUS_BASE);
--- 55,67 ----
System.getProperty("java.library.path"));
throw e;
}
}
! native static int doPopFrame(popFrameCls popFrameClsThr);
! native static int suspThread(popFrameCls popFrameClsThr);
! native static int resThread(popFrameCls popFrameClsThr);
public static void main(String[] argv) {
argv = nsk.share.jvmti.JVMTITest.commonInit(argv);
System.exit(run(argv, System.out) + JCK_STATUS_BASE);
*** 74,126 ****
private int runIt(String argv[], PrintStream out) {
int retValue = 0;
this.out = out;
- for (int i = 0; i < argv.length; i++) {
- if (argv[i].equals("-v")) // verbose mode
- DEBUG_MODE = true;
- }
popFrameClsThr = new popFrameCls("Tested Thread");
startingBarrier = new Wicket();
// start the child thread
popFrameClsThr.start();
startingBarrier.waitFor();
// pause until the child thread exits notification-block
synchronized (barrier) {
}
- if (DEBUG_MODE) {
out.println("Going to suspend the thread...");
! retValue = suspThread(1, popFrameClsThr);
! } else
! retValue = suspThread(0, popFrameClsThr);
if (retValue != PASSED) {
out.println("TEST: failed to suspend thread");
return FAILED;
}
// pop a frame of the child thread
- if (DEBUG_MODE) {
out.println("Going to pop a frame...");
! retValue = doPopFrame(1, popFrameClsThr);
! } else
! retValue = doPopFrame(0, popFrameClsThr);
popFdone = true;
popFrameClsThr.letItGo();
if (retValue != PASSED) {
out.println("TEST: failed to pop frame");
! resThread(0, popFrameClsThr);
return FAILED;
}
- if (DEBUG_MODE) {
out.println("Going to resume the thread...");
! retValue = resThread(1, popFrameClsThr);
! } else
! retValue = resThread(0, popFrameClsThr);
if (retValue != PASSED) {
out.println("TEST: failed to resume thread");
return FAILED;
}
--- 73,112 ----
private int runIt(String argv[], PrintStream out) {
int retValue = 0;
this.out = out;
popFrameClsThr = new popFrameCls("Tested Thread");
startingBarrier = new Wicket();
// start the child thread
popFrameClsThr.start();
startingBarrier.waitFor();
// pause until the child thread exits notification-block
synchronized (barrier) {
}
out.println("Going to suspend the thread...");
! retValue = suspThread(popFrameClsThr);
if (retValue != PASSED) {
out.println("TEST: failed to suspend thread");
return FAILED;
}
// pop a frame of the child thread
out.println("Going to pop a frame...");
! retValue = doPopFrame(popFrameClsThr);
popFdone = true;
popFrameClsThr.letItGo();
if (retValue != PASSED) {
out.println("TEST: failed to pop frame");
! resThread(popFrameClsThr);
return FAILED;
}
out.println("Going to resume the thread...");
! retValue = resThread(popFrameClsThr);
if (retValue != PASSED) {
out.println("TEST: failed to resume thread");
return FAILED;
}
*** 141,174 ****
super(name);
}
public void run() {
activeMethod();
! if (DEBUG_MODE)
! out.println("popFrameCls (" + this +
! "): exiting...");
}
public void activeMethod() {
boolean compl = true; // complain in a finally block
if (popframe001.popFdone) { // popping has been done
! if (DEBUG_MODE)
! out.println("popFrameCls (" + this +
! "): enter activeMethod() after popping");
return;
}
try {
// notify the main thread
synchronized (popframe001.barrier) {
! if (DEBUG_MODE)
! out.println("popFrameCls (" + this +
! "): notifying main thread");
popframe001.startingBarrier.unlock();
! if (DEBUG_MODE)
! out.println("popFrameCls (" + this +
! "): inside activeMethod()");
}
// loop until the main thread pops us
int i = 0;
int n = 1000;
while (flag) {
--- 127,152 ----
super(name);
}
public void run() {
activeMethod();
! out.println("popFrameCls (" + this + "): exiting...");
}
public void activeMethod() {
boolean compl = true; // complain in a finally block
if (popframe001.popFdone) { // popping has been done
! out.println("popFrameCls (" + this + "): enter activeMethod() after popping");
return;
}
try {
// notify the main thread
synchronized (popframe001.barrier) {
! out.println("popFrameCls (" + this + "): notifying main thread");
popframe001.startingBarrier.unlock();
! out.println("popFrameCls (" + this + "): inside activeMethod()");
}
// loop until the main thread pops us
int i = 0;
int n = 1000;
while (flag) {
< prev index next >