mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-11 14:11:36 +00:00
8265796: vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java fails when running with JEP 416
Reviewed-by: cjplummer, mchung
This commit is contained in:
parent
24e586a043
commit
7cb56a230d
@ -38,7 +38,6 @@
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java 8265796 generic-all
|
||||
|
||||
#############################################################################
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -56,6 +56,8 @@
|
||||
* @build nsk.jdi.ObjectReference.referringObjects.referringObjects002.referringObjects002
|
||||
* nsk.jdi.ObjectReference.referringObjects.referringObjects002.referringObjects002a
|
||||
* nsk.share.jdi.TestClass1
|
||||
* @build sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm/native
|
||||
* nsk.jdi.ObjectReference.referringObjects.referringObjects002.referringObjects002
|
||||
* -verbose
|
||||
@ -63,7 +65,8 @@
|
||||
* -waittime=5
|
||||
* -debugee.vmkind=java
|
||||
* -transport.address=dynamic
|
||||
* -debugee.vmkeys="-Xmx256M ${test.vm.opts} ${test.java.opts}"
|
||||
* -debugee.vmkeys="-Xmx256M -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI ${test.vm.opts} ${test.java.opts}"
|
||||
* -testClassPath ${test.class.path}
|
||||
*/
|
||||
|
||||
@ -97,6 +100,10 @@ public class referringObjects002 extends HeapwalkingDebugger {
|
||||
|
||||
public void checkClassObjectReferrersCount(ClassObjectReference classObjectReference, int expectedCount) {
|
||||
int referrersCount = classObjectReference.referringObjects(0).size();
|
||||
log.display("References:");
|
||||
for (ObjectReference ref: classObjectReference.referringObjects(0)) {
|
||||
log.display(ref);
|
||||
}
|
||||
|
||||
if (referrersCount != expectedCount) {
|
||||
setSuccess(false);
|
||||
@ -137,7 +144,6 @@ public class referringObjects002 extends HeapwalkingDebugger {
|
||||
expectedReferrersCount = 3;
|
||||
|
||||
checkClassObjectReferrersCount(classObjectReference, expectedReferrersCount);
|
||||
|
||||
// disable collection and try unload class object
|
||||
classObjectReference.disableCollection();
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,6 +29,7 @@ import nsk.share.TestBug;
|
||||
import nsk.share.jdi.HeapwalkingDebuggee;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import sun.hotspot.WhiteBox;
|
||||
|
||||
/*
|
||||
* Class create and save given number of class instances
|
||||
@ -56,6 +57,8 @@ public class referringObjects002a extends HeapwalkingDebuggee {
|
||||
|
||||
final static public String COMMAND_DELETE_CLASS_OBJECT_REFERRERS = "deleteClassObjectReferrers";
|
||||
|
||||
private final WhiteBox WB = WhiteBox.getWhiteBox();
|
||||
|
||||
public static void main(String args[]) {
|
||||
new referringObjects002a().doTest(args);
|
||||
}
|
||||
@ -76,6 +79,9 @@ public class referringObjects002a extends HeapwalkingDebuggee {
|
||||
|
||||
for (String referenceType : ObjectInstancesManager.allReferenceTypes)
|
||||
classReferrers.add(new ReferringObject(klass, referenceType));
|
||||
// force full GC with WB to ensure that weak refernces are collected
|
||||
// j.l.i.MethodType has ConcurrentWeakInternSet which might contain references to TestClass1
|
||||
WB.fullGC();
|
||||
}
|
||||
|
||||
// delete all created references to class object
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user