Skip to content

Conversation

@davidwrighton
Copy link
Member

@davidwrighton davidwrighton commented Jul 31, 2020

  • Enable type layout verification in crossgen2 test passes
  • Fix issues noted from last attempt to do so
  • Do not generate type layout checks or verification if the offset is 24 bits or larger
  • Only load approx enclosing type when verifying, instead of enclosing type (this avoids asserts)
  • HFA encoding was not correct for Arm64, and did not have R2R defined constants

Do not merge until this has passed manual checks against all of the various crossgen2 test pipelines

  • Crossgen2 pipeline tested
  • Crossgen2 Composite pipeline tested

@AntonLapounov
Copy link
Member

Why do we need to introduce ReadyToRunHFAElemType if it is the same as CorInfoHFAElemType?

{
public class FieldFixupSignature : Signature
{
public const int MaxCheckableOffset = 0x1FFFFFFF;
Copy link
Member

Choose a reason for hiding this comment

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

What was the issue with larger offsets? Are they now unchecked?

Copy link
Member Author

Choose a reason for hiding this comment

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

They are now unchecked. The problem is that the encoding uses the compressed uint encoding from metadata which cannot encode a number greater than 0x1FFFFFFF.

In practice, the need to do this is so rare, that it isn't worth changing the encoding.

Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we fail compilation for large offsets then? I see throwing a RequiresRuntimeJitException in one if branch, but not in others.

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 modulo Anton's feedback

@davidwrighton
Copy link
Member Author

Why do we need to introduce ReadyToRunHFAElemType if it is the same as CorInfoHFAElemType?

All contents of the ReadyToRun file format should be either ECMA 335 constants, or defined as part of the ready to run headers.

Copy link
Member

@jkoritzinsky jkoritzinsky left a comment

Choose a reason for hiding this comment

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

fieldmarshaler.cpp changes look good to me!

@AaronRobinsonMSFT
Copy link
Member

@jkoritzinsky I see some validation here for crossgen2, what about the runtime itself? I would assume the runtime needs a new test or to update one.

@jkoritzinsky
Copy link
Member

I don't believe we have a type layout test in the runtime for this case.

The crossgen2 test will catch any unintentional layout changes in this area since crossgen2 has a parallel implementation, so a runtime test isn't as immediately important. It would still be worth adding though I think.

@davidwrighton davidwrighton marked this pull request as ready for review August 3, 2020 20:00
@davidwrighton davidwrighton merged commit a4c4efc into dotnet:master Aug 3, 2020
Jacksondr5 pushed a commit to Jacksondr5/runtime that referenced this pull request Aug 10, 2020
- Enable type layout verification in crossgen2 test passes

Product bugs found/fixed
- Fix type blittability issue found during enabling this test.
  - HFA encoding was not correct for Arm64, and did not have R2R defined constants

- Fix type layout verification infrastructure issues
  - Do not generate type layout checks or verification if the offset is 24 bits or larger
  - Only load approx enclosing type when verifying, instead of enclosing type (this avoids asserts)
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
@davidwrighton davidwrighton deleted the type_verification_in_tests branch April 20, 2021 17:43
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.

7 participants