diff options
| author | Alain Frisch <alain@frisch.fr> | 2013-10-15 13:09:01 +0000 |
|---|---|---|
| committer | Alain Frisch <alain@frisch.fr> | 2013-10-15 13:09:01 +0000 |
| commit | f2597364a29d64bec722a2e7125c4e3f5fa5f01c (patch) | |
| tree | e5f1639005c85b286dbfd9f23fcb5a7c282c2d27 | |
| parent | 784b0b3d6e8fe25326adc60ccc995a96ac8e3fad (diff) | |
| download | ocaml-f2597364a29d64bec722a2e7125c4e3f5fa5f01c.tar.gz | |
Support the two variants on i386, intel syntax (i.e. Win32 msvc port).
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/raise_variants@14232 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
| -rw-r--r-- | asmcomp/i386/emit_nt.mlp | 12 | ||||
| -rw-r--r-- | asmrun/i386nt.asm | 18 |
2 files changed, 24 insertions, 6 deletions
diff --git a/asmcomp/i386/emit_nt.mlp b/asmcomp/i386/emit_nt.mlp index b233f818b4..dd340858f9 100644 --- a/asmcomp/i386/emit_nt.mlp +++ b/asmcomp/i386/emit_nt.mlp @@ -769,11 +769,16 @@ let emit_instr i = ` pop _caml_exception_pointer\n`; ` add esp, 4\n`; stack_offset := !stack_offset - 8 - | Lraise -> - if !Clflags.debug then begin + | Lraise k -> + begin match !Clflags.debug, k with + | true, Lambda.Raise_regular -> ` call _caml_raise_exn\n`; record_frame Reg.Set.empty i.dbg - end else begin + | true, Lambda.Raise_reraise -> + ` call _caml_reraise_exn\n`; + record_frame Reg.Set.empty i.dbg + | false, _ + | true, Lambda.Raise_notrace -> ` mov esp, _caml_exception_pointer\n`; ` pop _caml_exception_pointer\n`; ` ret\n` @@ -861,6 +866,7 @@ let begin_assembly() = ` EXTERN _caml_alloc3: PROC\n`; ` EXTERN _caml_ml_array_bound_error: PROC\n`; ` EXTERN _caml_raise_exn: PROC\n`; + ` EXTERN _caml_reraise_exn: PROC\n`; ` .DATA\n`; let lbl_begin = Compilenv.make_symbol (Some "data_begin") in add_def_symbol lbl_begin; diff --git a/asmrun/i386nt.asm b/asmrun/i386nt.asm index d74497413f..61ec34162f 100644 --- a/asmrun/i386nt.asm +++ b/asmrun/i386nt.asm @@ -27,6 +27,7 @@ EXTERN _caml_last_return_address: DWORD EXTERN _caml_gc_regs: DWORD EXTERN _caml_exception_pointer: DWORD + EXTERN _caml_backtrace_pos: DWORD EXTERN _caml_backtrace_active: DWORD EXTERN _caml_stash_backtrace: PROC @@ -205,6 +206,8 @@ _caml_raise_exn: pop _caml_exception_pointer ret L110: + mov _caml_backtrace_pos, 0 +L111: mov esi, eax ; Save exception bucket in esi mov edi, _caml_exception_pointer ; SP of handler mov eax, [esp] ; PC of raise @@ -219,18 +222,27 @@ L110: pop _caml_exception_pointer ret -; Raise an exception from C + PUBLIC _caml_reraise_exn + ALIGN 4 +_caml_reraise_exn: + test _caml_backtrace_active, 1 + jne L111 + mov esp, _caml_exception_pointer + pop _caml_exception_pointer + ret + + ; Raise an exception from C PUBLIC _caml_raise_exception ALIGN 4 _caml_raise_exception: test _caml_backtrace_active, 1 - jne L111 + jne L112 mov eax, [esp+4] mov esp, _caml_exception_pointer pop _caml_exception_pointer ret -L111: +L112: mov esi, [esp+4] ; Save exception bucket in esi push _caml_exception_pointer ; arg 4: SP of handler push _caml_bottom_of_stack ; arg 3: SP of raise |
