| 1 |
= PolyHash |
| 2 |
|
| 3 |
<<PolyHash#>> is an optimization pass for the <<SSA#>> |
| 4 |
<<IntermediateLanguage#>>, invoked from <<SSASimplify#>>. |
| 5 |
|
| 6 |
== Description |
| 7 |
|
| 8 |
This pass implements polymorphic, structural hashing. |
| 9 |
|
| 10 |
== Implementation |
| 11 |
|
| 12 |
* https://github.com/MLton/mlton/blob/master/mlton/ssa/poly-hash.fun[`poly-hash.fun`] |
| 13 |
|
| 14 |
== Details and Notes |
| 15 |
|
| 16 |
For each datatype, tycon, and vector type, it builds and equality |
| 17 |
function and translates calls to `MLton_hash` into calls to that |
| 18 |
function. |
| 19 |
|
| 20 |
For tuples, it does the equality test inline; i.e., it does not create |
| 21 |
a separate equality function for each tuple type. |
| 22 |
|
| 23 |
All equality functions are created only if necessary, i.e., if |
| 24 |
equality is actually used at a type. |