Disable fast path in compileCompareJump for vector constants because supporting it would require a new opcode

This commit is contained in:
Petri Häkkinen 2023-11-10 11:49:17 +02:00
parent 33c48485f1
commit d29890ee39

View file

@ -1100,6 +1100,13 @@ struct Compiler
return cv && cv->type != Constant::Type_Unknown && !cv->isTruthful(); return cv && cv->type != Constant::Type_Unknown && !cv->isTruthful();
} }
bool isConstantVector(AstExpr* node)
{
const Constant* cv = constants.find(node);
return cv && cv->type == Constant::Type_Vector;
}
Constant getConstant(AstExpr* node) Constant getConstant(AstExpr* node)
{ {
const Constant* cv = constants.find(node); const Constant* cv = constants.find(node);
@ -1123,6 +1130,10 @@ struct Compiler
std::swap(left, right); std::swap(left, right);
} }
// disable fast path for vectors because supporting it would require a new opcode
if (isConstantVector(right))
operandIsConstant = false;
uint8_t rl = compileExprAuto(left, rs); uint8_t rl = compileExprAuto(left, rs);
if (isEq && operandIsConstant) if (isEq && operandIsConstant)