digitalmars.D - TypeTuple ABI mangling
- Iain Buclaw (14/14) Jul 26 2014 Hi,
- Iain Buclaw (2/14) Jul 26 2014 NB. This is purely for the purpose of demangling in binutils.
- Dicebot (4/9) Jul 26 2014 This is.. funny. Type tuples don't really have ABI, they don't
- H. S. Teoh via Digitalmars-d (9/27) Jul 26 2014 [...]
- Iain Buclaw via Digitalmars-d (5/29) Jul 26 2014 I've tried something similar using D1 too, and get the same results.
- Iain Buclaw via Digitalmars-d (4/35) Jul 27 2014 I changed Ttuple = 'B' to Ttuple = '@' and waited for assembly errors to...
- Iain Buclaw via Digitalmars-d (10/47) Jul 27 2014 Ah ha! D-style native varargs use them!
- Iain Buclaw via Digitalmars-d (6/54) Jul 27 2014 Inspecting the resultant mangled identifier itself though, the tuple
Hi, TypeTuples have a special mangling convention in the compiler. As per the docs (ref: http://dlang.org/abi.html) TypeTuple: B Number Arguments However after some cursory tests, it seems that the most obvious examples of, passing a tuple via parameters, returning a tuple, declaring a tuple variable, etc... all get lowered before mangling. So at first glance, this mangling convention is redundant. Unless of course someone can post an example which triggers mangling of TypeTuples... Regards Iain.
Jul 26 2014
On Saturday, 26 July 2014 at 19:44:49 UTC, Iain Buclaw wrote:Hi, TypeTuples have a special mangling convention in the compiler. As per the docs (ref: http://dlang.org/abi.html) TypeTuple: B Number Arguments However after some cursory tests, it seems that the most obvious examples of, passing a tuple via parameters, returning a tuple, declaring a tuple variable, etc... all get lowered before mangling. So at first glance, this mangling convention is redundant. Unless of course someone can post an example which triggers mangling of TypeTuples...NB. This is purely for the purpose of demangling in binutils.
Jul 26 2014
On Saturday, 26 July 2014 at 19:44:49 UTC, Iain Buclaw wrote:Hi, TypeTuples have a special mangling convention in the compiler. As per the docs (ref: http://dlang.org/abi.html) TypeTuple: B Number ArgumentsThis is.. funny. Type tuples don't really have ABI, they don't even have .sizeof - any usage where expansion is meaningless results in compile-time error afaik. No idea what this may mean :O
Jul 26 2014
On Sat, Jul 26, 2014 at 07:44:47PM +0000, Iain Buclaw via Digitalmars-d wrote:Hi, TypeTuples have a special mangling convention in the compiler. As per the docs (ref: http://dlang.org/abi.html) TypeTuple: B Number Arguments However after some cursory tests, it seems that the most obvious examples of, passing a tuple via parameters, returning a tuple, declaring a tuple variable, etc... all get lowered before mangling. So at first glance, this mangling convention is redundant. Unless of course someone can post an example which triggers mangling of TypeTuples...[...] Huh, interesting. I tried various wrapping/unwrapping tricks and passing things via alias parameters, but none of them triggered TypeTuple mangling. Either I missed something obvious, or perhaps this mangling is never actually emitted? Not sure. T -- It won't be covered in the book. The source code has to be useful for something, after all. -- Larry Wall
Jul 26 2014
On 26 July 2014 21:06, H. S. Teoh via Digitalmars-d <digitalmars-d puremagic.com> wrote:On Sat, Jul 26, 2014 at 07:44:47PM +0000, Iain Buclaw via Digitalmars-d wrote:I've tried something similar using D1 too, and get the same results. I'd be willing to do an experiment and remove TypeTuple mangling from the language by force and see what ICE's.Hi, TypeTuples have a special mangling convention in the compiler. As per the docs (ref: http://dlang.org/abi.html) TypeTuple: B Number Arguments However after some cursory tests, it seems that the most obvious examples of, passing a tuple via parameters, returning a tuple, declaring a tuple variable, etc... all get lowered before mangling. So at first glance, this mangling convention is redundant. Unless of course someone can post an example which triggers mangling of TypeTuples...[...] Huh, interesting. I tried various wrapping/unwrapping tricks and passing things via alias parameters, but none of them triggered TypeTuple mangling. Either I missed something obvious, or perhaps this mangling is never actually emitted? Not sure.
Jul 26 2014
On 27 July 2014 00:20, Iain Buclaw <ibuclaw gdcproject.org> wrote:On 26 July 2014 21:06, H. S. Teoh via Digitalmars-d <digitalmars-d puremagic.com> wrote:I changed Ttuple = 'B' to Ttuple = ' ' and waited for assembly errors to happen. Finally got them when compiling std.outbuffer unittests. Reducing....On Sat, Jul 26, 2014 at 07:44:47PM +0000, Iain Buclaw via Digitalmars-d wrote:I've tried something similar using D1 too, and get the same results. I'd be willing to do an experiment and remove TypeTuple mangling from the language by force and see what ICE's.Hi, TypeTuples have a special mangling convention in the compiler. As per the docs (ref: http://dlang.org/abi.html) TypeTuple: B Number Arguments However after some cursory tests, it seems that the most obvious examples of, passing a tuple via parameters, returning a tuple, declaring a tuple variable, etc... all get lowered before mangling. So at first glance, this mangling convention is redundant. Unless of course someone can post an example which triggers mangling of TypeTuples...[...] Huh, interesting. I tried various wrapping/unwrapping tricks and passing things via alias parameters, but none of them triggered TypeTuple mangling. Either I missed something obvious, or perhaps this mangling is never actually emitted? Not sure.
Jul 27 2014
On 27 July 2014 08:14, Iain Buclaw <ibuclaw gdcproject.org> wrote:On 27 July 2014 00:20, Iain Buclaw <ibuclaw gdcproject.org> wrote:Ah ha! D-style native varargs use them! void printf(...) { } void main() { printf; // printf(_arguments_typeinfo); } Here, the _arguments_typeinfo is a TypeInfo_Tuple. Regards Iain.On 26 July 2014 21:06, H. S. Teoh via Digitalmars-d <digitalmars-d puremagic.com> wrote:I changed Ttuple = 'B' to Ttuple = ' ' and waited for assembly errors to happen. Finally got them when compiling std.outbuffer unittests. Reducing....On Sat, Jul 26, 2014 at 07:44:47PM +0000, Iain Buclaw via Digitalmars-d wrote:I've tried something similar using D1 too, and get the same results. I'd be willing to do an experiment and remove TypeTuple mangling from the language by force and see what ICE's.Hi, TypeTuples have a special mangling convention in the compiler. As per the docs (ref: http://dlang.org/abi.html) TypeTuple: B Number Arguments However after some cursory tests, it seems that the most obvious examples of, passing a tuple via parameters, returning a tuple, declaring a tuple variable, etc... all get lowered before mangling. So at first glance, this mangling convention is redundant. Unless of course someone can post an example which triggers mangling of TypeTuples...[...] Huh, interesting. I tried various wrapping/unwrapping tricks and passing things via alias parameters, but none of them triggered TypeTuple mangling. Either I missed something obvious, or perhaps this mangling is never actually emitted? Not sure.
Jul 27 2014
On 27 July 2014 08:22, Iain Buclaw <ibuclaw gdcproject.org> wrote:On 27 July 2014 08:14, Iain Buclaw <ibuclaw gdcproject.org> wrote:Inspecting the resultant mangled identifier itself though, the tuple part will never get demangled. _D15TypeInfo_B4iiii6__initZ Meaning that I'm back at demangling tuple being pointless because it will never be reached.On 27 July 2014 00:20, Iain Buclaw <ibuclaw gdcproject.org> wrote:Ah ha! D-style native varargs use them! void printf(...) { } void main() { printf; // printf(_arguments_typeinfo); } Here, the _arguments_typeinfo is a TypeInfo_Tuple.On 26 July 2014 21:06, H. S. Teoh via Digitalmars-d <digitalmars-d puremagic.com> wrote:I changed Ttuple = 'B' to Ttuple = ' ' and waited for assembly errors to happen. Finally got them when compiling std.outbuffer unittests. Reducing....On Sat, Jul 26, 2014 at 07:44:47PM +0000, Iain Buclaw via Digitalmars-d wrote:I've tried something similar using D1 too, and get the same results. I'd be willing to do an experiment and remove TypeTuple mangling from the language by force and see what ICE's.Hi, TypeTuples have a special mangling convention in the compiler. As per the docs (ref: http://dlang.org/abi.html) TypeTuple: B Number Arguments However after some cursory tests, it seems that the most obvious examples of, passing a tuple via parameters, returning a tuple, declaring a tuple variable, etc... all get lowered before mangling. So at first glance, this mangling convention is redundant. Unless of course someone can post an example which triggers mangling of TypeTuples...[...] Huh, interesting. I tried various wrapping/unwrapping tricks and passing things via alias parameters, but none of them triggered TypeTuple mangling. Either I missed something obvious, or perhaps this mangling is never actually emitted? Not sure.
Jul 27 2014