Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8263024: Convert Valhalla tests using the old framework to the new framework #457

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

This file was deleted.

@@ -0,0 +1,149 @@
/*
* Copyright (c) 2017, 2021, 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 compiler.valhalla.inlinetypes;

import jdk.test.lib.Utils;
import compiler.lib.ir_framework.Scenario;
import compiler.lib.ir_framework.TestFramework;

public class InlineTypes {
public static final int rI = Utils.getRandomInstance().nextInt() % 1000;
public static final long rL = Utils.getRandomInstance().nextLong() % 1000;
public static final double rD = Utils.getRandomInstance().nextDouble() % 1000;

public static final Scenario[] DEFAULT_SCENARIOS = {
new Scenario(0,
"-XX:+IgnoreUnrecognizedVMOptions",
"-XX:-UseACmpProfile",
"-XX:+AlwaysIncrementalInline",
"-XX:FlatArrayElementMaxOops=5",
"-XX:FlatArrayElementMaxSize=-1",
"-XX:-UseArrayLoadStoreProfile",
"-XX:InlineFieldMaxFlatSize=-1",
"-XX:+InlineTypePassFieldsAsArgs",
"-XX:+InlineTypeReturnedAsFields"
),
new Scenario(1,
"-XX:+IgnoreUnrecognizedVMOptions",
"-XX:-UseACmpProfile",
"-XX:-UseCompressedOops",
"-XX:FlatArrayElementMaxOops=5",
"-XX:FlatArrayElementMaxSize=-1",
"-XX:-UseArrayLoadStoreProfile",
"-XX:InlineFieldMaxFlatSize=-1",
"-XX:-InlineTypePassFieldsAsArgs",
"-XX:-InlineTypeReturnedAsFields"
),
new Scenario(2,
"-XX:+IgnoreUnrecognizedVMOptions",
"-XX:-UseACmpProfile",
"-XX:-UseCompressedOops",
"-XX:FlatArrayElementMaxOops=0",
"-XX:FlatArrayElementMaxSize=0",
"-XX:-UseArrayLoadStoreProfile",
"-XX:InlineFieldMaxFlatSize=-1",
"-XX:+InlineTypePassFieldsAsArgs",
"-XX:+InlineTypeReturnedAsFields",
"-XX:+StressInlineTypeReturnedAsFields"
),
new Scenario(3,
"-XX:+IgnoreUnrecognizedVMOptions",
"-DVerifyIR=false",
"-XX:+AlwaysIncrementalInline",
"-XX:FlatArrayElementMaxOops=0",
"-XX:FlatArrayElementMaxSize=0",
"-XX:InlineFieldMaxFlatSize=0",
"-XX:+InlineTypePassFieldsAsArgs",
"-XX:+InlineTypeReturnedAsFields"
),
new Scenario(4,
"-XX:+IgnoreUnrecognizedVMOptions",
"-DVerifyIR=false",
"-XX:FlatArrayElementMaxOops=-1",
"-XX:FlatArrayElementMaxSize=-1",
"-XX:InlineFieldMaxFlatSize=0",
"-XX:+InlineTypePassFieldsAsArgs",
"-XX:-InlineTypeReturnedAsFields",
"-XX:-ReduceInitialCardMarks"
),
new Scenario(5,
"-XX:+IgnoreUnrecognizedVMOptions",
"-XX:-UseACmpProfile",
"-XX:+AlwaysIncrementalInline",
"-XX:FlatArrayElementMaxOops=5",
"-XX:FlatArrayElementMaxSize=-1",
"-XX:-UseArrayLoadStoreProfile",
"-XX:InlineFieldMaxFlatSize=-1",
"-XX:-InlineTypePassFieldsAsArgs",
"-XX:-InlineTypeReturnedAsFields"
)
};

public static TestFramework getFramework() {
StackWalker walker = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
return new TestFramework(walker.getCallerClass()).setDefaultWarmup(251);
}

static class IRNode {
// Regular expressions used to match nodes in the PrintIdeal output
protected static final String START = "(\\d+ (.*";
protected static final String MID = ".*)+ ===.*";
protected static final String END = ")";
// Generic allocation
protected static final String ALLOC_G = "(.*call,static wrapper for: _new_instance_Java" + END;
protected static final String ALLOCA_G = "(.*call,static wrapper for: _new_array_Java" + END;
// Inline type allocation
protected static final String ALLOC = "(.*precise klass compiler/valhalla/inlinetypes/MyValue.*\\R(.*(movl|xorl|nop|spill).*\\R)*.*_new_instance_Java" + END;
protected static final String ALLOCA = "(.*precise klass \\[(L|Q)compiler/valhalla/inlinetypes/MyValue.*\\R(.*(movl|xorl|nop|spill).*\\R)*.*_new_array_Java" + END;
protected static final String LOAD = START + "Load(B|S|I|L|F|D|P|N)" + MID + "@compiler/valhalla/inlinetypes/MyValue.*" + END;
protected static final String LOADK = START + "LoadK" + MID + END;
protected static final String STORE = START + "Store(B|C|S|I|L|F|D|P|N)" + MID + "@compiler/valhalla/inlinetypes/MyValue.*" + END;
protected static final String LOOP = START + "Loop" + MID + "" + END;
protected static final String COUNTEDLOOP = START + "CountedLoop\\b" + MID + "" + END;
protected static final String COUNTEDLOOP_MAIN = START + "CountedLoop\\b" + MID + "main" + END;
protected static final String TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*(unstable_if|predicate)" + END;
protected static final String LINKTOSTATIC = START + "CallStaticJava" + MID + "linkToStatic" + END;
protected static final String NPE = START + "CallStaticJava" + MID + "null_check" + END;
protected static final String CALL = START + "CallStaticJava" + MID + END;
protected static final String STORE_INLINE_FIELDS = START + "CallStaticJava" + MID + "store_inline_type_fields" + END;
protected static final String SCOBJ = "(.*# ScObj.*" + END;
protected static final String LOAD_UNKNOWN_INLINE = "(.*call_leaf,runtime load_unknown_inline.*" + END;
protected static final String STORE_UNKNOWN_INLINE = "(.*call_leaf,runtime store_unknown_inline.*" + END;
protected static final String INLINE_ARRAY_NULL_GUARD = "(.*call,static wrapper for: uncommon_trap.*reason='null_check' action='none'.*" + END;
protected static final String INTRINSIC_SLOW_PATH = "(.*call,static wrapper for: uncommon_trap.*reason='intrinsic_or_type_checked_inlining'.*" + END;
protected static final String CLONE_INTRINSIC_SLOW_PATH = "(.*call,static.*java.lang.Object::clone.*" + END;
protected static final String CLASS_CHECK_TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*class_check" + END;
protected static final String NULL_CHECK_TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*null_check" + END;
protected static final String NULL_ASSERT_TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*null_assert" + END;
protected static final String RANGE_CHECK_TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*range_check" + END;
protected static final String UNHANDLED_TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*unhandled" + END;
protected static final String PREDICATE_TRAP = START + "CallStaticJava" + MID + "uncommon_trap.*predicate" + END;
protected static final String MEMBAR = START + "MemBar" + MID + END;
protected static final String CHECKCAST_ARRAY = "(cmp.*precise klass \\[(L|Q)compiler/valhalla/inlinetypes/MyValue.*" + END;
protected static final String CHECKCAST_ARRAYCOPY = "(.*call_leaf_nofp,runtime checkcast_arraycopy.*" + END;
protected static final String JLONG_ARRAYCOPY = "(.*call_leaf_nofp,runtime jlong_disjoint_arraycopy.*" + END;
protected static final String FIELD_ACCESS = "(.*Field: *" + END;
protected static final String SUBSTITUTABILITY_TEST = START + "CallStaticJava" + MID + "java.lang.invoke.ValueBootstrapMethods::isSubstitutable" + END;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021, 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
@@ -23,17 +23,23 @@

package compiler.valhalla.inlinetypes;

import compiler.lib.ir_framework.DontCompile;
import compiler.lib.ir_framework.DontInline;
import compiler.lib.ir_framework.ForceCompileClassInitializer;
import compiler.lib.ir_framework.ForceInline;

@ForceCompileClassInitializer
public final primitive class MyValue1 extends MyAbstract {
static int s;
static final long sf = InlineTypeTest.rL;
static final long sf = InlineTypes.rL;
final int x;
final long y;
final short z;
final Integer o;
final int[] oa;
final MyValue2 v1;
final MyValue2 v2;
static final MyValue2 v3 = MyValue2.createWithFieldsInline(InlineTypeTest.rI, InlineTypeTest.rD);
static final MyValue2 v3 = MyValue2.createWithFieldsInline(InlineTypes.rI, InlineTypes.rD);
final int c;

@ForceInline
@@ -74,8 +80,8 @@ static MyValue1 createWithFieldsInline(int x, long y) {
v = setO(v, new Integer(x));
int[] oa = {x};
v = setOA(v, oa);
v = setV1(v, MyValue2.createWithFieldsInline(x, y, InlineTypeTest.rD));
v = setV2(v, MyValue2.createWithFieldsInline(x, y, InlineTypeTest.rD+x));
v = setV1(v, MyValue2.createWithFieldsInline(x, y, InlineTypes.rD));
v = setV2(v, MyValue2.createWithFieldsInline(x, y, InlineTypes.rD + x));
v = setC(v, (int)(x+y));
return v;
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021, 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
@@ -23,6 +23,9 @@

package compiler.valhalla.inlinetypes;

import compiler.lib.ir_framework.DontInline;
import compiler.lib.ir_framework.ForceInline;

final primitive class MyValue2Inline {
final double d;
final long l;
@@ -88,7 +91,7 @@ public static MyValue2 createWithFieldsInline(int x, double d) {
MyValue2 v = createDefaultInline();
v = setX(v, x);
v = setY(v, (byte)x);
v = setV(v, MyValue2Inline.createWithFieldsInline(d, InlineTypeTest.rL));
v = setV(v, MyValue2Inline.createWithFieldsInline(d, InlineTypes.rL));
return v;
}

@@ -97,7 +100,7 @@ public static MyValue2 createWithFieldsDontInline(int x, double d) {
MyValue2 v = createDefaultInline();
v = setX(v, x);
v = setY(v, (byte)x);
v = setV(v, MyValue2Inline.createWithFieldsInline(d, InlineTypeTest.rL));
v = setV(v, MyValue2Inline.createWithFieldsInline(d, InlineTypes.rL));
return v;
}

@@ -25,6 +25,8 @@

import jdk.test.lib.Asserts;
import jdk.test.lib.Utils;
import compiler.lib.ir_framework.DontInline;
import compiler.lib.ir_framework.ForceInline;

final primitive class MyValue3Inline {
final float f7;
@@ -23,6 +23,8 @@

package compiler.valhalla.inlinetypes;

import compiler.lib.ir_framework.ForceInline;

// Inline type definition with too many fields to return in registers
final primitive class MyValue4 extends MyAbstract {
final MyValue3 v1;