1 /* 2 * Copyright (c) 2018, 2020, 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 /* 26 * @test 27 * 28 * @summary converted from VM Testbase nsk/jvmti/scenarios/allocation/AP05/ap05t001. 29 * VM Testbase keywords: [quick, jpda, jvmti, noras] 30 * VM Testbase readme: 31 * DESCRIPTION 32 * The test implements AP05 scenario of test plan for Allocation 33 * Profiling. 34 * The test checks the following common assertion from specs 35 * of IterateOverReachableObjects and 36 * IterateOverObjectsReachableFromObject: 37 * The callback (jvmtiObjectReferenceCallback) is called 38 * exactly once for each reference from a referrer; 39 * this is true even if there are reference cycles or 40 * multiple paths to the referrer. 41 * The test class 'ap05t001' has 'referrer' field of 42 * 'ap05t001Subclass' type. The 'ap05t001Subclass' class 43 * extends 'ap05t001Superclass' class and implements 44 * 'ap05t001Interface' interface. Each of the classes and 45 * the interface defines several static and instance fields 46 * of Object type but with dirrerent modifiers, i.e. private, 47 * public, protected or package-private. All these fields 48 * named as 'referreeXX' where XX is some decimal number. 49 * The test class initializes 'referrer' field and 50 * all 'referreeXX' fields. The last ones are assigned to 51 * the same Object instance. Then the tags are assigned 52 * to 'referrer', to Class instance of 'ap05t001Subclass' 53 * type and to the referred Object instance. 54 * Then the test agent runs IterateOverReachableObjects and 55 * IterateOverObjectsReachableFromObject. The test fails 56 * if defined jvmtiObjectReferenceCallback founds unexpected 57 * number of references between tagged objects. 58 * COMMENTS 59 * 60 * @library /vmTestbase 61 * /test/lib 62 * @run main/othervm/native 63 * -agentlib:ap05t001=-waittime=5 64 * nsk.jvmti.scenarios.allocation.AP05.ap05t001 65 */ 66 67