Merge branch 'hotfix/v0.1.176'

This commit is contained in:
Joshua Suskalo 2021-09-30 15:31:41 -05:00
commit 918268331e
3 changed files with 20 additions and 12 deletions

View file

@ -1,6 +1,12 @@
# 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/).
## [0.1.184] - 2021-09-30
### Fixed
- Deserializing nullpointers as functions threw an exception
- Upcall stubs with non-primitive arguments failed to compile
- Upcall stubs had incorrect types
## [0.1.176] - 2021-09-29
### Fixed
- Usage of `defcfn` without a docstring produced an invalid `def` form
@ -15,5 +21,6 @@ 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
[0.1.184]: https://github.com/IGJoshua/coffi/compare/v0.1.176...v0.1.184
[0.1.176]: https://github.com/IGJoshua/coffi/compare/v0.1.169...v0.1.176
[0.1.169]: https://github.com/IGJoshua/coffi/compare/16f56bc31d69142ec4d2fb61b15b069d78b127ca...v0.1.169

View file

@ -17,8 +17,8 @@ This library is available on Clojars. Add one of the following entries to the
`:deps` key of your `deps.edn`:
```clojure
org.suskalo/coffi {:mvn/version "0.1.176"}
io.github.IGJoshua/coffi {:git/tag "v0.1.176" :git/sha "2a90bdb"}
org.suskalo/coffi {:mvn/version "0.1.184"}
io.github.IGJoshua/coffi {:git/tag "v0.1.184" :git/sha "ea53cfb"}
```
If you use this library as a git dependency, you will need to prepare the

View file

@ -314,13 +314,13 @@
[:return]]}
{:name :upcall
:flags #{:public}
:desc (conj (mapv mem/java-layout arg-types)
(mem/java-layout ret-type))
:desc (conj (mapv insn-layout arg-types)
(insn-layout ret-type))
:emit [[:aload 0]
[:getfield :this "upcall_ifn" IFn]
(map-indexed
(fn [idx arg]
[[(load-instructions arg) (inc idx)]
[[(load-instructions arg :aload) (inc idx)]
(to-object-asm arg)])
arg-types)
[:invokeinterface IFn "invoke" (repeat (inc (count arg-types)) Object)]
@ -367,13 +367,14 @@
(defmethod mem/deserialize* ::fn
[addr [_fn arg-types ret-type & {:keys [raw-fn?]}]]
(when-not (mem/null? addr)
(-> addr
(downcall-handle
(method-type arg-types ret-type)
(function-descriptor arg-types ret-type))
(downcall-fn arg-types ret-type)
(cond->
(not raw-fn?) (make-serde-wrapper arg-types ret-type))))
(not raw-fn?) (make-serde-wrapper arg-types ret-type)))))
;;; Static memory access