Hasty Briefsbeta

A Catalog of Side Effects

11 days ago
  • #compiler-optimization
  • #jit-compilation
  • #ir-effects
  • Optimizing compilers track IR instruction effects to determine reordering, duplication, or removal possibilities.
  • Effects range from no effect to writing specific variables or unknown state changes.
  • Different compilers represent effects differently, with two main approaches: bitsets and heap range lists.
  • Cinder (Python JIT) uses a bitset representation for heap effects, allowing efficient union and intersection operations.
  • JavaScriptCore (JSC) uses abstract heaps with integer ranges to represent nested heap effects, offering flexibility.
  • Effects are crucial for optimizations like dead code elimination (DCE), common subexpression elimination (CSE), and instruction reordering.
  • Simple (Sea of Nodes project) uses type-based alias analysis (TBAA) for memory effects, with dependencies on effect nodes.
  • Other compilers like HHVM, ART, CoreCLR, and V8 also use bitsets or similar representations for effect tracking.
  • DOM builtins in JSC annotate effects to allow the JIT to optimize around them, improving performance.
  • Both bitsets and int ranges are valid for representing heap effects, with trade-offs in precision and flexibility.