This commit is contained in:
Pavel Punegov 2016-04-14 18:15:41 +02:00
commit dc3f4fbc96
21 changed files with 108 additions and 110 deletions

View File

@ -26,7 +26,6 @@
* @bug 8137167
* @summary Tests CompileCommand=print
* @library /testlibrary /test/lib /compiler/testlibrary ../share /
* @ignore 8140354
* @build compiler.compilercontrol.commandfile.PrintTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*

View File

@ -26,7 +26,6 @@
* @bug 8137167
* @summary Tests CompileCommand=print
* @library /testlibrary /test/lib /compiler/testlibrary ../share /
* @ignore 8140354
* @build compiler.compilercontrol.commands.PrintTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*

View File

@ -26,7 +26,6 @@
* @bug 8137167
* @summary Tests directives to be able to turn on print_assembly
* @library /testlibrary /test/lib /compiler/testlibrary ../share /
* @ignore 8140354
* @build compiler.compilercontrol.directives.PrintTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*

View File

@ -26,7 +26,6 @@
* @bug 8137167
* @summary Tests jcmd to be able to add a directive to compile only specified methods
* @library /testlibrary /test/lib /compiler/testlibrary ../share /
* @ignore 8140354
* @build compiler.compilercontrol.jcmd.PrintDirectivesTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*

View File

@ -26,7 +26,6 @@
* @bug 8137167
* @summary Randomly generates valid commands with random types
* @library /testlibrary /test/lib /compiler/testlibrary ../share /
* @ignore 8140354
* @build compiler.compilercontrol.mixed.RandomValidCommandsTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*

View File

@ -1,85 +0,0 @@
/*
* Copyright (c) 2005, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.test.lib.jittester;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
public class TypeUtil {
public static Collection<Type> getImplicitlyCastable(Collection<Type> types, Type type) {
ArrayList<Type> result = new ArrayList<>(types);
Iterator<Type> iterator = result.iterator();
while (iterator.hasNext()) {
if (!iterator.next().canImplicitlyCastTo(type)) {
iterator.remove();
}
}
return result;
}
public static Collection<Type> getExplicitlyCastable(Collection<Type> types, Type type) {
ArrayList<Type> result = new ArrayList<>(types);
Iterator<Type> iterator = result.iterator();
while (iterator.hasNext()) {
if (!iterator.next().canExplicitlyCastTo(type)) {
iterator.remove();
}
}
return result;
}
public static List<Type> getMoreCapatiousThan(Collection<Type> types, BuiltInType type) {
ArrayList<Type> result = new ArrayList<>();
Iterator<Type> iterator = types.iterator();
while (iterator.hasNext()) {
try {
BuiltInType builtInType = (BuiltInType) iterator.next();
if (builtInType.isMoreCapaciousThan(type)) {
result.add(builtInType);
}
} catch (Exception e) {
}
}
return result;
}
public static List<Type> getLessCapatiousOrEqualThan(Collection<Type> types, BuiltInType type) {
ArrayList<Type> result = new ArrayList<>();
Iterator<Type> iterator = types.iterator();
while (iterator.hasNext()) {
try {
BuiltInType builtInType = (BuiltInType) iterator.next();
if (!builtInType.isMoreCapaciousThan(type) || builtInType.equals(type)) {
result.add(builtInType);
}
} catch (Exception e) {
}
}
return result;
}
}

View File

@ -31,7 +31,7 @@ import jdk.test.lib.jittester.ProductionFailedException;
import jdk.test.lib.jittester.Rule;
import jdk.test.lib.jittester.Type;
import jdk.test.lib.jittester.TypeList;
import jdk.test.lib.jittester.TypeUtil;
import jdk.test.lib.jittester.utils.TypeUtil;
import jdk.test.lib.jittester.VariableBase;
import jdk.test.lib.jittester.VariableInfo;
import jdk.test.lib.jittester.types.TypeKlass;

View File

@ -29,7 +29,7 @@ import jdk.test.lib.jittester.OperatorKind;
import jdk.test.lib.jittester.ProductionFailedException;
import jdk.test.lib.jittester.Type;
import jdk.test.lib.jittester.TypeList;
import jdk.test.lib.jittester.TypeUtil;
import jdk.test.lib.jittester.utils.TypeUtil;
import jdk.test.lib.jittester.types.TypeInt;
import jdk.test.lib.jittester.types.TypeKlass;
import jdk.test.lib.jittester.utils.PseudoRandom;

View File

@ -28,7 +28,7 @@ import jdk.test.lib.jittester.OperatorKind;
import jdk.test.lib.jittester.ProductionFailedException;
import jdk.test.lib.jittester.Type;
import jdk.test.lib.jittester.TypeList;
import jdk.test.lib.jittester.TypeUtil;
import jdk.test.lib.jittester.utils.TypeUtil;
import jdk.test.lib.jittester.types.TypeBoolean;
import jdk.test.lib.jittester.types.TypeInt;
import jdk.test.lib.jittester.types.TypeKlass;

View File

@ -28,11 +28,11 @@ import jdk.test.lib.jittester.OperatorKind;
import jdk.test.lib.jittester.ProductionFailedException;
import jdk.test.lib.jittester.Type;
import jdk.test.lib.jittester.TypeList;
import jdk.test.lib.jittester.TypeUtil;
import jdk.test.lib.jittester.types.TypeInt;
import jdk.test.lib.jittester.types.TypeKlass;
import jdk.test.lib.jittester.types.TypeLong;
import jdk.test.lib.jittester.utils.PseudoRandom;
import jdk.test.lib.jittester.utils.TypeUtil;
class BinaryShiftOperatorFactory extends BinaryOperatorFactory {
BinaryShiftOperatorFactory(OperatorKind opKind, long complexityLimit, int operatorLimit,

View File

@ -28,7 +28,7 @@ import jdk.test.lib.jittester.OperatorKind;
import jdk.test.lib.jittester.ProductionFailedException;
import jdk.test.lib.jittester.Type;
import jdk.test.lib.jittester.TypeList;
import jdk.test.lib.jittester.TypeUtil;
import jdk.test.lib.jittester.utils.TypeUtil;
import jdk.test.lib.jittester.UnaryOperator;
import jdk.test.lib.jittester.types.TypeKlass;
import jdk.test.lib.jittester.types.TypeInt;

View File

@ -33,7 +33,7 @@ import jdk.test.lib.jittester.Switch;
import jdk.test.lib.jittester.SymbolTable;
import jdk.test.lib.jittester.Type;
import jdk.test.lib.jittester.TypeList;
import jdk.test.lib.jittester.TypeUtil;
import jdk.test.lib.jittester.utils.TypeUtil;
import jdk.test.lib.jittester.loops.DoWhile;
import jdk.test.lib.jittester.loops.For;
import jdk.test.lib.jittester.loops.While;

View File

@ -30,7 +30,7 @@ import jdk.test.lib.jittester.OperatorKind;
import jdk.test.lib.jittester.ProductionFailedException;
import jdk.test.lib.jittester.Type;
import jdk.test.lib.jittester.TypeList;
import jdk.test.lib.jittester.TypeUtil;
import jdk.test.lib.jittester.utils.TypeUtil;
import jdk.test.lib.jittester.types.TypeBoolean;
import jdk.test.lib.jittester.types.TypeKlass;
import jdk.test.lib.jittester.utils.PseudoRandom;

View File

@ -30,7 +30,7 @@ import jdk.test.lib.jittester.OperatorKind;
import jdk.test.lib.jittester.ProductionFailedException;
import jdk.test.lib.jittester.Type;
import jdk.test.lib.jittester.TypeList;
import jdk.test.lib.jittester.TypeUtil;
import jdk.test.lib.jittester.utils.TypeUtil;
import jdk.test.lib.jittester.types.TypeKlass;
import jdk.test.lib.jittester.utils.PseudoRandom;

View File

@ -30,7 +30,7 @@ import jdk.test.lib.jittester.OperatorKind;
import jdk.test.lib.jittester.ProductionFailedException;
import jdk.test.lib.jittester.Type;
import jdk.test.lib.jittester.TypeList;
import jdk.test.lib.jittester.TypeUtil;
import jdk.test.lib.jittester.utils.TypeUtil;
import jdk.test.lib.jittester.types.TypeKlass;
import jdk.test.lib.jittester.types.TypeBoolean;
import jdk.test.lib.jittester.utils.PseudoRandom;

View File

@ -30,7 +30,7 @@ import jdk.test.lib.jittester.ProductionFailedException;
import jdk.test.lib.jittester.SymbolTable;
import jdk.test.lib.jittester.Type;
import jdk.test.lib.jittester.TypeList;
import jdk.test.lib.jittester.TypeUtil;
import jdk.test.lib.jittester.utils.TypeUtil;
import jdk.test.lib.jittester.VariableInfo;
import jdk.test.lib.jittester.loops.CounterInitializer;
import jdk.test.lib.jittester.types.TypeKlass;
@ -48,7 +48,7 @@ class CounterInitializerFactory extends SafeFactory {
@Override
protected IRNode sproduce() throws ProductionFailedException {
List<Type> types = TypeUtil.getMoreCapatiousThan(TypeList.getBuiltIn(), new TypeInt());
List<Type> types = TypeUtil.getMoreCapaciousThan(TypeList.getBuiltIn(), new TypeInt());
types.add(new TypeInt());
final Type selectedType = PseudoRandom.randomElement(types);
IRNode init = new LiteralInitializer(counterValue, selectedType);

View File

@ -34,7 +34,7 @@ import jdk.test.lib.jittester.ProductionFailedException;
import jdk.test.lib.jittester.Rule;
import jdk.test.lib.jittester.Switch;
import jdk.test.lib.jittester.Type;
import jdk.test.lib.jittester.TypeUtil;
import jdk.test.lib.jittester.utils.TypeUtil;
import jdk.test.lib.jittester.types.TypeKlass;
import jdk.test.lib.jittester.types.TypeByte;
import jdk.test.lib.jittester.types.TypeChar;
@ -63,7 +63,7 @@ class SwitchFactory extends SafeFactory {
@Override
protected IRNode sproduce() throws ProductionFailedException {
if (statementLimit > 0 && complexityLimit > 0) {
ArrayList<Type> switchTypes = new ArrayList<>();
List<Type> switchTypes = new ArrayList<>();
switchTypes.add(new TypeChar());
switchTypes.add(new TypeByte());
switchTypes.add(new TypeShort());
@ -78,8 +78,8 @@ class SwitchFactory extends SafeFactory {
.setCanHaveReturn(canHaveReturn);
MAIN_LOOP:
for (Type type : switchTypes) {
ArrayList<IRNode> caseConsts = new ArrayList<>();
ArrayList<IRNode> caseBlocks = new ArrayList<>();
List<IRNode> caseConsts = new ArrayList<>();
List<IRNode> caseBlocks = new ArrayList<>();
try {
int accumulatedStatements = 0;
int currentStatementsLimit = 0;
@ -94,10 +94,10 @@ class SwitchFactory extends SafeFactory {
.getLimitedExpressionFactory()
.produce();
accumulatedComplexity += currentComplexityLimit;
ArrayList<Type> caseTypes = new ArrayList<>();
List<Type> caseTypes = new ArrayList<>();
caseTypes.add(new TypeByte());
caseTypes.add(new TypeChar());
caseTypes = new ArrayList<>(TypeUtil.getLessCapatiousOrEqualThan(caseTypes,
caseTypes = new ArrayList<>(TypeUtil.getLessCapaciousOrEqualThan(caseTypes,
(BuiltInType) type));
if (PseudoRandom.randomBoolean()) { // "default"
currentStatementsLimit = (int) (PseudoRandom.random()

View File

@ -30,7 +30,7 @@ import jdk.test.lib.jittester.SymbolTable;
import jdk.test.lib.jittester.TernaryOperator;
import jdk.test.lib.jittester.Type;
import jdk.test.lib.jittester.TypeList;
import jdk.test.lib.jittester.TypeUtil;
import jdk.test.lib.jittester.utils.TypeUtil;
import jdk.test.lib.jittester.types.TypeKlass;
import jdk.test.lib.jittester.types.TypeBoolean;
import jdk.test.lib.jittester.utils.PseudoRandom;

View File

@ -31,7 +31,7 @@ import jdk.test.lib.jittester.ProductionFailedException;
import jdk.test.lib.jittester.TryCatchBlock;
import jdk.test.lib.jittester.Type;
import jdk.test.lib.jittester.TypeList;
import jdk.test.lib.jittester.TypeUtil;
import jdk.test.lib.jittester.utils.TypeUtil;
import jdk.test.lib.jittester.types.TypeKlass;
import jdk.test.lib.jittester.utils.PseudoRandom;

View File

@ -29,7 +29,7 @@ import jdk.test.lib.jittester.OperatorKind;
import jdk.test.lib.jittester.ProductionFailedException;
import jdk.test.lib.jittester.Type;
import jdk.test.lib.jittester.TypeList;
import jdk.test.lib.jittester.TypeUtil;
import jdk.test.lib.jittester.utils.TypeUtil;
import jdk.test.lib.jittester.UnaryOperator;
import jdk.test.lib.jittester.types.TypeBoolean;
import jdk.test.lib.jittester.types.TypeInt;

View File

@ -0,0 +1,88 @@
/*
* Copyright (c) 2005, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.test.lib.jittester.utils;
import jdk.test.lib.jittester.BuiltInType;
import jdk.test.lib.jittester.Type;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
/**
* Utility functions for type system
*/
public class TypeUtil {
/**
* Gets a list of implicitly castable types to a given one from the collection of types
*
* @param types a collection to get types from
* @param type a target type which result type could be implicitly cast to
* @return a result collection of types that match given conditions
*/
public static Collection<Type> getImplicitlyCastable(Collection<Type> types, Type type) {
return types.stream()
.filter(t -> t.canImplicitlyCastTo(type))
.collect(Collectors.toList());
}
/**
* Gets a list of explicitly castable types to a given one from the collection of types
*
* @param types a collection to get types from
* @param type a target type which result type could be explicitly cast to
* @return a result collection of types that match given conditions
*/
public static Collection<Type> getExplicitlyCastable(Collection<Type> types, Type type) {
return types.stream()
.filter(t -> t.canExplicitlyCastTo(type))
.collect(Collectors.toList());
}
/**
* Gets a list of more capacious types than a given one from the collection of types
*
* @param types a collection to get types from
* @param type a type to filter given types by capacity
* @return a result collection of types that match given conditions
*/
public static List<Type> getMoreCapaciousThan(Collection<Type> types, BuiltInType type) {
return types.stream()
.filter(t -> ((BuiltInType) t).isMoreCapaciousThan(type))
.collect(Collectors.toList());
}
/**
* Gets a list of less or equal capacious types than a given one from the collection of types
*
* @param types a collection to get types from
* @param type a type to filter given types by capacity
* @return a result collection of types that match given conditions
*/
public static List<Type> getLessCapaciousOrEqualThan(Collection<Type> types, BuiltInType type) {
return types.stream()
.filter(t -> !((BuiltInType) t).isMoreCapaciousThan(type) || t.equals(type))
.collect(Collectors.toList());
}
}