Fix bug with inlined serdes causing complex pointer serdes to fail
This commit is contained in:
parent
75bbe11971
commit
fa40902ce9
2 changed files with 13 additions and 3 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 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -251,9 +251,18 @@
|
||||||
;; argument is not converted to [[MemoryAddress/NULL]] if it's
|
;; argument is not converted to [[MemoryAddress/NULL]] if it's
|
||||||
;; considered primitive.
|
;; considered primitive.
|
||||||
simple-args? (when const-args?
|
simple-args? (when const-args?
|
||||||
(every? mem/primitive? arg-types))
|
(and (every? mem/primitive? arg-types)
|
||||||
|
;; NOTE(Joshua): Pointer types with serdes (e.g. [::mem/pointer ::mem/int])
|
||||||
|
;; still require a scope, making them not qualify as "simple".
|
||||||
|
(every? keyword? (filter (comp #{::mem/pointer} mem/primitive-type) arg-types))))
|
||||||
const-ret? (s/valid? ::mem/type ret-type)
|
const-ret? (s/valid? ::mem/type ret-type)
|
||||||
primitive-ret? (and const-ret? (or (mem/primitive? ret-type)
|
primitive-ret? (and const-ret?
|
||||||
|
(or (and (mem/primitive? ret-type)
|
||||||
|
;; NOTE(Joshua): Pointer types with serdes require deserializing the
|
||||||
|
;; return value, but don't require passing a scope to the downcall,
|
||||||
|
;; making them cause the return to not be primitive, but it may still
|
||||||
|
;; be "simple".
|
||||||
|
(or (keyword? ret-type) (not (#{::mem/pointer} (mem/primitive-type ret-type)))))
|
||||||
(#{::mem/void} ret-type)))
|
(#{::mem/void} ret-type)))
|
||||||
simple-ret? (and const-ret? (mem/primitive-type ret-type))
|
simple-ret? (and const-ret? (mem/primitive-type ret-type))
|
||||||
no-serde? (and const-args? (empty? arg-types)
|
no-serde? (and const-args? (empty? arg-types)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue