Merge branch 'develop'
This commit is contained in:
commit
44bd08ca2f
4 changed files with 28 additions and 8 deletions
|
|
@ -1,6 +1,11 @@
|
||||||
# Change Log
|
# 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/).
|
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
|
||||||
|
- Long and double arguments to upcalls failed to compile in some cases
|
||||||
|
- Void return types on upcalls would crash on serialization
|
||||||
|
|
||||||
## [0.1.251] - 2021-10-14
|
## [0.1.251] - 2021-10-14
|
||||||
### Fixed
|
### Fixed
|
||||||
- Bug with the inline expansion of `make-serde-wrapper`, make it more maintainable
|
- Bug with the inline expansion of `make-serde-wrapper`, make it more maintainable
|
||||||
|
|
@ -63,6 +68,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.251...HEAD
|
||||||
[0.1.251]: https://github.com/IGJoshua/coffi/compare/v0.1.246...v0.1.251
|
[0.1.251]: https://github.com/IGJoshua/coffi/compare/v0.1.246...v0.1.251
|
||||||
[0.1.246]: https://github.com/IGJoshua/coffi/compare/v0.1.241...v0.1.246
|
[0.1.246]: https://github.com/IGJoshua/coffi/compare/v0.1.241...v0.1.246
|
||||||
[0.1.241]: https://github.com/IGJoshua/coffi/compare/v0.1.220...v0.1.241
|
[0.1.241]: https://github.com/IGJoshua/coffi/compare/v0.1.220...v0.1.241
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
[clojure.tools.build.api :as b]))
|
[clojure.tools.build.api :as b]))
|
||||||
|
|
||||||
(def lib-coord 'org.suskalo/coffi)
|
(def lib-coord 'org.suskalo/coffi)
|
||||||
(def version (format "0.1.%s" (b/git-count-revs nil)))
|
(def version (format "0.2.%s" (b/git-count-revs nil)))
|
||||||
|
|
||||||
(def resource-dirs ["resources/"])
|
(def resource-dirs ["resources/"])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -459,6 +459,10 @@
|
||||||
::mem/double :dreturn
|
::mem/double :dreturn
|
||||||
::mem/void :return})
|
::mem/void :return})
|
||||||
|
|
||||||
|
(def ^:private double-sized?
|
||||||
|
"Set of primitive types which require 2 indices in the constant pool."
|
||||||
|
#{::mem/double ::mem/long ::mem/long-long})
|
||||||
|
|
||||||
(defn- upcall-class
|
(defn- upcall-class
|
||||||
"Constructs a class definition for a class with a single method, `upcall`, which
|
"Constructs a class definition for a class with a single method, `upcall`, which
|
||||||
boxes any primitives passed to it and calls a closed over [[IFn]]."
|
boxes any primitives passed to it and calls a closed over [[IFn]]."
|
||||||
|
|
@ -482,11 +486,18 @@
|
||||||
(insn-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
|
(loop [types arg-types
|
||||||
(fn [idx arg]
|
acc []
|
||||||
[[(load-instructions (mem/primitive-type arg) :aload) (inc idx)]
|
idx 1]
|
||||||
(to-object-asm arg)])
|
(if (seq types)
|
||||||
arg-types)
|
(let [prim (mem/primitive-type (first types))]
|
||||||
|
(recur (rest types)
|
||||||
|
(conj acc [[(load-instructions prim) idx]
|
||||||
|
(to-object-asm (first types))])
|
||||||
|
(cond-> (inc idx)
|
||||||
|
(double-sized? prim)
|
||||||
|
inc)))
|
||||||
|
acc))
|
||||||
[:invokeinterface IFn "invoke" (repeat (inc (count arg-types)) Object)]
|
[:invokeinterface IFn "invoke" (repeat (inc (count arg-types)) Object)]
|
||||||
(to-prim-asm ret-type)
|
(to-prim-asm ret-type)
|
||||||
[(return-for-type ret-type :areturn)]]}]})
|
[(return-for-type ret-type :areturn)]]}]})
|
||||||
|
|
@ -538,8 +549,7 @@
|
||||||
(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)))
|
|
||||||
assoc ::address addr)))
|
assoc ::address addr)))
|
||||||
|
|
||||||
;;; Static memory access
|
;;; Static memory access
|
||||||
|
|
|
||||||
|
|
@ -417,6 +417,10 @@
|
||||||
obj)
|
obj)
|
||||||
(MemoryAddress/NULL)))
|
(MemoryAddress/NULL)))
|
||||||
|
|
||||||
|
(defmethod serialize* ::void
|
||||||
|
[_obj _type _scope]
|
||||||
|
nil)
|
||||||
|
|
||||||
(defmulti serialize-into
|
(defmulti serialize-into
|
||||||
"Writes a serialized version of the `obj` to the given `segment`.
|
"Writes a serialized version of the `obj` to the given `segment`.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue