[PATCH 0/9] Handle small-aggregates via AMD64 abi
[Thread Prev] | [Thread Next]
[Date Prev] | [Date Next]
- Subject: [PATCH 0/9] Handle small-aggregates via AMD64 abi
- From: "S. Gilles" <sgilles@xxxxxxx>
- Reply-to: myrddin-dev@xxxxxxxxxxxxxx
- Date: Mon, 8 Jun 2020 00:21:07 -0400
- To: "myrddin-dev" <myrddin-dev@xxxxxxxxxxxxxx>
- Cc: "S. Gilles" <sgilles@xxxxxxx>
This is v1 of the patchset I promised two or three eons ago, with the ultimate goal of moving mcbind one step closer to working out of the box. The patchset has now reached the stage where my fuzzing attempts have found an unrelated issue, so I might as well request comments on what I've got. For those unaware, myrddin's original convention regarding arguments and return values was roughly “If it's small enough to fit in a register, put it in a register. If it's larger, put it on the stack.” The AMD64 abi, in a desparate attempt to keep complex and extra-large floating point numbers in registers, defines rules for when small structures are passed between functions in multiple registers. These rules create edge cases that break a number of entirely reasonable assumptions, like “one object in code means one storage location” and “floating point numbers go in floating point registers”. I've tried to keep these edge cases clearly marked, but the resulting code is still painful to read in many places. Completely understandable reactions might include “This part is too ugly” and “Actually, the abi isn't worth all this gunk”. If so, please let me know what parts are especially offensive, and I'll try to smooth them out. S. Gilles (9): Unify alignment for heterogeneous tuples. Add isaggregate for later use with abi conformity. Factor out the code for placing/retrieving arguments. Add classification algorithm for small-struct passing. Pass small-aggregate arguments by the AMD64 abi. Return small-aggregate values by the AMD64 abi. Bump abi version. Allow runtest.{rc,sh} to handle subdirectories. Add tests for abi conformity. 6/asm.h | 22 + 6/gengas.c | 3 + 6/genp9.c | 3 + 6/isel.c | 511 ++++++++++++++++++---- 6/locs.c | 2 + 6/simp.c | 76 +++- 6/typeinfo.c | 170 +++++++- lib/std/varargs.myr | 2 +- mbld/libs.myr | 2 +- parse/parse.h | 2 +- test/abi/001_in-c.glue.c | 25 ++ test/abi/001_in-c.myr | 7 + test/abi/001_in-myr.myr | 11 + test/abi/001_main.myr | 29 ++ test/abi/001_types.h | 2 + test/abi/001_types.myr | 5 + test/abi/002_main.myr | 24 + test/abi/003_main.myr | 42 ++ test/abi/004_in-c.glue.c | 443 +++++++++++++++++++ test/abi/004_in-c.myr | 16 + test/abi/004_in-myr.myr | 310 +++++++++++++ test/abi/004_main.myr | 175 ++++++++ test/abi/004_types.h | 62 +++ test/abi/004_types.myr | 341 +++++++++++++++ test/abi/005_in-c.glue.c | 468 ++++++++++++++++++++ test/abi/005_in-c.myr | 16 + test/abi/005_in-myr.myr | 330 ++++++++++++++ test/abi/005_main.myr | 180 ++++++++ test/abi/005_types.h | 79 ++++ test/abi/005_types.myr | 420 ++++++++++++++++++ test/abi/006_in-c.glue.c | 913 +++++++++++++++++++++++++++++++++++++++ test/abi/006_in-c.myr | 26 ++ test/abi/006_in-myr.myr | 646 +++++++++++++++++++++++++++ test/abi/006_main.myr | 339 +++++++++++++++ test/abi/006_types.h | 102 +++++ test/abi/006_types.myr | 523 ++++++++++++++++++++++ test/abi/bld.proj | 39 ++ test/fmtnest.myr | 18 + test/runtest.rc | 23 +- test/runtest.sh | 28 +- test/tests | 16 +- 41 files changed, 6329 insertions(+), 122 deletions(-) create mode 100644 test/abi/001_in-c.glue.c create mode 100644 test/abi/001_in-c.myr create mode 100644 test/abi/001_in-myr.myr create mode 100644 test/abi/001_main.myr create mode 100644 test/abi/001_types.h create mode 100644 test/abi/001_types.myr create mode 100644 test/abi/002_main.myr create mode 100644 test/abi/003_main.myr create mode 100644 test/abi/004_in-c.glue.c create mode 100644 test/abi/004_in-c.myr create mode 100644 test/abi/004_in-myr.myr create mode 100644 test/abi/004_main.myr create mode 100644 test/abi/004_types.h create mode 100644 test/abi/004_types.myr create mode 100644 test/abi/005_in-c.glue.c create mode 100644 test/abi/005_in-c.myr create mode 100644 test/abi/005_in-myr.myr create mode 100644 test/abi/005_main.myr create mode 100644 test/abi/005_types.h create mode 100644 test/abi/005_types.myr create mode 100644 test/abi/006_in-c.glue.c create mode 100644 test/abi/006_in-c.myr create mode 100644 test/abi/006_in-myr.myr create mode 100644 test/abi/006_main.myr create mode 100644 test/abi/006_types.h create mode 100644 test/abi/006_types.myr create mode 100644 test/abi/bld.proj create mode 100644 test/fmtnest.myr -- 2.26.2
[PATCH 1/9] Unify alignment for heterogeneous tuples. | "S. Gilles" <sgilles@xxxxxxx> |
[PATCH 2/9] Add isaggregate for later use with abi conformity. | "S. Gilles" <sgilles@xxxxxxx> |
[PATCH 3/9] Factor out the code for placing/retrieving arguments. | "S. Gilles" <sgilles@xxxxxxx> |
[PATCH 4/9] Add classification algorithm for small-struct passing. | "S. Gilles" <sgilles@xxxxxxx> |
[PATCH 5/9] Pass small-aggregate arguments by the AMD64 abi. | "S. Gilles" <sgilles@xxxxxxx> |
[PATCH 7/9] Bump abi version. | "S. Gilles" <sgilles@xxxxxxx> |
[PATCH 6/9] Return small-aggregate values by the AMD64 abi. | "S. Gilles" <sgilles@xxxxxxx> |
[PATCH 8/9] Allow runtest.{rc,sh} to handle subdirectories. | "S. Gilles" <sgilles@xxxxxxx> |
[PATCH 9/9] Add tests for abi conformity. | "S. Gilles" <sgilles@xxxxxxx> |
- Next by Date: [PATCH 1/9] Unify alignment for heterogeneous tuples.
- Next by thread: [PATCH 1/9] Unify alignment for heterogeneous tuples.
- Index(es):