Don't write to NULL after calling C natives returning void.
This commit is contained in:
parent
3ce18d88c5
commit
7ef9e82f51
@ -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 *)
|
||||
|
@ -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)
|
||||
| _ -> ()
|
||||
;;
|
||||
|
||||
|
||||
|
@ -4998,8 +4998,12 @@ let trans_visitor
|
||||
libstr;
|
||||
symstr |];
|
||||
|
||||
abi.Abi.abi_emit_native_call_in_thunk (emitter())
|
||||
out nabi (Il.Cell f) args;
|
||||
abi.Abi.abi_emit_native_call_in_thunk
|
||||
(emitter())
|
||||
(if pointee_type out = Il.NilTy then None else Some out)
|
||||
nabi
|
||||
(Il.Cell f)
|
||||
args;
|
||||
end
|
||||
|
||||
| _ -> bug ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user