Adopt zero-length interface members from Objectively - #6
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
🟢 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 withXInterface *interface[0];across all ObjectivelyGPU classes. - Remove
.interfaceOffset = offsetof(X, interface),from eachClassDefinitializer (field no longer exists upstream). - Update
.github/copilot-instructions.mdto 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.
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
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>
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.
Mechanical follow-through of jdolan/Objectively#41, which removes the per-instance interface pointer:
$now resolves the interface throughObject::clazz, and the struct member exists only sotypeofcan name the interface type.ClassDef.interfaceOffsetno 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 eachClassDefVerified: builds clean (0 warnings) against Objectively
zero-length-interfaceinstalled to/usr/local;Examples/HelloandExamples/HelloComputebuild. ObjectivelyGPU has nomake checksuite.Depends on jdolan/Objectively#41 being installed first. ObjectivelyMVC follows on top of this.
🤖 Generated with Claude Code