summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlain Frisch <alain@frisch.fr>2013-10-15 12:38:11 +0000
committerAlain Frisch <alain@frisch.fr>2013-10-15 12:38:11 +0000
commit784b0b3d6e8fe25326adc60ccc995a96ac8e3fad (patch)
treecf4eae15387650bb09a1d392068b68942c6a735d
parent0efe8df10794c1365fc69cf169be9603206d2127 (diff)
downloadocaml-784b0b3d6e8fe25326adc60ccc995a96ac8e3fad.tar.gz
Support the two variants on i386.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14231 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--asmcomp/i386/emit.mlp11
-rw-r--r--asmrun/i386.S16
2 files changed, 22 insertions, 5 deletions
diff --git a/asmcomp/i386/emit.mlp b/asmcomp/i386/emit.mlp
index ec8ec5d862..9b08aaf8a6 100644
--- a/asmcomp/i386/emit.mlp
+++ b/asmcomp/i386/emit.mlp
@@ -830,11 +830,16 @@ let emit_instr fallthrough i =
` addl ${emit_int (trap_frame_size - 4)}, %esp\n`;
cfi_adjust_cfa_offset (-trap_frame_size);
stack_offset := !stack_offset - trap_frame_size
- | Lraise ->
- if !Clflags.debug then begin
+ | Lraise k ->
+ begin match !Clflags.debug, k with
+ | true, Lambda.Raise_regular ->
` call {emit_symbol "caml_raise_exn"}\n`;
record_frame Reg.Set.empty i.dbg
- end else begin
+ | true, Lambda.Raise_reraise ->
+ ` call {emit_symbol "caml_reraise_exn"}\n`;
+ record_frame Reg.Set.empty i.dbg
+ | false, _
+ | true, Lambda.Raise_notrace ->
` movl {emit_symbol "caml_exception_pointer"}, %esp\n`;
` popl {emit_symbol "caml_exception_pointer"}\n`;
if trap_frame_size > 8 then
diff --git a/asmrun/i386.S b/asmrun/i386.S
index 306c9a5885..f880db2574 100644
--- a/asmrun/i386.S
+++ b/asmrun/i386.S
@@ -339,6 +339,8 @@ FUNCTION(caml_raise_exn)
UNDO_ALIGN_STACK(8)
ret
LBL(110):
+ movl $0, G(caml_backtrace_pos)
+LBL(111):
movl %eax, %esi /* Save exception bucket in esi */
movl G(caml_exception_pointer), %edi /* SP of handler */
movl 0(%esp), %eax /* PC of raise */
@@ -356,19 +358,29 @@ LBL(110):
ret
CFI_ENDPROC
+FUNCTION(caml_reraise_exn)
+ CFI_STARTPROC
+ testl $1, G(caml_backtrace_active)
+ jne LBL(111)
+ movl G(caml_exception_pointer), %esp
+ popl G(caml_exception_pointer); CFI_ADJUST(-4)
+ UNDO_ALIGN_STACK(8)
+ ret
+ CFI_ENDPROC
+
/* Raise an exception from C */
FUNCTION(caml_raise_exception)
CFI_STARTPROC
PROFILE_C
testl $1, G(caml_backtrace_active)
- jne LBL(111)
+ jne LBL(112)
movl 4(%esp), %eax
movl G(caml_exception_pointer), %esp
popl G(caml_exception_pointer); CFI_ADJUST(-4)
UNDO_ALIGN_STACK(8)
ret
-LBL(111):
+LBL(112):
movl 4(%esp), %esi /* Save exception bucket in esi */
ALIGN_STACK(12)
pushl G(caml_exception_pointer); CFI_ADJUST(4) /* 4: sp of handler */