aboutsummaryrefslogtreecommitdiff
path: root/src/boot/be
diff options
context:
space:
mode:
authorRoy Frostig <[email protected]>2010-07-25 21:27:28 -0700
committerRoy Frostig <[email protected]>2010-07-25 21:27:28 -0700
commit7ef9e82f51de73e89759910fd1b45ce5ccc363b3 (patch)
tree6a5575cb416ae20feaa18a4cf642c176eebf0389 /src/boot/be
parentAnother quick fix from jmuizelaar for that "some ocaml versions dont't notice... (diff)
downloadrust-7ef9e82f51de73e89759910fd1b45ce5ccc363b3.tar.xz
rust-7ef9e82f51de73e89759910fd1b45ce5ccc363b3.zip
Don't write to NULL after calling C natives returning void.
Diffstat (limited to 'src/boot/be')
-rw-r--r--src/boot/be/abi.ml2
-rw-r--r--src/boot/be/x86.ml9
2 files changed, 7 insertions, 4 deletions
diff --git a/src/boot/be/abi.ml b/src/boot/be/abi.ml
index 8084c7cf..975ff032 100644
--- a/src/boot/be/abi.ml
+++ b/src/boot/be/abi.ml
@@ -149,7 +149,7 @@ type abi =
-> unit);
abi_emit_native_call_in_thunk: (Il.emitter
- -> Il.cell (* ret *)
+ -> Il.cell option (* ret *)
-> Common.nabi
-> Il.operand (* callee *)
-> Il.operand array (* args *)
diff --git a/src/boot/be/x86.ml b/src/boot/be/x86.ml
index d5541eb1..0d0206d7 100644
--- a/src/boot/be/x86.ml
+++ b/src/boot/be/x86.ml
@@ -700,7 +700,7 @@ let emit_native_void_call
let emit_native_call_in_thunk
(e:Il.emitter)
- (ret:Il.cell)
+ (ret:Il.cell option)
(nabi:nabi)
(fn:Il.operand)
(args:Il.operand array)
@@ -734,9 +734,12 @@ let emit_native_call_in_thunk
end;
match ret with
- Il.Reg (r, _) -> mov (word_at r) (ro eax)
- | _ -> mov (rc edx) (c ret);
+ Some (Il.Reg (r, _)) ->
+ mov (word_at r) (ro eax)
+ | Some ret ->
+ mov (rc edx) (c ret);
mov (word_at (h edx)) (ro eax)
+ | _ -> ()
;;