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

Use TypeFlags enum instead of CorElementType in EEType - #8004

Merged
MichalStrehovsky merged 2 commits into
dotnet:masterfrom
MichalStrehovsky:eetypeElementType
Mar 2, 2020
Merged

MichalStrehovsky merged 2 commits into
dotnet:masterfrom
MichalStrehovsky:eetypeElementType

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

Fixes #478.

It doesn't fully reap the benefits yet (we can e.g. delete the IsInterface and IsValueType bits). I'm going to work on those later. This is already too big and too scary.

Fixes dotnet#478.

It doesn't fully reap the benefits yet (we can e.g. delete the IsInterface and IsValueType bits). I'm going to work on those later. This is already too big and too scary.
@MichalStrehovsky

Copy link
Copy Markdown
Member Author

Marking NO MERGE because I want to self review this at least one more time. @jkotas could you have a look as well?

The point is to free up bits in EEType so that we can start doing things with it.

I'm e.g. thinking about adding a pointer to "writable data" similar to what CoreCLR has so that we can make typeof as fast as CoreCLR, but I want to start with a small cleanup first.

}

internal RuntimeImports.RhCorElementType CorElementType
internal CorElementType CorElementType

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this used on any hot paths? This change makes this quite a bit slower.

@MichalStrehovsky MichalStrehovsky Feb 23, 2020 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's used mostly in shared code around enums and arrays. They mostly just care about primitive types, so we could make this faster if we forgo correctness for the other values. We were already not reporting ARRAY/SZARRAY/STRING that Array.cs tests for to make an optimization anyway.

Then it's used in the widening code that I didn't want to touch because it's another scary change (offsetting into arrays). That should be a separately reviewed thing, ideally. We can add it as a commit in this pull request later, but I don't want it to distract from the main change here.

@MichalStrehovsky
MichalStrehovsky merged commit 65f1d8f into dotnet:master Mar 2, 2020
@MichalStrehovsky
MichalStrehovsky deleted the eetypeElementType branch March 2, 2020 07:45
MichalStrehovsky added a commit to MichalStrehovsky/corert that referenced this pull request Mar 14, 2020
After dotnet#8004, some information in EEType was duplicated. This frees up two bits in the main flags, and makes a couple checks easier.

I'm keeping the ParameterizedTypeShape concept because it makes casting Sz/Md arrays easier.
MichalStrehovsky added a commit that referenced this pull request Mar 15, 2020
After #8004, some information in EEType was duplicated. This frees up two bits in the main flags, and makes a couple checks easier.

I'm keeping the ParameterizedTypeShape concept because it makes casting Sz/Md arrays easier.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use TypeFlags enum instead of ECMA CorElementType in MRT binary format

2 participants