Commit Graph

10 Commits

Author SHA1 Message Date
Chris Fallin
2ba518517d Fuzzbugfix: actually do need eager liveness computation; must uphold invariant that all earlier-in-postorder blocks have full livein sets. 2021-05-06 23:29:59 -07:00
Chris Fallin
2ff02b50a3 Some perf opts in liveness computation and set impl:
- Cache the most recent u64 chunk in the set to avoid some hashmap
  lookups;
- Defer the live-set union'ing over the loop body until query time
  (remember the set that would have been union'd in instead), and lazily
  propagate the liveness bit at that query time, union-find style;
- Do n-1 rather than n union operations for n successors (first is a
  clone instead);
- Don't union in liveness sets from blocks we haven't visited yet (the
  loop-body/backedge handling handles these).
2021-05-06 22:46:16 -07:00
Chris Fallin
a148dccac3 Parameterize adaptive-map size in BitVec. 2021-05-06 22:14:46 -07:00
Chris Fallin
02b6516acd Some memory-size/bitpacking optimizations 2021-05-06 20:47:17 -07:00
Chris Fallin
07a5a88972 BitVec perf: use adaptive hybrid chunked small-array + FxHashMap. 2021-05-06 20:03:44 -07:00
Chris Fallin
747c56c2c3 Some micro-optimizations in BitVec. 2021-05-06 16:19:38 -07:00
Chris Fallin
48fbc235ea BitVec::get() takes immutable self 2021-05-05 23:08:19 -07:00
Chris Fallin
940c1b719d Changes from review comments. 2021-04-18 13:12:33 -07:00
Chris Fallin
a08b0121a0 Add support for reftypes/stackmaps and Stack constraints, and misc API changes.
The main enhancement in this commit is support for reference types and
stackmaps. This requires tracking whether each VReg is a "reference" or
"pointer". At certain instructions designated as "safepoints", the
regalloc will (i) ensure that all references are in spillslots rather
than in registers, and (ii) provide a list of exactly which spillslots
have live references at that program point. This can be used by, e.g., a
GC to trace and possibly modify pointers. The stackmap of spillslots is
precise: it includes all live references, and *only* live references.

This commit also brings in some API tweaks as part of the in-progress
Cranelift glue. In particular, it makes Allocations and Operands
mutually disjoint by using the same bitfield for the type-tag in both
and choosing non-overlapping tags. This will allow instructions to carry
an Operand for each register slot and then overwrite these in place with
Allocations. The `OperandOrAllocation` type does the necessary magic to
make this look like an enum, but staying in 32 bits.
2021-04-17 21:29:13 -07:00
Chris Fallin
8e923b0ad9 Initial public commit of regalloc2. 2021-04-13 17:40:12 -07:00