Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Use overriden double/float GetHashCode for default struct hashcodes #16550

Merged
merged 1 commit into from Feb 26, 2018

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Feb 24, 2018

Fixes #16545

@jkotas
Copy link
Member Author

jkotas commented Feb 24, 2018

cc @MichalStrehovsky

void *pFieldValue = (BYTE *)pObj + field->GetOffsetUnsafe();
if (field->IsObjRef())
// if we get an object reference we get the hash code out of that
if (*(Object**)((BYTE *)pObjRef + field->GetOffsetUnsafe()) != NULL)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder what was the reason for removing the pFieldValue and using the (BYTE *)pObjRef + field->GetOffsetUnsafe() at all places.

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 would have to add more GC protects for the pFieldValue. The original code tried to step around the GC protect, but it is not easy to do in the extra code that I have added (and I am also not sure whether the original got it 100% right).

@jkotas jkotas merged commit 1e1d242 into dotnet:master Feb 26, 2018
@MichalStrehovsky
Copy link
Member

Thanks! I'm glad I don't have to replicate this bug on the CoreRT side :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants