Fix incorrect serdes around upcalls
This commit is contained in:
parent
284b76255a
commit
3f6203b5d3
1 changed files with 11 additions and 1 deletions
|
|
@ -907,12 +907,22 @@
|
||||||
[_type]
|
[_type]
|
||||||
::pointer)
|
::pointer)
|
||||||
|
|
||||||
|
(defn- upcall-serde-wrapper
|
||||||
|
"Creates a function that wraps `f` which deserializes the arguments and
|
||||||
|
serializes the return type in the [[global-scope]]."
|
||||||
|
[f arg-types ret-type]
|
||||||
|
(fn [& args]
|
||||||
|
(serialize
|
||||||
|
(apply f (map deserialize args arg-types))
|
||||||
|
ret-type
|
||||||
|
(global-scope))))
|
||||||
|
|
||||||
(defmethod serialize* ::fn
|
(defmethod serialize* ::fn
|
||||||
[f [_fn arg-types ret-type & {:keys [wrap-serde?]}] scope]
|
[f [_fn arg-types ret-type & {:keys [wrap-serde?]}] scope]
|
||||||
(.upcallStub
|
(.upcallStub
|
||||||
(CLinker/getInstance)
|
(CLinker/getInstance)
|
||||||
(cond-> f
|
(cond-> f
|
||||||
wrap-serde? (make-serde-wrapper arg-types ret-type)
|
wrap-serde? (upcall-serde-wrapper arg-types ret-type)
|
||||||
:always (upcall-handle arg-types ret-type))
|
:always (upcall-handle arg-types ret-type))
|
||||||
(function-descriptor arg-types ret-type)
|
(function-descriptor arg-types ret-type)
|
||||||
scope))
|
scope))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue