Fix tail call synthesis

This commit is contained in:
Théophile Bastian 2019-06-11 03:22:22 +02:00
parent 3b2cad0dc4
commit ec75b2fc92

View file

@ -524,7 +524,13 @@ let process_jmp jmp (cur_reg: reg_pos)
in in
match (BStd.Jmp.kind jmp) with match (BStd.Jmp.kind jmp) with
| BStd.Call call -> gen_change (-8) | BStd.Call call -> (
(* If this call never returns (tail call), do not generate an offset of
-8. *)
match BStd.Call.return call with
| Some _ -> gen_change (-8)
| None -> None
)
| BStd.Ret ret -> gen_change (8) | BStd.Ret ret -> gen_change (8)
| _ -> None | _ -> None