Fix bug where primitive arg optimizations weren't applied to cfn
This commit is contained in:
parent
2ff4d9ba52
commit
aa93014f83
2 changed files with 6 additions and 10 deletions
|
|
@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This change
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- All-primitive method types still used serialization when called from `cfn`
|
||||||
- Arrays deserialized to non-vector sequences
|
- Arrays deserialized to non-vector sequences
|
||||||
- Non-primitive argument types fail to link
|
- Non-primitive argument types fail to link
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,10 @@
|
||||||
(-> symbol
|
(-> symbol
|
||||||
ensure-address
|
ensure-address
|
||||||
(make-downcall args ret)
|
(make-downcall args ret)
|
||||||
(make-serde-wrapper args ret)))
|
(cond->
|
||||||
|
(every? #(= % (mem/primitive-type %))
|
||||||
|
(cons ret args))
|
||||||
|
(make-serde-wrapper args ret))))
|
||||||
|
|
||||||
(defn vacfn-factory
|
(defn vacfn-factory
|
||||||
"Constructs a varargs factory to call the native function referenced by `symbol`.
|
"Constructs a varargs factory to call the native function referenced by `symbol`.
|
||||||
|
|
@ -548,7 +551,6 @@
|
||||||
args-types (gensym "args-types")
|
args-types (gensym "args-types")
|
||||||
ret-type (gensym "ret-type")
|
ret-type (gensym "ret-type")
|
||||||
address (gensym "symbol")
|
address (gensym "symbol")
|
||||||
invoke (gensym "invoke")
|
|
||||||
native-sym (gensym "native")
|
native-sym (gensym "native")
|
||||||
[arity fn-tail] (-> args :wrapper :fn-tail)
|
[arity fn-tail] (-> args :wrapper :fn-tail)
|
||||||
fn-tail (case arity
|
fn-tail (case arity
|
||||||
|
|
@ -562,14 +564,7 @@
|
||||||
`(let [~args-types ~(:native-arglist args)
|
`(let [~args-types ~(:native-arglist args)
|
||||||
~ret-type ~(:return-type args)
|
~ret-type ~(:return-type args)
|
||||||
~address (find-symbol ~(name (:symbol args)))
|
~address (find-symbol ~(name (:symbol args)))
|
||||||
~invoke (make-downcall ~address ~args-types ~ret-type)
|
~native-sym (cfn ~address ~args-types ~ret-type)
|
||||||
~(or (-> args :wrapper :native-fn) native-sym)
|
|
||||||
~(if (and (every? #(= % (mem/primitive-type %))
|
|
||||||
(:native-arglist args))
|
|
||||||
(= (:return-type args)
|
|
||||||
(mem/primitive-type (:return-type args))))
|
|
||||||
invoke
|
|
||||||
`(make-serde-wrapper ~invoke ~args-types ~ret-type))
|
|
||||||
fun# ~(if (:wrapper args)
|
fun# ~(if (:wrapper args)
|
||||||
`(fn ~(:name args)
|
`(fn ~(:name args)
|
||||||
~@fn-tail)
|
~@fn-tail)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue