Add a function's address to the metadata of deserialized functions

This commit is contained in:
Joshua Suskalo 2021-09-30 15:40:55 -05:00
parent b543b013df
commit 5ab2bae1fa
2 changed files with 11 additions and 7 deletions

View file

@ -2,6 +2,8 @@
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]
### Added
- An `::ffi/address` key to deserialized function pointers' metadata
## [0.1.184] - 2021-09-30
### Fixed

View file

@ -368,13 +368,15 @@
(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)))))
(vary-meta
(-> 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)))
assoc ::address addr)))
;;; Static memory access