Skip to content

Adopt zero-length interface members from Objectively - #6

Merged
jdolan merged 3 commits into
mainfrom
zero-length-interface
Sep 2, 2026
Merged

Adopt zero-length interface members from Objectively#6
jdolan merged 3 commits into
mainfrom
zero-length-interface

Conversation

@jdolan

@jdolan jdolan commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Mechanical follow-through of jdolan/Objectively#41, which removes the per-instance interface pointer: $ now resolves the interface through Object::clazz, and the struct member exists only so typeof can name the interface type. ClassDef.interfaceOffset no longer exists.

Two edits per class, no call-site changes:

  • XInterface *interface;XInterface *interface[0]; (15 classes + Copilot guidance)
  • .interfaceOffset = offsetof(X, interface), removed from each ClassDef

Verified: builds clean (0 warnings) against Objectively zero-length-interface installed to /usr/local; Examples/Hello and Examples/HelloCompute build. ObjectivelyGPU has no make check suite.

Depends on jdolan/Objectively#41 being installed first. ObjectivelyMVC follows on top of this.

🤖 Generated with Claude Code

Objectively no longer stores an interface pointer on each instance; `$` resolves
the interface through Object::clazz, and the struct member exists only to carry a
type for typeof. ClassDef.interfaceOffset is gone. Follow suit: each instance
struct's interface member becomes a zero-length array, and each ClassDef drops
interfaceOffset. No call sites change.

See jdolan/Objectively#41.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 2, 2026 23:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are consistent across all affected classes, remove all interfaceOffset usage, and no remaining per-instance ->interface accesses were found.

Pull request overview

Aligns ObjectivelyGPU’s class layouts with the updated Objectively runtime (jdolan/Objectively#41) by removing per-instance interface pointers and relying on Object::clazz for vtable resolution, while keeping a zero-length interface member solely for typeof/type naming.

Changes:

  • Replace per-instance XInterface *interface; members with XInterface *interface[0]; across all ObjectivelyGPU classes.
  • Remove .interfaceOffset = offsetof(X, interface), from each ClassDef initializer (field no longer exists upstream).
  • Update .github/copilot-instructions.md to document the new class-layout pattern.
File summaries
File Description
Sources/ObjectivelyGPU/TransferBuffer.h Switch interface member to zero-length array; clarify Doxygen brief.
Sources/ObjectivelyGPU/TransferBuffer.c Remove ClassDef.interfaceOffset initializer entry.
Sources/ObjectivelyGPU/Texture.h Switch interface member to zero-length array; clarify Doxygen brief.
Sources/ObjectivelyGPU/Texture.c Remove ClassDef.interfaceOffset initializer entry.
Sources/ObjectivelyGPU/Shader.h Switch interface member to zero-length array; clarify Doxygen brief.
Sources/ObjectivelyGPU/Shader.c Remove ClassDef.interfaceOffset initializer entry.
Sources/ObjectivelyGPU/Sampler.h Switch interface member to zero-length array; clarify Doxygen brief.
Sources/ObjectivelyGPU/Sampler.c Remove ClassDef.interfaceOffset initializer entry.
Sources/ObjectivelyGPU/RenderPass.h Switch interface member to zero-length array; clarify Doxygen brief.
Sources/ObjectivelyGPU/RenderPass.c Remove ClassDef.interfaceOffset initializer entry.
Sources/ObjectivelyGPU/RenderDevice.h Switch interface member to zero-length array; clarify Doxygen brief.
Sources/ObjectivelyGPU/RenderDevice.c Remove ClassDef.interfaceOffset initializer entry.
Sources/ObjectivelyGPU/QueryPool.h Switch interface member to zero-length array; clarify Doxygen brief.
Sources/ObjectivelyGPU/QueryPool.c Remove ClassDef.interfaceOffset initializer entry.
Sources/ObjectivelyGPU/GraphicsPipeline.h Switch interface member to zero-length array; clarify Doxygen brief.
Sources/ObjectivelyGPU/GraphicsPipeline.c Remove ClassDef.interfaceOffset initializer entry.
Sources/ObjectivelyGPU/Framebuffer.h Switch interface member to zero-length array; clarify Doxygen brief.
Sources/ObjectivelyGPU/Framebuffer.c Remove ClassDef.interfaceOffset initializer entry.
Sources/ObjectivelyGPU/Fence.h Switch interface member to zero-length array; clarify Doxygen brief.
Sources/ObjectivelyGPU/Fence.c Remove ClassDef.interfaceOffset initializer entry.
Sources/ObjectivelyGPU/CopyPass.h Switch interface member to zero-length array; clarify Doxygen brief.
Sources/ObjectivelyGPU/CopyPass.c Remove ClassDef.interfaceOffset initializer entry.
Sources/ObjectivelyGPU/ComputePipeline.h Switch interface member to zero-length array; clarify Doxygen brief.
Sources/ObjectivelyGPU/ComputePipeline.c Remove ClassDef.interfaceOffset initializer entry.
Sources/ObjectivelyGPU/ComputePass.h Switch interface member to zero-length array; clarify Doxygen brief.
Sources/ObjectivelyGPU/ComputePass.c Remove ClassDef.interfaceOffset initializer entry.
Sources/ObjectivelyGPU/CommandBuffer.h Switch interface member to zero-length array; clarify Doxygen brief.
Sources/ObjectivelyGPU/CommandBuffer.c Remove ClassDef.interfaceOffset initializer entry.
Sources/ObjectivelyGPU/Buffer.h Switch interface member to zero-length array; clarify Doxygen brief.
Sources/ObjectivelyGPU/Buffer.c Remove ClassDef.interfaceOffset initializer entry.
.github/copilot-instructions.md Update documented class pattern to use interface[0] and omit interfaceOffset.
Review details
  • Files reviewed: 31/31 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

jdolan and others added 2 commits September 2, 2026 19:32
Objectively 2.2.0 changed the instance layout (no per-instance interface
pointers), so this library MUST be built against it and nothing older.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Replace the -version-info hard-coded in Makefile.am with -release MAJOR.MINOR,
computed from AC_INIT, so the soname follows configure.ac. Every minor release
gets a new soname; patch releases stay compatible.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@jdolan
jdolan merged commit 19c663a into main Sep 2, 2026
3 of 6 checks passed
@jdolan
jdolan deleted the zero-length-interface branch September 2, 2026 23:45
jdolan added a commit to jdolan/ObjectivelyMVC that referenced this pull request Sep 2, 2026
)

* Adopt zero-length interface members from Objectively

Objectively no longer stores an interface pointer on each instance; `$` resolves
the interface through Object::clazz, and the struct member exists only to carry a
type for typeof. ClassDef.interfaceOffset is gone. Follow suit: each instance
struct's interface member becomes a zero-length array, and each ClassDef drops
interfaceOffset. No call sites change.

See jdolan/Objectively#41 and jdolan/ObjectivelyGPU#6.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Bump version to 2.2.0; require ObjectivelyGPU and Objectively >= 2.2.0

Objectively 2.2.0 changed the instance layout (no per-instance interface
pointers); ObjectivelyGPU 2.2.0 is the first build against it. This library
MUST be built against both and nothing older.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Derive the shared library soname from the package version

The library was previously unversioned. Use -release MAJOR.MINOR, computed from
AC_INIT, so every minor release gets a new soname and patch releases stay
compatible, matching Objectively and ObjectivelyGPU.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Fix Makefile.am by correcting LDFLAGS syntax

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

2 participants