Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle IR collisions wrt. built-in TypeInfos and make them mutable #3599

Merged
merged 3 commits into from
Oct 31, 2020

Conversation

kinke
Copy link
Member

@kinke kinke commented Oct 25, 2020

Compiling the rt.util.typeinfo unittests (mostly disabled until now) leads to base-typed forward declarations of built-in TypeInfos colliding with the init symbols for their TypeInfo_* classes in rt.util.typeinfo.

We've already had a workaround for this in one place (typinf.cpp); extend it to the other side as well (iraggr.cpp).

Also make sure to emit the TypeInfo metadata even if the IR symbol already exists as init symbol.

Also keep init symbols of built-in TypeInfo classes mutable just like any other TypeInfo, so that e.g. synchronized() can be used on the implicit monitor.

And finally, simplify the TypeInfo metadata for the GC2Stack pass.

kinke added 3 commits October 25, 2020 17:06
Compiling the rt.util.typeinfo unittests leads to base-typed forward
declarations of built-in TypeInfos colliding with the init symbols for
their TypeInfo_* classes in rt.util.typeinfo.

We've already had a workaround for this in one place (typinf.cpp);
extend it to the other side as well (iraggr.cpp).

Also make sure to emit the TypeInfo metadata even if the IR symbol
already exists as init symbol.

And finally, keep init symbols of built-in TypeInfo classes mutable just
like any other TypeInfo, so that e.g. synchronized() can be used on the
implicit monitor.
Don't store and check a back reference to the TypeInfo global.
The association is already unambiguously expressed by the metadata name
ending with the mangled name of the TypeInfo global.

Removing this check fixes a problem when replacing a TypeInfo global at
some point via IRState::setGlobalVarInitializer() (e.g., for the
rt.util.typeinfo unittests), because llvm::ValueAsMetadata doesn't fully
support LLVM's replace-all-uses-with.
@kinke kinke merged commit 05cdd24 into ldc-developers:master Oct 31, 2020
@kinke kinke deleted the builtin_typeinfo branch October 31, 2020 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant