Skip to content

Conversation

@clamp03
Copy link
Member

@clamp03 clamp03 commented Mar 4, 2020

No description provided.

@clamp03
Copy link
Member Author

clamp03 commented Mar 4, 2020

I fixed a crash in System.String:StartsWith(System.String, int):bool:this which uses JMPTABLE.
And I tested on ARM32.

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you. Fixed.

@jkotas
Copy link
Member

jkotas commented Mar 4, 2020

cc @dotnet/crossgen-contrib

Copy link
Member

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[] _data field, it has a ObjectData _data field.
  • Data is not passed to the constructor (so we start with _data == null)
  • StaticDependenciesAreComputed property is implemented as return _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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you. Fixed.

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a 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!

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. Renamed.

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. Renamed too.

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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!

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a 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!

Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed. Thank you!

Copy link
Member

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.

Copy link
Member Author

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
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.

@MichalStrehovsky MichalStrehovsky merged commit 790a8d3 into dotnet:master Mar 6, 2020
@clamp03 clamp03 deleted the fixROData branch March 9, 2020 01:55
@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 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.

6 participants