Path: blob/master/test/hotspot/jtreg/compiler/exceptions/TestSpilling.java
41149 views
/*1* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package compiler.exceptions;2425/**26* @test27* @bug 826322728* @summary Tests that users of return values from exception-throwing method29* calls are not duplicated in the call's exception path. The second30* run with a variable seed is added for test robustness.31* @library /test/lib /32* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions33* -XX:+UnlockDiagnosticVMOptions34* -Xbatch -XX:+StressGCM -XX:StressSeed=035* -XX:+VerifyRegisterAllocator36* -XX:CompileCommand=dontinline,java.lang.Integer::*37* compiler.exceptions.TestSpilling38* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions39* -XX:+UnlockDiagnosticVMOptions40* -Xbatch -XX:+StressGCM41* -XX:+VerifyRegisterAllocator42* -XX:CompileCommand=dontinline,java.lang.Integer::*43* compiler.exceptions.TestSpilling44*/4546public class TestSpilling {4748public static void test() {49int a = Integer.valueOf(42).intValue();50// After global code motion, the logic below should only be placed in51// the fall-through path of java.lang.Integer::intValue(). Otherwise,52// live range splitting might create uses without reaching definitions53// if 'a' is spilled.54int b = (((a & 0x0000F000)) + 1);55int c = a / b + ((a % b > 0) ? 1 : 0);56}5758public static void main(String[] args) {59for (int i = 0; i < 10_000; i++) {60test();61}62}6364}656667