@@ -1471,12 +1471,21 @@ FlatVariablesHasher::operator()(const std::shared_ptr<FlatVariables> &key) const
1471
1471
(uint64_t ) (key->var_layout .size () << 2 );
1472
1472
1473
1473
for (const Layout &layout : key->layout ) {
1474
- // if layout.fields is not 0 then layout.num == layout.fields.size()
1474
+ // If layout.fields is not 0 then layout.num == layout.fields.size()
1475
1475
// therefore we can omit layout.fields.size().
1476
- hash_combine (hash,
1477
- ((uint64_t ) layout.num << 32 ) | ((uint64_t ) layout.index ));
1478
- hash_combine (hash,
1479
- ((uint64_t ) layout.flags << 32 ) | ((uint64_t ) layout.vt ));
1476
+ // Layout of the hash key data:
1477
+ // struct {
1478
+ // uint64_t num : 20;
1479
+ // uint64_t index: 32;
1480
+ // uint64_t flags: 8;
1481
+ // uint64_t vt: 4;
1482
+ // };
1483
+ // This makes the assumption that we either don't have more than 1M
1484
+ // elements in one layout.
1485
+ hash_combine (hash, ((uint64_t ) layout.num << 44 ) |
1486
+ ((uint64_t ) layout.index << 12 ) |
1487
+ ((uint64_t ) layout.flags << 4 ) |
1488
+ ((uint64_t ) layout.vt ));
1480
1489
if (layout.flags & (uint32_t ) LayoutFlag::JitIndex)
1481
1490
hash_combine (hash, layout.literal );
1482
1491
@@ -1507,7 +1516,7 @@ FlatVariablesHasher::operator()(const std::shared_ptr<FlatVariables> &key) const
1507
1516
for (const VarLayout &layout : key->var_layout ) {
1508
1517
// layout.vt: 4
1509
1518
// layout.vs: 4
1510
- // layout.flags: 6
1519
+ // layout.flags: 8
1511
1520
hash_combine (hash, ((uint64_t ) layout.size_index << 32 ) |
1512
1521
((uint64_t ) layout.flags << 8 ) |
1513
1522
((uint64_t ) layout.vs << 4 ) |
0 commit comments