Merge branch 'develop'

This commit is contained in:
Joshua Suskalo 2021-10-14 13:19:20 -05:00
commit af5cb01924
2 changed files with 15 additions and 7 deletions

View file

@ -1,6 +1,10 @@
# Change Log
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
## [Unreleased]
### Fixed
- Incorrect inline expansion of `make-serde-wrapper` in cases where a function has no arguments
## [0.1.241] - 2021-10-14
### Performance
- Added an `:inline` function to `make-serde-wrapper` to remove serialization overhead on primitives
@ -55,6 +59,7 @@ All notable changes to this project will be documented in this file. This change
- Support for serializing and deserializing arbitrary Clojure functions
- Support for serializing and deserializing arbitrary Clojure data structures
[Unreleased]: https://github.com/IGJoshua/coffi/compare/v0.1.241...HEAD
[0.1.241]: https://github.com/IGJoshua/coffi/compare/v0.1.220...v0.1.241
[0.1.220]: https://github.com/IGJoshua/coffi/compare/v0.1.205...v0.1.220
[0.1.205]: https://github.com/IGJoshua/coffi/compare/v0.1.192...v0.1.205

View file

@ -305,10 +305,12 @@
nil))
(list sym `(mem/serialize ~sym ~type ~scope))))
arg-syms arg-types)
wrap-scope (fn [expr]
`(with-open [~scope (mem/stack-scope)]
~expr))
wrap-serialize (fn [expr]
`(with-open [~scope (mem/stack-scope)]
(let [~@(mapcat identity serialize-args)]
~expr)))
`(let [~@(mapcat identity serialize-args)]
~expr))
native-fn (fn [expr]
`(fn ~'native-fn [~@arg-syms]
~expr))
@ -321,6 +323,7 @@
primitive-ret?
(-> (cons downcall-sym arg-syms)
wrap-serialize
wrap-scope
native-fn)
:else
@ -336,12 +339,12 @@
const-ret?)
(native-fn (if (mem/primitive-type ret-type)
prim-call
non-prim-call))
(wrap-scope non-prim-call)))
none-to-serialize?
(if (mem/primitive-type ~ret)
~(native-fn prim-call)
~(native-fn non-prim-call))
`(if (mem/primitive-type ~ret)
~(native-fn prim-call)
~(native-fn (wrap-scope non-prim-call)))
const-ret?
(native-fn (wrap-serialize