Merge branch 'master' into develop

This commit is contained in:
Joshua Suskalo 2021-09-30 15:33:17 -05:00
commit b543b013df
3 changed files with 21 additions and 13 deletions

View file

@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. This change
## [Unreleased] ## [Unreleased]
## [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 ## [0.1.176] - 2021-09-29
### Fixed ### Fixed
- Usage of `defcfn` without a docstring produced an invalid `def` form - Usage of `defcfn` without a docstring produced an invalid `def` form
@ -17,6 +23,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 functions
- Support for serializing and deserializing arbitrary Clojure data structures - Support for serializing and deserializing arbitrary Clojure data structures
[Unreleased]: https://github.com/IGJoshua/coffi/compare/v0.1.176...HEAD [Unreleased]: https://github.com/IGJoshua/coffi/compare/v0.1.184...HEAD
[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.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 [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`: `:deps` key of your `deps.edn`:
```clojure ```clojure
org.suskalo/coffi {:mvn/version "0.1.176"} org.suskalo/coffi {:mvn/version "0.1.184"}
io.github.IGJoshua/coffi {:git/tag "v0.1.176" :git/sha "2a90bdb"} 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 If you use this library as a git dependency, you will need to prepare the

View file

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