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

Detect ByRefLike types using attribute #15745

Merged
merged 2 commits into from Jan 5, 2018

Conversation

Projects
None yet
4 participants
@jkotas
Member

jkotas commented Jan 5, 2018

Detect ByRefLike types using attribute and improve error messages for their invalid use

Fixes #11371 and #15458

@mikedn

This comment has been minimized.

Contributor

mikedn commented Jan 5, 2018

Hmm, I wonder if there are sufficient guarantees that by ref like types only live on the stack for the JIT to be able to eliminate GC write barriers when writing to fields of such types.

@MichalStrehovsky

Looks good apart from the minor comments.

@@ -4085,8 +4089,10 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList,
// Non-value-classes cannot contain by-ref-like instance fields
BuildMethodTableThrowException(IDS_CLASSLOAD_BYREFLIKE_NOTVALUECLASSFIELD);
}
bmtFP->fIsByRefLikeType = true;
if (!bmtFP->fIsByRefLikeType)

This comment has been minimized.

@MichalStrehovsky

MichalStrehovsky Jan 5, 2018

Member

Maybe update the comment above (// Inherit IsByRefLike characteristic from fields) since we're not inheriting it anymore, but merely checking?

.maxstack 1
ldc.i4.1
newarr valuetype MyByRefLikeType
ret

This comment has been minimized.

@MichalStrehovsky

MichalStrehovsky Jan 5, 2018

Member

Non-empty stack but returns void?

.method private hidebysig static void ByRefLikeGenericInstantiation() cil managed
{
.maxstack 1
newobj instance void class [System.Runtime]System.Collections.Generic.List`1<valuetype MyByRefLikeType>::.ctor()

This comment has been minimized.

@MichalStrehovsky

MichalStrehovsky Jan 5, 2018

Member

Non-empty stack but returns void?

@jkotas

This comment has been minimized.

Member

jkotas commented Jan 5, 2018

Hmm, I wonder if there are sufficient guarantees that by ref like types only live on the stack for the JIT to be able to eliminate GC write barriers when writing to fields of such types.

Yes, there are. It would be nice optimization to have.

Opened #15755

@jkotas

This comment has been minimized.

Member

jkotas commented Jan 5, 2018

@dotnet-bot test OSX10.12 x64 Checked Innerloop Build and Test please

@kouvel

This comment has been minimized.

Member

kouvel commented Jan 5, 2018

LGTM

@jkotas

This comment has been minimized.

Member

jkotas commented Jan 5, 2018

@dotnet-bot test Tizen armel Cross Checked Innerloop Build and Test please
@dotnet-bot test Windows_NT arm64 Cross Checked Innerloop Build and Test please

@jkotas jkotas merged commit 6c12105 into dotnet:master Jan 5, 2018

18 of 19 checks passed

Windows_NT arm64 Cross Checked Innerloop Build and Test Started.
Details
Alpine.3.6 x64 Debug Build Build finished.
Details
CROSS Check Build finished.
Details
CentOS7.1 x64 Checked Innerloop Build and Test Build finished.
Details
CentOS7.1 x64 Debug Innerloop Build Build finished.
Details
OSX10.12 x64 Checked Innerloop Build and Test Build finished.
Details
Tizen armel Cross Checked Innerloop Build and Test Build finished.
Details
Ubuntu arm Cross Debug Innerloop Build Build finished.
Details
Ubuntu arm64 Cross Debug Innerloop Build Build finished.
Details
Ubuntu x64 Checked Innerloop Build and Test Build finished.
Details
Ubuntu x64 Innerloop Formatting Build finished.
Details
Ubuntu16.04 arm Cross Debug Innerloop Build Build finished.
Details
WIP ready for review
Details
Windows_NT arm Cross Checked Innerloop Build and Test Build finished.
Details
Windows_NT armlb Cross Checked Innerloop Build and Test Build finished.
Details
Windows_NT x64 Checked Innerloop Build and Test Build finished.
Details
Windows_NT x64 Innerloop Formatting Build finished.
Details
Windows_NT x86 Checked Innerloop Build and Test Build finished.
Details
license/cla All CLA requirements met.
Details

@jkotas jkotas deleted the jkotas:byref-like branch Jan 5, 2018

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