Skip to content

Answer every value a call states through an out-parameter - #39

Merged
estebanzimanyi merged 2 commits into
MobilityDB:mainfrom
estebanzimanyi:feat/an-out-parameter-is-an-answer
Sep 3, 2026
Merged

Answer every value a call states through an out-parameter#39
estebanzimanyi merged 2 commits into
MobilityDB:mainfrom
estebanzimanyi:feat/an-out-parameter-is-an-answer

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

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.

`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.
@estebanzimanyi
estebanzimanyi merged commit ba6d79b into MobilityDB:main Sep 3, 2026
1 check passed
@estebanzimanyi
estebanzimanyi deleted the feat/an-out-parameter-is-an-answer branch September 3, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant