jdk/test/com/sun/jdi/ReferrersTest.java
author alexsch
Thu, 12 May 2016 20:43:37 +0400
changeset 38413 d9e49b45fd7d
parent 30376 2ccf2cf7ea48
child 44423 306c020eb154
permissions -rw-r--r--
8154539: Examine the desktop module's use of sun.misc.SoftCache Reviewed-by: prr, chegar, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
30376
2ccf2cf7ea48 8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents: 24973
diff changeset
     2
 * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 *  @test
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 *  @bug 5089849
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 *  @summary Add support for backtracking reference graph.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 *  @author jjh
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *
30376
2ccf2cf7ea48 8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents: 24973
diff changeset
    30
 *  @modules jdk.jdi
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 *  @run build TestScaffold VMConnection TargetListener TargetAdapter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 *  @run compile -g ReferrersTest.java
24973
8c4bc3fa4c4e 6622468: TEST_BUG: Time to retire the @debuggeeVMOptions mechanism used in the com.sun.jdi infrastructure
sla
parents: 5506
diff changeset
    33
 *  @run driver ReferrersTest
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *  To run this test do this:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *     runregress -no ReferrersTest <cmd line options>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *  where <cmd line options> are the options to be used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *  launch the debuggee, with the classname prefixed with @@.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *  For example, this would run java2d demo as the debuggee:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *     runregress -no ReferrersTest -classpath
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *                                    $jdkDir/demo/jfc/Java2D/Java2Demo.jar \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *                                    -client @@java2d.Java2Demo
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * In this mode, the specified debuggee is launched in debug mode,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * and the debugger waits for a keystroke before connecting to the debuggee.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * If <cmd line options> is not specified, then the ReferrersTarg class below
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * is run as the debuggee.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
import com.sun.jdi.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
import com.sun.jdi.event.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
import com.sun.jdi.request.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
class ReferrersFiller {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    // This many instances of this are created.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    static int FILLER_COUNT = 20000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    static ReferrersFiller[] lotsAndLots = new ReferrersFiller[
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
                                               ReferrersFiller.FILLER_COUNT];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    int xx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    ReferrersFiller(int p1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        xx = p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
class ReferrersTarg {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    // This many instances + 1 of this class are created.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    static int TARG_COUNT = 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    static ReferrersTarg theReferrersTarg;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    static ReferrersTarg[] allReferrersTargs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    // Each instance will point to the theReferrersTarg
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    ReferrersTarg oneReferrersTarg;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    public static void bkpt() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    public static void main(String[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        System.out.println("Howdy!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        for (int ii = 0; ii < ReferrersFiller.lotsAndLots.length; ii++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
            ReferrersFiller.lotsAndLots[ii] = new ReferrersFiller(ii);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        theReferrersTarg = new ReferrersTarg();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        allReferrersTargs = new ReferrersTarg[ReferrersTarg.TARG_COUNT];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        for (int ii = 0; ii < ReferrersTarg.TARG_COUNT; ii++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
            allReferrersTargs[ii] = new ReferrersTarg();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            allReferrersTargs[ii].oneReferrersTarg = theReferrersTarg;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        bkpt();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        System.out.println("Goodbye from ReferrersTarg!");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
/********** test program **********/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
public class ReferrersTest extends TestScaffold {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    static String targetName = "ReferrersTarg";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    ReferenceType targetClass;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    ThreadReference mainThread;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    ReferrersTest(String args[]) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        super(args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    public static void main(String[] args) throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
         * If args contains @@xxxx, then that is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
         * name of the class we are to run.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        for (int ii = 0; ii < args.length; ii ++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            if (args[ii].startsWith("@@")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                targetName = args[ii] = args[ii].substring(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        new ReferrersTest(args).startTests();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * Used to sort a list of ReferenceTypes by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * instance count.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    class ToSort implements Comparable<ToSort> {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        long count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        ReferenceType rt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        public ToSort(long count, ReferenceType rt) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            this.count = count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            this.rt = rt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        public int compareTo(ToSort obj) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            if (count < obj.count) return -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
            if (count == obj.count) return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            return 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    protected void runTests() throws Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
         * Get to the top of main()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
         * to determine targetClass and mainThread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        int CUT_OFF = 1000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        BreakpointEvent bpe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        bpe = startToMain(targetName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        targetClass = bpe.location().declaringType();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        mainThread = bpe.thread();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        if (targetName.equals("ReferrersTarg")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            resumeTo("ReferrersTarg", "bkpt", "()V");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            // Let debuggee run for awhile to get classes loaded
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            vm().resume();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                System.err.println("Press <enter> to continue");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                System.in.read();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                System.err.println("running...");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            } catch(Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            vm().suspend();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        // Get all classes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        long start = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        List<ReferenceType> allClasses = vm().allClasses();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        long end = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        System.out.println( allClasses.size() +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                            " classes from vm.allClasses() took " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                            (end - start) + " ms");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        long[] counts;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        // Test for NPE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            boolean pass = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                counts = vm().instanceCounts(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            } catch (NullPointerException ee) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                pass = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
            if (!pass) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                failure("failure: NullPointerException not thrown on instanceCounts(null)");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        // Test for 0 length array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            List<ReferenceType>someClasses = new ArrayList(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            counts = vm().instanceCounts(someClasses);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            if (counts.length != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                failure("failure: instanceCounts with a zero length array fails: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                        counts.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        // Test various values of maxInstances
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        if (targetClass.name().equals("ReferrersTarg")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            List<ObjectReference> noInstances = targetClass.instances(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
            if (noInstances.size() != ReferrersTarg.TARG_COUNT + 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                failure("failure: instances(0): " + noInstances.size() + ", for " + targetClass);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
            noInstances = targetClass.instances(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
            if (noInstances.size() != 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                failure("failure: instances(1): " + noInstances.size() + ", for " + targetClass);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
            boolean pass = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                noInstances = targetClass.instances(-1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
            } catch (IllegalArgumentException ee) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                pass = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            if (!pass) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                failure("failure: instances(-1) did not get an exception");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        // Instance counts for all classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        start = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        counts = vm().instanceCounts(allClasses);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        end = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        if (counts.length == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
            System.out.println("failure: No instances found");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            throw new Exception("ReferrersTest: failed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        // Create a list of ReferenceTypes sorted by instance count
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        int size = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        List<ToSort> sorted = new ArrayList(allClasses.size());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        for (int ii = 0; ii < allClasses.size(); ii++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
            size += counts[ii];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
            ToSort tos = new ToSort(counts[ii], allClasses.get(ii));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
            sorted.add(tos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        System.out.println("instance counts for " + counts.length +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
                           " classes got " + size + " instances and took " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
                            (end - start) + " ms");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        boolean gotReferrersFiller = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        boolean gotReferrersTarg = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        Collections.sort(sorted);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        for (int ii = sorted.size() - 1; ii >= 0 ; ii--) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
            ToSort xxx = sorted.get(ii);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
            if (xxx.rt.name().equals("ReferrersFiller") &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
                xxx.count == ReferrersFiller.FILLER_COUNT) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
                gotReferrersFiller = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
            if (xxx.rt.name().equals("ReferrersTarg") &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
                xxx.count == ReferrersTarg.TARG_COUNT + 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
                gotReferrersTarg = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        if (!gotReferrersFiller) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
            failure("failure: Expected " + ReferrersFiller.FILLER_COUNT +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                        " instances of ReferrersFiller");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        if (!gotReferrersTarg) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
            failure("failure: Expected " + (ReferrersTarg.TARG_COUNT + 1) +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
                    " instances of ReferrersTarg");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
        List<List<ObjectReference>> allInstances = new ArrayList(10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        // Instances, one class at a time, in sorted order, printing each line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        if (true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
            System.out.println("\nGetting instances for one class " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
                               "at a time (limited) in sorted order");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
            List<ReferenceType> rtList = new ArrayList(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
            rtList.add(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
            long start1 = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
            size = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
            long count = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
            for (int ii = sorted.size() - 1; ii >= 0 ; ii--) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
                ToSort xxx = sorted.get(ii);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
                if (xxx.count <= CUT_OFF) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
                rtList.set(0, xxx.rt);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
                start = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
                List<ObjectReference> oneInstances = xxx.rt.instances(19999999);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
                end = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
                size += oneInstances.size();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
                count++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
                System.out.println("Expected " + xxx.count + " instances, got " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
                                   oneInstances.size() +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
                                   " instances for " + sorted.get(ii).rt +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
                                   " in " + (end - start) + " ms");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
                if (xxx.rt.name().equals("ReferrersFiller") &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
                    oneInstances.size() != ReferrersFiller.FILLER_COUNT) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
                    failure("failure: Expected " + ReferrersFiller.FILLER_COUNT +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
                            " instances of ReferrersFiller");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
                if (xxx.rt.name().equals("ReferrersTarg") &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
                    oneInstances.size() != ReferrersTarg.TARG_COUNT + 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
                    failure("failure: Expected " + (ReferrersTarg.TARG_COUNT + 1) +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
                            " instances of ReferrersTarg");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
                allInstances.add(oneInstances);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
            end = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
            System.out.println(size + " instances via making one vm.instances" +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                               " call for each of " + count +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                               " classes took " + (end - start1) + " ms");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
            System.out.println("Per class = " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
                               (end - start) / allClasses.size() + " ms");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        // referrers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
        // Test various values of maxReferrers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        if (targetClass.name().equals("ReferrersTarg")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
            Field field1 = targetClass.fieldByName("theReferrersTarg");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
            ObjectReference anInstance = (ObjectReference)targetClass.getValue(field1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
            List<ObjectReference> noReferrers = anInstance.referringObjects(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
            if (noReferrers.size() != ReferrersTarg.TARG_COUNT + 1 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
                failure("failure: referringObjects(0) got " + noReferrers.size() +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
                        ", for " + anInstance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
            noReferrers = anInstance.referringObjects(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
            if (noReferrers.size() != 1 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
                failure("failure: referringObjects(1) got " + noReferrers.size() +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
                        ", for " + anInstance);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
            boolean pass = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
                noReferrers = anInstance.referringObjects(-1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
            } catch (IllegalArgumentException ee) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
                pass = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
            if (!pass) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
                failure("failure: referringObjects(-1) did not get an exception");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
        List<ObjectReference> allReferrers = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        List<ObjectReference> someInstances = new ArrayList();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
        if (targetName.equals("ReferrersTarg")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
            Field field1 = targetClass.fieldByName("theReferrersTarg");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
            ObjectReference val = (ObjectReference)targetClass.getValue(field1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
            someInstances.add(val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
            allReferrers = val.referringObjects(99999);  //LIMIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
            if (allReferrers.size() != ReferrersTarg.TARG_COUNT + 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
                failure("failure: expected " + (ReferrersTarg.TARG_COUNT + 1) +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
                        "referrers, but got " + allReferrers.size() +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
                        " referrers for " + val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
            // referrers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
            // Create someInstances to find the referrers of.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
            for (int ii = 0; ii < allClasses.size(); ii++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
                List<ObjectReference> objRefList = allInstances.get(ii);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
                if (objRefList != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
                    int asize = objRefList.size();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
                    if (false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
                        System.out.println(asize + ", " + allClasses.get(ii));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
                    // Remember one instance per class to get referrers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
                    if (asize > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
                        someInstances.add(objRefList.get(0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        for (ObjectReference objRef: someInstances) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
            //System.out.println( "Getting referrers for " + objRef);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
            start = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
            if ( true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
                showReferrers(objRef, 0, 0, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
                allReferrers = objRef.referringObjects(99999);  //LIMIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
                end = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
                if (true || allReferrers.size() > 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
                    System.out.println( allReferrers.size() + " referrers for " + objRef + " took " + (end - start) + " ms");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
         * deal with results of test
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
         * if anything has called failure("foo") testFailed will be true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        if (!testFailed) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
            println("ReferrersTest: passed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
            throw new Exception("ReferrersTest: failed");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    void indent(int level) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
        for (int ii = 0; ii < level; ii++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
            System.out.print("    ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    Map<ObjectReference, Object> visited = new HashMap(100);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    void showReferrers(ObjectReference objRef, int level, int total, int which) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        if (level == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
            visited.clear();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
            if (visited.containsKey(objRef)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
                indent(level);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
                System.out.println("(" + which + ")" + ":<pruned> " + objRef);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
            visited.put(objRef, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
            indent(level);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
            //System.out.println(which + "/" + total + ": " + objRef + " took " + time + " ms");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        List<ObjectReference> allReferrers = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        //System.out.println( "Getting referrers for " + objRef);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
        long start, end;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        start = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        allReferrers = objRef.referringObjects(99999);  //LIMIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        end = System.currentTimeMillis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        if (which == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
            System.out.println(allReferrers.size() + " referrers for " + objRef + " took " + (end - start) + " ms");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
            System.out.println("(" + which + ") "  + objRef);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
            indent(level);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
            System.out.println("    " + allReferrers.size() + " referrers for " + objRef + " took " + (end - start) + " ms");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
        // We have to stop going up a referrer chain in some cases
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        Type rt = objRef.type();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        if (rt instanceof ClassType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
            ClassType ct = (ClassType)rt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
            String name = ct.name();
38413
d9e49b45fd7d 8154539: Examine the desktop module's use of sun.misc.SoftCache
alexsch
parents: 30376
diff changeset
   449
            if (name.equals("sun.awt.SoftCache$ValueCell")) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
            if (name.equals("java.lang.ref.Finalizer")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
            if (name.equals("java.lang.ref.SoftReference")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
            // oh oh, should really check for a subclass of ClassLoader :-)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
            if (name.indexOf("ClassLoader") >= 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
            // No doubt there are other reasons to stop ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
        int itemNumber = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
        int allSize = allReferrers.size();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
        for (ObjectReference objx: allReferrers) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
            showReferrers(objx, level + 1, allSize, itemNumber++);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
}