< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.amd64/src/org/graalvm/compiler/core/amd64/AMD64LIRGenerator.java
Print this page
rev 52509 : [mq]: graal
@@ -85,11 +85,12 @@
import org.graalvm.compiler.lir.amd64.AMD64Move;
import org.graalvm.compiler.lir.amd64.AMD64Move.CompareAndSwapOp;
import org.graalvm.compiler.lir.amd64.AMD64Move.MembarOp;
import org.graalvm.compiler.lir.amd64.AMD64Move.StackLeaOp;
import org.graalvm.compiler.lir.amd64.AMD64PauseOp;
-import org.graalvm.compiler.lir.amd64.AMD64StringIndexOfOp;
+import org.graalvm.compiler.lir.amd64.AMD64StringLatin1InflateOp;
+import org.graalvm.compiler.lir.amd64.AMD64StringUTF16CompressOp;
import org.graalvm.compiler.lir.amd64.AMD64ZapRegistersOp;
import org.graalvm.compiler.lir.amd64.AMD64ZapStackOp;
import org.graalvm.compiler.lir.gen.LIRGenerationResult;
import org.graalvm.compiler.lir.gen.LIRGenerator;
import org.graalvm.compiler.phases.util.Providers;
@@ -260,12 +261,12 @@
return emitCompareAndSwap(false, accessKind, address, expectedValue, newValue, null, null);
}
public void emitCompareAndSwapBranch(ValueKind<?> kind, AMD64AddressValue address, Value expectedValue, Value newValue, Condition condition, LabelRef trueLabel, LabelRef falseLabel,
double trueLabelProbability) {
- assert kind.equals(expectedValue.getValueKind());
- assert kind.equals(newValue.getValueKind());
+ assert kind.getPlatformKind().getSizeInBytes() <= expectedValue.getValueKind().getPlatformKind().getSizeInBytes();
+ assert kind.getPlatformKind().getSizeInBytes() <= newValue.getValueKind().getPlatformKind().getSizeInBytes();
assert condition == Condition.EQ || condition == Condition.NE;
AMD64Kind memKind = (AMD64Kind) kind.getPlatformKind();
RegisterValue raxValue = AMD64.rax.asValue(kind);
emitMove(raxValue, expectedValue);
append(new CompareAndSwapOp(memKind, raxValue, address, raxValue, asAllocatable(newValue)));
@@ -540,39 +541,73 @@
emitMove(result, raxRes);
return result;
}
@Override
- public Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length) {
+ public Variable emitArrayEquals(JavaKind kind, Value array1, Value array2, Value length, int constantLength, boolean directPointers) {
Variable result = newVariable(LIRKind.value(AMD64Kind.DWORD));
- append(new AMD64ArrayEqualsOp(this, kind, result, array1, array2, asAllocatable(length)));
+ append(new AMD64ArrayEqualsOp(this, kind, result, array1, array2, asAllocatable(length), constantLength, directPointers, getMaxVectorSize()));
return result;
}
/**
* Return a conservative estimate of the page size for use by the String.indexOf intrinsic.
*/
protected int getVMPageSize() {
return 4096;
}
+ /**
+ * Return the maximum size of vector registers used in SSE/AVX instructions.
+ */
+ protected int getMaxVectorSize() {
+ // default for "unlimited"
+ return -1;
+ }
+
@Override
- public Variable emitStringIndexOf(Value source, Value sourceCount, Value target, Value targetCount, int constantTargetCount) {
- Variable result = newVariable(LIRKind.value(AMD64Kind.DWORD));
- RegisterValue cnt1 = AMD64.rdx.asValue(sourceCount.getValueKind());
- emitMove(cnt1, sourceCount);
- RegisterValue cnt2 = AMD64.rax.asValue(targetCount.getValueKind());
- emitMove(cnt2, targetCount);
- append(new AMD64StringIndexOfOp(this, result, source, target, cnt1, cnt2, AMD64.rcx.asValue(), AMD64.xmm0.asValue(), constantTargetCount, getVMPageSize()));
+ public Variable emitArrayIndexOf(JavaKind kind, boolean findTwoConsecutive, Value arrayPointer, Value arrayLength, Value... searchValues) {
+ Variable result = newVariable(LIRKind.value(AMD64Kind.QWORD));
+ Value[] allocatableSearchValues = new Value[searchValues.length];
+ for (int i = 0; i < searchValues.length; i++) {
+ allocatableSearchValues[i] = asAllocatable(searchValues[i]);
+ }
+ append(new AMD64ArrayIndexOfOp(kind, findTwoConsecutive, getVMPageSize(), getMaxVectorSize(), this, result, asAllocatable(arrayPointer), asAllocatable(arrayLength), allocatableSearchValues));
return result;
}
@Override
- public Variable emitArrayIndexOf(JavaKind kind, Value arrayPointer, Value arrayLength, Value charValue) {
- Variable result = newVariable(LIRKind.value(AMD64Kind.DWORD));
- append(new AMD64ArrayIndexOfOp(kind, getVMPageSize(), this, result, asAllocatable(arrayPointer), asAllocatable(arrayLength), asAllocatable(charValue)));
- return result;
+ public void emitStringLatin1Inflate(Value src, Value dst, Value len) {
+ RegisterValue rsrc = AMD64.rsi.asValue(src.getValueKind());
+ RegisterValue rdst = AMD64.rdi.asValue(dst.getValueKind());
+ RegisterValue rlen = AMD64.rdx.asValue(len.getValueKind());
+
+ emitMove(rsrc, src);
+ emitMove(rdst, dst);
+ emitMove(rlen, len);
+
+ append(new AMD64StringLatin1InflateOp(this, rsrc, rdst, rlen));
+ }
+
+ @Override
+ public Variable emitStringUTF16Compress(Value src, Value dst, Value len) {
+ RegisterValue rsrc = AMD64.rsi.asValue(src.getValueKind());
+ RegisterValue rdst = AMD64.rdi.asValue(dst.getValueKind());
+ RegisterValue rlen = AMD64.rdx.asValue(len.getValueKind());
+
+ emitMove(rsrc, src);
+ emitMove(rdst, dst);
+ emitMove(rlen, len);
+
+ LIRKind reskind = LIRKind.value(AMD64Kind.DWORD);
+ RegisterValue rres = AMD64.rax.asValue(reskind);
+
+ append(new AMD64StringUTF16CompressOp(this, rres, rsrc, rdst, rlen));
+
+ Variable res = newVariable(reskind);
+ emitMove(res, rres);
+ return res;
}
@Override
public void emitReturn(JavaKind kind, Value input) {
AllocatableValue operand = Value.ILLEGAL;
@@ -612,9 +647,10 @@
@Override
public LIRInstruction createZapArgumentSpace(StackSlot[] zappedStack, JavaConstant[] zapValues) {
return new AMD64ZapStackOp(zappedStack, zapValues);
}
- public void emitLFence() {
+ @Override
+ public void emitSpeculationFence() {
append(new AMD64LFenceOp());
}
}
< prev index next >