MCPcopy Create free account
hub / github.com/GJDuck/e9patch / optimizeAllJumps

Function optimizeAllJumps

src/e9patch/e9optimize.cpp:279–300  ·  view source on GitHub ↗

* Optimize all jumps in the binary. */

Source from the content-addressed store, hash-verified

277 * Optimize all jumps in the binary.
278 */
279void optimizeAllJumps(Binary *B)
280{
281 if (!option_Opeephole)
282 return;
283
284 for (const auto &J: B->Js)
285 optimizeJump(B, J.addr, J.bytes, J.size);
286 B->Js.clear();
287
288 for (Instr *I = B->Is.front(); I != nullptr; I = I->next())
289 {
290 if (I->is_patched)
291 continue;
292 bool ok = true;
293 for (size_t i = 0; ok && i < I->size; i++)
294 ok = (I->STATE[i] == STATE_INSTRUCTION);
295 if (!ok)
296 continue;
297
298 optimizeJump(B, I->addr, I->PATCH, I->size);
299 }
300}
301

Callers 1

parseEmitFunction · 0.85

Calls 3

optimizeJumpFunction · 0.85
frontMethod · 0.80
nextMethod · 0.80

Tested by

no test coverage detected