Implement the macro in terms of invokeWithArguments

This commit is contained in:
Joshua Suskalo 2021-09-16 14:10:28 -05:00
parent 9aa608a254
commit 6801c7735e

View file

@ -467,10 +467,16 @@
(find-symbol ~(name (:symbol args))) (find-symbol ~(name (:symbol args)))
(method-type args-types# ret-type#) (method-type args-types# ret-type#)
(function-descriptor args-types# ret-type#)) (function-descriptor args-types# ret-type#))
~(:name args) (fn [& args#] ~(:name args) (fn [~@arg-syms]
(with-open [~scope (stack-scope)] (with-open [~scope (stack-scope)]
(let [[~@arg-syms] (map #(serialize ))] (let [args# (map #(serialize %1 %2 ~scope)
(.invoke downcall# ~@arg-syms)))) [~@arg-syms]
args-types#)]
;; TODO(Joshua): Rewrite this to use jgpc42/insn
;; to generate bytecode for a proper invoke for
;; an instant performance boost
(deserialize (.invokeWithArguments downcall# (object-array args#))
ret-type#))))
fun# ~(if (:fn-tail args) fun# ~(if (:fn-tail args)
`(fn ~(-> args :fn-tail :arglist) `(fn ~(-> args :fn-tail :arglist)
~@(-> args :fn-tail :body)) ~@(-> args :fn-tail :body))