-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Support rodata relocations in crossgen2 for ARM32 #33153
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
Conversation
|
I fixed a crash in System.String:StartsWith(System.String, int):bool:this which uses JMPTABLE. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unmanaged crossgen does this for Unix ARM only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. Fixed.
|
cc @dotnet/crossgen-contrib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a rather dangerous API - it changes what the node depends on within the dependency graph. If the node is already marked, the new dependencies won't be visited. We try to avoid APIs like this.
I would prefer we create a new class for this (e.g. SettableBlobNode) that is pretty much a copy of BlobNode with these differences:
- Instead of the
byte[] _datafield, it has aObjectData _datafield. - Data is not passed to the constructor (so we start with
_data == null) StaticDependenciesAreComputedproperty is implemented asreturn _data != null(this is the protection to make sure we don't end up in a situation where first there are no dependencies reported in the graph)- There is a
InitializeData(ObjectData data)method to initialize the _data field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your comment. I fixed based on your guide.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move the throw new NotImplementException to the place where we're reading locationBlock to have this together and avoid the duplicated condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could use a ref ArrayBuilder<Relocation> sourceBlock; local variable that either points to _codeRelocs or _roDataRelocs` to avoid the duplicated code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I fixed but I am not sure I did in right way.
MichalStrehovsky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good otherwise, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rename this method to SettableReadOnlyDataBlob? We might want to have the non-settable version back at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Renamed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename this to SettableReadOnlyDataBlobKey as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Renamed too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize this was the only use of BlobNode. Can you also delete BlobNode.cs? It feels like something we will need again, but we can just restore it from history it's ever needed again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I deleted BlobNode.cs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alignment is actually coming from the ObjectData, so this parameter and field is unused.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed alignment. Thank you!
MichalStrehovsky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good otherwise! Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rename the method to SettableReadOnlyDataBlob?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sigh, sorry to pester one more time - since the alignment parameter is now gone from here, this struct can be deleted too. We can just use the Utf8String as the key to the NodeCache instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem. Thank you so much!
| IMAGE_REL_BASED_REL32 = 0x10, // 32-bit relative address from byte following reloc | ||
| IMAGE_REL_BASED_THUMB_BRANCH24 = 0x13, // Thumb2: based B, BL | ||
| IMAGE_REL_BASED_THUMB_MOV32_PCREL = 0x14, // Thumb2: based MOVW/MOVT | ||
| IMAGE_REL_BASED_ARM64_BRANCH26 = 0x15, // Arm64: B, BL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AntonLapounov It looks like this relocation isn't handled correctly today in CorInfoImpl.GetRelocType . Please fix that there. Also, please adjust the value of this enum to be like the other ARM64 specific relocation types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidwrighton What code generates this relocation type? Apparently none of my tests hit it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AntonLapounov if we tweak the R2R codegen to generate direct calls/jumps at any point, it will do it. It doesn't now, but it might in the future.
The two interesting cases are if we come up with a scheme that allows direct calls without going through a R2R entrypoint indirection cell, or when we implement hot/cold splitting of methods. Of the two, I believe that hot/cold splitting is more likely in the .NET 5.0 timeframe, but neither is currently scheduled.
No description provided.