Skip to content

Commit 43b0324

Browse files
author
duke
committed
Backport 54fe50210efe9ae6fad225b815cfdeb16c868115
1 parent 89c5659 commit 43b0324

File tree

27 files changed

+65
-266
lines changed

27 files changed

+65
-266
lines changed

test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TEST.properties

Lines changed: 0 additions & 24 deletions
This file was deleted.

test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TestDescription.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
3737
* Test scenario:
3838
* - during initialization (from function Agent_OnAttach) agent starts auxiliary thread waiting on
3939
* raw monitor and enables GarbageCollectionStart and GarbageCollectionFinish events
40-
* - target application provokes garbage collection (calls System.gc())
40+
* - target application provokes garbage collection (calls WhiteBox.getWhiteBox().fullGC())
4141
* - agent receives event GarbageCollectionStart
4242
* - agent receives event GarbageCollectionFinish event and notifies waiting auxiliary thread
4343
* - notified auxiliary thread notifies target application that agent finished its work
@@ -48,11 +48,13 @@
4848
* /test/lib
4949
* @build nsk.share.aod.AODTestRunner
5050
* nsk.jvmti.AttachOnDemand.attach020.attach020Target
51+
* @build jdk.test.whitebox.WhiteBox
52+
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
5153
* @run main/othervm/native
5254
* nsk.share.aod.AODTestRunner
5355
* -jdk ${test.jdk}
5456
* -target nsk.jvmti.AttachOnDemand.attach020.attach020Target
55-
* -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts}"
57+
* -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI"
5658
* -na attach020Agent00
5759
*/
5860

test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Target.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,14 +22,14 @@
2222
*/
2323
package nsk.jvmti.AttachOnDemand.attach020;
2424

25-
import nsk.share.ClassUnloader;
2625
import nsk.share.aod.TargetApplicationWaitingAgents;
26+
import jdk.test.whitebox.WhiteBox;
2727

2828
public class attach020Target extends TargetApplicationWaitingAgents {
2929

3030
protected void targetApplicationActions() {
3131
log.display("Provoking garbage collection");
32-
ClassUnloader.eatMemory();
32+
WhiteBox.getWhiteBox().fullGC();
3333
}
3434

3535
public static void main(String[] args) {

test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TEST.properties

Lines changed: 0 additions & 24 deletions
This file was deleted.

test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/TestDescription.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -44,11 +44,13 @@
4444
* /test/lib
4545
* @build nsk.share.aod.AODTestRunner
4646
* nsk.jvmti.AttachOnDemand.attach021.attach021Target
47+
* @build jdk.test.whitebox.WhiteBox
48+
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
4749
* @run main/othervm/native
4850
* nsk.share.aod.AODTestRunner
4951
* -jdk ${test.jdk}
5052
* -target nsk.jvmti.AttachOnDemand.attach021.attach021Target
51-
* -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts}"
53+
* -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI"
5254
* -na attach021Agent00
5355
*/
5456

test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Target.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,8 +22,8 @@
2222
*/
2323
package nsk.jvmti.AttachOnDemand.attach021;
2424

25-
import nsk.share.ClassUnloader;
2625
import nsk.share.aod.TargetApplicationWaitingAgents;
26+
import jdk.test.whitebox.WhiteBox;
2727

2828
public class attach021Target extends TargetApplicationWaitingAgents {
2929

@@ -51,7 +51,7 @@ protected void targetApplicationActions() throws Throwable {
5151
try {
5252
if (createTaggedObject()) {
5353
log.display("Provoking GC");
54-
ClassUnloader.eatMemory();
54+
WhiteBox.getWhiteBox().fullGC();
5555
}
5656
} finally {
5757
shutdownAgent();

test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TEST.properties

Lines changed: 0 additions & 24 deletions
This file was deleted.

test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TestDescription.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -47,11 +47,13 @@
4747
* /test/lib
4848
* @build nsk.share.aod.AODTestRunner
4949
* nsk.jvmti.AttachOnDemand.attach022.attach022Target
50+
* @build jdk.test.whitebox.WhiteBox
51+
* @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
5052
* @run main/othervm/native
5153
* nsk.share.aod.AODTestRunner
5254
* -jdk ${test.jdk}
5355
* -target nsk.jvmti.AttachOnDemand.attach022.attach022Target
54-
* -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts}"
56+
* -javaOpts="-XX:+UsePerfData ${test.vm.opts} ${test.java.opts} -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI"
5557
* -na attach022Agent00
5658
*/
5759

test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Target.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,8 +22,8 @@
2222
*/
2323
package nsk.jvmti.AttachOnDemand.attach022;
2424

25-
import nsk.share.ClassUnloader;
2625
import nsk.share.aod.TargetApplicationWaitingAgents;
26+
import jdk.test.whitebox.WhiteBox;
2727

2828
class ClassForAllocationEventsTest {
2929

@@ -47,7 +47,7 @@ protected void targetApplicationActions() throws Throwable {
4747
}
4848

4949
log.display("Provoking GC");
50-
ClassUnloader.eatMemory();
50+
WhiteBox.getWhiteBox().fullGC();
5151
} finally {
5252
if (!shutdownAgent(TEST_ALLOCATION_NUMBER)) {
5353
setStatusFailed("Error happened during agent work, see error messages for details");

test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
2727
import java.math.*;
2828

2929
import nsk.share.*;
30+
import jdk.test.whitebox.WhiteBox;
3031

3132
/**
3233
* This test exercises the JVMTI event <code>GarbageCollectionFinish</code>.
@@ -63,7 +64,7 @@ public static int run(String argv[], PrintStream out) {
6364
private int runThis(String argv[], PrintStream out) {
6465
try {
6566
for (int i=0; i<ITERATIONS; i++)
66-
ClassUnloader.eatMemory(); // provoke garbage collecting
67+
WhiteBox.getWhiteBox().fullGC(); // provoke garbage collecting
6768
} catch (OutOfMemoryError e) {
6869
// ignoring
6970
}

0 commit comments

Comments
 (0)