Name mangling of subscripts

Hi all,

With a recent change of mine (#9989 <https://github.com/apple/swift/pull/9989&gt;\) subscripts are no longer represented internally by the identifier "subscript" but by a DeclBaseName with a special flag. In name mangling, however, the string "subscript" still surfaces (e.g. _T04test3FooC9subscriptyycfg). I think that we should use a special flag here instead, similar to "fC" for constructors or "fD" for destructors.
I don't know much about the mangling and which considerations need to be taken here though, so: Would this be a change that is worth doing, even though it gives no immediate benefit? If yes, could someone assist me with the design work of choosing the right mangling scheme or take over the issue? Or should I just file a JIRA for it, assign it the label "AffectsABI" and wait for someone to pick it up as the ABI gets stabilised?

– Alex

Filing a bug seems appropriate. If you'd like to also volunteer to fix that bug, that would be great. :) I agree that we should use a special name in the mangling here, and I disagree that it gives no immediate benefit: if nothing else, it reduces the symbol size by a few bytes.

The only consideration is making sure that the mangling doesn't collide with some other identifier. Erik (CC'ed) probably has thoughts about that, although he's on vacation until Monday.

John.

···

On Jul 14, 2017, at 6:41 AM, Alex Hoppen via swift-dev <swift-dev@swift.org> wrote:
Hi all,

With a recent change of mine (#9989 <https://github.com/apple/swift/pull/9989&gt;\) subscripts are no longer represented internally by the identifier "subscript" but by a DeclBaseName with a special flag. In name mangling, however, the string "subscript" still surfaces (e.g. _T04test3FooC9subscriptyycfg). I think that we should use a special flag here instead, similar to "fC" for constructors or "fD" for destructors.
I don't know much about the mangling and which considerations need to be taken here though, so: Would this be a change that is worth doing, even though it gives no immediate benefit? If yes, could someone assist me with the design work of choosing the right mangling scheme or take over the issue? Or should I just file a JIRA for it, assign it the label "AffectsABI" and wait for someone to pick it up as the ABI gets stabilised?

Hi all,

With a recent change of mine (#9989 <https://github.com/apple/swift/pull/9989&gt;\) subscripts are no longer represented internally by the identifier "subscript" but by a DeclBaseName with a special flag. In name mangling, however, the string "subscript" still surfaces (e.g. _T04test3FooC9subscriptyycfg). I think that we should use a special flag here instead, similar to "fC" for constructors or "fD" for destructors.

Yes, for example ‘fS’ would work.

I don't know much about the mangling and which considerations need to be taken here though, so: Would this be a change that is worth doing, even though it gives no immediate benefit? If yes, could someone assist me with the design work of choosing the right mangling scheme or take over the issue? Or should I just file a JIRA for it, assign it the label "AffectsABI" and wait for someone to pick it up as the ABI gets stabilised?

Filing a bug seems appropriate. If you'd like to also volunteer to fix that bug, that would be great. :) I agree that we should use a special name in the mangling here, and I disagree that it gives no immediate benefit: if nothing else, it reduces the symbol size by a few bytes.

If you like to implement it yourself, I’m happy to assist you.

···

On Jul 14, 2017, at 12:02 PM, John McCall <rjmccall@apple.com> wrote:

On Jul 14, 2017, at 6:41 AM, Alex Hoppen via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:

The only consideration is making sure that the mangling doesn't collide with some other identifier. Erik (CC'ed) probably has thoughts about that, although he's on vacation until Monday.

John.

Thanks, I have filed SR-5506 <Issues · apple/swift-issues · GitHub; for the issue and will give it a shot. If I've got any questions, I'll tag you either in the bug report or in a pull request.

– Alex

···

On 17. Jul 2017, at 21:38, Erik Eckstein <eeckstein@apple.com> wrote:

On Jul 14, 2017, at 12:02 PM, John McCall <rjmccall@apple.com <mailto:rjmccall@apple.com>> wrote:

On Jul 14, 2017, at 6:41 AM, Alex Hoppen via swift-dev <swift-dev@swift.org <mailto:swift-dev@swift.org>> wrote:
Hi all,

With a recent change of mine (#9989 <https://github.com/apple/swift/pull/9989&gt;\) subscripts are no longer represented internally by the identifier "subscript" but by a DeclBaseName with a special flag. In name mangling, however, the string "subscript" still surfaces (e.g. _T04test3FooC9subscriptyycfg). I think that we should use a special flag here instead, similar to "fC" for constructors or "fD" for destructors.

Yes, for example ‘fS’ would work.

I don't know much about the mangling and which considerations need to be taken here though, so: Would this be a change that is worth doing, even though it gives no immediate benefit? If yes, could someone assist me with the design work of choosing the right mangling scheme or take over the issue? Or should I just file a JIRA for it, assign it the label "AffectsABI" and wait for someone to pick it up as the ABI gets stabilised?

Filing a bug seems appropriate. If you'd like to also volunteer to fix that bug, that would be great. :) I agree that we should use a special name in the mangling here, and I disagree that it gives no immediate benefit: if nothing else, it reduces the symbol size by a few bytes.

If you like to implement it yourself, I’m happy to assist you.

The only consideration is making sure that the mangling doesn't collide with some other identifier. Erik (CC'ed) probably has thoughts about that, although he's on vacation until Monday.

John.