< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/ArrayRegionEqualsNode.java

Print this page

        

*** 53,63 **** public final class ArrayRegionEqualsNode extends FixedWithNextNode implements LIRLowerable, MemoryAccess { public static final NodeClass<ArrayRegionEqualsNode> TYPE = NodeClass.create(ArrayRegionEqualsNode.class); /** {@link JavaKind} of the arrays to compare. */ ! private final JavaKind kind; /** Pointer to first array region to be tested for equality. */ @Input private ValueNode array1; /** Pointer to second array region to be tested for equality. */ --- 53,64 ---- public final class ArrayRegionEqualsNode extends FixedWithNextNode implements LIRLowerable, MemoryAccess { public static final NodeClass<ArrayRegionEqualsNode> TYPE = NodeClass.create(ArrayRegionEqualsNode.class); /** {@link JavaKind} of the arrays to compare. */ ! private final JavaKind kind1; ! private final JavaKind kind2; /** Pointer to first array region to be tested for equality. */ @Input private ValueNode array1; /** Pointer to second array region to be tested for equality. */
*** 66,99 **** /** Length of the array region. */ @Input private ValueNode length; @OptionalInput(Memory) private MemoryNode lastLocationAccess; ! public ArrayRegionEqualsNode(ValueNode array1, ValueNode array2, ValueNode length, @ConstantNodeParameter JavaKind kind) { super(TYPE, StampFactory.forKind(JavaKind.Boolean)); ! this.kind = kind; this.array1 = array1; this.array2 = array2; this.length = length; } @NodeIntrinsic ! public static native boolean regionEquals(Pointer array1, Pointer array2, int length, @ConstantNodeParameter JavaKind kind); @Override public void generate(NodeLIRBuilderTool gen) { int constantLength = -1; if (length.isConstant()) { constantLength = length.asJavaConstant().asInt(); } ! Value result = gen.getLIRGeneratorTool().emitArrayEquals(kind, gen.operand(array1), gen.operand(array2), gen.operand(length), constantLength, true); gen.setResult(this, result); } @Override public LocationIdentity getLocationIdentity() { ! return NamedLocationIdentity.getArrayLocation(kind); } @Override public MemoryNode getLastLocationAccess() { return lastLocationAccess; --- 67,110 ---- /** Length of the array region. */ @Input private ValueNode length; @OptionalInput(Memory) private MemoryNode lastLocationAccess; ! public ArrayRegionEqualsNode(ValueNode array1, ValueNode array2, ValueNode length, @ConstantNodeParameter JavaKind kind1, @ConstantNodeParameter JavaKind kind2) { super(TYPE, StampFactory.forKind(JavaKind.Boolean)); ! this.kind1 = kind1; ! this.kind2 = kind2; this.array1 = array1; this.array2 = array2; this.length = length; } + public static boolean regionEquals(Pointer array1, Pointer array2, int length, @ConstantNodeParameter JavaKind kind) { + return regionEquals(array1, array2, length, kind, kind); + } + @NodeIntrinsic ! public static native boolean regionEquals(Pointer array1, Pointer array2, int length, @ConstantNodeParameter JavaKind kind1, @ConstantNodeParameter JavaKind kind2); @Override public void generate(NodeLIRBuilderTool gen) { int constantLength = -1; if (length.isConstant()) { constantLength = length.asJavaConstant().asInt(); } ! Value result; ! if (kind1 == kind2) { ! result = gen.getLIRGeneratorTool().emitArrayEquals(kind1, gen.operand(array1), gen.operand(array2), gen.operand(length), constantLength, true); ! } else { ! result = gen.getLIRGeneratorTool().emitArrayEquals(kind1, kind2, gen.operand(array1), gen.operand(array2), gen.operand(length), constantLength, true); ! } gen.setResult(this, result); } @Override public LocationIdentity getLocationIdentity() { ! return kind1 != kind2 ? LocationIdentity.ANY_LOCATION : NamedLocationIdentity.getArrayLocation(kind1); } @Override public MemoryNode getLastLocationAccess() { return lastLocationAccess;
< prev index next >