8227034: Graal crash with gcbasher
Summary: Adjust Graal's registers declaration for String intrinisics.
Reviewed-by: dlong, dnsimon, kvn
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64StringLatin1InflateOp.java Tue Jul 09 13:46:39 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64StringLatin1InflateOp.java Tue Jul 09 14:59:12 2019 -0700
@@ -29,11 +29,9 @@
import static jdk.vm.ci.amd64.AMD64.rdi;
import static jdk.vm.ci.amd64.AMD64.rdx;
import static jdk.vm.ci.amd64.AMD64.rsi;
-
import static jdk.vm.ci.code.ValueUtil.asRegister;
import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG;
-import jdk.vm.ci.amd64.AMD64;
import org.graalvm.compiler.asm.Label;
import org.graalvm.compiler.asm.amd64.AMD64Address;
import org.graalvm.compiler.asm.amd64.AMD64Assembler;
@@ -44,6 +42,7 @@
import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
import org.graalvm.compiler.lir.gen.LIRGeneratorTool;
+import jdk.vm.ci.amd64.AMD64;
import jdk.vm.ci.amd64.AMD64Kind;
import jdk.vm.ci.code.Register;
import jdk.vm.ci.meta.Value;
@@ -52,9 +51,13 @@
public final class AMD64StringLatin1InflateOp extends AMD64LIRInstruction {
public static final LIRInstructionClass<AMD64StringLatin1InflateOp> TYPE = LIRInstructionClass.create(AMD64StringLatin1InflateOp.class);
- @Alive({REG}) private Value rsrc;
- @Alive({REG}) private Value rdst;
- @Alive({REG}) private Value rlen;
+ @Use({REG}) private Value rsrc;
+ @Use({REG}) private Value rdst;
+ @Use({REG}) private Value rlen;
+
+ @Temp({REG}) private Value rsrcTemp;
+ @Temp({REG}) private Value rdstTemp;
+ @Temp({REG}) private Value rlenTemp;
@Temp({REG}) private Value vtmp1;
@Temp({REG}) private Value rtmp2;
@@ -66,9 +69,9 @@
assert asRegister(dst).equals(rdi);
assert asRegister(len).equals(rdx);
- rsrc = src;
- rdst = dst;
- rlen = len;
+ rsrcTemp = rsrc = src;
+ rdstTemp = rdst = dst;
+ rlenTemp = rlen = len;
vtmp1 = tool.newVariable(LIRKind.value(AMD64Kind.V512_BYTE));
rtmp2 = tool.newVariable(LIRKind.value(AMD64Kind.DWORD));
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64StringUTF16CompressOp.java Tue Jul 09 13:46:39 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir.amd64/src/org/graalvm/compiler/lir/amd64/AMD64StringUTF16CompressOp.java Tue Jul 09 14:59:12 2019 -0700
@@ -31,12 +31,10 @@
import static jdk.vm.ci.amd64.AMD64.rdi;
import static jdk.vm.ci.amd64.AMD64.rdx;
import static jdk.vm.ci.amd64.AMD64.rsi;
-
import static jdk.vm.ci.amd64.AMD64.rsp;
import static jdk.vm.ci.code.ValueUtil.asRegister;
import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG;
-import jdk.vm.ci.amd64.AMD64;
import org.graalvm.compiler.asm.Label;
import org.graalvm.compiler.asm.amd64.AMD64Address;
import org.graalvm.compiler.asm.amd64.AMD64Assembler;
@@ -47,6 +45,7 @@
import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
import org.graalvm.compiler.lir.gen.LIRGeneratorTool;
+import jdk.vm.ci.amd64.AMD64;
import jdk.vm.ci.amd64.AMD64Kind;
import jdk.vm.ci.code.Register;
import jdk.vm.ci.meta.Value;
@@ -56,9 +55,13 @@
public static final LIRInstructionClass<AMD64StringUTF16CompressOp> TYPE = LIRInstructionClass.create(AMD64StringUTF16CompressOp.class);
@Def({REG}) private Value rres;
- @Alive({REG}) private Value rsrc;
- @Alive({REG}) private Value rdst;
- @Alive({REG}) private Value rlen;
+ @Use({REG}) private Value rsrc;
+ @Use({REG}) private Value rdst;
+ @Use({REG}) private Value rlen;
+
+ @Temp({REG}) private Value rsrcTemp;
+ @Temp({REG}) private Value rdstTemp;
+ @Temp({REG}) private Value rlenTemp;
@Temp({REG}) private Value vtmp1;
@Temp({REG}) private Value vtmp2;
@@ -75,9 +78,9 @@
assert asRegister(res).equals(rax);
rres = res;
- rsrc = src;
- rdst = dst;
- rlen = len;
+ rsrcTemp = rsrc = src;
+ rdstTemp = rdst = dst;
+ rlenTemp = rlen = len;
LIRKind vkind = LIRKind.value(AMD64Kind.V512_BYTE);