Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

Make NameMangler not depend on Compilation - #1524

Merged
MichalStrehovsky merged 1 commit into
dotnet:masterfrom
MichalStrehovsky:nameMangler
Jul 15, 2016
Merged

MichalStrehovsky merged 1 commit into
dotnet:masterfrom
MichalStrehovsky:nameMangler

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

NameMangler's job is to provide stable names for types and their
members. It doesn't have a connection with the compilation process and
therefore shouldn't depend on Compilation. This makes it reusable and
unit testable.

I'm also taking CompilationUnitPrefix away from it. It doesn't have a
logical connection (except that it's related to naming and it was
convenient to put it there). I'm putting it on NodeFactory temporarily,
but there is a strong correlation between a dependency node using
CompiationUnitPrefix in it's name and reporting
ShouldShareNodeAcrossModules as false. Maybe we should use that in
ObjectWriter to prepend it automatically instead of hoping the node
won't mess it up and jumping through hoops (a static variable) to get to
it.

`NameMangler`'s job is to provide stable names for types and their
members. It doesn't have a connection with the compilation process and
therefore shouldn't depend on `Compilation`. This makes it reusable and
unit testable.

I'm also taking `CompilationUnitPrefix` away from it. It doesn't have a
logical connection (except that it's related to naming and it was
convenient to put it there). I'm putting it on NodeFactory temporarily,
but there is a strong correlation between a dependency node using
`CompiationUnitPrefix` in it's name and reporting
`ShouldShareNodeAcrossModules` as false. Maybe we should use that in
`ObjectWriter` to prepend it automatically instead of hoping the node
won't mess it up and jumping through hoops (a static variable) to get to
it.
@jkotas

jkotas commented Jul 15, 2016

Copy link
Copy Markdown
Member

LGTM

@MichalStrehovsky

Copy link
Copy Markdown
Member Author

Cc @nattress

@nattress

Copy link
Copy Markdown
Contributor

LGTM - Re moving CompilationUnitPrefix into ObjectWriter - with ProjectX, UTC will ask us for symbol names for nodes as it compiles, so we should retain some way of computing these things statelessly. I have been moving to having node types statically able to provide a mangled symbol name for themselves given the type / method they base their name on. I'd like to keep that to make interacting with UTC easier.

@MichalStrehovsky
MichalStrehovsky merged commit 38dbaa2 into dotnet:master Jul 15, 2016
@MichalStrehovsky
MichalStrehovsky deleted the nameMangler branch July 15, 2016 20:49
@MichalStrehovsky

Copy link
Copy Markdown
Member Author

@nattress We should probably move the name computations to a centralized location. We already have to keep things in sync between how we compute the name for a EEType node (or code node), vs. how we compute the name for the ExternEEType/ExternMethod node. Maybe the nodes shouldn't decide their names, maybe another class should.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants