test/compiler/valhalla/valuetypes/ValueTypeTestBench.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/test/compiler/valhalla/valuetypes/ValueTypeTestBench.java Mon Nov 7 08:32:10 2016
--- new/test/compiler/valhalla/valuetypes/ValueTypeTestBench.java Mon Nov 7 08:32:10 2016
*** 71,80 ****
--- 71,90 ----
@ForceInline
public static MyValue createInline(int x, long y, double z) {
return __Make MyValue(x, y, z);
}
+
+ @DontInline
+ public String toStringDontInline() {
+ return "MyValue: x=" + x + " y=" + y + " z=" + z;
+ }
+
+ @ForceInline
+ public String toStringInline() {
+ return "MyValue: x=" + x + " y=" + y + " z=" + z;
+ }
}
public class ValueTypeTestBench {
// Print ideal graph after execution of each test
private static final boolean PRINT_GRAPH = true;
*** 313,322 ****
--- 323,393 ----
public void test13_verifier(boolean warmup) {
double result = test13(warmup);
Asserts.assertEQ(result, warmup ? 42 + (1000*(double)rI) : (rI + rL + rD));
}
+ // Create a value type in a non-inlined method and then call a
+ // non-inlined method on that value type.
+ @Test(failOn = (ALLOC + STORE))
+ public String test14() {
+ MyValue v = MyValue.createDontInline(32, 64L, 128.0);
+ String s = v.toStringDontInline();
+ return s;
+ }
+
+ @DontCompile
+ public void test14_verifier(boolean b) {
+ String s = test14();
+ System.out.println("Result is: " + s);
+ }
+
+ // Create a value type in an inlined method and then call a
+ // non-inlined method on that value type.
+ @Test(match = {ALLOC}, matchCount = {1})
+ public String test15() {
+ MyValue v = MyValue.createInline(65, 129L, 257.0);
+ String s = v.toStringDontInline();
+ return s;
+ }
+
+ @DontCompile
+ public void test15_verifier(boolean b) {
+ String s = test15();
+ System.out.println("Result is: " + s);
+ }
+
+ // Create a value type in a non-inlined method and then call an
+ // inlined method on that value type. Allocations are due to building
+ // String objects and not due to allocating value types.
+ @Test(match = {ALLOC}, matchCount = {2})
+ public String test16() {
+ MyValue v = MyValue.createDontInline(130, 258L, 514.0);
+ String s = v.toStringInline();
+ return s;
+ }
+
+ @DontCompile
+ public void test16_verifier(boolean b) {
+ String s = test16();
+ System.out.println("Result is: " + s);
+ }
+
+ // Create a value type in an inlined method and then call an
+ // inlined method on that value type. Allocations are due to
+ // building String objects and not due to allocating value types.
+ @Test(match = {ALLOC}, matchCount = {2})
+ public String test17() {
+ MyValue v = MyValue.createInline(259, 515L, 1027.0);
+ String s = v.toStringInline();
+ return s;
+ }
+
+ @DontCompile
+ public void test17_verifier(boolean b) {
+ String s = test17();
+ System.out.println("Result is: " + s);
+ }
// ========== Helper methods ==========
@DontCompile
public double sumValue(MyValue v) {
test/compiler/valhalla/valuetypes/ValueTypeTestBench.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File