Skip to content

Commit

Permalink
Fix delivery of unhandled effect exceptions on s390x (ocaml#12486)
Browse files Browse the repository at this point in the history
Delivery of Effect.Unhandled and Effect.Continuation_already_resumed
(through caml_raise_unhandled_effect and caml_raise_continuation_already_resumed
 respectively) should not assume anything about the stack it runs on and thus
should not bypass the first few instructions of caml_c_call.
  • Loading branch information
dustanddreams committed Sep 4, 2023
1 parent 221c769 commit 9a83067
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Changes
Expand Up @@ -331,6 +331,9 @@ Working version
- #12949: open shadowing mistriggers
(Gabriel Scherer, review by Florian Angeletti, report by Andreas Rossberg)

- #12486: Fix delivery of unhandled effect exceptions on s390x
(Miod Vallat, report by Jan Midtgaard)

OCaml 5.1.0
---------------

Expand Down
6 changes: 4 additions & 2 deletions runtime/s390x.S
Expand Up @@ -753,7 +753,7 @@ LBL(112):
SWITCH_OCAML_STACKS(%r9, %r8)
/* No parent stack. Raise Unhandled. */
LEA_VAR(caml_raise_unhandled_effect, ADDITIONAL_ARG)
brcl 15, LBL(caml_c_call)
brcl 15, GCALL(caml_c_call)
CFI_ENDPROC
ENDFUNCTION(G(caml_perform))

Expand Down Expand Up @@ -795,7 +795,7 @@ LBL(caml_resume_1):
br %r5
LBL(caml_resume_2):
LEA_VAR(caml_raise_continuation_already_resumed, ADDITIONAL_ARG)
brcl 15, LBL(caml_c_call)
brcl 15, G(caml_c_call)
CFI_ENDPROC
ENDFUNCTION(G(caml_resume))

Expand Down Expand Up @@ -891,6 +891,8 @@ CFI_STARTPROC
CFI_OFFSET(14, -168)
ENTER_FUNCTION
LEA_VAR(caml_array_bound_error_asm, ADDITIONAL_ARG)
/* Note the following jumps in the middle of caml_c_call, since stack
has already been adjusted. */
brcl 15, LBL(caml_c_call)
CFI_ENDPROC
ENDFUNCTION(G(caml_ml_array_bound_error))
Expand Down

0 comments on commit 9a83067

Please sign in to comment.