Skip to content
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

Re-Implemented ILBinaryReader with System.Reflection.Metadata #8081

Closed
wants to merge 76 commits into from

Conversation

TIHan
Copy link
Contributor

@TIHan TIHan commented Jan 3, 2020

This work is almost a year old, Jan 4th 2019; I decided to go ahead and try to finish it since I've been doing a lot of work in our IL metadata lately.

It saves about ~1500 lines of code and is a lot more readable.

Acceptance Criteria

  • Merge with latest 'main'
  • Properly read field data as a byte array when the field has a RVA
  • Add a command-line flag to turn this the reader on as we need to keep the original metadata reader available in-case of regressions; means this will be opt-in for now until we feel very comfortable that it works well enough to be the default.
  • Manual testing of major F# open-source projects, FAKE, Ionide, etc.
  • Tests that verify same data that was read in the older metadata reader

@TIHan
Copy link
Contributor Author

TIHan commented Oct 13, 2020

Wow, CI passes for the first time.

However, there is a perf issue when getting the content of the field using the field's RVA. I think it's reading more than it should.

@cartermp
Copy link
Contributor

Are there any interesting benchmark results now that it's passing CI?

InlineNone(volatileOrUnalignedPrefix (fun (ilAlignment, ilVolatility) -> I_ldind(ilAlignment, ilVolatility, DT_I8)))//byte OperandType.InlineNone // ldind.i8
InlineNone(volatileOrUnalignedPrefix (fun (ilAlignment, ilVolatility) -> I_ldind(ilAlignment, ilVolatility, DT_I)))//byte OperandType.InlineNone // ldind.i
InlineNone(volatileOrUnalignedPrefix (fun (ilAlignment, ilVolatility) -> I_ldind(ilAlignment, ilVolatility, DT_R4)))//byte OperandType.InlineNone // ldind.r4

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is incorrect: blobReader.ReadBytes(blobReader.Length)

blobReader.Length will definitely not give back the proper length. We may have to do what the original implementation did.

@vzarytovskii
Copy link
Member

Shelving this for the time being.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants