Skip to content

Commit

Permalink
Fix opcode profiler for synth benchmarks
Browse files Browse the repository at this point in the history
Summary:
If opcode profiler is turned on while running synth benchmarks, there's a compiler error due to type mismatch.

This change adds a dynamic cast of JSI Runtime to Hermes Runtime so opcode profiler would work.

Reviewed By: dulinriley

Differential Revision: D18642058

fbshipit-source-id: b987d297d4bb3881433007d3a371d10c36f97270
  • Loading branch information
Kiwi137 authored and facebook-github-bot committed Nov 22, 2019
1 parent aa6c072 commit 9fd8834
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion API/hermes/TraceInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,11 @@ std::string TraceInterpreter::printStats() {
stats += "\n";
std::string opcodeOutput;
llvm::raw_string_ostream os{opcodeOutput};
rt.dumpOpcodeStats(os);
if (auto *hermesRuntime = dynamic_cast<HermesRuntime *>(&rt)) {
hermesRuntime->dumpOpcodeStats(os);
} else {
throw std::runtime_error("Unable to cast runtime into HermesRuntime");
}
os.flush();
stats += opcodeOutput;
stats += "\n";
Expand Down

0 comments on commit 9fd8834

Please sign in to comment.