Skip to content

stream: make the variadic interface methods final - #60

Merged
thewilsonator merged 1 commit into
dlang:masterfrom
pkubaj:ppc-fix
Sep 20, 2026
Merged

thewilsonator merged 1 commit into
dlang:masterfrom
pkubaj:ppc-fix

Conversation

@pkubaj

@pkubaj pkubaj commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

InputStream.readf(...), OutputStream.printf(fmt, ...), writef(...) and
writefln(...) are D-style variadic interface methods. For a class that
implements the interface at a non-zero offset (Stream), LDC has to emit
this-adjusting thunks for them and can only forward the variadic
arguments with a musttail call. LLVM's PowerPC backend cannot honour
musttail there, so compiling the library aborts on ppc64/ppc64le:

LLVM ERROR: failed to perform tail call elimination on a call site
marked musttail

All four are thin forwarders to the non-variadic virtual methods
(vreadf, vprintf, writefx). Make them final in the interfaces with
those bodies and drop the identical copies from Stream: final interface
methods are dispatched statically, so no thunk is generated. The API is
unchanged and the methods remain callable through interface references;
customisation still happens by overriding vreadf/vprintf/writefx.

InputStream.readf(...), OutputStream.printf(fmt, ...), writef(...) and
writefln(...) are D-style variadic interface methods. For a class that
implements the interface at a non-zero offset (Stream), LDC has to emit
this-adjusting thunks for them and can only forward the variadic
arguments with a `musttail` call. LLVM's PowerPC backend cannot honour
`musttail` there, so compiling the library aborts on ppc64/ppc64le:

    LLVM ERROR: failed to perform tail call elimination on a call site
    marked musttail

All four are thin forwarders to the non-variadic virtual methods
(vreadf, vprintf, writefx). Make them `final` in the interfaces with
those bodies and drop the identical copies from Stream: final interface
methods are dispatched statically, so no thunk is generated. The API is
unchanged and the methods remain callable through interface references;
customisation still happens by overriding vreadf/vprintf/writefx.
@thewilsonator
thewilsonator merged commit 94f1327 into dlang:master Sep 20, 2026
0 of 13 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.

2 participants