Mercurial > octave
changeset 27212:f84c5528e932
eliminate direct access to call stack in interpreter::mlock
* pt-eval.h, pt-eval.cc (tree_evaluator::mlock): New function.
* interpreter.cc (interpreter::mlock): Access mlock through evaluator
instead of using call stack directly.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 02 Apr 2019 11:59:28 +0000 |
parents | 8c27802a76c4 |
children | dc8df9a9e8b6 |
files | libinterp/corefcn/interpreter.cc libinterp/parse-tree/pt-eval.cc libinterp/parse-tree/pt-eval.h |
diffstat | 3 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc Tue Apr 02 11:51:24 2019 +0000 +++ b/libinterp/corefcn/interpreter.cc Tue Apr 02 11:59:28 2019 +0000 @@ -1126,14 +1126,7 @@ void interpreter::mlock (void) { - call_stack& cs = get_call_stack (); - - octave_function *fcn = cs.current (); - - if (! fcn) - error ("mlock: invalid use outside a function"); - - fcn->lock (); + m_evaluator.mlock (); } void interpreter::munlock (const std::string& nm)
--- a/libinterp/parse-tree/pt-eval.cc Tue Apr 02 11:51:24 2019 +0000 +++ b/libinterp/parse-tree/pt-eval.cc Tue Apr 02 11:59:28 2019 +0000 @@ -2043,6 +2043,16 @@ return m_call_stack.current_scope (); } + void tree_evaluator::mlock (void) const + { + octave_function *fcn = m_call_stack.current (); + + if (! fcn) + error ("mlock: invalid use outside a function"); + + fcn->lock (); + } + octave_value tree_evaluator::max_stack_depth (const octave_value_list& args, int nargout) {
--- a/libinterp/parse-tree/pt-eval.h Tue Apr 02 11:51:24 2019 +0000 +++ b/libinterp/parse-tree/pt-eval.h Tue Apr 02 11:59:28 2019 +0000 @@ -555,6 +555,8 @@ symbol_scope get_top_scope (void) const; symbol_scope get_current_scope (void) const; + void mlock (void) const; + octave_value max_stack_depth (const octave_value_list& args, int nargout); // Useful for debugging