8233273: Update Graal
Reviewed-by: kvn
This commit is contained in:
parent
3f93ec68ee
commit
cf43427ce9
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2019, 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
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2019, 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
|
||||
@ -35,9 +35,7 @@ import jdk.vm.ci.meta.Signature;
|
||||
/**
|
||||
* Denotes a method whose body is used by a compiler as the substitute (or intrinsification) of
|
||||
* another method. The exact mechanism used to do the substitution is compiler dependent but every
|
||||
* compiler should require substitute methods to be annotated with {@link MethodSubstitution}. In
|
||||
* addition, a compiler is recommended to implement {@link MethodSubstitutionRegistry} to advertise
|
||||
* the mechanism by which it supports registration of method substitutes.
|
||||
* compiler should require substitute methods to be annotated with {@link MethodSubstitution}.
|
||||
*
|
||||
* A compiler may support partial intrinsification where only a part of a method is implemented by
|
||||
* the compiler. The unsupported path is expressed by a call to either the original or substitute
|
||||
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2018, 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 org.graalvm.compiler.api.replacements;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
* A registry for {@link MethodSubstitution}s.
|
||||
*/
|
||||
public interface MethodSubstitutionRegistry {
|
||||
|
||||
/**
|
||||
* Gets the type representing the receiver (i.e., {@code this}) argument in a non-static method.
|
||||
*/
|
||||
Class<?> getReceiverType();
|
||||
|
||||
/**
|
||||
* Registers a substitution method.
|
||||
*
|
||||
* @param substituteDeclaringClass the class declaring the substitute method
|
||||
* @param name the name of both the original and substitute method
|
||||
* @param argumentTypes the argument types of the method. Element 0 of this array must be
|
||||
* {@link #getReceiverType()} iff the method is non-static. Upon returning, element 0
|
||||
* will have been rewritten to {@code declaringClass}.
|
||||
*/
|
||||
default void registerMethodSubstitution(Class<?> substituteDeclaringClass, String name, Type... argumentTypes) {
|
||||
registerMethodSubstitution(substituteDeclaringClass, name, name, argumentTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a substitution method.
|
||||
*
|
||||
* @param substituteDeclaringClass the class declaring the substitute method
|
||||
* @param name the name of both the original method
|
||||
* @param substituteName the name of the substitute method
|
||||
* @param argumentTypes the argument types of the method. Element 0 of this array must be
|
||||
* {@link #getReceiverType()} iff the method is non-static. Upon returning, element 0
|
||||
* will have been rewritten to {@code declaringClass}.
|
||||
*/
|
||||
void registerMethodSubstitution(Class<?> substituteDeclaringClass, String name, String substituteName, Type... argumentTypes);
|
||||
}
|
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
|
||||
package org.graalvm.compiler.test;
|
||||
package org.graalvm.compiler.api.test;
|
||||
|
||||
/**
|
||||
* A class loader that exports all packages in the module defining the class loader to all classes
|
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
|
||||
package org.graalvm.compiler.test;
|
||||
package org.graalvm.compiler.api.test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.module.ModuleDescriptor.Requires;
|
@ -471,6 +471,7 @@ public abstract class AArch64Assembler extends Assembler {
|
||||
private static final int AddSubExtendedOp = 0x0B200000;
|
||||
|
||||
private static final int MulOp = 0x1B000000;
|
||||
private static final int SignedMulLongOp = 0x9B200000;
|
||||
private static final int DataProcessing1SourceOp = 0x5AC00000;
|
||||
private static final int DataProcessing2SourceOp = 0x1AC00000;
|
||||
|
||||
@ -2313,7 +2314,7 @@ public abstract class AArch64Assembler extends Assembler {
|
||||
}
|
||||
|
||||
/**
|
||||
* unsigned multiply high. dst = (src1 * src2)[127:64]
|
||||
* Unsigned multiply high. dst = (src1 * src2)[127:64]
|
||||
*
|
||||
* @param dst general purpose register. May not be null or the stackpointer.
|
||||
* @param src1 general purpose register. May not be null or the stackpointer.
|
||||
@ -2327,7 +2328,7 @@ public abstract class AArch64Assembler extends Assembler {
|
||||
}
|
||||
|
||||
/**
|
||||
* unsigned multiply add-long. xDst = xSrc3 + (wSrc1 * wSrc2)
|
||||
* Unsigned multiply add-long. xDst = xSrc3 + (wSrc1 * wSrc2)
|
||||
*
|
||||
* @param dst general purpose register. May not be null or the stackpointer.
|
||||
* @param src1 general purpose register. May not be null or the stackpointer.
|
||||
@ -2343,7 +2344,7 @@ public abstract class AArch64Assembler extends Assembler {
|
||||
}
|
||||
|
||||
/**
|
||||
* signed multiply add-long. xDst = xSrc3 + (wSrc1 * wSrc2)
|
||||
* Signed multiply-add long. xDst = xSrc3 + (wSrc1 * wSrc2)
|
||||
*
|
||||
* @param dst general purpose register. May not be null or the stackpointer.
|
||||
* @param src1 general purpose register. May not be null or the stackpointer.
|
||||
@ -2351,11 +2352,19 @@ public abstract class AArch64Assembler extends Assembler {
|
||||
* @param src3 general purpose register. May not be null or the stackpointer.
|
||||
*/
|
||||
public void smaddl(Register dst, Register src1, Register src2, Register src3) {
|
||||
assert !dst.equals(sp);
|
||||
assert !src1.equals(sp);
|
||||
assert !src2.equals(sp);
|
||||
assert !src3.equals(sp);
|
||||
emitInt(0b10011011001 << 21 | dst.encoding | rs1(src1) | rs2(src2) | rs3(src3));
|
||||
smullInstruction(MADD, dst, src1, src2, src3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Signed multiply-sub long. xDst = xSrc3 - (wSrc1 * wSrc2)
|
||||
*
|
||||
* @param dst general purpose register. May not be null or the stackpointer.
|
||||
* @param src1 general purpose register. May not be null or the stackpointer.
|
||||
* @param src2 general purpose register. May not be null or the stackpointer.
|
||||
* @param src3 general purpose register. May not be null or the stackpointer.
|
||||
*/
|
||||
public void smsubl(Register dst, Register src1, Register src2, Register src3) {
|
||||
smullInstruction(MSUB, dst, src1, src2, src3);
|
||||
}
|
||||
|
||||
private void mulInstruction(Instruction instr, Register dst, Register src1, Register src2, Register src3, InstructionType type) {
|
||||
@ -2366,6 +2375,14 @@ public abstract class AArch64Assembler extends Assembler {
|
||||
emitInt(type.encoding | instr.encoding | MulOp | rd(dst) | rs1(src1) | rs2(src2) | rs3(src3));
|
||||
}
|
||||
|
||||
private void smullInstruction(Instruction instr, Register dst, Register src1, Register src2, Register src3) {
|
||||
assert !dst.equals(sp);
|
||||
assert !src1.equals(sp);
|
||||
assert !src2.equals(sp);
|
||||
assert !src3.equals(sp);
|
||||
emitInt(instr.encoding | SignedMulLongOp | rd(dst) | rs1(src1) | rs2(src2) | rs3(src3));
|
||||
}
|
||||
|
||||
/**
|
||||
* Signed divide. dst = src1 / src2.
|
||||
*
|
||||
|
@ -817,7 +817,7 @@ public class AArch64MacroAssembler extends AArch64Assembler {
|
||||
}
|
||||
|
||||
/**
|
||||
* unsigned multiply high. dst = (src1 * src2) >> size
|
||||
* Unsigned multiply high. dst = (src1 * src2) >> size
|
||||
*
|
||||
* @param size register size. Has to be 32 or 64.
|
||||
* @param dst general purpose register. May not be null or the stackpointer.
|
||||
@ -838,7 +838,7 @@ public class AArch64MacroAssembler extends AArch64Assembler {
|
||||
}
|
||||
|
||||
/**
|
||||
* signed multiply high. dst = (src1 * src2) >> size
|
||||
* Signed multiply high. dst = (src1 * src2) >> size
|
||||
*
|
||||
* @param size register size. Has to be 32 or 64.
|
||||
* @param dst general purpose register. May not be null or the stackpointer.
|
||||
@ -858,6 +858,60 @@ public class AArch64MacroAssembler extends AArch64Assembler {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Signed multiply long. xDst = wSrc1 * wSrc2
|
||||
*
|
||||
* @param size destination register size. Has to be 64.
|
||||
* @param dst 64-bit general purpose register. May not be null or the stackpointer.
|
||||
* @param src1 32-bit general purpose register. May not be null or the stackpointer.
|
||||
* @param src2 32-bit general purpose register. May not be null or the stackpointer.
|
||||
*/
|
||||
public void smull(int size, Register dst, Register src1, Register src2) {
|
||||
this.smaddl(size, dst, src1, src2, zr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Signed multiply-negate long. xDst = -(wSrc1 * wSrc2)
|
||||
*
|
||||
* @param size destination register size. Has to be 64.
|
||||
* @param dst 64-bit general purpose register. May not be null or the stackpointer.
|
||||
* @param src1 32-bit general purpose register. May not be null or the stackpointer.
|
||||
* @param src2 32-bit general purpose register. May not be null or the stackpointer.
|
||||
*/
|
||||
public void smnegl(int size, Register dst, Register src1, Register src2) {
|
||||
this.smsubl(size, dst, src1, src2, zr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Signed multiply-add long. xDst = xSrc3 + (wSrc1 * wSrc2)
|
||||
*
|
||||
* @param size destination register size. Has to be 64.
|
||||
* @param dst 64-bit general purpose register. May not be null or the stackpointer.
|
||||
* @param src1 32-bit general purpose register. May not be null or the stackpointer.
|
||||
* @param src2 32-bit general purpose register. May not be null or the stackpointer.
|
||||
* @param src3 64-bit general purpose register. May not be null or the stackpointer.
|
||||
*/
|
||||
public void smaddl(int size, Register dst, Register src1, Register src2, Register src3) {
|
||||
assert (!dst.equals(sp) && !src1.equals(sp) && !src2.equals(sp) && !src3.equals(sp));
|
||||
assert size == 64;
|
||||
super.smaddl(dst, src1, src2, src3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Signed multiply-sub long. xDst = xSrc3 - (wSrc1 * wSrc2)
|
||||
*
|
||||
* @param size destination register size. Has to be 64.
|
||||
* @param dst 64-bit general purpose register. May not be null or the stackpointer.
|
||||
* @param src1 32-bit general purpose register. May not be null or the stackpointer.
|
||||
* @param src2 32-bit general purpose register. May not be null or the stackpointer.
|
||||
* @param src3 64-bit general purpose register. May not be null or the stackpointer.
|
||||
*/
|
||||
public void smsubl(int size, Register dst, Register src1, Register src2, Register src3) {
|
||||
assert (!dst.equals(sp) && !src1.equals(sp) && !src2.equals(sp) && !src3.equals(sp));
|
||||
assert size == 64;
|
||||
super.smsubl(dst, src1, src2, src3);
|
||||
}
|
||||
|
||||
/**
|
||||
* dst = src1 % src2. Signed.
|
||||
*
|
||||
|
@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, Arm Limited. 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 org.graalvm.compiler.core.aarch64.test;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class AArch64MultiplyLongTest extends AArch64MatchRuleTest {
|
||||
|
||||
public long signedMulLong(int a, int b) {
|
||||
return a * (long) b;
|
||||
}
|
||||
|
||||
public long signedMulLongFromShort(short a, short b) {
|
||||
return (long) a * b;
|
||||
}
|
||||
|
||||
public long signedMulLongFromChar(char a, char b) {
|
||||
return a * (long) b;
|
||||
}
|
||||
|
||||
public long signedMulLongFromByte(byte a, byte b) {
|
||||
return (long) a * b;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSignedMulLong() {
|
||||
test("signedMulLong", 0x12345678, 0x87654321);
|
||||
checkLIR("signedMulLong", op -> op.name().equals("SMULL"), 1);
|
||||
test("signedMulLongFromShort", (short) 32767, (short) -32768);
|
||||
checkLIR("signedMulLongFromShort", op -> op.name().equals("SMULL"), 1);
|
||||
test("signedMulLongFromChar", (char) 59999, (char) 65535);
|
||||
checkLIR("signedMulLongFromChar", op -> op.name().equals("SMULL"), 1);
|
||||
test("signedMulLongFromByte", (byte) 10, (byte) -256);
|
||||
checkLIR("signedMulLongFromByte", op -> op.name().equals("SMULL"), 1);
|
||||
}
|
||||
|
||||
public long signedMNegLong1(int a, int b) {
|
||||
return -(a * (long) b);
|
||||
}
|
||||
|
||||
public long signedMNegLong2(int a, int b) {
|
||||
return a * (-(long) b);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSignedMNegLong() {
|
||||
test("signedMNegLong1", 0x89abcdef, 0xfedcba98);
|
||||
checkLIR("signedMNegLong1", op -> op.name().equals("SMNEGL"), 1);
|
||||
test("signedMNegLong2", 0x89abcdef, 0xfedcba98);
|
||||
checkLIR("signedMNegLong2", op -> op.name().equals("SMNEGL"), 1);
|
||||
}
|
||||
|
||||
public long signedMAddLong1(int a, int b, long c) {
|
||||
return c + a * (long) b;
|
||||
}
|
||||
|
||||
public long signedMAddLong2(int a, int b, long c) {
|
||||
return a * (long) b + c;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSignedMAddLong() {
|
||||
test("signedMAddLong1", 0x22228888, 0xaaaacccc, 0x123456789abcdL);
|
||||
checkLIR("signedMAddLong1", op -> op.name().equals("SMADDL"), 1);
|
||||
test("signedMAddLong2", 0x22228888, 0xaaaacccc, 0x123456789abcdL);
|
||||
checkLIR("signedMAddLong2", op -> op.name().equals("SMADDL"), 1);
|
||||
}
|
||||
|
||||
public long signedMSubLong(int a, int b, long c) {
|
||||
return c - a * (long) b;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSignedMSubLong() {
|
||||
test("signedMSubLong", 0x99995555, 0xeeeebbbb, 0x3456789abcdefL);
|
||||
checkLIR("signedMSubLong", op -> op.name().equals("SMSUBL"), 1);
|
||||
}
|
||||
}
|
@ -220,23 +220,34 @@ public class AArch64ArithmeticLIRGenerator extends ArithmeticLIRGenerator implem
|
||||
return result;
|
||||
}
|
||||
|
||||
public Value emitMAdd(Value a, Value b, Value c) {
|
||||
return emitMultiplyAddSub(AArch64ArithmeticOp.ADD, a, b, c);
|
||||
Value emitIntegerMAdd(Value a, Value b, Value c, boolean isI2L) {
|
||||
return emitMultiplyAddSub(isI2L ? AArch64ArithmeticOp.SMADDL : AArch64ArithmeticOp.MADD, a, b, c);
|
||||
}
|
||||
|
||||
public Value emitMSub(Value a, Value b, Value c) {
|
||||
return emitMultiplyAddSub(AArch64ArithmeticOp.SUB, a, b, c);
|
||||
Value emitIntegerMSub(Value a, Value b, Value c, boolean isI2L) {
|
||||
return emitMultiplyAddSub(isI2L ? AArch64ArithmeticOp.SMSUBL : AArch64ArithmeticOp.MSUB, a, b, c);
|
||||
}
|
||||
|
||||
private Value emitMultiplyAddSub(AArch64ArithmeticOp op, Value a, Value b, Value c) {
|
||||
assert a.getPlatformKind() == b.getPlatformKind() && b.getPlatformKind() == c.getPlatformKind();
|
||||
if (op == AArch64ArithmeticOp.ADD || op == AArch64ArithmeticOp.SUB) {
|
||||
assert isNumericInteger(a.getPlatformKind());
|
||||
} else if (op == AArch64ArithmeticOp.FADD) {
|
||||
assert a.getPlatformKind() == AArch64Kind.SINGLE || a.getPlatformKind() == AArch64Kind.DOUBLE;
|
||||
assert a.getPlatformKind() == b.getPlatformKind();
|
||||
Variable result;
|
||||
if (op == AArch64ArithmeticOp.SMADDL || op == AArch64ArithmeticOp.SMSUBL) {
|
||||
// For signed multiply int and then add/sub long.
|
||||
assert a.getPlatformKind() != c.getPlatformKind();
|
||||
result = getLIRGen().newVariable(LIRKind.combine(c));
|
||||
} else {
|
||||
assert a.getPlatformKind() == c.getPlatformKind();
|
||||
if (op == AArch64ArithmeticOp.FADD) {
|
||||
// For floating-point Math.fma intrinsic.
|
||||
assert a.getPlatformKind() == AArch64Kind.SINGLE || a.getPlatformKind() == AArch64Kind.DOUBLE;
|
||||
} else {
|
||||
// For int/long multiply add or sub.
|
||||
assert op == AArch64ArithmeticOp.MADD || op == AArch64ArithmeticOp.MSUB;
|
||||
assert isNumericInteger(a.getPlatformKind());
|
||||
}
|
||||
result = getLIRGen().newVariable(LIRKind.combine(a, b, c));
|
||||
}
|
||||
|
||||
Variable result = getLIRGen().newVariable(LIRKind.combine(a, b, c));
|
||||
AllocatableValue x = moveSp(asAllocatable(a));
|
||||
AllocatableValue y = moveSp(asAllocatable(b));
|
||||
AllocatableValue z = moveSp(asAllocatable(c));
|
||||
@ -451,7 +462,7 @@ public class AArch64ArithmeticLIRGenerator extends ArithmeticLIRGenerator implem
|
||||
|
||||
@Override
|
||||
public Value emitFusedMultiplyAdd(Value a, Value b, Value c) {
|
||||
return emitMultiplyAddSub(AArch64ArithmeticOp.FADD, a, b, c);
|
||||
return emitMultiplyAddSub(AArch64ArithmeticOp.FMADD, a, b, c);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,6 +57,7 @@ import org.graalvm.compiler.nodes.calc.AndNode;
|
||||
import org.graalvm.compiler.nodes.calc.BinaryNode;
|
||||
import org.graalvm.compiler.nodes.calc.IntegerLessThanNode;
|
||||
import org.graalvm.compiler.nodes.calc.LeftShiftNode;
|
||||
import org.graalvm.compiler.nodes.calc.MulNode;
|
||||
import org.graalvm.compiler.nodes.calc.NotNode;
|
||||
import org.graalvm.compiler.nodes.calc.OrNode;
|
||||
import org.graalvm.compiler.nodes.calc.RightShiftNode;
|
||||
@ -224,6 +225,33 @@ public class AArch64NodeMatchRules extends NodeMatchRules {
|
||||
return emitBinaryShift(op, a, shift, isShiftNot);
|
||||
}
|
||||
|
||||
@MatchRule("(Add=binary (Mul (SignExtend a) (SignExtend b)) c)")
|
||||
@MatchRule("(Sub=binary c (Mul (SignExtend a) (SignExtend b)))")
|
||||
public ComplexMatchResult signedMultiplyAddSubLong(BinaryNode binary, ValueNode a, ValueNode b, ValueNode c) {
|
||||
assert a.getStackKind() == JavaKind.Int && b.getStackKind() == JavaKind.Int && c.getStackKind() == JavaKind.Long;
|
||||
if (binary instanceof AddNode) {
|
||||
return builder -> getArithmeticLIRGenerator().emitIntegerMAdd(operand(a), operand(b), operand(c), true);
|
||||
}
|
||||
return builder -> getArithmeticLIRGenerator().emitIntegerMSub(operand(a), operand(b), operand(c), true);
|
||||
}
|
||||
|
||||
@MatchRule("(Negate (Mul=mul (SignExtend a) (SignExtend b)))")
|
||||
@MatchRule("(Mul=mul (Negate (SignExtend a)) (SignExtend b))")
|
||||
public ComplexMatchResult signedMultiplyNegLong(MulNode mul, ValueNode a, ValueNode b) {
|
||||
assert a.getStackKind() == JavaKind.Int && b.getStackKind() == JavaKind.Int;
|
||||
LIRKind resultKind = LIRKind.fromJavaKind(gen.target().arch, mul.getStackKind());
|
||||
return builder -> getArithmeticLIRGenerator().emitBinary(
|
||||
resultKind, AArch64ArithmeticOp.SMNEGL, true, operand(a), operand(b));
|
||||
}
|
||||
|
||||
@MatchRule("(Mul=mul (SignExtend a) (SignExtend b))")
|
||||
public ComplexMatchResult signedMultiplyLong(MulNode mul, ValueNode a, ValueNode b) {
|
||||
assert a.getStackKind() == JavaKind.Int && b.getStackKind() == JavaKind.Int;
|
||||
LIRKind resultKind = LIRKind.fromJavaKind(gen.target().arch, mul.getStackKind());
|
||||
return builder -> getArithmeticLIRGenerator().emitBinary(
|
||||
resultKind, AArch64ArithmeticOp.SMULL, true, operand(a), operand(b));
|
||||
}
|
||||
|
||||
@MatchRule("(Mul (Negate a) b)")
|
||||
@MatchRule("(Negate (Mul a b))")
|
||||
public ComplexMatchResult multiplyNegate(ValueNode a, ValueNode b) {
|
||||
@ -244,9 +272,9 @@ public class AArch64NodeMatchRules extends NodeMatchRules {
|
||||
}
|
||||
|
||||
if (binary instanceof AddNode) {
|
||||
return builder -> getArithmeticLIRGenerator().emitMAdd(operand(a), operand(b), operand(c));
|
||||
return builder -> getArithmeticLIRGenerator().emitIntegerMAdd(operand(a), operand(b), operand(c), false);
|
||||
}
|
||||
return builder -> getArithmeticLIRGenerator().emitMSub(operand(a), operand(b), operand(c));
|
||||
return builder -> getArithmeticLIRGenerator().emitIntegerMSub(operand(a), operand(b), operand(c), false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -359,6 +359,7 @@ public class AMD64NodeMatchRules extends NodeMatchRules {
|
||||
|
||||
@MatchRule("(If (IntegerTest Read=access value))")
|
||||
@MatchRule("(If (IntegerTest FloatingRead=access value))")
|
||||
@MatchRule("(If (IntegerTest VolatileRead=access value))")
|
||||
public ComplexMatchResult integerTestBranchMemory(IfNode root, LIRLowerableAccess access, ValueNode value) {
|
||||
return emitIntegerTestBranchMemory(root, value, access);
|
||||
}
|
||||
@ -369,14 +370,21 @@ public class AMD64NodeMatchRules extends NodeMatchRules {
|
||||
@MatchRule("(If (IntegerEquals=compare value FloatingRead=access))")
|
||||
@MatchRule("(If (IntegerLessThan=compare value FloatingRead=access))")
|
||||
@MatchRule("(If (IntegerBelow=compare value FloatingRead=access))")
|
||||
@MatchRule("(If (IntegerEquals=compare value VolatileRead=access))")
|
||||
@MatchRule("(If (IntegerLessThan=compare value VolatileRead=access))")
|
||||
@MatchRule("(If (IntegerBelow=compare value VolatileRead=access))")
|
||||
@MatchRule("(If (FloatEquals=compare value Read=access))")
|
||||
@MatchRule("(If (FloatEquals=compare value FloatingRead=access))")
|
||||
@MatchRule("(If (FloatEquals=compare value VolatileRead=access))")
|
||||
@MatchRule("(If (FloatLessThan=compare value Read=access))")
|
||||
@MatchRule("(If (FloatLessThan=compare value FloatingRead=access))")
|
||||
@MatchRule("(If (FloatLessThan=compare value VolatileRead=access))")
|
||||
@MatchRule("(If (PointerEquals=compare value Read=access))")
|
||||
@MatchRule("(If (PointerEquals=compare value FloatingRead=access))")
|
||||
@MatchRule("(If (PointerEquals=compare value VolatileRead=access))")
|
||||
@MatchRule("(If (ObjectEquals=compare value Read=access))")
|
||||
@MatchRule("(If (ObjectEquals=compare value FloatingRead=access))")
|
||||
@MatchRule("(If (ObjectEquals=compare value VolatileRead=access))")
|
||||
public ComplexMatchResult ifCompareMemory(IfNode root, CompareNode compare, ValueNode value, LIRLowerableAccess access) {
|
||||
return emitCompareBranchMemory(root, compare, value, access);
|
||||
}
|
||||
@ -478,6 +486,7 @@ public class AMD64NodeMatchRules extends NodeMatchRules {
|
||||
|
||||
@MatchRule("(Add value Read=access)")
|
||||
@MatchRule("(Add value FloatingRead=access)")
|
||||
@MatchRule("(Add value VolatileRead=access)")
|
||||
public ComplexMatchResult addMemory(ValueNode value, LIRLowerableAccess access) {
|
||||
OperandSize size = getMemorySize(access);
|
||||
if (size.isXmmType()) {
|
||||
@ -493,6 +502,7 @@ public class AMD64NodeMatchRules extends NodeMatchRules {
|
||||
|
||||
@MatchRule("(Sub value Read=access)")
|
||||
@MatchRule("(Sub value FloatingRead=access)")
|
||||
@MatchRule("(Sub value VolatileRead=access)")
|
||||
public ComplexMatchResult subMemory(ValueNode value, LIRLowerableAccess access) {
|
||||
OperandSize size = getMemorySize(access);
|
||||
if (size.isXmmType()) {
|
||||
@ -508,6 +518,7 @@ public class AMD64NodeMatchRules extends NodeMatchRules {
|
||||
|
||||
@MatchRule("(Mul value Read=access)")
|
||||
@MatchRule("(Mul value FloatingRead=access)")
|
||||
@MatchRule("(Mul value VolatileRead=access)")
|
||||
public ComplexMatchResult mulMemory(ValueNode value, LIRLowerableAccess access) {
|
||||
OperandSize size = getMemorySize(access);
|
||||
if (size.isXmmType()) {
|
||||
@ -523,6 +534,7 @@ public class AMD64NodeMatchRules extends NodeMatchRules {
|
||||
|
||||
@MatchRule("(And value Read=access)")
|
||||
@MatchRule("(And value FloatingRead=access)")
|
||||
@MatchRule("(And value VolatileRead=access)")
|
||||
public ComplexMatchResult andMemory(ValueNode value, LIRLowerableAccess access) {
|
||||
OperandSize size = getMemorySize(access);
|
||||
if (size.isXmmType()) {
|
||||
@ -534,6 +546,7 @@ public class AMD64NodeMatchRules extends NodeMatchRules {
|
||||
|
||||
@MatchRule("(Or value Read=access)")
|
||||
@MatchRule("(Or value FloatingRead=access)")
|
||||
@MatchRule("(Or value VolatileRead=access)")
|
||||
public ComplexMatchResult orMemory(ValueNode value, LIRLowerableAccess access) {
|
||||
OperandSize size = getMemorySize(access);
|
||||
if (size.isXmmType()) {
|
||||
@ -545,6 +558,7 @@ public class AMD64NodeMatchRules extends NodeMatchRules {
|
||||
|
||||
@MatchRule("(Xor value Read=access)")
|
||||
@MatchRule("(Xor value FloatingRead=access)")
|
||||
@MatchRule("(Xor value VolatileRead=access)")
|
||||
public ComplexMatchResult xorMemory(ValueNode value, LIRLowerableAccess access) {
|
||||
OperandSize size = getMemorySize(access);
|
||||
if (size.isXmmType()) {
|
||||
@ -565,12 +579,14 @@ public class AMD64NodeMatchRules extends NodeMatchRules {
|
||||
|
||||
@MatchRule("(SignExtend Read=access)")
|
||||
@MatchRule("(SignExtend FloatingRead=access)")
|
||||
@MatchRule("(SignExtend VolatileRead=access)")
|
||||
public ComplexMatchResult signExtend(SignExtendNode root, LIRLowerableAccess access) {
|
||||
return emitSignExtendMemory(access, root.getInputBits(), root.getResultBits(), null);
|
||||
}
|
||||
|
||||
@MatchRule("(ZeroExtend Read=access)")
|
||||
@MatchRule("(ZeroExtend FloatingRead=access)")
|
||||
@MatchRule("(ZeroExtend VolatileRead=access)")
|
||||
public ComplexMatchResult zeroExtend(ZeroExtendNode root, LIRLowerableAccess access) {
|
||||
AMD64Kind memoryKind = getMemoryKind(access);
|
||||
return builder -> getArithmeticLIRGenerator().emitZeroExtendMemory(memoryKind, root.getResultBits(), (AMD64AddressValue) operand(access.getAddress()), getState(access));
|
||||
@ -578,6 +594,7 @@ public class AMD64NodeMatchRules extends NodeMatchRules {
|
||||
|
||||
@MatchRule("(Narrow Read=access)")
|
||||
@MatchRule("(Narrow FloatingRead=access)")
|
||||
@MatchRule("(Narrow VolatileRead=access)")
|
||||
public ComplexMatchResult narrowRead(NarrowNode root, LIRLowerableAccess access) {
|
||||
return new ComplexMatchResult() {
|
||||
@Override
|
||||
@ -595,6 +612,7 @@ public class AMD64NodeMatchRules extends NodeMatchRules {
|
||||
|
||||
@MatchRule("(SignExtend (Narrow=narrow Read=access))")
|
||||
@MatchRule("(SignExtend (Narrow=narrow FloatingRead=access))")
|
||||
@MatchRule("(SignExtend (Narrow=narrow VolatileRead=access))")
|
||||
public ComplexMatchResult signExtendNarrowRead(SignExtendNode root, NarrowNode narrow, LIRLowerableAccess access) {
|
||||
LIRKind kind = getLIRGeneratorTool().getLIRKind(narrow.stamp(NodeView.DEFAULT));
|
||||
return emitSignExtendMemory(access, narrow.getResultBits(), root.getResultBits(), kind);
|
||||
@ -602,6 +620,7 @@ public class AMD64NodeMatchRules extends NodeMatchRules {
|
||||
|
||||
@MatchRule("(FloatConvert Read=access)")
|
||||
@MatchRule("(FloatConvert FloatingRead=access)")
|
||||
@MatchRule("(FloatConvert VolatileRead=access)")
|
||||
public ComplexMatchResult floatConvert(FloatConvertNode root, LIRLowerableAccess access) {
|
||||
switch (root.getFloatConvert()) {
|
||||
case D2F:
|
||||
@ -631,6 +650,7 @@ public class AMD64NodeMatchRules extends NodeMatchRules {
|
||||
|
||||
@MatchRule("(Reinterpret Read=access)")
|
||||
@MatchRule("(Reinterpret FloatingRead=access)")
|
||||
@MatchRule("(Reinterpret VolatileRead=access)")
|
||||
public ComplexMatchResult reinterpret(ReinterpretNode root, LIRLowerableAccess access) {
|
||||
return builder -> {
|
||||
LIRKind kind = getLIRGeneratorTool().getLIRKind(root.stamp(NodeView.DEFAULT));
|
||||
|
@ -115,7 +115,7 @@ public final class GraalOptions {
|
||||
public static final OptionKey<Boolean> PartialUnroll = new OptionKey<>(true);
|
||||
|
||||
@Option(help = "", type = OptionType.Expert)
|
||||
public static final OptionKey<Float> MinimumPeelProbability = new OptionKey<>(0.35f);
|
||||
public static final OptionKey<Float> MinimumPeelFrequency = new OptionKey<>(0.35f);
|
||||
|
||||
@Option(help = "", type = OptionType.Expert)
|
||||
public static final OptionKey<Integer> LoopMaxUnswitch = new OptionKey<>(3);
|
||||
@ -241,9 +241,6 @@ public final class GraalOptions {
|
||||
@Option(help = "", type = OptionType.Debug)
|
||||
public static final OptionKey<Boolean> OptImplicitNullChecks = new OptionKey<>(true);
|
||||
|
||||
@Option(help = "", type = OptionType.Debug)
|
||||
public static final OptionKey<Boolean> OptLoopTransform = new OptionKey<>(true);
|
||||
|
||||
@Option(help = "", type = OptionType.Debug)
|
||||
public static final OptionKey<Boolean> OptFloatingReads = new OptionKey<>(true);
|
||||
|
||||
@ -291,4 +288,7 @@ public final class GraalOptions {
|
||||
|
||||
@Option(help = "Alignment in bytes for loop header blocks.", type = OptionType.Expert)
|
||||
public static final OptionKey<Integer> LoopHeaderAlignment = new OptionKey<>(16);
|
||||
|
||||
@Option(help = "Do not include membars for volatile accesses until the end of optimizations.", type = OptionType.Expert)
|
||||
public static final OptionKey<Boolean> LateMembars = new OptionKey<>(true);
|
||||
}
|
||||
|
@ -94,6 +94,38 @@ public abstract class AbstractBlockBase<T extends AbstractBlockBase<T>> {
|
||||
return dominator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next dominator of this block that is either in the same loop of this block or in
|
||||
* an outer loop.
|
||||
*
|
||||
* @return the next dominator while skipping over loops
|
||||
*/
|
||||
public T getDominatorSkipLoops() {
|
||||
T d = getDominator();
|
||||
|
||||
if (d == null) {
|
||||
// We are at the start block and don't have a dominator.
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isLoopHeader()) {
|
||||
// We are moving out of current loop => just return dominator.
|
||||
assert d.getLoopDepth() == getLoopDepth() - 1;
|
||||
assert d.getLoop() != getLoop();
|
||||
return d;
|
||||
}
|
||||
|
||||
while (d.getLoop() != getLoop()) {
|
||||
// We have a case where our dominator is in a different loop. Move further along
|
||||
// the domiantor tree until we hit our loop again.
|
||||
d = d.getDominator();
|
||||
}
|
||||
|
||||
assert d.getLoopDepth() <= getLoopDepth();
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
public void setDominator(T dominator) {
|
||||
this.dominator = dominator;
|
||||
this.domDepth = dominator.domDepth + 1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2019, 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
|
||||
@ -46,7 +46,7 @@ public interface AbstractControlFlowGraph<T extends AbstractBlockBase<T>> {
|
||||
T getStartBlock();
|
||||
|
||||
/**
|
||||
* True if block {@code a} is dominated by block {@code b}.
|
||||
* True if block {@code a} is dominated by block {@code b} or {@code a} is equal to {@code b}.
|
||||
*/
|
||||
static boolean isDominatedBy(AbstractBlockBase<?> a, AbstractBlockBase<?> b) {
|
||||
int domNumberA = a.getDominatorNumber();
|
||||
|
@ -177,25 +177,6 @@ public abstract class Loop<T extends AbstractBlockBase<T>> {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if one loop is a transitive parent of another loop.
|
||||
*
|
||||
* @param childLoop The loop for which parentLoop might be a transitive parent loop.
|
||||
* @param parentLoop The loop which might be a transitive parent loop of child loop.
|
||||
* @return {@code true} if parentLoop is a (transitive) parent loop of childLoop, {@code false}
|
||||
* otherwise
|
||||
*/
|
||||
public static <T extends AbstractBlockBase<T>> boolean transitiveParentLoop(Loop<T> childLoop, Loop<T> parentLoop) {
|
||||
Loop<T> curr = childLoop;
|
||||
while (curr != null) {
|
||||
if (curr == parentLoop) {
|
||||
return true;
|
||||
}
|
||||
curr = curr.getParent();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return index + depth * 31;
|
||||
|
@ -167,8 +167,15 @@ public final class IntegerStamp extends PrimitiveStamp {
|
||||
@Override
|
||||
public Stamp constant(Constant c, MetaAccessProvider meta) {
|
||||
if (c instanceof PrimitiveConstant) {
|
||||
long value = ((PrimitiveConstant) c).asLong();
|
||||
return StampFactory.forInteger(getBits(), value, value);
|
||||
PrimitiveConstant primitiveConstant = (PrimitiveConstant) c;
|
||||
long value = primitiveConstant.asLong();
|
||||
if (primitiveConstant.getJavaKind() == JavaKind.Boolean && value == 1) {
|
||||
// Need to special case booleans as integer stamps are always signed values.
|
||||
value = -1;
|
||||
}
|
||||
Stamp returnedStamp = StampFactory.forInteger(getBits(), value, value);
|
||||
assert returnedStamp.hasValues();
|
||||
return returnedStamp;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@ -1605,7 +1612,10 @@ public final class IntegerStamp extends PrimitiveStamp {
|
||||
long newUpMask = stamp.upMask() & defaultMask;
|
||||
long newLowerBound = CodeUtil.signExtend((lowerBound | newDownMask) & newUpMask, resultBits);
|
||||
long newUpperBound = CodeUtil.signExtend((upperBound | newDownMask) & newUpMask, resultBits);
|
||||
return new IntegerStamp(resultBits, newLowerBound, newUpperBound, newDownMask, newUpMask);
|
||||
|
||||
IntegerStamp result = new IntegerStamp(resultBits, newLowerBound, newUpperBound, newDownMask, newUpMask);
|
||||
assert result.hasValues();
|
||||
return result;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -134,12 +134,14 @@ public class SPARCNodeMatchRules extends NodeMatchRules {
|
||||
|
||||
@MatchRule("(SignExtend Read=access)")
|
||||
@MatchRule("(SignExtend FloatingRead=access)")
|
||||
@MatchRule("(SignExtend VolatileRead=access)")
|
||||
public ComplexMatchResult signExtend(SignExtendNode root, Access access) {
|
||||
return emitSignExtendMemory(access, root.getInputBits(), root.getResultBits());
|
||||
}
|
||||
|
||||
@MatchRule("(ZeroExtend Read=access)")
|
||||
@MatchRule("(ZeroExtend FloatingRead=access)")
|
||||
@MatchRule("(ZeroExtend VolatileRead=access)")
|
||||
public ComplexMatchResult zeroExtend(ZeroExtendNode root, Access access) {
|
||||
return emitZeroExtendMemory(access, root.getInputBits(), root.getResultBits());
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2019, 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
|
||||
@ -313,7 +313,7 @@ public class BoxingEliminationTest extends GraalCompilerTest {
|
||||
graph = parseEager(snippet, AllowAssumptions.NO);
|
||||
HighTierContext context = getDefaultHighTierContext();
|
||||
createInliningPhase().apply(graph, context);
|
||||
new PartialEscapePhase(false, new CanonicalizerPhase(), graph.getOptions()).apply(graph, context);
|
||||
new PartialEscapePhase(false, createCanonicalizerPhase(), graph.getOptions()).apply(graph, context);
|
||||
}
|
||||
|
||||
private void compareGraphs(final String snippet, final String referenceSnippet) {
|
||||
@ -323,7 +323,7 @@ public class BoxingEliminationTest extends GraalCompilerTest {
|
||||
private void compareGraphs(final String snippet, final String referenceSnippet, final boolean loopPeeling, final boolean excludeVirtual) {
|
||||
graph = parseEager(snippet, AllowAssumptions.NO);
|
||||
HighTierContext context = getDefaultHighTierContext();
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = this.createCanonicalizerPhase();
|
||||
canonicalizer.apply(graph, context);
|
||||
createInliningPhase().apply(graph, context);
|
||||
if (loopPeeling) {
|
||||
@ -339,7 +339,7 @@ public class BoxingEliminationTest extends GraalCompilerTest {
|
||||
StructuredGraph referenceGraph = parseEager(referenceSnippet, AllowAssumptions.YES);
|
||||
createInliningPhase().apply(referenceGraph, context);
|
||||
new DeadCodeEliminationPhase().apply(referenceGraph);
|
||||
new CanonicalizerPhase().apply(referenceGraph, context);
|
||||
this.createCanonicalizerPhase().apply(referenceGraph, context);
|
||||
|
||||
assertEquals(referenceGraph, graph, excludeVirtual, true);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ import org.graalvm.compiler.phases.util.Providers;
|
||||
import org.graalvm.compiler.runtime.RuntimeProvider;
|
||||
import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
|
||||
import org.graalvm.compiler.test.AddExports;
|
||||
import org.graalvm.compiler.test.ModuleSupport;
|
||||
import org.graalvm.compiler.api.test.ModuleSupport;
|
||||
import jdk.internal.vm.compiler.word.LocationIdentity;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Assume;
|
||||
|
@ -31,14 +31,13 @@ import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.nodes.ValueNode;
|
||||
import org.graalvm.compiler.nodes.calc.ConditionalNode;
|
||||
import org.graalvm.compiler.nodes.calc.IntegerTestNode;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class CompareCanonicalizerTest extends GraalCompilerTest {
|
||||
|
||||
private StructuredGraph getCanonicalizedGraph(String name) {
|
||||
StructuredGraph graph = parseEager(name, AllowAssumptions.YES);
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
return graph;
|
||||
}
|
||||
|
||||
@ -55,7 +54,7 @@ public class CompareCanonicalizerTest extends GraalCompilerTest {
|
||||
StructuredGraph graph = parseEager("canonicalCompare" + i, AllowAssumptions.NO);
|
||||
assertEquals(referenceGraph, graph);
|
||||
}
|
||||
new CanonicalizerPhase().apply(referenceGraph, getProviders());
|
||||
createCanonicalizerPhase().apply(referenceGraph, getProviders());
|
||||
for (int i = 1; i < 4; i++) {
|
||||
StructuredGraph graph = getCanonicalizedGraph("canonicalCompare" + i);
|
||||
assertEquals(referenceGraph, graph);
|
||||
|
@ -26,7 +26,6 @@ package org.graalvm.compiler.core.test;
|
||||
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class CompareCanonicalizerTest2 extends GraalCompilerTest {
|
||||
@ -35,7 +34,7 @@ public class CompareCanonicalizerTest2 extends GraalCompilerTest {
|
||||
|
||||
private StructuredGraph getCanonicalizedGraph(String name) {
|
||||
StructuredGraph graph = getRegularGraph(name);
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
return graph;
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ public class CompareCanonicalizerTest3 extends GraalCompilerTest {
|
||||
protected void assertCanonicallyEqual(String snippet, String reference) {
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
|
||||
CoreProviders context = getProviders();
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = this.createCanonicalizerPhase();
|
||||
|
||||
canonicalizer.apply(graph, context);
|
||||
new GuardLoweringPhase().apply(graph, new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.getProfilingInfo()));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
@ -78,7 +78,7 @@ public class ConditionalEliminationMulTest extends GraalCompilerTest {
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
|
||||
HighTierContext context = getDefaultHighTierContext();
|
||||
new ConditionalEliminationPhase(false).apply(graph, context);
|
||||
CanonicalizerPhase c = new CanonicalizerPhase();
|
||||
CanonicalizerPhase c = createCanonicalizerPhase();
|
||||
c.apply(graph, context);
|
||||
new ConditionalEliminationPhase(false).apply(graph, context);
|
||||
c.apply(graph, context);
|
||||
|
@ -30,7 +30,6 @@ import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.nodes.spi.CoreProviders;
|
||||
import org.graalvm.compiler.nodes.spi.LoweringTool;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.ConditionalEliminationPhase;
|
||||
import org.graalvm.compiler.phases.common.LoweringPhase;
|
||||
import org.junit.Assert;
|
||||
@ -95,7 +94,7 @@ public class ConditionalEliminationTest10 extends ConditionalEliminationTestBase
|
||||
private void test(String snippet, int guardCount) {
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
|
||||
CoreProviders context = getProviders();
|
||||
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new LoweringPhase(createCanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new ConditionalEliminationPhase(true).apply(graph, context);
|
||||
Assert.assertEquals(guardCount, graph.getNodes().filter(GuardNode.class).count());
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class ConditionalEliminationTest14 extends ConditionalEliminationTestBase
|
||||
@Test
|
||||
public void test1() {
|
||||
StructuredGraph graph = parseEager("test1Snippet", AllowAssumptions.YES);
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
|
||||
CoreProviders context = getProviders();
|
||||
|
||||
/* Convert the LoadIndexNode to ReadNode with floating guards. */
|
||||
|
@ -47,10 +47,10 @@ public class ConditionalEliminationTest15 extends ConditionalEliminationTestBase
|
||||
private void checkNodeCount(String methodName, Class<? extends Node> nodeClass, int count) {
|
||||
StructuredGraph graph = parseEager(methodName, AllowAssumptions.YES);
|
||||
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = this.createCanonicalizerPhase();
|
||||
CoreProviders context = getProviders();
|
||||
|
||||
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new LoweringPhase(this.createCanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
canonicalizer.apply(graph, context);
|
||||
|
||||
// Merge arr.length reads.
|
||||
|
@ -31,7 +31,6 @@ import org.graalvm.compiler.core.common.type.TypeReference;
|
||||
import org.graalvm.compiler.nodes.ParameterNode;
|
||||
import org.graalvm.compiler.nodes.PiNode;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -69,7 +68,7 @@ public class ConditionalEliminationTest16 extends ConditionalEliminationTestBase
|
||||
break;
|
||||
}
|
||||
}
|
||||
new CanonicalizerPhase().apply(graph, getDefaultHighTierContext());
|
||||
this.createCanonicalizerPhase().apply(graph, getDefaultHighTierContext());
|
||||
}
|
||||
super.checkHighTierGraph(graph);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class ConditionalEliminationTest2 extends ConditionalEliminationTestBase
|
||||
@Test
|
||||
public void testRedundantCompares() {
|
||||
StructuredGraph graph = parseEager("testRedundantComparesSnippet", AllowAssumptions.YES);
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
|
||||
CoreProviders context = getProviders();
|
||||
|
||||
new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
@ -132,7 +132,7 @@ public class ConditionalEliminationTest2 extends ConditionalEliminationTestBase
|
||||
public void testInstanceOfCheckCastLowered() {
|
||||
StructuredGraph graph = parseEager("testInstanceOfCheckCastSnippet", AllowAssumptions.YES);
|
||||
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
|
||||
CoreProviders context = getProviders();
|
||||
|
||||
new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
@ -146,7 +146,7 @@ public class ConditionalEliminationTest2 extends ConditionalEliminationTestBase
|
||||
private void checkInstanceOfCount(String methodName, int count) {
|
||||
StructuredGraph graph = parseEager(methodName, AllowAssumptions.YES);
|
||||
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = this.createCanonicalizerPhase();
|
||||
CoreProviders context = getProviders();
|
||||
|
||||
canonicalizer.apply(graph, context);
|
||||
|
@ -69,8 +69,8 @@ public class ConditionalEliminationTestBase extends GraalCompilerTest {
|
||||
DebugContext debug = graph.getDebug();
|
||||
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
|
||||
CoreProviders context = getProviders();
|
||||
CanonicalizerPhase canonicalizer1 = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer1 = createCanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
|
||||
try (DebugContext.Scope scope = debug.scope("ConditionalEliminationTest", graph)) {
|
||||
prepareGraph(graph, canonicalizer1, context, applyLowering);
|
||||
new IterativeConditionalEliminationPhase(canonicalizer, true).apply(graph, context);
|
||||
@ -106,10 +106,9 @@ public class ConditionalEliminationTestBase extends GraalCompilerTest {
|
||||
public void testProxies(String snippet, int expectedProxiesCreated) {
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
|
||||
CoreProviders context = getProviders();
|
||||
CanonicalizerPhase canonicalizer1 = new CanonicalizerPhase();
|
||||
canonicalizer1.disableSimplification();
|
||||
CanonicalizerPhase canonicalizer1 = CanonicalizerPhase.createWithoutCFGSimplification();
|
||||
canonicalizer1.apply(graph, context);
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
|
||||
new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
canonicalizer.apply(graph, context);
|
||||
|
||||
|
@ -43,6 +43,7 @@ import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins;
|
||||
import org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins.Registration;
|
||||
import org.graalvm.compiler.nodes.spi.LIRLowerable;
|
||||
import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool;
|
||||
import org.graalvm.compiler.nodes.util.GraphUtil;
|
||||
import org.graalvm.compiler.phases.OptimisticOptimizations;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
import org.junit.Test;
|
||||
@ -559,7 +560,7 @@ public class CountedLoopTest extends GraalCompilerTest {
|
||||
}
|
||||
|
||||
public void rewrite(LoopsData loops) {
|
||||
InductionVariable inductionVariable = loops.getInductionVariable(iv);
|
||||
InductionVariable inductionVariable = loops.getInductionVariable(GraphUtil.unproxify(iv));
|
||||
ValueNode node = null;
|
||||
if (inductionVariable == null) {
|
||||
assert loopCanBeRemoved;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
@ -29,7 +29,6 @@ import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.nodes.calc.AndNode;
|
||||
import org.graalvm.compiler.nodes.calc.NotNode;
|
||||
import org.graalvm.compiler.nodes.calc.OrNode;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -46,7 +45,7 @@ public class DeMorganCanonicalizationTest extends GraalCompilerTest {
|
||||
@Test
|
||||
public void testAnd() {
|
||||
StructuredGraph g = parseEager("and", AllowAssumptions.NO, getInitialOptions());
|
||||
new CanonicalizerPhase().apply(g, getDefaultHighTierContext());
|
||||
createCanonicalizerPhase().apply(g, getDefaultHighTierContext());
|
||||
Assert.assertEquals(1, g.getNodes().filter(OrNode.class).count());
|
||||
Assert.assertEquals(1, g.getNodes().filter(NotNode.class).count());
|
||||
|
||||
@ -59,7 +58,7 @@ public class DeMorganCanonicalizationTest extends GraalCompilerTest {
|
||||
@Test
|
||||
public void testOr() {
|
||||
StructuredGraph g = parseEager("or", AllowAssumptions.NO, getInitialOptions());
|
||||
new CanonicalizerPhase().apply(g, getDefaultHighTierContext());
|
||||
createCanonicalizerPhase().apply(g, getDefaultHighTierContext());
|
||||
Assert.assertEquals(1, g.getNodes().filter(AndNode.class).count());
|
||||
Assert.assertEquals(1, g.getNodes().filter(NotNode.class).count());
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2019, 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
|
||||
@ -28,7 +28,6 @@ import org.graalvm.compiler.debug.DebugContext;
|
||||
import org.graalvm.compiler.debug.DebugDumpScope;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -85,7 +84,7 @@ public class DegeneratedLoopsTest extends GraalCompilerTest {
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
|
||||
HighTierContext context = getDefaultHighTierContext();
|
||||
createInliningPhase().apply(graph, context);
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
createCanonicalizerPhase().apply(graph, context);
|
||||
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
|
||||
StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, AllowAssumptions.YES);
|
||||
debug.dump(DebugContext.BASIC_LEVEL, referenceGraph, "ReferenceGraph");
|
||||
|
@ -29,7 +29,6 @@ import org.graalvm.compiler.nodes.extended.IntegerSwitchNode;
|
||||
import org.graalvm.compiler.nodes.java.LoadIndexedNode;
|
||||
import org.graalvm.compiler.options.OptionValues;
|
||||
import org.graalvm.compiler.phases.Phase;
|
||||
import org.graalvm.compiler.phases.common.RemoveValueProxyPhase;
|
||||
import org.graalvm.compiler.phases.tiers.Suites;
|
||||
import org.junit.Assume;
|
||||
import org.junit.Test;
|
||||
@ -157,7 +156,7 @@ public class EnumSwitchTest extends GraalCompilerTest {
|
||||
return "CheckGraphPhase";
|
||||
}
|
||||
});
|
||||
ret.getHighTier().findPhase(RemoveValueProxyPhase.class).add(new Phase() {
|
||||
ret.getHighTier().addBeforeLast(new Phase() {
|
||||
@Override
|
||||
protected void run(StructuredGraph graph) {
|
||||
/* Re-writing of the switch cases eliminates the array load. */
|
||||
|
@ -38,7 +38,6 @@ import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration;
|
||||
import org.graalvm.compiler.nodes.java.RegisterFinalizerNode;
|
||||
import org.graalvm.compiler.options.OptionValues;
|
||||
import org.graalvm.compiler.phases.OptimisticOptimizations;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@ -80,7 +79,7 @@ public class FinalizableSubclassTest extends GraalCompilerTest {
|
||||
new GraphBuilderPhase.Instance(getProviders(), conf, OptimisticOptimizations.ALL, null).apply(graph);
|
||||
HighTierContext context = new HighTierContext(getProviders(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL);
|
||||
createInliningPhase().apply(graph, context);
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
createCanonicalizerPhase().apply(graph, context);
|
||||
return graph;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,6 @@ import org.graalvm.compiler.nodes.extended.MonitorExit;
|
||||
import org.graalvm.compiler.nodes.memory.FloatingReadNode;
|
||||
import org.graalvm.compiler.nodes.spi.CoreProviders;
|
||||
import org.graalvm.compiler.nodes.spi.LoweringTool;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.FloatingReadPhase;
|
||||
import org.graalvm.compiler.phases.common.LoweringPhase;
|
||||
import org.junit.Assert;
|
||||
@ -68,7 +67,7 @@ public class FloatingReadTest extends GraphScheduleTest {
|
||||
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
|
||||
CoreProviders context = getProviders();
|
||||
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new LoweringPhase(createCanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new FloatingReadPhase().apply(graph);
|
||||
|
||||
ReturnNode returnNode = null;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2019, 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
|
||||
@ -126,7 +126,7 @@ import org.graalvm.compiler.printer.GraalDebugHandlersFactory;
|
||||
import org.graalvm.compiler.runtime.RuntimeProvider;
|
||||
import org.graalvm.compiler.test.AddExports;
|
||||
import org.graalvm.compiler.test.GraalTest;
|
||||
import org.graalvm.compiler.test.ModuleSupport;
|
||||
import org.graalvm.compiler.api.test.ModuleSupport;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.BeforeClass;
|
||||
@ -643,7 +643,7 @@ public abstract class GraalCompilerTest extends GraalTest {
|
||||
}
|
||||
|
||||
protected final BasePhase<HighTierContext> createInliningPhase() {
|
||||
return createInliningPhase(new CanonicalizerPhase());
|
||||
return createInliningPhase(this.createCanonicalizerPhase());
|
||||
}
|
||||
|
||||
protected BasePhase<HighTierContext> createInliningPhase(CanonicalizerPhase canonicalizer) {
|
||||
@ -1119,6 +1119,12 @@ public abstract class GraalCompilerTest extends GraalTest {
|
||||
return graph;
|
||||
}
|
||||
|
||||
protected StructuredGraph getFinalGraph(ResolvedJavaMethod method, OptionValues options) {
|
||||
StructuredGraph graph = parseForCompile(method, options);
|
||||
applyFrontEnd(graph);
|
||||
return graph;
|
||||
}
|
||||
|
||||
@SuppressWarnings("try")
|
||||
protected void applyFrontEnd(StructuredGraph graph) {
|
||||
DebugContext debug = graph.getDebug();
|
||||
@ -1515,4 +1521,8 @@ public abstract class GraalCompilerTest extends GraalTest {
|
||||
protected boolean isArchitecture(String name) {
|
||||
return name.equals(backend.getTarget().arch.getName());
|
||||
}
|
||||
|
||||
protected CanonicalizerPhase createCanonicalizerPhase() {
|
||||
return CanonicalizerPhase.create();
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ import org.graalvm.compiler.nodes.GraphEncoder;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.nodes.spi.CoreProviders;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Test;
|
||||
|
||||
import jdk.vm.ci.meta.ResolvedJavaMethod;
|
||||
@ -61,7 +60,7 @@ public class GraphEncoderTest extends GraalCompilerTest {
|
||||
StructuredGraph originalGraph = parseEager(javaMethod, AllowAssumptions.YES);
|
||||
if (canonicalize) {
|
||||
CoreProviders context = getProviders();
|
||||
new CanonicalizerPhase().apply(originalGraph, context);
|
||||
createCanonicalizerPhase().apply(originalGraph, context);
|
||||
}
|
||||
originalGraphs.add(originalGraph);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public class GuardPrioritiesTest extends GraphScheduleTest {
|
||||
private StructuredGraph prepareGraph(String method) {
|
||||
StructuredGraph graph = parseEager(method, StructuredGraph.AllowAssumptions.YES);
|
||||
HighTierContext highTierContext = getDefaultHighTierContext();
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
|
||||
new ConvertDeoptimizeToGuardPhase().apply(graph, highTierContext);
|
||||
new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, highTierContext);
|
||||
new FloatingReadPhase().apply(graph);
|
||||
|
@ -35,7 +35,6 @@ import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.nodes.spi.CoreProviders;
|
||||
import org.graalvm.compiler.nodes.spi.LoweringTool;
|
||||
import org.graalvm.compiler.phases.OptimisticOptimizations;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.FloatingReadPhase;
|
||||
import org.graalvm.compiler.phases.common.GuardLoweringPhase;
|
||||
import org.graalvm.compiler.phases.common.LoweringPhase;
|
||||
@ -227,12 +226,12 @@ public class IfCanonicalizerTest extends GraalCompilerTest {
|
||||
private void testCombinedIf(String snippet, int count) {
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
|
||||
CoreProviders context = getProviders();
|
||||
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new LoweringPhase(createCanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new FloatingReadPhase().apply(graph);
|
||||
MidTierContext midContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.getProfilingInfo());
|
||||
new GuardLoweringPhase().apply(graph, midContext);
|
||||
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.MID_TIER).apply(graph, midContext);
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
new LoweringPhase(createCanonicalizerPhase(), LoweringTool.StandardLoweringStage.MID_TIER).apply(graph, midContext);
|
||||
createCanonicalizerPhase().apply(graph, context);
|
||||
assertDeepEquals(count, graph.getNodes().filter(IfNode.class).count());
|
||||
}
|
||||
|
||||
@ -247,7 +246,7 @@ public class IfCanonicalizerTest extends GraalCompilerTest {
|
||||
}
|
||||
}
|
||||
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
for (FrameState fs : param.usages().filter(FrameState.class).snapshot()) {
|
||||
fs.replaceFirstInput(param, null);
|
||||
param.safeDelete();
|
||||
|
@ -34,7 +34,6 @@ import org.graalvm.compiler.nodes.memory.ReadNode;
|
||||
import org.graalvm.compiler.nodes.spi.CoreProviders;
|
||||
import org.graalvm.compiler.nodes.spi.LoweringTool;
|
||||
import org.graalvm.compiler.phases.OptimisticOptimizations;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.FloatingReadPhase;
|
||||
import org.graalvm.compiler.phases.common.GuardLoweringPhase;
|
||||
import org.graalvm.compiler.phases.common.LoweringPhase;
|
||||
@ -72,7 +71,7 @@ public class ImplicitNullCheckTest extends GraphScheduleTest {
|
||||
try (DebugContext.Scope s = debug.scope("FloatingReadTest", new DebugDumpScope(snippet))) {
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES, debug);
|
||||
CoreProviders context = getProviders();
|
||||
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new LoweringPhase(createCanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new FloatingReadPhase().apply(graph);
|
||||
MidTierContext midTierContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.getProfilingInfo());
|
||||
new GuardLoweringPhase().apply(graph, midTierContext);
|
||||
|
@ -27,7 +27,6 @@ package org.graalvm.compiler.core.test;
|
||||
import org.graalvm.compiler.nodes.FrameState;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class IntegerEqualsCanonicalizerTest extends GraalCompilerTest {
|
||||
@ -166,7 +165,7 @@ public class IntegerEqualsCanonicalizerTest extends GraalCompilerTest {
|
||||
|
||||
private StructuredGraph getCanonicalizedGraph(String snippet) {
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
for (FrameState state : graph.getNodes(FrameState.TYPE).snapshot()) {
|
||||
state.replaceAtUsages(null);
|
||||
state.safeDelete();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2019, 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
|
||||
@ -30,7 +30,7 @@ import java.lang.invoke.MethodType;
|
||||
|
||||
import org.graalvm.compiler.code.CompilationResult;
|
||||
import org.graalvm.compiler.debug.DebugContext;
|
||||
import org.graalvm.compiler.test.ExportingClassLoader;
|
||||
import org.graalvm.compiler.api.test.ExportingClassLoader;
|
||||
import org.junit.Test;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Label;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2019, 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
|
||||
@ -30,7 +30,6 @@ import java.util.Map;
|
||||
import org.graalvm.compiler.nodes.Invoke;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
import org.junit.Test;
|
||||
@ -69,8 +68,8 @@ public class InvokeExceptionTest extends GraalCompilerTest {
|
||||
hints.put(invoke, 1000d);
|
||||
}
|
||||
HighTierContext context = getDefaultHighTierContext();
|
||||
createInliningPhase(hints, new CanonicalizerPhase()).apply(graph, context);
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
createInliningPhase(hints, createCanonicalizerPhase()).apply(graph, context);
|
||||
createCanonicalizerPhase().apply(graph, context);
|
||||
new DeadCodeEliminationPhase().apply(graph);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2019, 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
|
||||
@ -30,7 +30,6 @@ import java.util.Map;
|
||||
import org.graalvm.compiler.nodes.Invoke;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
import org.junit.Test;
|
||||
@ -80,8 +79,8 @@ public class InvokeHintsTest extends GraalCompilerTest {
|
||||
}
|
||||
|
||||
HighTierContext context = getDefaultHighTierContext();
|
||||
createInliningPhase(hints, new CanonicalizerPhase()).apply(graph, context);
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
createInliningPhase(hints, createCanonicalizerPhase()).apply(graph, context);
|
||||
createCanonicalizerPhase().apply(graph, context);
|
||||
new DeadCodeEliminationPhase().apply(graph);
|
||||
StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, AllowAssumptions.NO);
|
||||
assertEquals(referenceGraph, graph);
|
||||
|
@ -0,0 +1,233 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, Red Hat Inc. 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 org.graalvm.compiler.core.test;
|
||||
|
||||
import jdk.vm.ci.meta.ConstantReflectionProvider;
|
||||
import jdk.vm.ci.meta.MetaAccessProvider;
|
||||
import jdk.vm.ci.meta.ResolvedJavaType;
|
||||
import jdk.internal.vm.compiler.collections.EconomicMap;
|
||||
import org.graalvm.compiler.core.common.type.Stamp;
|
||||
import org.graalvm.compiler.nodes.ConstantNode;
|
||||
import org.graalvm.compiler.nodes.NodeView;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.ValueNode;
|
||||
import org.graalvm.compiler.nodes.cfg.Block;
|
||||
import org.graalvm.compiler.nodes.cfg.ControlFlowGraph;
|
||||
import org.graalvm.compiler.nodes.memory.FixedAccessNode;
|
||||
import org.graalvm.compiler.nodes.memory.MemoryAccess;
|
||||
import org.graalvm.compiler.nodes.memory.ReadNode;
|
||||
import org.graalvm.compiler.nodes.memory.address.AddressNode;
|
||||
import org.graalvm.compiler.options.OptionKey;
|
||||
import org.graalvm.compiler.options.OptionValues;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.graalvm.compiler.core.common.GraalOptions.StressTestEarlyReads;
|
||||
|
||||
public class LateMembarInsertionTest extends GraalCompilerTest {
|
||||
|
||||
private final ResolvedJavaType volatileAccessType = getMetaAccess().lookupJavaType(VolatileAccess.class);
|
||||
private final ResolvedJavaType regularAccessField = getMetaAccess().lookupJavaType(RegularAccess.class);
|
||||
private final ResolvedJavaType volatileAccess2Type = getMetaAccess().lookupJavaType(VolatileAccess2.class);
|
||||
|
||||
static class VolatileAccess {
|
||||
static volatile int field;
|
||||
}
|
||||
|
||||
static class VolatileAccess2 {
|
||||
static volatile int field;
|
||||
}
|
||||
|
||||
static class RegularAccess {
|
||||
static int field;
|
||||
}
|
||||
|
||||
public static int volatileFieldLoadFieldLoad() {
|
||||
int v1 = VolatileAccess.field;
|
||||
int v2 = RegularAccess.field;
|
||||
return v1 + v2;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test01() {
|
||||
List<TypePair> accesses = compile("volatileFieldLoadFieldLoad", stressTestEarlyReads());
|
||||
|
||||
Assert.assertEquals(accesses.size(), 2);
|
||||
Assert.assertEquals(accesses.get(0).getType(), volatileAccessType);
|
||||
Assert.assertEquals(accesses.get(1).getType(), regularAccessField);
|
||||
Assert.assertTrue(accesses.get(0).isRead());
|
||||
Assert.assertTrue(accesses.get(1).isRead());
|
||||
}
|
||||
|
||||
public static int volatileFieldLoadVolatileFieldLoad() {
|
||||
int v1 = VolatileAccess.field;
|
||||
int v2 = VolatileAccess2.field;
|
||||
return v1 + v2;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test02() {
|
||||
List<TypePair> accesses = compile("volatileFieldLoadVolatileFieldLoad", stressTestEarlyReads());
|
||||
|
||||
Assert.assertEquals(accesses.size(), 2);
|
||||
Assert.assertEquals(accesses.get(0).getType(), volatileAccessType);
|
||||
Assert.assertEquals(accesses.get(1).getType(), volatileAccess2Type);
|
||||
Assert.assertTrue(accesses.get(0).isRead());
|
||||
Assert.assertTrue(accesses.get(1).isRead());
|
||||
}
|
||||
|
||||
public static int volatileFieldLoadVolatileFieldStore(int v2) {
|
||||
int v1 = VolatileAccess.field;
|
||||
VolatileAccess2.field = v2;
|
||||
return v1;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test03() {
|
||||
List<TypePair> accesses = compile("volatileFieldLoadVolatileFieldStore");
|
||||
|
||||
Assert.assertEquals(accesses.size(), 2);
|
||||
Assert.assertEquals(accesses.get(0).getType(), volatileAccessType);
|
||||
Assert.assertEquals(accesses.get(1).getType(), volatileAccess2Type);
|
||||
Assert.assertTrue(accesses.get(0).isRead());
|
||||
Assert.assertTrue(accesses.get(1).isWrite());
|
||||
}
|
||||
|
||||
public static int volatileFieldStoreVolatileFieldLoad(int v2) {
|
||||
VolatileAccess.field = v2;
|
||||
return VolatileAccess2.field;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test04() {
|
||||
List<TypePair> accesses = compile("volatileFieldStoreVolatileFieldLoad", stressTestEarlyReads());
|
||||
|
||||
Assert.assertEquals(accesses.size(), 2);
|
||||
Assert.assertEquals(accesses.get(0).getType(), volatileAccessType);
|
||||
Assert.assertEquals(accesses.get(1).getType(), volatileAccess2Type);
|
||||
Assert.assertTrue(accesses.get(0).isWrite());
|
||||
Assert.assertTrue(accesses.get(1).isRead());
|
||||
}
|
||||
|
||||
public static int fieldLoadVolatileFieldStore(int v2) {
|
||||
int v1 = RegularAccess.field;
|
||||
VolatileAccess2.field = v2;
|
||||
return v1;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test05() {
|
||||
List<TypePair> accesses = compile("fieldLoadVolatileFieldStore");
|
||||
|
||||
Assert.assertEquals(accesses.size(), 2);
|
||||
Assert.assertEquals(accesses.get(0).getType(), regularAccessField);
|
||||
Assert.assertEquals(accesses.get(1).getType(), volatileAccess2Type);
|
||||
Assert.assertTrue(accesses.get(0).isRead());
|
||||
Assert.assertTrue(accesses.get(1).isWrite());
|
||||
}
|
||||
|
||||
public static void volatileFieldStoreVolatileFieldStore(int v1, int v2) {
|
||||
VolatileAccess.field = v1;
|
||||
VolatileAccess2.field = v2;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test06() {
|
||||
List<TypePair> accesses = compile("volatileFieldStoreVolatileFieldStore");
|
||||
|
||||
Assert.assertEquals(accesses.size(), 2);
|
||||
Assert.assertEquals(accesses.get(0).getType(), volatileAccessType);
|
||||
Assert.assertEquals(accesses.get(1).getType(), volatileAccess2Type);
|
||||
Assert.assertTrue(accesses.get(0).isWrite());
|
||||
Assert.assertTrue(accesses.get(1).isWrite());
|
||||
}
|
||||
|
||||
private static OptionValues stressTestEarlyReads() {
|
||||
EconomicMap<OptionKey<?>, Object> overrides = OptionValues.newOptionMap();
|
||||
overrides.put(StressTestEarlyReads, true);
|
||||
return new OptionValues(getInitialOptions(), overrides);
|
||||
}
|
||||
|
||||
static class TypePair {
|
||||
private boolean isRead;
|
||||
private ResolvedJavaType type;
|
||||
|
||||
TypePair(boolean isRead, ResolvedJavaType type) {
|
||||
this.isRead = isRead;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public boolean isRead() {
|
||||
return isRead;
|
||||
}
|
||||
|
||||
public boolean isWrite() {
|
||||
return !isRead;
|
||||
}
|
||||
|
||||
public ResolvedJavaType getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
private List<TypePair> compile(String test, OptionValues options) {
|
||||
StructuredGraph graph = getFinalGraph(getResolvedJavaMethod(test), options);
|
||||
return getAccesses(graph);
|
||||
}
|
||||
|
||||
private List<TypePair> getAccesses(StructuredGraph graph) {
|
||||
StructuredGraph.ScheduleResult schedule = graph.getLastSchedule();
|
||||
ControlFlowGraph cfg = schedule.getCFG();
|
||||
Block[] blocks = cfg.getBlocks();
|
||||
|
||||
return Arrays.stream(blocks).flatMap(b -> schedule.nodesFor(b).stream()).filter(n -> n instanceof MemoryAccess).map(
|
||||
n -> new TypePair(n instanceof ReadNode, classForAccess((FixedAccessNode) n))).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<TypePair> compile(String test) {
|
||||
StructuredGraph graph = getFinalGraph(getResolvedJavaMethod(test));
|
||||
return getAccesses(graph);
|
||||
}
|
||||
|
||||
private ResolvedJavaType classForAccess(FixedAccessNode n) {
|
||||
AddressNode address = n.getAddress();
|
||||
ValueNode base = address.getBase();
|
||||
Stamp stamp = base.stamp(NodeView.DEFAULT);
|
||||
MetaAccessProvider metaAccess = getMetaAccess();
|
||||
ResolvedJavaType javaType = stamp.javaType(metaAccess);
|
||||
if (javaType == metaAccess.lookupJavaType(Class.class) && base instanceof ConstantNode) {
|
||||
ConstantReflectionProvider constantReflection = getConstantReflection();
|
||||
javaType = constantReflection.asJavaType(base.asConstant());
|
||||
}
|
||||
return javaType;
|
||||
}
|
||||
|
||||
}
|
@ -69,7 +69,7 @@ public class LockEliminationTest extends GraalCompilerTest {
|
||||
test("testSynchronizedSnippet", new A(), new A());
|
||||
|
||||
StructuredGraph graph = getGraph("testSynchronizedSnippet", false);
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
new LockEliminationPhase().apply(graph);
|
||||
assertDeepEquals(1, graph.getNodes().filter(RawMonitorEnterNode.class).count());
|
||||
assertDeepEquals(1, graph.getNodes().filter(MonitorExitNode.class).count());
|
||||
@ -87,7 +87,7 @@ public class LockEliminationTest extends GraalCompilerTest {
|
||||
test("testSynchronizedMethodSnippet", new A());
|
||||
|
||||
StructuredGraph graph = getGraph("testSynchronizedMethodSnippet", false);
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
new LockEliminationPhase().apply(graph);
|
||||
assertDeepEquals(1, graph.getNodes().filter(RawMonitorEnterNode.class).count());
|
||||
assertDeepEquals(1, graph.getNodes().filter(MonitorExitNode.class).count());
|
||||
@ -104,7 +104,7 @@ public class LockEliminationTest extends GraalCompilerTest {
|
||||
@Test
|
||||
public void testUnrolledSync() {
|
||||
StructuredGraph graph = getGraph("testUnrolledSyncSnippet", false);
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
|
||||
canonicalizer.apply(graph, getProviders());
|
||||
HighTierContext context = getDefaultHighTierContext();
|
||||
new LoopFullUnrollPhase(canonicalizer, new DefaultLoopPolicies()).apply(graph, context);
|
||||
@ -117,15 +117,15 @@ public class LockEliminationTest extends GraalCompilerTest {
|
||||
ResolvedJavaMethod method = getResolvedJavaMethod(snippet);
|
||||
StructuredGraph graph = parseEager(method, AllowAssumptions.YES);
|
||||
HighTierContext context = getDefaultHighTierContext();
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
|
||||
canonicalizer.apply(graph, context);
|
||||
createInliningPhase().apply(graph, context);
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
createCanonicalizerPhase().apply(graph, context);
|
||||
new DeadCodeEliminationPhase().apply(graph);
|
||||
if (doEscapeAnalysis) {
|
||||
new PartialEscapePhase(true, canonicalizer, graph.getOptions()).apply(graph, context);
|
||||
}
|
||||
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new LoweringPhase(createCanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
return graph;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2019, 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
|
||||
@ -37,7 +37,6 @@ import org.graalvm.compiler.nodes.ValueNode;
|
||||
import org.graalvm.compiler.nodes.calc.AddNode;
|
||||
import org.graalvm.compiler.nodes.extended.OpaqueNode;
|
||||
import org.graalvm.compiler.options.OptionValues;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.schedule.SchedulePhase;
|
||||
import org.graalvm.compiler.phases.schedule.SchedulePhase.SchedulingStrategy;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
@ -85,7 +84,7 @@ public class LongNodeChainTest extends GraalCompilerTest {
|
||||
new SchedulePhase(s).apply(graph);
|
||||
}
|
||||
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
this.createCanonicalizerPhase().apply(graph, context);
|
||||
JavaConstant asConstant = (JavaConstant) returnNode.result().asConstant();
|
||||
Assert.assertEquals(N + 1, asConstant.asInt());
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ import org.graalvm.compiler.nodes.LoopBeginNode;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.nodes.spi.CoreProviders;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class LoopFullUnrollTest extends GraalCompilerTest {
|
||||
@ -89,7 +88,7 @@ public class LoopFullUnrollTest extends GraalCompilerTest {
|
||||
final StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO, debug);
|
||||
|
||||
CoreProviders context = getProviders();
|
||||
new LoopFullUnrollPhase(new CanonicalizerPhase(), new DefaultLoopPolicies()).apply(graph, context);
|
||||
new LoopFullUnrollPhase(createCanonicalizerPhase(), new DefaultLoopPolicies()).apply(graph, context);
|
||||
|
||||
assertTrue(graph.getNodes().filter(LoopBeginNode.class).count() == loopCount);
|
||||
} catch (Throwable e) {
|
||||
|
@ -30,7 +30,6 @@ import org.graalvm.compiler.loop.DefaultLoopPolicies;
|
||||
import org.graalvm.compiler.loop.phases.LoopUnswitchingPhase;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class LoopUnswitchTest extends GraalCompilerTest {
|
||||
@ -133,8 +132,8 @@ public class LoopUnswitchTest extends GraalCompilerTest {
|
||||
graph.clearAllStateAfter();
|
||||
referenceGraph.clearAllStateAfter();
|
||||
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
new CanonicalizerPhase().apply(referenceGraph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(referenceGraph, getProviders());
|
||||
try (DebugContext.Scope s = debug.scope("Test", new DebugDumpScope("Test:" + snippet))) {
|
||||
assertEquals(referenceGraph, graph);
|
||||
} catch (Throwable e) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2019, 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
|
||||
@ -37,7 +37,6 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.inlining.InliningPhase;
|
||||
import org.graalvm.compiler.phases.common.inlining.policy.InlineEverythingPolicy;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
@ -125,8 +124,8 @@ public class MarkUnsafeAccessTest extends GraalCompilerTest {
|
||||
Assert.assertNotNull(getMethodImpl);
|
||||
StructuredGraph graph = parseForCompile(getMethodImpl);
|
||||
HighTierContext highContext = getDefaultHighTierContext();
|
||||
new CanonicalizerPhase().apply(graph, highContext);
|
||||
new InliningPhase(new InlineEverythingPolicy(), new CanonicalizerPhase()).apply(graph, highContext);
|
||||
createCanonicalizerPhase().apply(graph, highContext);
|
||||
new InliningPhase(new InlineEverythingPolicy(), createCanonicalizerPhase()).apply(graph, highContext);
|
||||
InstalledCode compiledCode = getCode(getMethodImpl, graph);
|
||||
testMappedByteBuffer(mbb -> {
|
||||
try {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
@ -28,7 +28,6 @@ package org.graalvm.compiler.core.test;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.memory.WriteNode;
|
||||
import org.graalvm.compiler.nodes.spi.LoweringTool;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.FloatingReadPhase;
|
||||
import org.graalvm.compiler.phases.common.IncrementalCanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.LoweringPhase;
|
||||
@ -76,10 +75,9 @@ public class MemoryGraphCanonicalizeTest extends GraalCompilerTest {
|
||||
public void testGraph(String name, int expectedWrites) {
|
||||
StructuredGraph graph = parseEager(name, StructuredGraph.AllowAssumptions.YES);
|
||||
HighTierContext context = getDefaultHighTierContext();
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new IncrementalCanonicalizerPhase<>(canonicalizer, new FloatingReadPhase()).apply(graph, context);
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
new LoweringPhase(createCanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new IncrementalCanonicalizerPhase<>(createCanonicalizerPhase(), new FloatingReadPhase()).apply(graph, context);
|
||||
createCanonicalizerPhase().apply(graph, context);
|
||||
int writes = graph.getNodes().filter(WriteNode.class).count();
|
||||
assertTrue(writes == expectedWrites, "Expected %d writes, found %d", expectedWrites, writes);
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ import org.graalvm.compiler.debug.DebugContext;
|
||||
import org.graalvm.compiler.graph.Node;
|
||||
import org.graalvm.compiler.graph.iterators.NodeIterable;
|
||||
import org.graalvm.compiler.nodes.ReturnNode;
|
||||
import org.graalvm.compiler.nodes.StartNode;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult;
|
||||
@ -177,7 +176,6 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
@Test
|
||||
public void testLoop1() {
|
||||
ScheduleResult schedule = getFinalSchedule("testLoop1Snippet", TestMode.WITHOUT_FRAMESTATES);
|
||||
assertDeepEquals(6, schedule.getCFG().getBlocks().length);
|
||||
assertReadWithinStartBlock(schedule, true);
|
||||
assertReadWithinAllReturnBlocks(schedule, false);
|
||||
}
|
||||
@ -202,7 +200,6 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
@Test
|
||||
public void testLoop2() {
|
||||
ScheduleResult schedule = getFinalSchedule("testLoop2Snippet", TestMode.WITHOUT_FRAMESTATES);
|
||||
assertDeepEquals(6, schedule.getCFG().getBlocks().length);
|
||||
assertReadWithinStartBlock(schedule, false);
|
||||
assertReadWithinAllReturnBlocks(schedule, true);
|
||||
}
|
||||
@ -224,7 +221,6 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
@Test
|
||||
public void testLoop3() {
|
||||
ScheduleResult schedule = getFinalSchedule("testLoop3Snippet", TestMode.WITHOUT_FRAMESTATES);
|
||||
assertDeepEquals(6, schedule.getCFG().getBlocks().length);
|
||||
assertReadWithinStartBlock(schedule, true);
|
||||
assertReadWithinAllReturnBlocks(schedule, false);
|
||||
}
|
||||
@ -260,7 +256,6 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
@Test
|
||||
public void testLoop5() {
|
||||
ScheduleResult schedule = getFinalSchedule("testLoop5Snippet", TestMode.WITHOUT_FRAMESTATES);
|
||||
assertDeepEquals(10, schedule.getCFG().getBlocks().length);
|
||||
assertReadWithinStartBlock(schedule, false);
|
||||
assertReadWithinAllReturnBlocks(schedule, false);
|
||||
}
|
||||
@ -289,7 +284,6 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
@Test
|
||||
public void testLoop6() {
|
||||
ScheduleResult schedule = getFinalSchedule("testLoop6Snippet", TestMode.WITHOUT_FRAMESTATES);
|
||||
assertDeepEquals(13, schedule.getCFG().getBlocks().length);
|
||||
assertReadWithinStartBlock(schedule, false);
|
||||
assertReadWithinAllReturnBlocks(schedule, false);
|
||||
}
|
||||
@ -322,7 +316,6 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
@Test
|
||||
public void testLoop7() {
|
||||
ScheduleResult schedule = getFinalSchedule("testLoop7Snippet", TestMode.WITHOUT_FRAMESTATES);
|
||||
assertDeepEquals(18, schedule.getCFG().getBlocks().length);
|
||||
assertReadWithinStartBlock(schedule, false);
|
||||
assertReadWithinAllReturnBlocks(schedule, false);
|
||||
}
|
||||
@ -349,7 +342,6 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
@Test
|
||||
public void testLoop8() {
|
||||
ScheduleResult schedule = getFinalSchedule("testLoop8Snippet", TestMode.WITHOUT_FRAMESTATES);
|
||||
assertDeepEquals(10, schedule.getCFG().getBlocks().length);
|
||||
assertReadWithinStartBlock(schedule, true);
|
||||
assertReadWithinAllReturnBlocks(schedule, false);
|
||||
}
|
||||
@ -391,7 +383,6 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
@Test
|
||||
public void testIfRead1() {
|
||||
ScheduleResult schedule = getFinalSchedule("testIfRead1Snippet", TestMode.WITHOUT_FRAMESTATES);
|
||||
assertDeepEquals(3, schedule.getCFG().getBlocks().length);
|
||||
assertReadWithinStartBlock(schedule, true);
|
||||
assertReadAndWriteInSameBlock(schedule, false);
|
||||
}
|
||||
@ -412,7 +403,6 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
@Test
|
||||
public void testIfRead2() {
|
||||
ScheduleResult schedule = getFinalSchedule("testIfRead2Snippet", TestMode.WITHOUT_FRAMESTATES);
|
||||
assertDeepEquals(3, schedule.getCFG().getBlocks().length);
|
||||
assertDeepEquals(1, schedule.getCFG().graph.getNodes().filter(FloatingReadNode.class).count());
|
||||
assertReadWithinStartBlock(schedule, false);
|
||||
assertReadWithinAllReturnBlocks(schedule, false);
|
||||
@ -434,7 +424,6 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
@Test
|
||||
public void testIfRead3() {
|
||||
ScheduleResult schedule = getFinalSchedule("testIfRead3Snippet", TestMode.WITHOUT_FRAMESTATES);
|
||||
assertDeepEquals(4, schedule.getCFG().getBlocks().length);
|
||||
assertReadWithinStartBlock(schedule, false);
|
||||
assertReadWithinAllReturnBlocks(schedule, true);
|
||||
}
|
||||
@ -455,7 +444,6 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
@Test
|
||||
public void testIfRead4() {
|
||||
ScheduleResult schedule = getFinalSchedule("testIfRead4Snippet", TestMode.WITHOUT_FRAMESTATES);
|
||||
assertDeepEquals(3, schedule.getCFG().getBlocks().length);
|
||||
assertReadWithinStartBlock(schedule, false);
|
||||
assertReadWithinAllReturnBlocks(schedule, false);
|
||||
assertReadAndWriteInSameBlock(schedule, true);
|
||||
@ -474,7 +462,6 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
@Test
|
||||
public void testIfRead5() {
|
||||
ScheduleResult schedule = getFinalSchedule("testIfRead5Snippet", TestMode.WITHOUT_FRAMESTATES);
|
||||
assertDeepEquals(4, schedule.getCFG().getBlocks().length);
|
||||
assertReadWithinStartBlock(schedule, false);
|
||||
assertReadWithinAllReturnBlocks(schedule, true);
|
||||
assertReadAndWriteInSameBlock(schedule, false);
|
||||
@ -500,7 +487,6 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
@Test
|
||||
public void testAntiDependency() {
|
||||
ScheduleResult schedule = getFinalSchedule("testAntiDependencySnippet", TestMode.WITHOUT_FRAMESTATES);
|
||||
assertDeepEquals(4, schedule.getCFG().getBlocks().length);
|
||||
assertReadBeforeAllWritesInStartBlock(schedule);
|
||||
}
|
||||
|
||||
@ -527,7 +513,6 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
StructuredGraph graph = schedule.getCFG().graph;
|
||||
NodeIterable<WriteNode> writeNodes = graph.getNodes().filter(WriteNode.class);
|
||||
|
||||
assertDeepEquals(1, schedule.getCFG().getBlocks().length);
|
||||
assertDeepEquals(8, writeNodes.count());
|
||||
assertDeepEquals(1, graph.getNodes().filter(FloatingReadNode.class).count());
|
||||
|
||||
@ -708,7 +693,7 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
DebugContext debug = graph.getDebug();
|
||||
try (DebugContext.Scope d = debug.scope("FloatingReadTest", graph)) {
|
||||
HighTierContext context = getDefaultHighTierContext();
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
|
||||
canonicalizer.apply(graph, context);
|
||||
if (mode == TestMode.INLINED_WITHOUT_FRAMESTATES) {
|
||||
createInliningPhase(canonicalizer).apply(graph, context);
|
||||
@ -729,7 +714,6 @@ public class MemoryScheduleTest extends GraphScheduleTest {
|
||||
|
||||
SchedulePhase schedule = new SchedulePhase(schedulingStrategy);
|
||||
schedule.apply(graph);
|
||||
assertDeepEquals(1, graph.getNodes().filter(StartNode.class).count());
|
||||
return graph.getLastSchedule();
|
||||
} catch (Throwable e) {
|
||||
throw debug.handle(e);
|
||||
|
@ -30,7 +30,6 @@ import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.phases.OptimisticOptimizations;
|
||||
import org.graalvm.compiler.phases.OptimisticOptimizations.Optimization;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -70,8 +69,8 @@ public class MergeCanonicalizerTest extends GraalCompilerTest {
|
||||
|
||||
private void testReturnCount(String snippet, int returnCount) {
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
graph.getDebug().dump(DebugContext.BASIC_LEVEL, graph, "Graph");
|
||||
assertDeepEquals(returnCount, graph.getNodes(ReturnNode.TYPE).count());
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2019, 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
|
||||
@ -36,7 +36,6 @@ import org.graalvm.compiler.nodes.ParameterNode;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.nodes.java.MonitorExitNode;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
import org.junit.Assert;
|
||||
@ -103,8 +102,8 @@ public class MonitorGraphTest extends GraalCompilerTest {
|
||||
hints.put(invoke, 1000d);
|
||||
}
|
||||
HighTierContext context = getDefaultHighTierContext();
|
||||
createInliningPhase(hints, new CanonicalizerPhase()).apply(graph, context);
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
createInliningPhase(hints, createCanonicalizerPhase()).apply(graph, context);
|
||||
createCanonicalizerPhase().apply(graph, context);
|
||||
new DeadCodeEliminationPhase().apply(graph);
|
||||
return graph;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ import org.graalvm.compiler.nodes.ValueNode;
|
||||
import org.graalvm.compiler.nodes.spi.CoreProviders;
|
||||
import org.graalvm.compiler.phases.BasePhase;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase.CustomCanonicalizer;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase.CustomSimplification;
|
||||
import org.graalvm.compiler.phases.contract.NodeCostUtil;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
import org.junit.Assert;
|
||||
@ -162,19 +162,21 @@ public class NodePropertiesTest extends GraalCompilerTest {
|
||||
@Test
|
||||
public void testCanonicalizationExample() {
|
||||
HighTierContext htc = getDefaultHighTierContext();
|
||||
ImprovementSavingCanonicalizer c1 = new ImprovementSavingCanonicalizer();
|
||||
ImprovementSavingCalculator c1 = new ImprovementSavingCalculator();
|
||||
StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("test1Snippet"));
|
||||
new CanonicalizerPhase(c1).apply(g1, htc);
|
||||
ImprovementSavingCanonicalizer c2 = new ImprovementSavingCanonicalizer();
|
||||
CanonicalizerPhase canonicalizer1 = this.createCanonicalizerPhase().copyWithCustomSimplification(c1);
|
||||
canonicalizer1.apply(g1, htc);
|
||||
ImprovementSavingCalculator c2 = new ImprovementSavingCalculator();
|
||||
StructuredGraph g2 = parseForCompile(getResolvedJavaMethod("test2Snippet"));
|
||||
new CanonicalizerPhase(c2).apply(g2, htc);
|
||||
CanonicalizerPhase canonicalizer2 = this.createCanonicalizerPhase().copyWithCustomSimplification(c2);
|
||||
canonicalizer2.apply(g2, htc);
|
||||
Assert.assertEquals(0, c1.savedCycles);
|
||||
Assert.assertEquals(0, c2.savedCycles);
|
||||
}
|
||||
|
||||
private static void prepareGraphForLoopFrequencies(StructuredGraph g, HighTierContext htc) {
|
||||
private void prepareGraphForLoopFrequencies(StructuredGraph g, HighTierContext htc) {
|
||||
// let canonicalizer work away branch probability nodes
|
||||
new CanonicalizerPhase().apply(g, htc);
|
||||
createCanonicalizerPhase().apply(g, htc);
|
||||
// recompute the loop frequencies
|
||||
ComputeLoopFrequenciesClosure.compute(g);
|
||||
}
|
||||
@ -242,8 +244,8 @@ public class NodePropertiesTest extends GraalCompilerTest {
|
||||
StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("test1Snippet"));
|
||||
StructuredGraph g2 = parseForCompile(getResolvedJavaMethod("test2Snippet"));
|
||||
HighTierContext htc = getDefaultHighTierContext();
|
||||
new CanonicalizerPhase().apply(g1, htc);
|
||||
new CanonicalizerPhase().apply(g2, htc);
|
||||
createCanonicalizerPhase().apply(g1, htc);
|
||||
createCanonicalizerPhase().apply(g2, htc);
|
||||
GraphCostPhase gc1 = new GraphCostPhase();
|
||||
GraphCostPhase gc2 = new GraphCostPhase();
|
||||
gc1.apply(g1, htc);
|
||||
@ -257,7 +259,7 @@ public class NodePropertiesTest extends GraalCompilerTest {
|
||||
public void testExpectUntrusted() {
|
||||
StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("untrused01"));
|
||||
HighTierContext htc = getDefaultHighTierContext();
|
||||
new CanonicalizerPhase().apply(g1, htc);
|
||||
createCanonicalizerPhase().apply(g1, htc);
|
||||
GraphCostPhase gc1 = new GraphCostPhase();
|
||||
gc1.apply(g1, htc);
|
||||
}
|
||||
@ -266,7 +268,7 @@ public class NodePropertiesTest extends GraalCompilerTest {
|
||||
public void testArrayLoad() {
|
||||
StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("arrayLoadTest"));
|
||||
HighTierContext htc = getDefaultHighTierContext();
|
||||
new CanonicalizerPhase().apply(g1, htc);
|
||||
createCanonicalizerPhase().apply(g1, htc);
|
||||
GraphCostPhase gc1 = new GraphCostPhase();
|
||||
gc1.apply(g1, htc);
|
||||
Assert.assertEquals(15, gc1.finalCycles, 25);
|
||||
@ -276,7 +278,7 @@ public class NodePropertiesTest extends GraalCompilerTest {
|
||||
public void testArrayStore() {
|
||||
StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("arrayStoreTest"));
|
||||
HighTierContext htc = getDefaultHighTierContext();
|
||||
new CanonicalizerPhase().apply(g1, htc);
|
||||
createCanonicalizerPhase().apply(g1, htc);
|
||||
GraphCostPhase gc1 = new GraphCostPhase();
|
||||
gc1.apply(g1, htc);
|
||||
Assert.assertEquals(15, gc1.finalCycles, 25);
|
||||
@ -286,7 +288,7 @@ public class NodePropertiesTest extends GraalCompilerTest {
|
||||
public void testFieldLoad() {
|
||||
StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("fieldLoad"));
|
||||
HighTierContext htc = getDefaultHighTierContext();
|
||||
new CanonicalizerPhase().apply(g1, htc);
|
||||
createCanonicalizerPhase().apply(g1, htc);
|
||||
GraphCostPhase gc1 = new GraphCostPhase();
|
||||
gc1.apply(g1, htc);
|
||||
Assert.assertEquals(15, gc1.finalCycles, 25);
|
||||
@ -296,13 +298,13 @@ public class NodePropertiesTest extends GraalCompilerTest {
|
||||
public void testFieldStore() {
|
||||
StructuredGraph g1 = parseForCompile(getResolvedJavaMethod("fieldStore"));
|
||||
HighTierContext htc = getDefaultHighTierContext();
|
||||
new CanonicalizerPhase().apply(g1, htc);
|
||||
createCanonicalizerPhase().apply(g1, htc);
|
||||
GraphCostPhase gc1 = new GraphCostPhase();
|
||||
gc1.apply(g1, htc);
|
||||
Assert.assertEquals(15, gc1.finalCycles, 25);
|
||||
}
|
||||
|
||||
static class ImprovementSavingCanonicalizer extends CustomCanonicalizer {
|
||||
static class ImprovementSavingCalculator implements CustomSimplification {
|
||||
private int savedCycles;
|
||||
|
||||
@Override
|
||||
|
@ -104,7 +104,7 @@ public class PushNodesThroughPiTest extends GraalCompilerTest {
|
||||
private StructuredGraph compileTestSnippet(final String snippet) {
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
|
||||
CoreProviders context = getProviders();
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = this.createCanonicalizerPhase();
|
||||
new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
canonicalizer.apply(graph, context);
|
||||
canonicalizer.apply(graph, context);
|
||||
|
@ -29,7 +29,6 @@ import org.graalvm.compiler.nodes.FrameState;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.nodes.util.GraphUtil;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class PushThroughIfTest extends GraalCompilerTest {
|
||||
@ -65,15 +64,15 @@ public class PushThroughIfTest extends GraalCompilerTest {
|
||||
fs.replaceAtUsages(null);
|
||||
GraphUtil.killWithUnusedFloatingInputs(fs);
|
||||
}
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
|
||||
StructuredGraph referenceGraph = parseEager(reference, AllowAssumptions.YES);
|
||||
for (FrameState fs : referenceGraph.getNodes(FrameState.TYPE).snapshot()) {
|
||||
fs.replaceAtUsages(null);
|
||||
GraphUtil.killWithUnusedFloatingInputs(fs);
|
||||
}
|
||||
new CanonicalizerPhase().apply(referenceGraph, getProviders());
|
||||
createCanonicalizerPhase().apply(referenceGraph, getProviders());
|
||||
assertEquals(referenceGraph, graph);
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public class ReadAfterCheckCastTest extends GraphScheduleTest {
|
||||
// structure changes significantly
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
|
||||
CoreProviders context = getProviders();
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
|
||||
new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new FloatingReadPhase().apply(graph);
|
||||
canonicalizer.apply(graph, context);
|
||||
|
@ -28,7 +28,6 @@ import org.graalvm.compiler.graph.IterableNodeType;
|
||||
import org.graalvm.compiler.graph.Node;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ReassociateAndCanonicalTest extends GraalCompilerTest {
|
||||
@ -245,9 +244,9 @@ public class ReassociateAndCanonicalTest extends GraalCompilerTest {
|
||||
|
||||
private <T extends Node & IterableNodeType> void test(String test, String ref) {
|
||||
StructuredGraph testGraph = parseEager(test, AllowAssumptions.NO);
|
||||
new CanonicalizerPhase().apply(testGraph, getProviders());
|
||||
createCanonicalizerPhase().apply(testGraph, getProviders());
|
||||
StructuredGraph refGraph = parseEager(ref, AllowAssumptions.NO);
|
||||
new CanonicalizerPhase().apply(refGraph, getProviders());
|
||||
createCanonicalizerPhase().apply(refGraph, getProviders());
|
||||
assertEquals(testGraph, refGraph);
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ import org.graalvm.compiler.debug.DebugContext;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.nodes.spi.CoreProviders;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
@ -134,7 +133,7 @@ public class ScalarTypeSystemTest extends GraalCompilerTest {
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
|
||||
graph.getDebug().dump(DebugContext.BASIC_LEVEL, graph, "Graph");
|
||||
CoreProviders context = getProviders();
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
createCanonicalizerPhase().apply(graph, context);
|
||||
StructuredGraph referenceGraph = parseEager(referenceSnippet, AllowAssumptions.NO);
|
||||
assertEquals(referenceGraph, graph);
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ import org.graalvm.compiler.nodes.cfg.Block;
|
||||
import org.graalvm.compiler.nodes.spi.CoreProviders;
|
||||
import org.graalvm.compiler.nodes.spi.LoweringTool;
|
||||
import org.graalvm.compiler.phases.OptimisticOptimizations;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.FrameStateAssignmentPhase;
|
||||
import org.graalvm.compiler.phases.common.GuardLoweringPhase;
|
||||
import org.graalvm.compiler.phases.common.LoweringPhase;
|
||||
@ -99,8 +98,8 @@ public class SchedulingTest2 extends GraphScheduleTest {
|
||||
}
|
||||
|
||||
CoreProviders context = getProviders();
|
||||
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.MID_TIER).apply(graph, context);
|
||||
new LoweringPhase(createCanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new LoweringPhase(createCanonicalizerPhase(), LoweringTool.StandardLoweringStage.MID_TIER).apply(graph, context);
|
||||
MidTierContext midContext = new MidTierContext(getProviders(), getTargetProvider(), OptimisticOptimizations.ALL, graph.getProfilingInfo());
|
||||
|
||||
new GuardLoweringPhase().apply(graph, midContext);
|
||||
|
@ -27,7 +27,6 @@ package org.graalvm.compiler.core.test;
|
||||
import org.graalvm.compiler.core.common.type.IntegerStamp;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -111,7 +110,7 @@ public class StampCanonicalizerTest extends GraalCompilerTest {
|
||||
|
||||
private void testZeroReturn(String methodName) {
|
||||
StructuredGraph graph = parseEager(methodName, AllowAssumptions.YES);
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
new DeadCodeEliminationPhase().apply(graph);
|
||||
assertConstantReturn(graph, 0);
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ package org.graalvm.compiler.core.test;
|
||||
import org.graalvm.compiler.debug.DebugContext;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class StraighteningTest extends GraalCompilerTest {
|
||||
@ -90,7 +89,7 @@ public class StraighteningTest extends GraalCompilerTest {
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
|
||||
DebugContext debug = graph.getDebug();
|
||||
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
StructuredGraph referenceGraph = parseEager(REFERENCE_SNIPPET, AllowAssumptions.YES);
|
||||
assertEquals(referenceGraph, graph);
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ package org.graalvm.compiler.core.test;
|
||||
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.extended.IntegerSwitchNode;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SwitchCanonicalizerTest extends GraalCompilerTest {
|
||||
@ -119,7 +118,7 @@ public class SwitchCanonicalizerTest extends GraalCompilerTest {
|
||||
|
||||
private void shouldFoldSwitch(String methodName) {
|
||||
StructuredGraph graph = parseForCompile(getResolvedJavaMethod(methodName));
|
||||
new CanonicalizerPhase().apply(graph, getDefaultHighTierContext());
|
||||
createCanonicalizerPhase().apply(graph, getDefaultHighTierContext());
|
||||
assertTrue(graph.getNodes().filter(IntegerSwitchNode.class).isEmpty());
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class SwitchDyingLoopTest extends GraalCompilerTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
CanonicalizerPhase canonicalizerPhase = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizerPhase = createCanonicalizerPhase();
|
||||
HighTierContext highTierContext = getDefaultHighTierContext();
|
||||
StructuredGraph graph = parseEager("snippet", StructuredGraph.AllowAssumptions.YES);
|
||||
// there should be 1 loop and 1 switch
|
||||
|
@ -27,7 +27,6 @@ package org.graalvm.compiler.core.test;
|
||||
|
||||
import org.graalvm.compiler.debug.DebugContext;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SwitchFoldingTest extends GraalCompilerTest {
|
||||
@ -484,7 +483,7 @@ public class SwitchFoldingTest extends GraalCompilerTest {
|
||||
StructuredGraph graph = parseEager(snippet, StructuredGraph.AllowAssumptions.YES);
|
||||
DebugContext debug = graph.getDebug();
|
||||
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
StructuredGraph referenceGraph = parseEager(ref, StructuredGraph.AllowAssumptions.YES);
|
||||
assertEquals(referenceGraph, graph);
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult;
|
||||
import org.graalvm.compiler.nodes.cfg.Block;
|
||||
import org.graalvm.compiler.nodes.java.InstanceOfNode;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.ConditionalEliminationPhase;
|
||||
import org.graalvm.compiler.phases.schedule.SchedulePhase;
|
||||
import org.junit.Assert;
|
||||
@ -188,13 +187,13 @@ public class TypeSystemTest extends GraalCompilerTest {
|
||||
* reference graph.
|
||||
*/
|
||||
new ConditionalEliminationPhase(false).apply(graph, getProviders());
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
// a second canonicalizer is needed to process nested MaterializeNodes
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
StructuredGraph referenceGraph = parseEager(referenceSnippet, AllowAssumptions.NO);
|
||||
new ConditionalEliminationPhase(false).apply(referenceGraph, getProviders());
|
||||
new CanonicalizerPhase().apply(referenceGraph, getProviders());
|
||||
new CanonicalizerPhase().apply(referenceGraph, getProviders());
|
||||
this.createCanonicalizerPhase().apply(referenceGraph, getProviders());
|
||||
this.createCanonicalizerPhase().apply(referenceGraph, getProviders());
|
||||
assertEquals(referenceGraph, graph);
|
||||
}
|
||||
|
||||
@ -244,8 +243,8 @@ public class TypeSystemTest extends GraalCompilerTest {
|
||||
|
||||
private <T extends Node> void testHelper(String snippet, Class<T> clazz) {
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
DebugContext debug = graph.getDebug();
|
||||
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph " + snippet);
|
||||
Assert.assertFalse("shouldn't have nodes of type " + clazz, graph.getNodes().filter(clazz).iterator().hasNext());
|
||||
|
@ -119,7 +119,7 @@ public class UnsafeReadEliminationTest extends GraalCompilerTest {
|
||||
|
||||
public void testEarlyReadElimination(StructuredGraph graph, int reads, int writes) {
|
||||
CoreProviders context = getDefaultHighTierContext();
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
|
||||
canonicalizer.apply(graph, context);
|
||||
new EarlyReadEliminationPhase(canonicalizer).apply(graph, context);
|
||||
Assert.assertEquals(3, graph.getNodes().filter(UnsafeAccessNode.class).count());
|
||||
@ -134,7 +134,7 @@ public class UnsafeReadEliminationTest extends GraalCompilerTest {
|
||||
public void testPartialEscapeReadElimination(StructuredGraph graph, int reads, int writes) {
|
||||
OptionValues options = graph.getOptions();
|
||||
CoreProviders context = getDefaultHighTierContext();
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
|
||||
canonicalizer.apply(graph, context);
|
||||
new PartialEscapePhase(true, true, canonicalizer, null, options).apply(graph, context);
|
||||
Assert.assertEquals(3, graph.getNodes().filter(UnsafeAccessNode.class).count());
|
||||
|
@ -147,7 +147,7 @@ public class UnsafeVirtualizationTest extends GraalCompilerTest {
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
|
||||
OptionValues options = graph.getOptions();
|
||||
CoreProviders context = getDefaultHighTierContext();
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
|
||||
if (canonicalizeBefore) {
|
||||
canonicalizer.apply(graph, context);
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ import static org.junit.Assert.assertThat;
|
||||
import org.graalvm.compiler.graph.iterators.NodeIterable;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.java.NewArrayNode;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Test;
|
||||
|
||||
public class UnusedArray extends GraalCompilerTest {
|
||||
@ -66,7 +65,7 @@ public class UnusedArray extends GraalCompilerTest {
|
||||
|
||||
public void test(String method) {
|
||||
StructuredGraph graph = parseEager(method, StructuredGraph.AllowAssumptions.YES);
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
NodeIterable<NewArrayNode> newArrayNodes = graph.getNodes().filter(NewArrayNode.class);
|
||||
assertThat(newArrayNodes, isEmpty());
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ import org.graalvm.compiler.core.test.GraalCompilerTest;
|
||||
import org.graalvm.compiler.nodes.ConstantNode;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@ -62,7 +61,7 @@ public class CompiledMethodTest extends GraalCompilerTest {
|
||||
public void test1() {
|
||||
final ResolvedJavaMethod javaMethod = getResolvedJavaMethod("testMethod");
|
||||
final StructuredGraph graph = parseEager(javaMethod, AllowAssumptions.NO);
|
||||
new CanonicalizerPhase().apply(graph, getProviders());
|
||||
createCanonicalizerPhase().apply(graph, getProviders());
|
||||
new DeadCodeEliminationPhase().apply(graph);
|
||||
|
||||
for (ConstantNode node : ConstantNode.getConstantNodes(graph)) {
|
||||
|
@ -37,7 +37,6 @@ import org.graalvm.compiler.nodes.java.NewArrayNode;
|
||||
import org.graalvm.compiler.nodes.java.NewInstanceNode;
|
||||
import org.graalvm.compiler.nodes.virtual.AllocatedObjectNode;
|
||||
import org.graalvm.compiler.nodes.virtual.CommitAllocationNode;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
import org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase;
|
||||
@ -173,7 +172,7 @@ public class EATestBase extends GraalCompilerTest {
|
||||
createInliningPhase().apply(graph, context);
|
||||
new DeadCodeEliminationPhase().apply(graph);
|
||||
canonicalizeGraph();
|
||||
new PartialEscapePhase(iterativeEscapeAnalysis, false, new CanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
|
||||
new PartialEscapePhase(iterativeEscapeAnalysis, false, createCanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
|
||||
postEACanonicalizeGraph();
|
||||
returnNodes = graph.getNodes(ReturnNode.TYPE).snapshot();
|
||||
} catch (Throwable e) {
|
||||
@ -185,6 +184,6 @@ public class EATestBase extends GraalCompilerTest {
|
||||
}
|
||||
|
||||
protected void canonicalizeGraph() {
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
this.createCanonicalizerPhase().apply(graph, context);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2019, 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
|
||||
@ -27,6 +27,9 @@ package org.graalvm.compiler.core.test.ea;
|
||||
import java.util.List;
|
||||
|
||||
import org.graalvm.compiler.core.test.GraalCompilerTest;
|
||||
import org.graalvm.compiler.graph.Node;
|
||||
import org.graalvm.compiler.nodes.IfNode;
|
||||
import org.graalvm.compiler.nodes.LogicConstantNode;
|
||||
import org.graalvm.compiler.nodes.ProxyNode;
|
||||
import org.graalvm.compiler.nodes.ReturnNode;
|
||||
import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
@ -37,7 +40,6 @@ import org.graalvm.compiler.nodes.java.LoadFieldNode;
|
||||
import org.graalvm.compiler.nodes.java.StoreFieldNode;
|
||||
import org.graalvm.compiler.nodes.memory.ReadNode;
|
||||
import org.graalvm.compiler.nodes.spi.LoweringTool;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.LoweringPhase;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
import org.graalvm.compiler.virtual.phases.ea.EarlyReadEliminationPhase;
|
||||
@ -47,6 +49,50 @@ public class EarlyReadEliminationTest extends GraalCompilerTest {
|
||||
|
||||
public static Object staticField;
|
||||
|
||||
static void cfgSnippet() {
|
||||
if (staticField != null) {
|
||||
staticField = 12;
|
||||
if (staticField != null) {
|
||||
staticField = 12;
|
||||
}
|
||||
if (staticField != null) {
|
||||
staticField = 12;
|
||||
}
|
||||
if (staticField != null) {
|
||||
staticField = 12;
|
||||
}
|
||||
if (staticField != null) {
|
||||
staticField = 12;
|
||||
}
|
||||
} else {
|
||||
if (staticField != null) {
|
||||
staticField = 12;
|
||||
} else {
|
||||
if (staticField != null) {
|
||||
staticField = 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeadBranches() {
|
||||
StructuredGraph graph = parseEager(getResolvedJavaMethod("cfgSnippet"), AllowAssumptions.NO);
|
||||
HighTierContext context = getDefaultHighTierContext();
|
||||
int index = 0;
|
||||
boolean[] conditions = new boolean[]{true, false, false, true, true, true, false};
|
||||
/*
|
||||
* Create a graph with "dead" branches in the beginning.
|
||||
*/
|
||||
for (Node n : graph.getNodes()) {
|
||||
if (n instanceof IfNode) {
|
||||
IfNode ifNode = (IfNode) n;
|
||||
ifNode.setCondition(LogicConstantNode.forBoolean(conditions[index++], graph));
|
||||
}
|
||||
}
|
||||
new EarlyReadEliminationPhase(createCanonicalizerPhase()).apply(graph, context);
|
||||
}
|
||||
|
||||
public static class TestObject {
|
||||
|
||||
public int x;
|
||||
@ -264,9 +310,9 @@ public class EarlyReadEliminationTest extends GraalCompilerTest {
|
||||
HighTierContext context = getDefaultHighTierContext();
|
||||
createInliningPhase().apply(graph, context);
|
||||
if (doLowering) {
|
||||
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new LoweringPhase(createCanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
}
|
||||
new EarlyReadEliminationPhase(new CanonicalizerPhase()).apply(graph, context);
|
||||
new EarlyReadEliminationPhase(createCanonicalizerPhase()).apply(graph, context);
|
||||
return graph;
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ import org.graalvm.compiler.nodes.extended.ValueAnchorNode;
|
||||
import org.graalvm.compiler.nodes.java.LoadFieldNode;
|
||||
import org.graalvm.compiler.nodes.virtual.AllocatedObjectNode;
|
||||
import org.graalvm.compiler.nodes.virtual.CommitAllocationNode;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.schedule.SchedulePhase;
|
||||
import org.graalvm.compiler.test.SubprocessUtil;
|
||||
import org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase;
|
||||
@ -327,7 +326,7 @@ public class EscapeAnalysisTest extends EATestBase {
|
||||
Assert.assertEquals(1, graph.getNodes().filter(BoxNode.class).count());
|
||||
List<Node> nodes = graph.getNodes().snapshot();
|
||||
// verify that an additional run doesn't add or remove nodes
|
||||
new PartialEscapePhase(false, false, new CanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
|
||||
new PartialEscapePhase(false, false, createCanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
|
||||
Assert.assertEquals(nodes.size(), graph.getNodeCount());
|
||||
for (Node node : nodes) {
|
||||
Assert.assertTrue(node.isAlive());
|
||||
@ -362,9 +361,9 @@ public class EscapeAnalysisTest extends EATestBase {
|
||||
Assert.assertEquals(2, graph.getNodes().filter(CommitAllocationNode.class).count());
|
||||
// create the situation by removing the if
|
||||
graph.replaceFixedWithFloating(graph.getNodes().filter(LoadFieldNode.class).first(), graph.unique(ConstantNode.forInt(0)));
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
createCanonicalizerPhase().apply(graph, context);
|
||||
// verify that an additional run removes all allocations
|
||||
new PartialEscapePhase(false, false, new CanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
|
||||
new PartialEscapePhase(false, false, createCanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
|
||||
Assert.assertEquals(0, graph.getNodes().filter(CommitAllocationNode.class).count());
|
||||
}
|
||||
|
||||
@ -440,8 +439,8 @@ public class EscapeAnalysisTest extends EATestBase {
|
||||
@Test
|
||||
public void testFullyUnrolledLoop() {
|
||||
prepareGraph("testFullyUnrolledLoopSnippet", false);
|
||||
new LoopFullUnrollPhase(new CanonicalizerPhase(), new DefaultLoopPolicies()).apply(graph, context);
|
||||
new PartialEscapePhase(false, new CanonicalizerPhase(), graph.getOptions()).apply(graph, context);
|
||||
new LoopFullUnrollPhase(createCanonicalizerPhase(), new DefaultLoopPolicies()).apply(graph, context);
|
||||
new PartialEscapePhase(false, createCanonicalizerPhase(), graph.getOptions()).apply(graph, context);
|
||||
Assert.assertEquals(1, returnNodes.size());
|
||||
Assert.assertTrue(returnNodes.get(0).result() instanceof AllocatedObjectNode);
|
||||
CommitAllocationNode commit = ((AllocatedObjectNode) returnNodes.get(0).result()).getCommit();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2019, 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
|
||||
@ -30,7 +30,6 @@ import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
|
||||
import org.graalvm.compiler.nodes.extended.RawLoadNode;
|
||||
import org.graalvm.compiler.nodes.java.LoadIndexedNode;
|
||||
import org.graalvm.compiler.nodes.java.StoreIndexedNode;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
import org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase;
|
||||
import org.junit.Test;
|
||||
@ -181,7 +180,7 @@ public class PEAReadEliminationTest extends GraalCompilerTest {
|
||||
StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
|
||||
HighTierContext context = getDefaultHighTierContext();
|
||||
createInliningPhase().apply(graph, context);
|
||||
new PartialEscapePhase(false, true, new CanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
|
||||
new PartialEscapePhase(false, true, createCanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
|
||||
return graph;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
@ -31,7 +31,6 @@ import org.graalvm.compiler.nodes.extended.BoxNode;
|
||||
import org.graalvm.compiler.nodes.extended.UnboxNode;
|
||||
import org.graalvm.compiler.nodes.java.StoreFieldNode;
|
||||
import org.graalvm.compiler.nodes.virtual.CommitAllocationNode;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@ -147,7 +146,7 @@ public class PartialEscapeAnalysisIterationTest extends EATestBase {
|
||||
for (String name : new String[]{"noLoopIterationEmpty", "noLoopIteration"}) {
|
||||
prepareGraph(name, false);
|
||||
List<CommitAllocationNode> allocations = graph.getNodes().filter(CommitAllocationNode.class).snapshot();
|
||||
new PartialEscapePhase(true, false, new CanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
|
||||
new PartialEscapePhase(true, false, createCanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
|
||||
Assert.assertEquals(1, allocations.size());
|
||||
Assert.assertTrue(allocations.get(0).isAlive());
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2019, 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
|
||||
@ -44,7 +44,6 @@ import org.graalvm.compiler.nodes.java.NewArrayNode;
|
||||
import org.graalvm.compiler.nodes.java.NewInstanceNode;
|
||||
import org.graalvm.compiler.nodes.java.StoreFieldNode;
|
||||
import org.graalvm.compiler.nodes.virtual.CommitAllocationNode;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase;
|
||||
|
||||
/**
|
||||
@ -287,7 +286,7 @@ public class PartialEscapeAnalysisTest extends EATestBase {
|
||||
merge.setStateAfter(null);
|
||||
}
|
||||
new DeadCodeEliminationPhase().apply(graph);
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
createCanonicalizerPhase().apply(graph, context);
|
||||
try {
|
||||
Assert.assertTrue("partial escape analysis should have removed all NewInstanceNode allocations", graph.getNodes().filter(NewInstanceNode.class).isEmpty());
|
||||
Assert.assertTrue("partial escape analysis should have removed all NewArrayNode allocations", graph.getNodes().filter(NewArrayNode.class).isEmpty());
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
@ -30,7 +30,6 @@ import org.graalvm.compiler.api.directives.GraalDirectives;
|
||||
import org.graalvm.compiler.core.test.GraalCompilerTest;
|
||||
import org.graalvm.compiler.debug.DebugContext;
|
||||
import org.graalvm.compiler.nodes.debug.BlackholeNode;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@ -118,7 +117,7 @@ public class PartialEscapeAnalysisTreesTest extends EATestBase {
|
||||
graph.removeFixed(node);
|
||||
}
|
||||
new DeadCodeEliminationPhase().apply(graph);
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
createCanonicalizerPhase().apply(graph, context);
|
||||
|
||||
InstalledCode code = getCode(method, graph, true);
|
||||
|
||||
|
@ -35,7 +35,6 @@ import org.graalvm.compiler.nodes.java.AbstractNewObjectNode;
|
||||
import org.graalvm.compiler.nodes.java.NewInstanceNode;
|
||||
import org.graalvm.compiler.nodes.spi.CoreProviders;
|
||||
import org.graalvm.compiler.nodes.spi.LoweringTool;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.LoweringPhase;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
import org.junit.Test;
|
||||
@ -68,7 +67,7 @@ public class PoorMansEATest extends GraalCompilerTest {
|
||||
HighTierContext highTierContext = getDefaultHighTierContext();
|
||||
createInliningPhase().apply(graph, highTierContext);
|
||||
CoreProviders context = getProviders();
|
||||
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
new LoweringPhase(createCanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
|
||||
|
||||
// remove framestates in order to trigger the simplification.
|
||||
cleanup: for (FrameState fs : graph.getNodes(FrameState.TYPE).snapshot()) {
|
||||
@ -80,7 +79,7 @@ public class PoorMansEATest extends GraalCompilerTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
createCanonicalizerPhase().apply(graph, context);
|
||||
} catch (Throwable e) {
|
||||
throw debug.handle(e);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
@ -32,7 +32,6 @@ import org.graalvm.compiler.nodes.StructuredGraph;
|
||||
import org.graalvm.compiler.nodes.extended.RawLoadNode;
|
||||
import org.graalvm.compiler.nodes.extended.RawStoreNode;
|
||||
import org.graalvm.compiler.nodes.virtual.CommitAllocationNode;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
import org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase;
|
||||
import org.junit.Test;
|
||||
@ -123,7 +122,7 @@ public class TrufflePEATest extends GraalCompilerTest {
|
||||
StructuredGraph graph = parseEager(snippet, StructuredGraph.AllowAssumptions.NO);
|
||||
HighTierContext context = getDefaultHighTierContext();
|
||||
createInliningPhase().apply(graph, context);
|
||||
new PartialEscapePhase(true, true, new CanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
|
||||
new PartialEscapePhase(true, true, createCanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
|
||||
return graph;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2019, 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
|
||||
@ -37,7 +37,6 @@ import org.graalvm.compiler.nodes.extended.RawLoadNode;
|
||||
import org.graalvm.compiler.nodes.extended.RawStoreNode;
|
||||
import org.graalvm.compiler.nodes.extended.UnsafeAccessNode;
|
||||
import org.graalvm.compiler.nodes.java.LoadFieldNode;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -123,7 +122,7 @@ public class UnsafeEATest extends EATestBase {
|
||||
for (UnpackEndianHalfNode node : graph.getNodes().filter(UnpackEndianHalfNode.class)) {
|
||||
node.lower(getTarget().arch.getByteOrder());
|
||||
}
|
||||
new CanonicalizerPhase().applyIncremental(graph, context, mark);
|
||||
createCanonicalizerPhase().applyIncremental(graph, context, mark);
|
||||
}
|
||||
|
||||
private boolean testingUnsafe;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2019, 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
|
||||
@ -41,7 +41,6 @@ import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration;
|
||||
import org.graalvm.compiler.options.OptionValues;
|
||||
import org.graalvm.compiler.phases.OptimisticOptimizations;
|
||||
import org.graalvm.compiler.phases.PhaseSuite;
|
||||
import org.graalvm.compiler.phases.common.CanonicalizerPhase;
|
||||
import org.graalvm.compiler.phases.common.DeadCodeEliminationPhase;
|
||||
import org.graalvm.compiler.phases.tiers.HighTierContext;
|
||||
import org.junit.Assert;
|
||||
@ -291,10 +290,10 @@ public class InliningTest extends GraalCompilerTest {
|
||||
: getDefaultGraphBuilderSuite();
|
||||
HighTierContext context = new HighTierContext(getProviders(), graphBuilderSuite, OptimisticOptimizations.ALL);
|
||||
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
createCanonicalizerPhase().apply(graph, context);
|
||||
createInliningPhase().apply(graph, context);
|
||||
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
|
||||
new CanonicalizerPhase().apply(graph, context);
|
||||
createCanonicalizerPhase().apply(graph, context);
|
||||
new DeadCodeEliminationPhase().apply(graph);
|
||||
return graph;
|
||||
}
|
||||
|
@ -112,8 +112,8 @@ public class NestedLoopEffectsPhaseComplexityTest extends GraalCompilerTest {
|
||||
StructuredGraph g1 = prepareGraph(snippet, i);
|
||||
StructuredGraph g2 = (StructuredGraph) g1.copy(g1.getDebug());
|
||||
ResolvedJavaMethod method = g1.method();
|
||||
long elapsedRE = runAndTimePhase(g1, new EarlyReadEliminationPhase(new CanonicalizerPhase()));
|
||||
long elapsedPEA = runAndTimePhase(g2, new PartialEscapePhase(true, new CanonicalizerPhase(), g1.getOptions()));
|
||||
long elapsedRE = runAndTimePhase(g1, new EarlyReadEliminationPhase(createCanonicalizerPhase()));
|
||||
long elapsedPEA = runAndTimePhase(g2, new PartialEscapePhase(true, createCanonicalizerPhase(), g1.getOptions()));
|
||||
if (LOG_PHASE_TIMINGS) {
|
||||
TTY.printf("Needed %dms to run early partial escape analysis on a graph with %d nested loops compiling method %s\n", elapsedPEA, i, method);
|
||||
}
|
||||
@ -138,7 +138,7 @@ public class NestedLoopEffectsPhaseComplexityTest extends GraalCompilerTest {
|
||||
StructuredGraph callerGraph = parseEager(callerMethod, AllowAssumptions.YES);
|
||||
PhaseSuite<HighTierContext> graphBuilderSuite = getDefaultGraphBuilderSuite();
|
||||
HighTierContext context = new HighTierContext(getProviders(), graphBuilderSuite, OptimisticOptimizations.ALL);
|
||||
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
|
||||
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
|
||||
Invoke next = callerGraph.getNodes(MethodCallTargetNode.TYPE).first().invoke();
|
||||
StructuredGraph calleeGraph = parseBytecodes(next.callTarget().targetMethod(), context, canonicalizer);
|
||||
ResolvedJavaMethod calleeMethod = next.callTarget().targetMethod();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user