Skip to content

m3core: fold RTMachine into RTStack - #1355

Merged
hosking merged 2 commits into
masterfrom
rtmachine-into-rtstack
Nov 24, 2026
Merged

hosking merged 2 commits into
masterfrom
rtmachine-into-rtstack

Conversation

@hosking

@hosking hosking commented Nov 23, 2026

Copy link
Copy Markdown
Member

Closes #1338. RTMachine.i3 held a single type, FrameInfo, which RTStack re-exported as RTStack.Frame. The per-target copies that once made it machine-dependent are gone, and the one left in runtime/common is the same on every target.

This declares the record directly as RTStack.Frame and deletes common/RTMachine.i3.

  • Layout: unchanged, and it still matches Frame in walker/RTStackC.c.
  • Callers: nothing in the tree uses RTMachine except RTStack.i3, and Modula-3 callers of RTStack.Frame use only pc and sp.
  • Comments: those that pointed at RTMachine, in m3core.h, walker/RTStackC.c, runtime/m3makefile and the current-state paragraph of README-ex_stack.md, now point at RTStack.
  • Left alone:
    • the ALPHA_OSF and SOLsun RTMachine.i3 files, which only their m3makefile-old lists;
    • the historical "Files Changed" notes in README-ex_stack.md;
    • the generated HTML under docs/help;
    • the I_RTMachine entry in examples/win32-dll/src/m3main.c, which already lists other long-gone interfaces.

Testing.

  • Local (ARM64_DARWIN): all of m3core compiled, including RTStack, walker/RTStackC.c, RTExStack, RTHeapStats and RTAllocStats, with no errors. I couldn't complete the shared-library link locally, because the only compiler on hand is an msir build whose ABI-guard symbol master's m3core doesn't define; that's unrelated to this change.
  • CI: does the full build and the m3tests on every target.

🤖 Generated with Claude Code

RTMachine.i3 held only FrameInfo, which RTStack.Frame renamed.  The
per-target copies that once made it machine dependent are gone; the one
left in common is the same on every target.  Declare the record as
RTStack.Frame and delete RTMachine.  The layout is unchanged, and it
still matches Frame in walker/RTStackC.c.

Comments in m3core.h, walker/RTStackC.c, runtime/m3makefile and
README-ex_stack.md that pointed at RTMachine now point at RTStack.  The
ALPHA_OSF and SOLsun RTMachine.i3 files are left alone; only their
m3makefile-old lists them.

Closes #1338.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hosking
hosking requested a review from jaykrell November 23, 2026 21:56
@hosking

hosking commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

@jaykrell, this does what you suggested in #1338. Could you review it? It touches the runtime, so I'd like a second pair of eyes. The record layout is unchanged; the one thing to check is that nothing on Windows still refers to RTMachine. I found only the I_RTMachine entry in examples/win32-dll/src/m3main.c, which I left alone.

🤖 Generated with Claude Code

Comment thread m3-libs/m3core/src/m3core.h Outdated

@jaykrell jaykrell Nov 23, 2026 •

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.

Remove those few lines? They aren't needed?
We only need a pointer to, not the full definition?
Or maybe fix them?
Sorry I didn't notice these earlier.

Comment thread m3-libs/m3core/src/m3core.h Outdated

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.

Maybe remove the struct definition?
Since it is now wrong?
And doesn't appear needed?
Or else move the correct one here.

Its two-field body no longer matched RTStack.Frame.  Hand-written C
(no_walker/RTStackC.c) only passes pointers to it, and walker/RTStackC.c
has its own full layout, so the forward declaration is all that is
needed.  As Jay pointed out in review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hosking

hosking commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Thanks, Jay, good catch. Done in the latest push: m3core.h now has only the forward declaration (STRUCT_TYPEDEF(RTStack__Frame)) with no body. no_walker/RTStackC.c, the only hand-written C that names the type, only passes pointers to it, and walker/RTStackC.c keeps its own full layout. Both still compile as C and as C++.

🤖 Generated with Claude Code

@hosking
hosking merged commit 4f61eea into master Nov 24, 2026
11 checks passed
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.

RTMachine can now be merged into RTStack.

2 participants