Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/compiler/6800154/Test6800154.java
32285 views
/*1* Copyright (c) 2009, 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*/2223/**24* @test25* @bug 680015426* @summary Add comments to long_by_long_mulhi() for better understandability27*28* @run main/othervm -Xcomp -XX:CompileOnly=Test6800154.divcomp Test680015429*/3031import java.net.URLClassLoader;3233public class Test6800154 implements Runnable {34static final long[] DIVIDENDS = {350,361,372,381423487,394444441,404918923241323L,41-1,42-24351,430x3333,440x0000000080000000L,450x7fffffffffffffffL,460x8000000000000000L47};4849static final long[] DIVISORS = {501,512,5217,5312342,5424123,55143444,56123444442344L,57-1,58-2,59-4423423234231423L,600x0000000080000000L,610x7fffffffffffffffL,620x8000000000000000L63};6465// Initialize DIVISOR so that it is final in this class.66static final long DIVISOR;6768static {69long value = 0;70try {71value = Long.decode(System.getProperty("divisor"));72} catch (Throwable e) {73}74DIVISOR = value;75}7677public static void main(String[] args) throws Exception78{79Class cl = Class.forName("Test6800154");80URLClassLoader apploader = (URLClassLoader) cl.getClassLoader();8182// Iterate over all divisors.83for (int i = 0; i < DIVISORS.length; i++) {84System.setProperty("divisor", "" + DIVISORS[i]);85ClassLoader loader = new URLClassLoader(apploader.getURLs(), apploader.getParent());86Class c = loader.loadClass("Test6800154");87Runnable r = (Runnable) c.newInstance();88r.run();89}90}9192public void run()93{94// Iterate over all dividends.95for (int i = 0; i < DIVIDENDS.length; i++) {96long dividend = DIVIDENDS[i];9798long expected = divint(dividend);99long result = divcomp(dividend);100101if (result != expected)102throw new InternalError(dividend + " / " + DIVISOR + " failed: " + result + " != " + expected);103}104}105106static long divint(long a) { return a / DIVISOR; }107static long divcomp(long a) { return a / DIVISOR; }108}109110111