changeset 25381:072494014e76

maint: Merge stable to default.
author John W. Eaton <jwe@octave.org>
date Tue, 15 May 2018 15:34:09 -0400
parents 71cc81aad717 (current diff) 61ba501d8f04 (diff)
children 749d9e858553
files libinterp/parse-tree/pt-arg-list.cc libinterp/parse-tree/pt-eval.cc libinterp/parse-tree/pt-eval.h test/bug-46497/bug-46497.tst test/bug-46497/class_bug46497.m test/bug-46497/module.mk test/module.mk
diffstat 7 files changed, 3 insertions(+), 137 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-arg-list.cc	Tue May 15 11:47:21 2018 -0700
+++ b/libinterp/parse-tree/pt-arg-list.cc	Tue May 15 15:34:09 2018 -0400
@@ -247,29 +247,12 @@
 
         if (elt)
           {
-            bool is_assignment = elt->is_assignment_expression ();
-
             octave_value tmp = tw->evaluate (elt);
 
             if (tmp.is_cs_list ())
               args.push_back (tmp.list_value ());
             else if (tmp.is_defined ())
-              {
-                args.push_back (tmp);
-
-                // Defer deletion of any temporary values until the end
-                // of the containing statement.  That way destructors
-                // for temporary classdef handle objects will be called
-                // when it is safe to do so.
-                //
-                // FIXME: We could further limit this action to classdef
-                // handle objects, but we don't currently have an
-                // octave_value predicate for that so should add it on
-                // the default branch, not stable.
-
-                if (! is_assignment)
-                  tw->defer_deletion (tmp);
-              }
+              args.push_back (tmp);
           }
         else
           {
--- a/libinterp/parse-tree/pt-eval.cc	Tue May 15 11:47:21 2018 -0700
+++ b/libinterp/parse-tree/pt-eval.cc	Tue May 15 15:34:09 2018 -0400
@@ -78,7 +78,6 @@
     m_result_type = RT_UNDEFINED;
     m_expr_result_value = octave_value ();
     m_expr_result_value_list = octave_value_list ();
-    m_deferred_delete_stack.clear ();
     m_lvalue_list_stack.clear ();
     m_nargout_stack.clear ();
   }
@@ -1367,16 +1366,6 @@
     if (base_expr_val.is_undefined ())
       base_expr_val = evaluate (expr);
 
-    // Defer deletion of any temporary values until the end of the
-    // containing statement.  That way destructors for temporary
-    // classdef handle objects will be called when it is safe to do so.
-    //
-    // FIXME: We could further limit this action to classdef handle
-    // objects, but we don't currently have an octave_value predicate for
-    // that so should add it on the default branch, not stable.
-
-    defer_deletion (base_expr_val);
-
     // If we are indexing an object or looking at something like
     //
     //   classname.static_function (args, ...);
