< prev index next >
test/testlibrary/jittester/src/jdk/test/lib/jittester/factories/FunctionFactory.java
Print this page
*** 35,45 ****
import jdk.test.lib.jittester.functions.Function;
import jdk.test.lib.jittester.functions.FunctionInfo;
import jdk.test.lib.jittester.types.TypeKlass;
import jdk.test.lib.jittester.utils.PseudoRandom;
! class FunctionFactory extends SafeFactory {
private final FunctionInfo functionInfo;
private final int operatorLimit;
private final long complexityLimit;
private final boolean exceptionSafe;
private final TypeKlass ownerClass;
--- 35,45 ----
import jdk.test.lib.jittester.functions.Function;
import jdk.test.lib.jittester.functions.FunctionInfo;
import jdk.test.lib.jittester.types.TypeKlass;
import jdk.test.lib.jittester.utils.PseudoRandom;
! class FunctionFactory extends SafeFactory<Function> {
private final FunctionInfo functionInfo;
private final int operatorLimit;
private final long complexityLimit;
private final boolean exceptionSafe;
private final TypeKlass ownerClass;
*** 53,63 ****
this.functionInfo.type = resultType;
this.exceptionSafe = exceptionSafe;
}
@Override
! protected IRNode sproduce() throws ProductionFailedException {
// Currently no function is exception-safe
if (exceptionSafe) {
throw new ProductionFailedException();
}
ArrayList<Symbol> allFunctions;
--- 53,63 ----
this.functionInfo.type = resultType;
this.exceptionSafe = exceptionSafe;
}
@Override
! protected Function sproduce() throws ProductionFailedException {
// Currently no function is exception-safe
if (exceptionSafe) {
throw new ProductionFailedException();
}
ArrayList<Symbol> allFunctions;
*** 70,80 ****
PseudoRandom.shuffle(allFunctions);
Collection<TypeKlass> klassHierarchy = ownerClass.getAllParents();
for (Symbol function : allFunctions) {
FunctionInfo functionInfo = (FunctionInfo) function;
// Don't try to construct abstract classes.
! if (functionInfo.isConstructor() && functionInfo.klass.isAbstract()) {
continue;
}
// We don't call methods from the same class which are not final, because if we
// do this may produce an infinite recursion. Simple example:
// class A
--- 70,80 ----
PseudoRandom.shuffle(allFunctions);
Collection<TypeKlass> klassHierarchy = ownerClass.getAllParents();
for (Symbol function : allFunctions) {
FunctionInfo functionInfo = (FunctionInfo) function;
// Don't try to construct abstract classes.
! if (functionInfo.isConstructor() && functionInfo.owner.isAbstract()) {
continue;
}
// We don't call methods from the same class which are not final, because if we
// do this may produce an infinite recursion. Simple example:
// class A
*** 92,102 ****
// Also we introduce a special flag NONRECURSIVE to mark functions that
// are not overrided. We may also call such functions.
// If it's a local call.. or it's a call using some variable to some object of some type in our hierarchy
boolean inHierarchy = false;
! if (ownerClass.equals(functionInfo.klass) || (inHierarchy = klassHierarchy.contains(functionInfo.klass))) {
if ((functionInfo.flags & FunctionInfo.FINAL) == 0 && (functionInfo.flags & FunctionInfo.STATIC) == 0
&& (functionInfo.flags & FunctionInfo.NONRECURSIVE) == 0) {
continue;
}
if (inHierarchy && (functionInfo.flags & FunctionInfo.PRIVATE) > 0) {
--- 92,102 ----
// Also we introduce a special flag NONRECURSIVE to mark functions that
// are not overrided. We may also call such functions.
// If it's a local call.. or it's a call using some variable to some object of some type in our hierarchy
boolean inHierarchy = false;
! if (ownerClass.equals(functionInfo.owner) || (inHierarchy = klassHierarchy.contains(functionInfo.owner))) {
if ((functionInfo.flags & FunctionInfo.FINAL) == 0 && (functionInfo.flags & FunctionInfo.STATIC) == 0
&& (functionInfo.flags & FunctionInfo.NONRECURSIVE) == 0) {
continue;
}
if (inHierarchy && (functionInfo.flags & FunctionInfo.PRIVATE) > 0) {
*** 119,129 ****
// For example the following can be done:
// Scan all the hieirachy where the class is declared.
// If there are function with a same name and same number of args,
// then disable usage of foldable expressions in the args.
boolean noconsts = false;
! Collection<Symbol> allFuncsInKlass = SymbolTable.getAllCombined(functionInfo.klass,
FunctionInfo.class);
for (Symbol s2 : allFuncsInKlass) {
FunctionInfo i2 = (FunctionInfo) function;
if (!i2.equals(functionInfo) && i2.name.equals(functionInfo.name)
&& i2.argTypes.size() == functionInfo.argTypes.size()) {
--- 119,129 ----
// For example the following can be done:
// Scan all the hieirachy where the class is declared.
// If there are function with a same name and same number of args,
// then disable usage of foldable expressions in the args.
boolean noconsts = false;
! Collection<Symbol> allFuncsInKlass = SymbolTable.getAllCombined(functionInfo.owner,
FunctionInfo.class);
for (Symbol s2 : allFuncsInKlass) {
FunctionInfo i2 = (FunctionInfo) function;
if (!i2.equals(functionInfo) && i2.name.equals(functionInfo.name)
&& i2.argTypes.size() == functionInfo.argTypes.size()) {
< prev index next >