Re: [PATCH] Struct-by-value support for x86-64 and ARM64
Stas Boukarev <[email protected]>
| Newsgroups | gmane.lisp.steel-bank.devel |
|---|---|
| Message-ID | <CAF63=11L1TbZ1dJgB_3J0+OP3fexAJzwTDsYbAovLDJ2WTypRw@mail.gmail.com> |
About a week before the end of the month. But changes to new code can come in late. On Thu, Jan 15, 2026 at 03:47 Jesse Bouwman <[email protected]> wrote: > I looked at win32, the struct classification is simpler than sysv, and > other aspects look similar -- when does this release cycle close? > > > On Jan 14, 2026, at 9:20 AM, Stas Boukarev <[email protected]> wrote: > > > > Ok, I fixed that. > > > > On Wed, Jan 14, 2026 at 7:24 PM Stas Boukarev <[email protected]> > wrote: > >> > >> It just segfaults. > >> > >> On Wed, Jan 14, 2026 at 7:14 PM Jesse Bouwman > >> <[email protected]> wrote: > >>> > >>> Thank you for cleaning up the tests. I will take a look at win32. > >>> > >>> What result did you see from callback-struct-return-large? I reenabled > it locally and it passed. Machine info: > >>> > >>> Linux wren 6.12.44 #1-NixOS SMP PREEMPT_DYNAMIC Thu Aug 28 14:31:16 > UTC 2025 x86_64 GNU/Linux > >>> > >>> On Jan 13, 2026, at 11:14 PM, Stas Boukarev <[email protected]> > wrote: > >>> > >>> I merged this, but haven't reviewed it much. (I had to change it to > >>> compile on unsupported targets). > >>> And the callback-struct-return-large test fails on x86-64. > >>> How hard would it be to add win32 support during this release cycle? > >>> > >>> > >>> On Wed, Jan 14, 2026 at 2:58 AM Jesse Bouwman via Sbcl-devel > >>> <[email protected]> wrote: > >>> > >>> > >>> Hi, > >>> > >>> here is a patch that adds support for passing and returning structs by > value on unix-like x86-64 and ARM64. > >>> > >>> Briefly, src/code/c-call.lisp dispatches to architecture-specific > struct classifiers; classifiers determine whether a struct should be passed > in registers or memory, per ABI rules: For x86-64, structs less than 16 > bytes are classified into "eightbytes" that map to int or SSE register > classes. Larger structs are passed via hidden pointer in RDI, and returned > in RAX. ARM64 supports HFA: structs of up to 4 same-type floats are > passed/returned in floating-point registers. Non-HFA structs less than 16 > bytes use x0/x1; larger structs use a hidden pointer in x8. The > alien-funcall IR1 transform handles both small struct returns (unpacking > register to heap) and large struct returns (hidden pointer as synthetic > first argument). > >>> > >>> There are no changes to the FFI interface. > >>> > >>> Other notes: > >>> > >>> Implementation owes a lot to the work done a year ago by Rongcui Dong > and reviewers, documented on the launchpad thread at > https://bugs.launchpad.net/sbcl/+bug/313202 > >>> > >>> What I would deem pretty thorough testing is included: variously sized > structs, nested structs, structs containing arrays, unions, etc. I've been > debugging this with a binding to libclang, this has shaken out some > serioous bugs, and I think it's now usable. I would welcome feedback about > any aspects, especially relating to bad assumptions, missing functionality, > or non-sbcl-idiomatic code. > >>> > >>> The branch is at: > https://github.com/jbouwman/sbcl/tree/struct-by-value-final > >>> > >>> As the code is a result of bouncing between arm/darwin and x86/linux > to try to get reasonably clean abstractions, it was squashed into a few big > commits, but can be retroactively broken up in order to get something a > little more bisectable for future debugging ergonomics. > >>> > >>> Windows is blocked by a non-SysV ABI which is not familiar to me, but > looks pretty easy. Famous last words! > >>> > >>> Cheers, > >>> Jesse > >>> > >>> > >>> _______________________________________________ > >>> Sbcl-devel mailing list > >>> [email protected] > >>> https://lists.sourceforge.net/lists/listinfo/sbcl-devel > >>> > >>> > > > _______________________________________________ Sbcl-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sbcl-devel