< prev index next >
test/compiler/c2/6603011/Test.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 23,44 ****
/**
* @test
* @bug 6603011
* @summary long/int division by constant
! *
* @run main/othervm -Xcomp -Xbatch -XX:-Inline Test
*/
//
// -XX:-Inline is essential to this test so that verification functions
// divi, modi, divl and modl generate "plain" divides.
// -Xcomp -Xbatch are also useful to ensure the full range of
// dividend and divisor combinations are tested
//
! import java.net.*;
class s {
static int divi(int dividend, int divisor) { return dividend / divisor; }
static int modi(int dividend, int divisor) { return dividend % divisor; }
static long divl(long dividend, long divisor) { return dividend / divisor; }
--- 23,44 ----
/**
* @test
* @bug 6603011
* @summary long/int division by constant
! * @library /testlibrary
* @run main/othervm -Xcomp -Xbatch -XX:-Inline Test
*/
//
// -XX:-Inline is essential to this test so that verification functions
// divi, modi, divl and modl generate "plain" divides.
// -Xcomp -Xbatch are also useful to ensure the full range of
// dividend and divisor combinations are tested
//
! import jdk.test.lib.Utils;
class s {
static int divi(int dividend, int divisor) { return dividend / divisor; }
static int modi(int dividend, int divisor) { return dividend % divisor; }
static long divl(long dividend, long divisor) { return dividend / divisor; }
*** 187,208 ****
// Reload this class with the "divisor" property set to the input parameter.
// This allows the JIT to see q.DIVISOR as a final constant, and change
// any divisions or mod operations into multiplies.
public static void test_divisor(int divisor,
! URLClassLoader apploader) throws Exception {
System.setProperty("divisor", "" + divisor);
! ClassLoader loader = new URLClassLoader(apploader.getURLs(),
! apploader.getParent());
Class c = loader.loadClass("Test");
Runnable r = (Runnable)c.newInstance();
r.run();
}
public static void main(String[] args) throws Exception {
Class cl = Class.forName("Test");
! URLClassLoader apploader = (URLClassLoader)cl.getClassLoader();
// Test every divisor between -100 and 100.
for (int i = -100; i <= 100; i++) {
test_divisor(i, apploader);
--- 187,208 ----
// Reload this class with the "divisor" property set to the input parameter.
// This allows the JIT to see q.DIVISOR as a final constant, and change
// any divisions or mod operations into multiplies.
public static void test_divisor(int divisor,
! ClassLoader apploader) throws Exception {
System.setProperty("divisor", "" + divisor);
! ClassLoader loader
! = Utils.getTestClassPathURLClassLoader(apploader.getParent());
Class c = loader.loadClass("Test");
Runnable r = (Runnable)c.newInstance();
r.run();
}
public static void main(String[] args) throws Exception {
Class cl = Class.forName("Test");
! ClassLoader apploader = cl.getClassLoader();
// Test every divisor between -100 and 100.
for (int i = -100; i <= 100; i++) {
test_divisor(i, apploader);
< prev index next >