Mercurial > octave
diff libinterp/parse-tree/pt-eval.h @ 28426:9a3deb17b4ea stable
use shared_ptr for stack frames in call stack and for accesss and static links
* call-stack.h, call-stack.cc: Use std::shared_ptr<stack_frame>
instead of bare pointer for elements of call stack. Change all uses.
* stack-frame.h, stack-frame.cc (stack_frame::static_link,
stack_frame::access_link): Use std::shared_ptr<stack_frame>
instead of bare pointer. Change all uses.
(stack_frame::workspace): New function.
* ov-fcn-handle.h, ov-fcn-handle.cc
(octave_fcn_handle::m_closure_frames): Now a
std::shared_ptr<stack_frame> object instead of a list of copied stack
frames. Change all uses.
(octave_fcn_handle::push_closure_context): Simply store
std::shared_ptr to current stack frame.
(octave_fcn_handle::workspace): Call stack_frame::workspace to get
workspace info when we have closure frames.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 25 Apr 2020 13:17:11 -0400 |
parents | 3241ede9806c |
children | 8eb8ba8aff9a |
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-eval.h Fri Apr 24 14:21:07 2020 -0400 +++ b/libinterp/parse-tree/pt-eval.h Sat Apr 25 13:17:11 2020 -0400 @@ -212,7 +212,7 @@ octave_value_list execute_user_function (octave_user_function& user_function, int nargout, const octave_value_list& args, - stack_frame *closure_frames = nullptr); + const std::shared_ptr<stack_frame>& closure_frames = std::shared_ptr<stack_frame> ()); void visit_octave_user_function_header (octave_user_function&); @@ -378,7 +378,7 @@ void push_stack_frame (octave_user_function *fcn, unwind_protect *up_frame, - stack_frame *closure_frames = nullptr); + const std::shared_ptr<stack_frame>& closure_frames = std::shared_ptr<stack_frame> ()); void push_stack_frame (octave_user_script *script, unwind_protect *up_frame); @@ -387,17 +387,12 @@ void pop_stack_frame (void); - const stack_frame& get_current_stack_frame (void) const + std::shared_ptr<stack_frame> get_current_stack_frame (void) const { return m_call_stack.get_current_stack_frame (); } - stack_frame& get_current_stack_frame (void) - { - return m_call_stack.get_current_stack_frame (); - } - - stack_frame * current_user_frame (void) const + std::shared_ptr<stack_frame> current_user_frame (void) const { return m_call_stack.current_user_frame (); } @@ -443,10 +438,10 @@ bool is_class_constructor_executing (std::string& dispatch_class) const; - std::list<stack_frame *> + std::list<std::shared_ptr<stack_frame>> backtrace_frames (octave_idx_type& curr_user_frame) const; - std::list<stack_frame *> backtrace_frames () const; + std::list<std::shared_ptr<stack_frame>> backtrace_frames () const; std::list<frame_info> backtrace_info (octave_idx_type& curr_user_frame, bool print_subfn = true) const;