core: Implement stack and frame.