1 #pragma once 2 3 #include <vector> 4 5 #include <torch/csrc/jit/mobile/code.h> 6 #include <torch/csrc/jit/mobile/frame.h> 7 8 namespace torch::jit::mobile { 9 10 struct InterpreterState { 11 TORCH_API explicit InterpreterState(const Code& code); 12 TORCH_API bool run(Stack& stack); 13 14 private: 15 void enterFrame(const Code&); 16 void leaveFrame(); 17 void saveExceptionDebugHandles(); 18 void callFunction(torch::jit::Function& f, Stack& stack); 19 20 c10::IValue& reg(size_t reg); 21 std::vector<c10::IValue> registers_; 22 std::vector<Frame> frames_; 23 }; 24 25 const std::vector<DebugHandle>& getInterpretersExceptionDebugHandles(); 26 } // namespace torch::jit::mobile 27