Skip to content

Record the Go signature each generated wrapper is emitted with - #23

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/generated-object-layer
Sep 3, 2026
Merged

Record the Go signature each generated wrapper is emitted with#23
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/generated-object-layer

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

A caller of a generated wrapper needs the shape the generator CHOSE, and that
shape is not the C parameter list. tbool_value_at_timestamptz declares four C
parameters while the emitted wrapper takes three, folding the bool *value
out-parameter into a second result; an array and its length collapse into one
slice; a char * becomes a string. Anything reading the catalog C signature
to call these wrappers reconstructs a shape they do not have.

SIGNATURES states what the generator emits: each MEOS C name mapped to the Go
name, the parameters and the result types, recorded at the two sites that
assemble a signature. A function absent from it has no wrapper to call, which is
the honest answer rather than a guess.

It is the piece the object layer consumes, so the two generators cannot disagree
about a folded out-parameter -- the same split MEOS.NET keeps between
tools/codegen.py and tools/objectgen.py.

MEASURED: 3562 wrappers emitted, 3562 recorded, so the map is total over the
emitted surface rather than a subset. Regenerating from one catalog with and
without this commit yields 15 files on each side and a diff of 0 lines over
41653 lines of generated Go, so the emitted package does not move. The baseline
run carries no SIGNATURES attribute, which is what makes it a control rather
than a second run of the same code.

The change is confined to the Python generator and its Go output is
byte-identical, so it carries no compilable change.

A caller of a generated wrapper needs the shape the generator CHOSE, and that
shape is not the C parameter list. `tbool_value_at_timestamptz` declares four C
parameters while the emitted wrapper takes three, folding the `bool *value`
out-parameter into a second result; an array and its length collapse into one
slice; a `char *` becomes a `string`. Anything reading the catalog C signature
to call these wrappers reconstructs a shape they do not have.

`SIGNATURES` states what the generator emits: each MEOS C name mapped to the Go
name, the parameters and the result types, recorded at the two sites that
assemble a signature. A function absent from it has no wrapper to call, which is
the honest answer rather than a guess.

It is the piece the object layer consumes, so the two generators cannot disagree
about a folded out-parameter -- the same split MEOS.NET keeps between
`tools/codegen.py` and `tools/objectgen.py`.

MEASURED: 3562 wrappers emitted, 3562 recorded, so the map is total over the
emitted surface rather than a subset. Regenerating from one catalog with and
without this commit yields 15 files on each side and a diff of 0 lines over
41653 lines of generated Go, so the emitted package does not move. The baseline
run carries no `SIGNATURES` attribute, which is what makes it a control rather
than a second run of the same code.

The change is confined to the Python generator and its Go output is
byte-identical, so it carries no compilable change.
@estebanzimanyi
estebanzimanyi merged commit 2b7377c into MobilityDB:main Sep 3, 2026
2 checks passed
@estebanzimanyi
estebanzimanyi deleted the feat/generated-object-layer branch September 3, 2026 16:45
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