From ee3628c272a627f3de7307b94a3aebf53f3e0f74 Mon Sep 17 00:00:00 2001 From: jdelong Date: Tue, 16 Apr 2013 22:08:40 -0700 Subject: [PATCH] Relax an assert slightly after the change to unbox keys in-TC --- hphp/runtime/vm/translator/hopt/ir.h | 6 +++++- hphp/runtime/vm/translator/hopt/vectortranslator.cpp | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hphp/runtime/vm/translator/hopt/ir.h b/hphp/runtime/vm/translator/hopt/ir.h index 30bc71932..50865ef4c 100644 --- a/hphp/runtime/vm/translator/hopt/ir.h +++ b/hphp/runtime/vm/translator/hopt/ir.h @@ -2066,7 +2066,7 @@ struct VectorEffects { static bool getStackValue(const IRInstruction* inst, uint32_t index, SSATmp*& value, Type& type); - VectorEffects(const IRInstruction* inst) { + explicit VectorEffects(const IRInstruction* inst) { int keyIdx = vectorKeyIdx(inst); int valIdx = vectorValIdx(inst); init(inst->getOpcode(), @@ -2074,6 +2074,7 @@ struct VectorEffects { keyIdx == -1 ? Type::None : inst->getSrc(keyIdx)->getType(), valIdx == -1 ? Type::None : inst->getSrc(valIdx)->getType()); } + template VectorEffects(Opcode opc, const Container& srcs) { int keyIdx = vectorKeyIdx(opc); @@ -2083,14 +2084,17 @@ struct VectorEffects { keyIdx == -1 ? Type::None : srcs[keyIdx]->getType(), valIdx == -1 ? Type::None : srcs[valIdx]->getType()); } + VectorEffects(Opcode op, Type base, Type key, Type val) { init(op, base, key, val); } + VectorEffects(Opcode op, SSATmp* base, SSATmp* key, SSATmp* val) { auto typeOrNone = [](SSATmp* val){ return val ? val->getType() : Type::None; }; init(op, typeOrNone(base), typeOrNone(key), typeOrNone(val)); } + Type baseType; Type valType; bool baseTypeChanged; diff --git a/hphp/runtime/vm/translator/hopt/vectortranslator.cpp b/hphp/runtime/vm/translator/hopt/vectortranslator.cpp index 7049a5817..d2429a8ca 100644 --- a/hphp/runtime/vm/translator/hopt/vectortranslator.cpp +++ b/hphp/runtime/vm/translator/hopt/vectortranslator.cpp @@ -119,7 +119,13 @@ void VectorEffects::init(Opcode op, const Type origBase, // Canonicalize the op to SetProp or SetElem op = canonicalOp(op); - assert(key.equals(Type::None) || key.isKnownDataType()); + + // We're not expecting types other than specific known data types + // (or for keys, Cell). (At least for keys it might work since the + // helpers generally operate on cells, but we're asserting anyway + // since this shouldn't actually happen.) + assert(key.equals(Type::None) || key.isKnownDataType() || + key.equals(Type::Cell)); assert(origVal.equals(Type::None) || origVal.isKnownDataType()); if ((op == SetElem || op == SetProp) &&