Skip to content
Permalink
Browse files

Handle variadics properly in opt_foldable

Summary: HHBBC can generate FCallBuiltins where the variadic parameter is not a container, so have opt_foldable refuse to optimize functions with type mismatches.

Reviewed By: markw65

Differential Revision: D13901514

fbshipit-source-id: 215e777e00dea6a2d254a4b6562a2052581a11b1
  • Loading branch information...
paulbiss authored and hhvm-bot committed Feb 3, 2019
1 parent d64c577 commit 7a397fda98f296db33536fc59b67d815e37ebf4b
Showing with 6 additions and 3 deletions.
  1. +6 −3 hphp/runtime/vm/jit/irgen-builtin.cpp
@@ -653,12 +653,15 @@ SSATmp* opt_foldable(IRGS& env,
if (numNonDefaultArgs > func->numNonVariadicParams()) {
assertx(params.size() == func->numParams());
auto const variadic = params.info.back().value;
if (!variadic->type().hasConstVal()) return nullptr;
auto const ty = RuntimeOption::EvalHackArrDVArrs ? TVec : TArr;
if (!variadic->type().hasConstVal(ty)) return nullptr;

variadicArgs = variadic->variantVal().asCArrRef().get();
numVariadicArgs = variadicArgs->size();
assertx(variadicArgs->isStatic() &&
(!numVariadicArgs || variadicArgs->isVecOrVArray()));

if (numVariadicArgs && !variadicArgs->isVecOrVArray()) return nullptr;

assertx(variadicArgs->isStatic());
numNonDefaultArgs = func->numNonVariadicParams();
}

0 comments on commit 7a397fd

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.