The ActionScript Virtual Machine 2 (AVM2), developed as the open-source Mozilla Tamarin project, executes compiled ActionBlock Code (ABC) embedded within SWF `DoABC` tags. Analyzing its stack-based instruction set illuminates how high-level ActionScript code translates into deterministic machine execution.
1. AVM2 Stack Bytecode Example & Opcode Walkthrough
// Disassembled AVM2 Bytecode for `var total:int = a + b;`
getlocal_1 // Push local register 1 (variable 'a') onto evaluation stack
getlocal_2 // Push local register 2 (variable 'b') onto evaluation stack
add_i // Pop two integers, compute integer sum, push result
setlocal_3 // Pop result from stack and store in local register 3 ('total')