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

Enable Project N reflection stack - #1018

Merged
MichalStrehovsky merged 3 commits into
dotnet:masterfrom
MichalStrehovsky:enableReflection
Mar 18, 2016
Merged

MichalStrehovsky merged 3 commits into
dotnet:masterfrom
MichalStrehovsky:enableReflection

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

Turns out the only JIT assumption about RuntimeTypeHandle having a single field of type RuntimeType that was biting us was the intrinsic expansion of GetTypeFromHandle. Not reporting the intrinsic to the JIT seems to work well enough.

I scanned the rest of the JIT code base but I couldn't find other places where this would be a problem.

Not reporting GetTypeFromHandle means we don't get optimizations around equality comparison, but we can likely live with that for a year or so...

The JIT expansion of this intrinsic assumes RuntimeTypeHandle has a
single field of type RuntimeType which is not the case right now.
@jkotas

jkotas commented Mar 17, 2016

Copy link
Copy Markdown
Member

There are more places in the JIT that assume layout of RuntimeTypeHandle:

E.g. op1->gtCall.gtReturnType = TYP_REF; at https://github.com/dotnet/coreclr/blob/master/src/jit/importer.cpp#L12537 says that the result of GetRuntimeTypeHandle helper is a object reference wrapped in a struct.

@jkotas

jkotas commented Mar 17, 2016

Copy link
Copy Markdown
Member

(You should see asserts about this with debug build of the JIT.)

@MichalStrehovsky

Copy link
Copy Markdown
Member Author

There are more places in the JIT that assume layout of RuntimeTypeHandle

Sigh. That one is so subtle that only someone who knows the JIT code base can spot it :(

(You should see asserts about this with debug build of the JIT.)

I did use a CHK version of the JIT to run all the CI tests (including the new one) and I haven't seen it assert.

@jkotas

jkotas commented Mar 17, 2016

Copy link
Copy Markdown
Member

I have tried to repro the JIT asserts that I was seeing earlier when I have done the work on ldtoken, etc. I do not see them now either.

@jkotas

jkotas commented Mar 18, 2016

Copy link
Copy Markdown
Member

LGTM - it will need some more work in future.

MichalStrehovsky added a commit that referenced this pull request Mar 18, 2016
@MichalStrehovsky
MichalStrehovsky merged commit 0b1abbc into dotnet:master Mar 18, 2016
@MichalStrehovsky
MichalStrehovsky deleted the enableReflection branch March 18, 2016 02:12
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.

3 participants