Answer every value a call states through an out-parameter - #39
Merged
estebanzimanyi merged 2 commits intoSep 3, 2026
Merged
Conversation
`jsonb_each` and its seven siblings fill an array the CALLER allocates: MEOS writes one `Jsonb *` per member of the object into the storage the parameter points at, and states how many it wrote through the count. The catalog now says so, and the wrappers take that array — `JsonbEach(IntPtr jb, IntPtr values)` answering the keys — instead of allocating one pointer's worth of storage, handing MEOS the address of it, and reading the first pointer MEOS wrote as the address of an array. For an object of more than one member the old shape wrote past its allocation and then walked whatever the first written pointer aimed at. The object layer defers the four methods over that shape. Nothing in a class's signature says how many members the value it is called on has, so a method answering `each` cannot size the array the call needs; the flat wrapper, whose caller holds the value, is where the size is known. The layer emits 1349 methods over 115 classes with 11 deferred. Its own test allocates room for eight, reads the two keys and the two values MEOS wrote, and so states the contract the wrapper now keeps.
MEOS states some answers through a pointer the caller supplies, and the object layer read one of them: the value of a call whose `bool` return says whether it exists. A call stating two — the nearest-neighbour walk, which answers the entry it reached and how far away it is — and a call stating one beside a return of its own — `minBoundingRadius`, which answers the circle's centre and its radius — had no reading and deferred. Every out-parameter is now read back and none appears in the C# signature: the walk answers `(long, double)?`, null where it ends, and the radius answers `(Geo?, double)`. Two pointer parameters are not answers, and the signature says which. A pointer to a MEOS value is that value handed over for the call to fill, as `rtree_search` takes the `MeosArray` it appends to; and a by-pointer count says the call answers a NUMBER of things, so an out-parameter beside one holds as many as the count states rather than one value, which is what `jsonb_each` fills. Both stay ordinary arguments, so the six index searches keep the array they are given and the two `each` methods keep deferring. The layer emits 1352 methods over 115 classes with 8 deferred, against 1349 and 11. Its own test walks an RTree of two boxes from a query at the origin and reads the nearer entry, then the farther one, then the end of the walk.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MEOS states some answers through a pointer the caller supplies, and the object
layer read one of them: the value of a call whose
boolreturn says whether itexists. A call stating two — the nearest-neighbour walk, which answers the entry
it reached and how far away it is — and a call stating one beside a return of
its own —
minBoundingRadius, which answers the circle's centre and its radius— had no reading and deferred. Every out-parameter is now read back and none
appears in the C# signature: the walk answers
(long, double)?, null where itends, and the radius answers
(Geo?, double).Two pointer parameters are not answers, and the signature says which. A pointer
to a MEOS value is that value handed over for the call to fill, as
rtree_searchtakes theMeosArrayit appends to; and a by-pointer count saysthe call answers a NUMBER of things, so an out-parameter beside one holds as
many as the count states rather than one value, which is what
jsonb_eachfills. Both stay ordinary arguments, so the six index searches keep the array
they are given and the two
eachmethods keep deferring.The layer emits 1352 methods over 115 classes with 8 deferred, against 1349 and
11. Its own test walks an RTree of two boxes from a query at the origin and
reads the nearer entry, then the farther one, then the end of the walk.