1 /* 2 * Copyright (c) 2018, 2019, 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 TestVerifyStackAfterDeopt 27 * @bug 8148871 28 * @bug 8209825 29 * @summary Checks VerifyStack after deoptimization of array allocation slow call 30 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:TieredStopAtLevel=1 31 * -XX:AllocatePrefetchLines=1 -XX:AllocateInstancePrefetchLines=1 -XX:AllocatePrefetchStepSize=16 -XX:AllocatePrefetchDistance=1 32 * -XX:MinTLABSize=1k -XX:TLABSize=1k 33 * -XX:+DeoptimizeALot -XX:+VerifyStack 34 * compiler.interpreter.TestVerifyStackAfterDeopt 35 */ 36 37 package compiler.interpreter; 38 39 public class TestVerifyStackAfterDeopt { 40 method(long l1, long l2, Object[] a)41 private long method(long l1, long l2, Object[] a) { 42 return l1 + l2; 43 } 44 45 private long result[] = new long[1]; 46 test()47 private void test() { 48 // For the array allocation, C1 emits a slow call into the runtime 49 // that deoptimizes the caller frame due to -XX:+DeoptimizeALot. 50 // The VerifyStack code then gets confused because the following 51 // bytecode instruction is an invoke and the interpreter oop map 52 // generator reports the oop map after execution of that invoke. 53 this.result[0] = method(1L, 2L, new Object[0]); 54 } 55 main(String[] args)56 public static void main(String[] args) { 57 TestVerifyStackAfterDeopt t = new TestVerifyStackAfterDeopt(); 58 // Run long enough for C1 compilation to trigger and TLAB to fill up 59 for (int i = 0; i < 100_000; ++i) { 60 t.test(); 61 } 62 } 63 } 64