Skip to content

Fix crossgen2 handling of sequential layout with explicit size - #1763

Merged
janvorli merged 1 commit into
dotnet:masterfrom
janvorli:fix-sequential-with-explicit-size
Jan 16, 2020
Merged

janvorli merged 1 commit into
dotnet:masterfrom
janvorli:fix-sequential-with-explicit-size

Conversation

@janvorli

Copy link
Copy Markdown
Member

Crossgen2 is incorrectly not marking types with sequential layout and
explicit size as custom layout, which results in JIT generating incorrect
code for copying such structs. One example is the
Loader/classloader/SequentialLayout/Regress/ExplicitSize/ExplicitSize
test that has a struct with single int element, sequential layout and
explicitly set size to 16. The getClassAttribsInternal was not setting
CorInfoFlag.CORINFO_FLG_CUSTOMLAYOUT for this type and so JIT was
generating code that copied just the int element.

This change fixes it. Runtime uses similar check.

Crossgen2 is incorrectly not marking types with sequential layout and
explicit size as custom layout, which results in JIT generating incorrect
code for copying such structs. One example is the
Loader/classloader/SequentialLayout/Regress/ExplicitSize/ExplicitSize
test that has a struct with single int element, sequential layout and
explicitly set size to 16. The getClassAttribsInternal was not setting
CorInfoFlag.CORINFO_FLG_CUSTOMLAYOUT for this type and so JIT was
generating code that copied just the int element.

This change fixes it. Runtime uses similar check.
@janvorli janvorli added this to the 5.0 milestone Jan 15, 2020
@janvorli
janvorli requested a review from trylek January 15, 2020 15:36
@janvorli janvorli self-assigned this Jan 15, 2020

@trylek trylek left a comment

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.

LGTM, thanks for fixing this!

@janvorli
janvorli merged commit ef77b07 into dotnet:master Jan 16, 2020
@janvorli
janvorli deleted the fix-sequential-with-explicit-size branch January 16, 2020 10:36
@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 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.

2 participants