Skip to content

Use type system entities instead of strings for node identity#35918

Merged
nattress merged 4 commits intodotnet:masterfrom
nattress:stop_name_mangling
May 7, 2020
Merged

Use type system entities instead of strings for node identity#35918
nattress merged 4 commits intodotnet:masterfrom
nattress:stop_name_mangling

Conversation

@nattress
Copy link
Contributor

@nattress nattress commented May 6, 2020

The calling method for interface dispatches is used to provide imports specific to each call site (actually currently a shared one per calling method). Replace the use of mangled calling method name with its MethodDesc object as the key for the interface dispatch cell.

This saves ~4% compiler working set measured on a large application.

Also, removed mangled name as the key for method-specific readonly data blobs the JIT allocates. This was much more modest since most methods don't need a readonly blob.

With these changes, we shouldn't hit the name mangler at all during compilation unless we opt to generate a map file.

The calling method for interface dispatches is used to provide imports specific to each call site (actually currently a shared one per calling method). Replace the use of mangled calling method name with its `MethodDesc` object as the key for the interface dispatch cell.

This saves ~4% working set measured on a large application.

Also, removed mangled name as the key for method-specific readonly data blobs the JIT allocates. This was much more modest since most methods don't need a readonly blob.
@nattress
Copy link
Contributor Author

nattress commented May 6, 2020

cc @dotnet/crossgen-contrib

Copy link
Member

@trylek trylek left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for cleaning this up!

private ObjectData _data;

public SettableReadOnlyDataBlob(Utf8String name, ObjectNodeSection section)
public SettableReadOnlyDataBlob(MethodDesc owningMethod, ObjectNodeSection section)
Copy link
Member

Choose a reason for hiding this comment

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

Since this is making the node not general purpose anymore, maybe we can go all the way and remove the section parameter from the constructor and name the node in a way that conveys its purpose (MethodReadOnlyDataNode?).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea - done

Copy link
Member

Choose a reason for hiding this comment

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

Could you rename the file as well? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ugh, VS crashed during refactor. Will do.

@davidwrighton
Copy link
Member

Since there can only be one of these nodes per compiled method, instead of using a NodeCache, could you simply allocate it directly?

@nattress
Copy link
Contributor Author

nattress commented May 6, 2020

We absolutely can 😄

@nattress nattress merged commit 2019cd6 into dotnet:master May 7, 2020
@nattress nattress deleted the stop_name_mangling branch May 7, 2020 20:26
@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
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.

5 participants