ARMeilleure: Hash _data pointer instead of value for Operand (#4156)
I noticed a weirdly high cost for dictionary accesses from MarkLabel etc. Turns out that the hash code was always the same for labels, so the whole point of having a dictionary was missed and it was putting everything in the same bucket. I made it always hash the _data pointer as that's a good source of identifiable and "random" data.
This commit is contained in:
parent
6268170a10
commit
c200a7b7c6
1 changed files with 1 additions and 8 deletions
|
@ -378,14 +378,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
||||||
|
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
{
|
{
|
||||||
if (Kind == OperandKind.LocalVariable)
|
return ((ulong)_data).GetHashCode();
|
||||||
{
|
|
||||||
return base.GetHashCode();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return (int)Value ^ ((int)Kind << 16) ^ ((int)Type << 20);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(Operand operand)
|
public bool Equals(Operand operand)
|
||||||
|
|
Loading…
Reference in a new issue