Skip to content
Permalink
Browse files
8244414: [lworld] Migrate Valhalla micro benchmarks suite to not use …
…V? syntax

Reviewed-by: mcimadamore
  • Loading branch information
Srikanth Adayapalam committed May 6, 2020
1 parent 08bfa8f commit 72aa43ebe786c5529edf5bec16a9fd92f7d8368e
Showing with 313 additions and 178 deletions.
  1. +16 −0 src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
  2. +10 −0 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
  3. +7 −0 src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
  4. +53 −0 test/langtools/tools/javac/valhalla/lworld-values/InlineDiamondTest.java
  5. +49 −0 test/langtools/tools/javac/valhalla/lworld-values/LubWithInlines.java
  6. +2 −2 test/micro/org/openjdk/bench/valhalla/corelibs/mapprotos/XHashMap.java
  7. +16 −16 test/micro/org/openjdk/bench/valhalla/lworld/acmp/IsCmpBranch1.java
  8. +16 −16 test/micro/org/openjdk/bench/valhalla/lworld/acmp/IsCmpBranch2.java
  9. +16 −16 test/micro/org/openjdk/bench/valhalla/lworld/acmp/IsCmpBranch8.java
  10. +4 −4 test/micro/org/openjdk/bench/valhalla/lworld/arrays/Arraycopy1.java
  11. +4 −4 test/micro/org/openjdk/bench/valhalla/lworld/arrays/Arraycopy2.java
  12. +4 −4 test/micro/org/openjdk/bench/valhalla/lworld/arrays/Arraycopy8.java
  13. +6 −6 test/micro/org/openjdk/bench/valhalla/lworld/arrays/Copy1.java
  14. +6 −6 test/micro/org/openjdk/bench/valhalla/lworld/arrays/Copy2.java
  15. +6 −6 test/micro/org/openjdk/bench/valhalla/lworld/arrays/Copy8.java
  16. +4 −4 test/micro/org/openjdk/bench/valhalla/lworld/arrays/Set1.java
  17. +4 −4 test/micro/org/openjdk/bench/valhalla/lworld/arrays/Set2.java
  18. +4 −4 test/micro/org/openjdk/bench/valhalla/lworld/arrays/Set8.java
  19. +5 −5 test/micro/org/openjdk/bench/valhalla/lworld/arrays/Sum1.java
  20. +5 −5 test/micro/org/openjdk/bench/valhalla/lworld/arrays/Sum2.java
  21. +5 −5 test/micro/org/openjdk/bench/valhalla/lworld/arrays/Sum8.java
  22. +1 −1 test/micro/org/openjdk/bench/valhalla/lworld/callconv/Ackermann1.java
  23. +1 −1 test/micro/org/openjdk/bench/valhalla/lworld/callconv/Ackermann2.java
  24. +1 −1 test/micro/org/openjdk/bench/valhalla/lworld/callconv/Ackermann8.java
  25. +25 −25 test/micro/org/openjdk/bench/valhalla/lworld/callconv/CallConv1.java
  26. +1 −1 test/micro/org/openjdk/bench/valhalla/lworld/fields/NodeBox1.java
  27. +1 −1 test/micro/org/openjdk/bench/valhalla/lworld/fields/NodeBox2.java
  28. +1 −1 test/micro/org/openjdk/bench/valhalla/lworld/fields/NodeBox8.java
  29. +1 −1 test/micro/org/openjdk/bench/valhalla/lworld/fields/Sum1.java
  30. +1 −1 test/micro/org/openjdk/bench/valhalla/lworld/fields/Sum2.java
  31. +1 −1 test/micro/org/openjdk/bench/valhalla/lworld/fields/Sum8.java
  32. +9 −9 test/micro/org/openjdk/bench/valhalla/lworld/invoke/ObjectHashCodeExplicit.java
  33. +9 −9 test/micro/org/openjdk/bench/valhalla/lworld/invoke/ObjectHashCodeImplicit.java
  34. +13 −13 test/micro/org/openjdk/bench/valhalla/lworld/matrix/Boxed.java
  35. +3 −3 test/micro/org/openjdk/bench/valhalla/lworld/traversal/Boxed.java
  36. +3 −3 test/micro/org/openjdk/bench/valhalla/lworld/types/Utils.java
