Skip to content

Commit 6002c4b

Browse files
alexmalyshevfacebook-github-bot
authored andcommitted
Type the return of InvokeStaticFunction in LIR
Summary: This ended up biting me while I was working on de-stringifying IntBinaryOp. I was getting a crash in `make testcinder_jit` due to an invalid `imul bl, cl` instruction being generated (8-bit imul has to use ax and al). I tracked down the issue to this small repro, P580265190. Note how IntBinaryOp is getting a value that comes from an InvokeStaticFunction. In HIR, the return value is typed as CInt8, but the LIR generator generated `Mul RAX:Object, RCX:8bit`. This means the `rewriteByteMultiply` function in postalloc.cpp (https://fburl.com/code/770swxgu) can't kick in for cases like this because the first operand is not being correctly typed as an 8-bit argument. Adding the return type to the Call generated for the InvokeStaticFunction fixes the crash for me. Reviewed By: carljm Differential Revision: D42143037 fbshipit-source-id: 80b52b4
1 parent acffb97 commit 6002c4b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Jit/lir/generator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1851,7 +1851,8 @@ LIRGenerator::TranslatedBlock LIRGenerator::TranslateOneBasicBlock(
18511851
std::string tmp_id = GetSafeTempName();
18521852
bbb.AppendCode(
18531853
"Load {}, {:#x}", tmp_id, reinterpret_cast<uint64_t>(indir));
1854-
ss << "Call " << instr->dst()->name() << ", " << tmp_id;
1854+
ss << "Call " << instr->dst()->name() << ":" << instr->dst()->type()
1855+
<< ", " << tmp_id;
18551856
}
18561857

18571858
for (size_t i = 0; i < nargs; i++) {

0 commit comments

Comments
 (0)