@@ -2278,13 +2267,6 @@
               cmd->accept (*this);
             else
               {
-                unwind_protect frame;
-
-                frame.add_method (m_deferred_delete_stack,
-                                  &deferred_delete_stack::pop_frame);
-
-                m_deferred_delete_stack.mark ();
-
                 if (m_echo_state)
                   {
                     size_t line = stmt.line ();
--- a/libinterp/parse-tree/pt-eval.h	Tue May 15 11:47:21 2018 -0700
+++ b/libinterp/parse-tree/pt-eval.h	Tue May 15 15:34:09 2018 -0400
@@ -70,54 +70,6 @@
       ECHO_ALL = 4
     };
 
-    class deferred_delete_stack
-    {
-    public:
-
-      deferred_delete_stack (void) = default;
-
-      deferred_delete_stack (const deferred_delete_stack&) = default;
-
-      deferred_delete_stack& operator = (const deferred_delete_stack&) = default;
-
-      ~deferred_delete_stack (void) = default;
-
-      // An undefined value on the stack marks the boundary of the
-      // current frame.
-
-      void mark (void) { push (octave_value ()); }
-
-      void push (const octave_value& val) { m_stack.push (val); }
-
-      void pop_frame (void)
-      {
-        while (! m_stack.empty ())
-          {
-            octave_value val = val_pop ();
-
-            if (val.is_undefined ())
-              break;
-          }
-      }
-
-      void clear (void)
-      {
-        while (! m_stack.empty ())
-          m_stack.pop ();
-      }
-
-    private:
-
-      std::stack<octave_value> m_stack;
-
-      octave_value val_pop (void)
-      {
-        octave_value retval = m_stack.top ();
-        m_stack.pop ();
-        return retval;
-      }
-    };
-
     template <typename T>
     class value_stack
     {
@@ -176,8 +128,8 @@
     tree_evaluator (interpreter& interp)
       : m_interpreter (interp), m_result_type (RT_UNDEFINED),
         m_expr_result_value (), m_expr_result_value_list (),
-        m_deferred_delete_stack (), m_lvalue_list_stack (),
-        m_nargout_stack (), m_bp_table (*this), m_call_stack (interp),
+        m_lvalue_list_stack (), m_nargout_stack (),
+        m_bp_table (*this), m_call_stack (interp),
         m_profiler (), m_max_recursion_depth (256),
         m_silent_functions (false), m_string_fill_char (' '),
         m_PS4 ("+ "), m_dbstep_flag (0), m_echo (ECHO_OFF),
@@ -314,11 +266,6 @@
     // The context for the current evaluation.
     static stmt_list_type statement_context;
 
-    void defer_deletion (const octave_value& val)
-    {
-      m_deferred_delete_stack.push (val);
-    }
-
     Matrix ignored_fcn_outputs (void) const;
 
     bool isargout (int nargout, int iout) const;
@@ -547,8 +494,6 @@
     octave_value m_expr_result_value;
     octave_value_list m_expr_result_value_list;
 
-    deferred_delete_stack m_deferred_delete_stack;
-
     value_stack<const std::list<octave_lvalue>*> m_lvalue_list_stack;
 
     value_stack<int> m_nargout_stack;
--- a/test/bug-46497/bug-46497.tst	Tue May 15 11:47:21 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-## Copyright (C) 2017 Piotr Held
-##
-## This file is part of Octave.
-##
-## Octave is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 3 of the License, or
-## (at your option) any later version.
-##
-## Octave is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Octave; see the file COPYING.  If not, see
-## <http://www.gnu.org/licenses/>.
-
-%!test
-%! global __bug46497_global__
-%! __bug46497_global__ = "test_bug46497";
-%! a = class_bug46497 (13);
-%! a = [];
-%! assert(__bug46497_global__, struct ("myprop", 13, "status", "deleted"));
--- a/test/bug-46497/class_bug46497.m	Tue May 15 11:47:21 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-classdef class_bug46497 < handle
-  properties
-    myprop;
-  endproperties
-  methods
-    function obj = class_bug46497 (x)
-      obj.myprop = x;
-    endfunction
-    function delete (self)
-      global __bug46497_global__
-      __bug46497_global__ = struct ("myprop", self.myprop, "status", "deleted");
-    endfunction
-  endmethods
-endclassdef
--- a/test/bug-46497/module.mk	Tue May 15 11:47:21 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-bug_46497_TEST_FILES = \
-  %reldir%/bug-46497.tst \
-  %reldir%/class_bug46497.m
-
-TEST_FILES += $(bug_46497_TEST_FILES)
--- a/test/module.mk	Tue May 15 11:47:21 2018 -0700
+++ b/test/module.mk	Tue May 15 15:34:09 2018 -0400
@@ -56,7 +56,6 @@
 include %reldir%/bug-38691/module.mk
 include %reldir%/bug-41723/module.mk
 include %reldir%/bug-44940/module.mk
-include %reldir%/bug-46497/module.mk
 include %reldir%/bug-46660/module.mk
 include %reldir%/bug-49379/module.mk
 include %reldir%/bug-50014/module.mk