@@ -4000,6 +4000,22 @@ public Type lub(Type... ts) {

int[] kinds = new int[ts.length];

boolean haveValues = false;
boolean haveRefs = false;
for (int i = 0 ; i < ts.length ; i++) {
if (ts[i].isValue())
haveValues = true;
else
haveRefs = true;
}
if (haveRefs && haveValues) {
System.arraycopy(ts, 0, ts = new Type[ts.length], 0, ts.length);
for (int i = 0; i < ts.length; i++) {
if (ts[i].isValue())
ts[i] = ts[i].referenceProjection();
}
}

int boundkind = UNKNOWN_BOUND;
for (int i = 0 ; i < ts.length ; i++) {
Type t = ts[i];
@@ -471,6 +471,10 @@ public void visitClassDef(JCClassDecl tree) {
c.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, c, tree);
c.sourcefile = env.toplevel.sourcefile;
c.members_field = WriteableScope.create(c);
if (c.projection != null) {
// Do not carry around symbols from prior round.
c.projection.members_field = WriteableScope.create(c.projection);
}
c.clearAnnotationMetadata();

ClassType ct = (ClassType)c.type;
@@ -492,6 +496,12 @@ public void visitClassDef(JCClassDecl tree) {
// Enter type parameters.
ct.typarams_field = classEnter(tree.typarams, localEnv);
ct.allparams_field = null;
if (ct.isValue()) {
if (ct.projection != null) {
ct.projection.typarams_field = ct.typarams_field;
ct.projection.allparams_field = ct.allparams_field;
}
}

// install further completer for this type.
c.completer = typeEnter;
@@ -2949,6 +2949,13 @@ public Symbol baseSymbol() {
return sym;
}
};
ClassSymbol refProjection = newConstr.owner.isValue() ?
(ClassSymbol) newConstr.owner.referenceProjection() : null;
if (refProjection != null) {
MethodSymbol clone = newConstr.clone(refProjection);
clone.projection = newConstr;
newConstr.projection = clone;
}
bestSoFar = selectBest(env, site, argtypes, typeargtypes,
newConstr,
bestSoFar,
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2020, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/

/*
* @test
* @bug 8244458 8244414
* @summary Diamond inference does not work with value classes
* @run main InlineDiamondTest
*/

public class InlineDiamondTest<E> {

interface I<T> {
}

public I<E> get() {
return new Y<>();
}

private inline class Y<U> implements I<U> {
int x = 42;
}

public static void main(String [] args) {
InlineDiamondTest<String> idt = new InlineDiamondTest<>();
I<String> is = idt.get();
String toString = is.toString();
if (!toString.equals("[InlineDiamondTest$Y x=42]"))
throw new AssertionError("Expected: " + toString);
}
}
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2020, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/

/*
* @test
* @bug 8244458 8244414
* @summary Check that javac does not crash while computing LUB involving values.
* @run main LubWithInlines
*/

public class LubWithInlines {
interface I {}
static class Node implements I {
}
static I foo(Node e) {
var ret = (e == null) ? new XNodeWrapper() : e;
return ret;
}
static inline class XNodeWrapper implements I {
int i = 42;
}
public static void main(String [] args) {
I i = foo(null);
if (!i.toString().equals("[LubWithInlines$XNodeWrapper i=42]"))
throw new AssertionError("Unexpected: " + i);
}
}
@@ -309,9 +309,9 @@
final int hash;
final K key;
V value;
Node?<K,V> next;
Node<K,V> next;

XNode(int hash, K key, V value, Node?<K,V> next) {
XNode(int hash, K key, V value, Node<K,V> next) {
this.hash = hash;
this.key = key;
this.value = value;
@@ -62,11 +62,11 @@
Val1[] value1_75, value2_75;
Val1[] value1_100, value2_100;

Val1?[] boxed1_00, boxed2_00;
Val1?[] boxed1_25, boxed2_25;
Val1?[] boxed1_50, boxed2_50;
Val1?[] boxed1_75, boxed2_75;
Val1?[] boxed1_100, boxed2_100;
Val1.ref[] boxed1_00, boxed2_00;
Val1.ref[] boxed1_25, boxed2_25;
Val1.ref[] boxed1_50, boxed2_50;
Val1.ref[] boxed1_75, boxed2_75;
Val1.ref[] boxed1_100, boxed2_100;

Vector[] covariance1_00, covariance2_00;
Vector[] covariance1_25, covariance2_25;
@@ -87,16 +87,16 @@ public void setup() {
value2_75 = populateValues2(value1_75, 75);
value1_100 = populateValues1();
value2_100 = populateValues2(value1_100, 100);
boxed1_00 = new Val1?[SIZE];
boxed2_00 = new Val1?[SIZE];
boxed1_25 = new Val1?[SIZE];
boxed2_25 = new Val1?[SIZE];
boxed1_50 = new Val1?[SIZE];
boxed2_50 = new Val1?[SIZE];
boxed1_75 = new Val1?[SIZE];
boxed2_75 = new Val1?[SIZE];
boxed1_100 = new Val1?[SIZE];
boxed2_100 = new Val1?[SIZE];
boxed1_00 = new Val1.ref[SIZE];
boxed2_00 = new Val1.ref[SIZE];
boxed1_25 = new Val1.ref[SIZE];
boxed2_25 = new Val1.ref[SIZE];
boxed1_50 = new Val1.ref[SIZE];
boxed2_50 = new Val1.ref[SIZE];
boxed1_75 = new Val1.ref[SIZE];
boxed2_75 = new Val1.ref[SIZE];
boxed1_100 = new Val1.ref[SIZE];
boxed2_100 = new Val1.ref[SIZE];
for(int i = 0; i< SIZE; i++) {
boxed1_00[i] = value1_00[i];
boxed2_00[i] = value2_00[i];
@@ -201,7 +201,7 @@ public int value100() {
}

@CompilerControl(CompilerControl.Mode.DONT_INLINE)
private static int boxed_comparison(Val1?[] objects1, Val1?[] objects2) {
private static int boxed_comparison(Val1.ref[] objects1, Val1.ref[] objects2) {
int s = 0;
for (int i = 0; i < SIZE; i++) {
if (objects1[i] == objects2[i]) {
@@ -61,11 +61,11 @@
Val2[] value1_75, value2_75;
Val2[] value1_100, value2_100;

Val2?[] boxed1_00, boxed2_00;
Val2?[] boxed1_25, boxed2_25;
Val2?[] boxed1_50, boxed2_50;
Val2?[] boxed1_75, boxed2_75;
Val2?[] boxed1_100, boxed2_100;
Val2.ref[] boxed1_00, boxed2_00;
Val2.ref[] boxed1_25, boxed2_25;
Val2.ref[] boxed1_50, boxed2_50;
Val2.ref[] boxed1_75, boxed2_75;
Val2.ref[] boxed1_100, boxed2_100;

Vector[] covariance1_00, covariance2_00;
Vector[] covariance1_25, covariance2_25;
@@ -86,16 +86,16 @@ public void setup() {
value2_75 = populateValues2(value1_75, 75);
value1_100 = populateValues1();
value2_100 = populateValues2(value1_100, 100);
boxed1_00 = new Val2?[SIZE];
boxed2_00 = new Val2?[SIZE];
boxed1_25 = new Val2?[SIZE];
boxed2_25 = new Val2?[SIZE];
boxed1_50 = new Val2?[SIZE];
boxed2_50 = new Val2?[SIZE];
boxed1_75 = new Val2?[SIZE];
boxed2_75 = new Val2?[SIZE];
boxed1_100 = new Val2?[SIZE];
boxed2_100 = new Val2?[SIZE];
boxed1_00 = new Val2.ref[SIZE];
boxed2_00 = new Val2.ref[SIZE];
boxed1_25 = new Val2.ref[SIZE];
boxed2_25 = new Val2.ref[SIZE];
boxed1_50 = new Val2.ref[SIZE];
boxed2_50 = new Val2.ref[SIZE];
boxed1_75 = new Val2.ref[SIZE];
boxed2_75 = new Val2.ref[SIZE];
boxed1_100 = new Val2.ref[SIZE];
boxed2_100 = new Val2.ref[SIZE];
for(int i = 0; i< SIZE; i++) {
boxed1_00[i] = value1_00[i];
boxed2_00[i] = value2_00[i];
@@ -200,7 +200,7 @@ public int value100() {
}

@CompilerControl(CompilerControl.Mode.DONT_INLINE)
private static int boxed_comparison(Val2?[] objects1, Val2?[] objects2) {
private static int boxed_comparison(Val2.ref[] objects1, Val2.ref[] objects2) {
int s = 0;
for (int i = 0; i < SIZE; i++) {
if (objects1[i] == objects2[i]) {
@@ -61,11 +61,11 @@
Val8[] value1_75, value2_75;
Val8[] value1_100, value2_100;

Val8?[] boxed1_00, boxed2_00;
Val8?[] boxed1_25, boxed2_25;
Val8?[] boxed1_50, boxed2_50;
Val8?[] boxed1_75, boxed2_75;
Val8?[] boxed1_100, boxed2_100;
Val8.ref[] boxed1_00, boxed2_00;
Val8.ref[] boxed1_25, boxed2_25;
Val8.ref[] boxed1_50, boxed2_50;
Val8.ref[] boxed1_75, boxed2_75;
Val8.ref[] boxed1_100, boxed2_100;

Vector[] covariance1_00, covariance2_00;
Vector[] covariance1_25, covariance2_25;
@@ -86,16 +86,16 @@ public void setup() {
value2_75 = populateValues2(value1_75, 75);
value1_100 = populateValues1();
value2_100 = populateValues2(value1_100, 100);
boxed1_00 = new Val8?[SIZE];
boxed2_00 = new Val8?[SIZE];
boxed1_25 = new Val8?[SIZE];
boxed2_25 = new Val8?[SIZE];
boxed1_50 = new Val8?[SIZE];
boxed2_50 = new Val8?[SIZE];
boxed1_75 = new Val8?[SIZE];
boxed2_75 = new Val8?[SIZE];
boxed1_100 = new Val8?[SIZE];
boxed2_100 = new Val8?[SIZE];
boxed1_00 = new Val8.ref[SIZE];
boxed2_00 = new Val8.ref[SIZE];
boxed1_25 = new Val8.ref[SIZE];
boxed2_25 = new Val8.ref[SIZE];
boxed1_50 = new Val8.ref[SIZE];
boxed2_50 = new Val8.ref[SIZE];
boxed1_75 = new Val8.ref[SIZE];
boxed2_75 = new Val8.ref[SIZE];
boxed1_100 = new Val8.ref[SIZE];
boxed2_100 = new Val8.ref[SIZE];
for(int i = 0; i< SIZE; i++) {
boxed1_00[i] = value1_00[i];
boxed2_00[i] = value2_00[i];
@@ -200,7 +200,7 @@ public int value100() {
}

@CompilerControl(CompilerControl.Mode.DONT_INLINE)
private static int boxed_comparison(Val8?[] objects1, Val8?[] objects2) {
private static int boxed_comparison(Val8.ref[] objects1, Val8.ref[] objects2) {
int s = 0;
for (int i = 0; i < SIZE; i++) {
if (objects1[i] == objects2[i]) {
@@ -15,17 +15,17 @@
Vector[] srcCovariance;
Vector[] dstCovariance;

Val1?[] srcBoxed;
Val1?[] dstBoxed;
Val1.ref[] srcBoxed;
Val1.ref[] dstBoxed;

@Setup
public void setup() {
srcValue = Utils.fillV(new Val1[size]);
dstValue = new Val1[size];
srcCovariance = Utils.fillV(new Val1[size]);
dstCovariance = new Val1[size];
srcBoxed = Utils.fillB(new Val1?[size]);
dstBoxed = new Val1?[size];
srcBoxed = Utils.fillB(new Val1.ref[size]);
dstBoxed = new Val1.ref[size];
}

@Benchmark
@@ -15,17 +15,17 @@
Vector[] srcCovariance;
Vector[] dstCovariance;

Val2?[] srcBoxed;
Val2?[] dstBoxed;
Val2.ref[] srcBoxed;
Val2.ref[] dstBoxed;

@Setup
public void setup() {
srcValue = Utils.fillV(new Val2[size]);
dstValue = new Val2[size];
srcCovariance = Utils.fillV(new Val2[size]);
dstCovariance = new Val2[size];
srcBoxed = Utils.fillB(new Val2?[size]);
dstBoxed = new Val2?[size];
srcBoxed = Utils.fillB(new Val2.ref[size]);
dstBoxed = new Val2.ref[size];
}

@Benchmark

0 comments on commit 72aa43e

Please sign in to comment.