# HG changeset patch # User Christian Wimmer # Date 1325202435 28800 # Node ID 15b9402dc0187c28be427318085a0bfcb67ce49e # Parent 9c060d6f5f11b654878174ecba7a1656cd6725f1 Canonicalize the incoming and outgoing parameters to stack-kinds diff -r 9c060d6f5f11 -r 15b9402dc018 graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java --- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java Thu Dec 29 14:06:59 2011 -0800 +++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java Thu Dec 29 15:47:15 2011 -0800 @@ -346,10 +346,9 @@ CiCallingConvention args = compilation.frameMap().incomingArguments(); for (LocalNode local : compilation.graph.getNodes(LocalNode.class)) { int i = local.index(); - CiValue src = args.locations[i]; + CiValue src = toStackKind(args.locations[i]); CiVariable dest = emitMove(src); - assert src.isLegal() : "check"; - assert src.kind.stackKind() == local.kind().stackKind() : "local type check failed"; + assert src.kind == local.kind().stackKind() : "local type check failed"; setResult(local, dest); } } @@ -776,31 +775,32 @@ } } + private static CiValue toStackKind(CiValue value) { + if (value.kind.stackKind() != value.kind) { + // We only have stack-kinds in the LIR, so convert the operand kind for values from the calling convention. + if (isRegister(value)) { + return asRegister(value).asValue(value.kind.stackKind()); + } else if (isStackSlot(value)) { + return CiStackSlot.get(value.kind.stackKind(), asStackSlot(value).index(), asStackSlot(value).inCallerFrame()); + } else { + throw Util.shouldNotReachHere(); + } + } + return value; + } + public List visitInvokeArguments(CiCallingConvention cc, Iterable arguments, List pointerSlots) { // for each argument, load it into the correct location List argList = new ArrayList<>(); int j = 0; for (ValueNode arg : arguments) { if (arg != null) { - CiValue operand = cc.locations[j++]; - if (isRegister(operand)) { - if (operand.kind.stackKind() != operand.kind) { - // We only have stack-kinds in the LIR, so convert the operand kind. - operand = asRegister(operand).asValue(operand.kind.stackKind()); - } + CiValue operand = toStackKind(cc.locations[j++]); - } else if (isStackSlot(operand)) { + if (isStackSlot(operand) && operand.kind == CiKind.Object && pointerSlots != null) { assert !asStackSlot(operand).inCallerFrame(); - if (operand.kind == CiKind.Object && pointerSlots != null) { - // This slot must be marked explicitly in the pointer map. - pointerSlots.add(asStackSlot(operand)); - } - if (operand.kind.stackKind() != operand.kind) { - // We only have stack-kinds in the LIR, so convert the operand kind. - operand = CiStackSlot.get(operand.kind.stackKind(), asStackSlot(operand).index()); - } - } else { - throw Util.shouldNotReachHere(); + // This slot must be marked explicitly in the pointer map. + pointerSlots.add(asStackSlot(operand)); } emitMove(operand(arg), operand);