Foundationপ্রথম নীতি থেকে
LEVEL 5 · Compilers

JIT Compilation

জেআইটি কম্পিলেশন

Runtime-এই bytecode/IR থেকে native machine code বানিয়ে চালানো — interpreter-এর flexibility + AOT-এর speed মেলানোর compromise।

also: JIT, just-in-time compilation

Typical tiering (V8/JVM style):

interpreter  →  baseline JIT (দ্রুত compile, মোটামুটি code)
             →  optimizing JIT (hot path profile দেখে, speculative)
speculation fail → deoptimize → পেছনে
  • Hot path detection profiling থেকে — loop counter, call count
  • Speculative optimization: type feedback বলে “এখানে সব int” — guard emit করে int-only code; guard fail = deopt
  • Compile time একবারের খরচ, execution হাজারবার — তাই JIT-এ allocation speed সরাসরি user experience (linear scan regalloc এখানেই)
  • W^X security, code cache management, GC ও compiled frame-এর root agreement — runtime integration-এর কঠিন অংশ