s390x.S: fix errors related to stack backtraces
caml_raise_exception: set caml_backtrace_pos = 0, this is not a reraise caml_ml_array_bound_error: save SP before decrementing it, otherwise it doesn't match the frame descriptor generated by ocamlopt Cleanup: no need to set caml_return_address to 0 on return, that was useful a long time ago but no longer is.master
parent
ca03b4e500
commit
dad58090c6
|
@ -110,6 +110,7 @@ caml_call_gc:
|
|||
.type caml_c_call, @function
|
||||
caml_c_call:
|
||||
Storeglobal(%r15, caml_bottom_of_stack)
|
||||
.L101:
|
||||
/* Save return address */
|
||||
ldgr %f15, %r14
|
||||
/* Get ready to call C function (address in r7) */
|
||||
|
@ -125,10 +126,6 @@ caml_c_call:
|
|||
/* Reload allocation pointer and allocation limit*/
|
||||
Loadglobal(%r11, caml_young_ptr)
|
||||
Loadglobal(%r10, caml_young_limit)
|
||||
/* Say we are back into OCaml code */
|
||||
lgfi %r0, 0
|
||||
Storeglobal(%r0, caml_last_return_address)
|
||||
|
||||
/* Return to caller */
|
||||
br %r14
|
||||
|
||||
|
@ -181,7 +178,7 @@ caml_reraise_exn:
|
|||
.globl caml_raise_exception
|
||||
.type caml_raise_exception, @function
|
||||
caml_raise_exception:
|
||||
Loadglobal32(0, caml_backtrace_active)
|
||||
Loadglobal32(%r0, caml_backtrace_active)
|
||||
cgfi %r0, 0
|
||||
jne .L112
|
||||
.L113:
|
||||
|
@ -189,9 +186,6 @@ caml_raise_exception:
|
|||
Loadglobal(%r15, caml_exception_pointer)
|
||||
Loadglobal(%r11, caml_young_ptr)
|
||||
Loadglobal(%r10, caml_young_limit)
|
||||
/* Say we are back into OCaml code */
|
||||
lgfi %r0, 0
|
||||
Storeglobal(%r0, caml_last_return_address)
|
||||
/* Pop trap frame */
|
||||
lg %r1, 0(%r15)
|
||||
lg %r13, 8(%r15)
|
||||
|
@ -199,7 +193,9 @@ caml_raise_exception:
|
|||
/* Branch to handler */
|
||||
br %r1;
|
||||
.L112:
|
||||
ldgr %f15,%r2 /* preserve exn bucket in callee-save reg */
|
||||
lgfi %r0, 0
|
||||
Storeglobal32(%r0, caml_backtrace_pos)
|
||||
ldgr %f15,%r2 /* preserve exn bucket in callee-save reg */
|
||||
/* arg1: exception bucket, already in r2 */
|
||||
Loadglobal(%r3, caml_last_return_address) /* arg2: PC of raise */
|
||||
Loadglobal(%r4, caml_bottom_of_stack) /* arg3: SP of raise */
|
||||
|
@ -335,9 +331,12 @@ caml_callback3_exn:
|
|||
.globl caml_ml_array_bound_error
|
||||
.type caml_ml_array_bound_error, @function
|
||||
caml_ml_array_bound_error:
|
||||
/* Save return address before decrementing SP, otherwise
|
||||
the frame descriptor for the call site is not correct */
|
||||
Storeglobal(%r15, caml_bottom_of_stack)
|
||||
lay %r15, -160(%r15) /* Reserve stack space for C call */
|
||||
larl %r7, caml_array_bound_error
|
||||
j caml_c_call
|
||||
j .L101
|
||||
.globl caml_system__code_end
|
||||
caml_system__code_end:
|
||||
|
||||
|
|
Loading…
Reference in New Issue