Fix nullpointer serialization in simpler inline cases
This commit is contained in:
parent
fa40902ce9
commit
036d4112fb
2 changed files with 3 additions and 4 deletions
|
|
@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. This change
|
||||||
- New function to allow getting the backing memory segment of a `coffi.ffi.StaticVariable`, to replace the `Addressable` implementation lost in the migration to JDK 18
|
- New function to allow getting the backing memory segment of a `coffi.ffi.StaticVariable`, to replace the `Addressable` implementation lost in the migration to JDK 18
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- Bug where nil values would not be correctly coerced to null pointers when passed to inlined functions
|
||||||
- Bug where inline serde functions would fail on complex pointer types
|
- Bug where inline serde functions would fail on complex pointer types
|
||||||
- Bug where padding in structs may be increased when fields have alignments less than their size
|
- Bug where padding in structs may be increased when fields have alignments less than their size
|
||||||
- Bug where pointer alignment was incorrectly defined
|
- Bug where pointer alignment was incorrectly defined
|
||||||
|
|
|
||||||
|
|
@ -247,9 +247,6 @@
|
||||||
[downcall arg-types ret-type]
|
[downcall arg-types ret-type]
|
||||||
(let [;; Complexity of types
|
(let [;; Complexity of types
|
||||||
const-args? (or (vector? arg-types) (nil? arg-types))
|
const-args? (or (vector? arg-types) (nil? arg-types))
|
||||||
;; FIXME(Joshua): there's a potential bug where `nil` as a pointer
|
|
||||||
;; argument is not converted to [[MemoryAddress/NULL]] if it's
|
|
||||||
;; considered primitive.
|
|
||||||
simple-args? (when const-args?
|
simple-args? (when const-args?
|
||||||
(and (every? mem/primitive? arg-types)
|
(and (every? mem/primitive? arg-types)
|
||||||
;; NOTE(Joshua): Pointer types with serdes (e.g. [::mem/pointer ::mem/int])
|
;; NOTE(Joshua): Pointer types with serdes (e.g. [::mem/pointer ::mem/int])
|
||||||
|
|
@ -300,8 +297,9 @@
|
||||||
(not (#{::mem/pointer} (mem/primitive-type type))))
|
(not (#{::mem/pointer} (mem/primitive-type type))))
|
||||||
(list (primitive-cast-sym (mem/primitive-type type)) sym)
|
(list (primitive-cast-sym (mem/primitive-type type)) sym)
|
||||||
|
|
||||||
|
;; cast null pointers to something understood by panama
|
||||||
(#{::mem/pointer} type)
|
(#{::mem/pointer} type)
|
||||||
nil
|
`(or ~sym (MemoryAddress/NULL))
|
||||||
|
|
||||||
(mem/primitive-type type)
|
(mem/primitive-type type)
|
||||||
`(mem/serialize* ~sym ~type-sym ~scope)
|
`(mem/serialize* ~sym ~type-sym ~scope)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue