hotspot/test/gc/g1/humongousObjects/objectGraphTest/README
changeset 38256 685ac27ed264
child 39280 86907793a181
equal deleted inserted replaced
38255:5784bccf53b0 38256:685ac27ed264
       
     1 /*
       
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  *
       
    23  */
       
    24 
       
    25 The test checks that after different type of GC unreachable objects behave as expected:
       
    26 
       
    27 1. Young GC - weakly referenced non-humongous objects are collected, other objects are not collected.
       
    28 
       
    29 2. Full GC - weakly referenced non-humongous and humongous objects are collected, softly referenced non-humongous and
       
    30              humongous objects are not collected.
       
    31 
       
    32 3. Full GC with memory pressure - weakly and softly referenced non-humongous and humongous objects are collected.
       
    33 
       
    34 The test gets gc type as a command line argument.
       
    35 Then the test allocates object graph in heap (currently testing scenarios are pre-generated and stored in
       
    36 TestcaseData.getPregeneratedTestcases()) with TestObjectGraphAfterGC::allocateObjectGraph.
       
    37 
       
    38 Since we are testing humongous objects we need pretty unusual nodes - arrays of Object.
       
    39 We need this since only large enough array could be Humongous object (in fact class with huge amount of fields is
       
    40 humongous too but it's for other tests).
       
    41 ObjectGraph class generates object graph with Object[] nodes. It also provides a way to collect
       
    42 information about each node using "visitor" pattern.
       
    43 
       
    44 Using visitors we build Set of ReferenceInfo instances which contains the following information:
       
    45 reference - external weak/soft reference to graph's node
       
    46 graphId and nodeId - graph's and node's ids - we need this for error handling
       
    47 softlyReachable - is node effectively referenced by external soft reference. It could be when external
       
    48 soft reference or when this node is reachable from node that exteranally referenced by soft reference
       
    49 effectiveHumongous - if node behaves effectively humongous.  It could be when node is humongous
       
    50 or when this node is reachable from humongous node.
       
    51 
       
    52 When we leave TestObjectGraphAfterGC::allocateObjectGraph we make graph reachable only with references from Set of
       
    53 ReferenceInfo instances.
       
    54 
       
    55 We run specified gc and check that each instance of ReferenceInfo set behaves as expected.
       
    56 Then we check that gc log file contains expected tokens and doesn't contain tokens that it should not contain.