Skip to content

Commit

Permalink
With frame-pointers entertrap restores base pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
fabbing committed Feb 22, 2022
1 parent d480c0c commit 31ca227
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,10 @@ OCaml 4.14.0
- #10907, #10959: Wrong type inferred from existential types
(Jacques Garrigue and Gabriel Scherer, report by @dyzsr, review by Leo White)

- #11031: Exception handlers restore the rbp register when using frame-pointers
on amd64.
(Fabrice Buoro, with help from Stephen Dolan, Tom Kelly and Mark Shinwell,
review by Xavier Leroy)

OCaml 4.13 maintenance branch
-----------------------------
Expand Down
5 changes: 4 additions & 1 deletion asmcomp/amd64/emit.mlp
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,10 @@ let emit_instr env fallthrough i =
done;
emit_named_text_section env.f.fun_name
| Lentertrap ->
()
if fp then begin
let delta = frame_size env - 16 (* retaddr + rbp *) in
I.lea (mem64 NONE delta RSP) rbp
end;
| Ladjust_trap_depth { delta_traps; } ->
(* each trap occupies 16 bytes on the stack *)
let delta = 16 * delta_traps in
Expand Down

0 comments on commit 31ca227

Please sign in to comment.