Analyzer: combine SP0 and the stack array into stackFrames and fix stack-related logic.