Skip to content

Conversation

@WalterBright
Copy link
Member

The idea is to get code binaries with and without -dip1000 to play together. This is already done for scope.

@WalterBright WalterBright added the Review:Vision Vision Plan https://wiki.dlang.org/Vision/2018H1 label Mar 22, 2019
@dlang-bot
Copy link
Contributor

Thanks for your pull request, @WalterBright!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + dmd#9476"

Copy link
Contributor

@thewilsonator thewilsonator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests?

scopeinferred = (1L << 49), // 'scope' has been inferred and should not be part of mangling
future = (1L << 50), // introducing new base class function
local = (1L << 51), // do not forward (see dmd.dsymbol.ForwardingScopeDsymbol).
returninferred = (1L << 52), // 'return' has been inferred and should not be part of mangling
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be better to have just one STCinferred?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either return or scope or both can be present or inferred.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd not have expected inference to happen if either is explicitly given, but Ok.

Some of the bit flags may require a little pruning as there aren't many available left now.

Copy link
Member

@rainers rainers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea is correct.

va.storage_class |= STC.scope_ | STC.scopeinferred;
va.storage_class |= v.storage_class & STC.return_;
if (v.storage_class & STC.return_)
va.storage_class |= STC.return_ | STC.returninferred;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad indentation.

Doesn't this need a check for pre-existing return annotation?

if (!(va.storage_class & STC.return_))
    va.storage_class |= STC.return_ | STC.returninferred;

If scope and return can be inferred independently, the if-condition !va.isScope() seems to disallow that.

static assert(typeof(foo).mangleof == "FNaNbNiNfPvZi");

auto bar(void* p) { return p; }
static assert(typeof(bar).mangleof == "FNaNbNiNfPvZQd");
Copy link
Member

@rainers rainers Mar 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add tests that show explicit annotations make it to the mangling.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see testscope2.d

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testscope2.d only runs with -dip25, but some of the code only affects -dip1000 AFAICT.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW: you can also use core.demangle with CTFE for more readable asserts.

@wilzbach
Copy link
Contributor

Wow! I gave compiling Phobos with -preview=dip1000 another shot with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merge:auto-merge Review:Vision Vision Plan https://wiki.dlang.org/Vision/2018H1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants