gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/Property.cpp server/Prop...


From: Chad Musick
Subject: [Gnash-commit] gnash ChangeLog server/Property.cpp server/Prop...
Date: Wed, 21 Nov 2007 09:21:50 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Chad Musick <cmusick>   07/11/21 09:21:50

Modified files:
        .              : ChangeLog 
        server         : Property.cpp Property.h as_environment.cpp 
                         as_environment.h as_object.cpp as_value.cpp 
                         namedStrings.cpp namedStrings.h 
                         swf_function.cpp 
        server/vm      : ActionExec.cpp 
        testsuite/actionscript.all: LoadVars.as 

Log message:
        Making call stack static, fix unitialized value in as_environment, be
        more careful about values in boost variants.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4906&r2=1.4907
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Property.cpp?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Property.h?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.cpp?cvsroot=gnash&r1=1.109&r2=1.110
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.h?cvsroot=gnash&r1=1.63&r2=1.64
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.cpp?cvsroot=gnash&r1=1.83&r2=1.84
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.cpp?cvsroot=gnash&r1=1.97&r2=1.98
http://cvs.savannah.gnu.org/viewcvs/gnash/server/namedStrings.cpp?cvsroot=gnash&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/gnash/server/namedStrings.h?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf_function.cpp?cvsroot=gnash&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ActionExec.cpp?cvsroot=gnash&r1=1.58&r2=1.59
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/LoadVars.as?cvsroot=gnash&r1=1.15&r2=1.16

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4906
retrieving revision 1.4907
diff -u -b -r1.4906 -r1.4907
--- ChangeLog   21 Nov 2007 08:29:40 -0000      1.4906
+++ ChangeLog   21 Nov 2007 09:21:48 -0000      1.4907
@@ -1,3 +1,17 @@
+2007-11-21 Chad Musick <address@hidden>
+
+       * server/as_environment.h,.cpp: Initialize _original_target, as this
+         absence was causing segfaults.  Convert the call stack to a static
+         one.
+       * server/swf_function.cpp: Use a class for ensuring the call stack,
+         rather than doing so manually.
+       * server/Property.h,.cpp: Initialize differently.
+       * server/as_value.cpp: Be more careful about return values.
+       * testsuite/actionscript.all/LoadVars.as: Clean up debugging code.
+       * server/namedStrings.h,.cpp: Add 'super' to known strings.
+       * server/vm/ActionExec.cpp: No need to check call stack, as it is
+         guaranteed correct through use of FrameGuard class.
+       
 2007-11-21 Zou Lunkai <address@hidden>
 
        * server/as_value.cpp: to_number() convert invalid float literal

Index: server/Property.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/Property.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- server/Property.cpp 30 Oct 2007 18:55:42 -0000      1.3
+++ server/Property.cpp 21 Nov 2007 09:21:49 -0000      1.4
@@ -98,8 +98,10 @@
        case 0: // Blank, nothing to do.
                break;
        case 1: // Simple property, value
+       {
                boost::get<as_value>(mBound).setReachable();
                break;
+       }
        case 2: // Getter/setter
        {
                const as_accessors& a = boost::get<as_accessors>(mBound);

Index: server/Property.h
===================================================================
RCS file: /sources/gnash/gnash/server/Property.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/Property.h   9 Nov 2007 00:35:01 -0000       1.14
+++ server/Property.h   21 Nov 2007 09:21:49 -0000      1.15
@@ -15,7 +15,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: Property.h,v 1.14 2007/11/09 00:35:01 nihilus Exp $ */ 
+/* $Id: Property.h,v 1.15 2007/11/21 09:21:49 cmusick Exp $ */ 
 
 #ifndef GNASH_PROPERTY_H
 #define GNASH_PROPERTY_H
@@ -82,7 +82,7 @@
 public:
        /// Default constructor
        Property(string_table::key name = 0, string_table::key nsId = 0) : 
-               mName(name), mNamespace(nsId)
+               mBound(as_value()), mName(name), mNamespace(nsId)
        {/**/}
 
        /// Copy constructor

Index: server/as_environment.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.cpp,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -b -r1.109 -r1.110
--- server/as_environment.cpp   16 Nov 2007 21:28:54 -0000      1.109
+++ server/as_environment.cpp   21 Nov 2007 09:21:49 -0000      1.110
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: as_environment.cpp,v 1.109 2007/11/16 21:28:54 strk Exp $ */
+/* $Id: as_environment.cpp,v 1.110 2007/11/21 09:21:49 cmusick Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -46,6 +46,8 @@
 
 namespace gnash {
 
+as_environment::CallStack as_environment::_localFrames = 
as_environment::CallStack();
+
 // Return the value of the given var, if it's defined.
 as_value
 as_environment::get_variable(const std::string& varname,
@@ -880,6 +882,7 @@
        {
                i->setReachable();
        }
+       if (locals)
        locals->setReachable();
 }
 

Index: server/as_environment.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.h,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- server/as_environment.h     14 Nov 2007 22:16:05 -0000      1.63
+++ server/as_environment.h     21 Nov 2007 09:21:49 -0000      1.64
@@ -51,7 +51,9 @@
 
        as_environment()
                :
-               m_target(0)
+               m_stack(),
+               m_target(0),
+               _original_target(0)
        {
        }
 
@@ -436,6 +438,10 @@
        {
                CallFrame(as_function* funcPtr);
 
+               CallFrame(const CallFrame& other) : locals(other.locals),
+                       registers(other.registers), func(other.func)
+               {/**/}
+
                /// function use this 
                LocalVars locals;
 
@@ -489,12 +495,13 @@
        {
                return _localFrames.size();
        }
-
+/*
        /// Clear the call stack
        void clearCallFrames()
        {
                _localFrames.clear();
        }
+*/
 
 private:
 
@@ -502,7 +509,7 @@
 
        typedef std::vector<CallFrame> CallStack;
                
-       CallStack _localFrames;
+       static CallStack _localFrames;
 
        as_value m_global_register[numGlobalRegisters];
 

Index: server/as_object.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.cpp,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -b -r1.83 -r1.84
--- server/as_object.cpp        20 Nov 2007 22:14:48 -0000      1.83
+++ server/as_object.cpp        21 Nov 2007 09:21:49 -0000      1.84
@@ -102,7 +102,8 @@
        assert(val);
 
        Property* prop = findProperty(name, nsname);
-       if ( ! prop ) return false;
+       if (!prop)
+               return false;
 
        try 
        {
@@ -212,7 +213,7 @@
        as_object **owner)
 {
        // don't enter an infinite loop looking for __proto__ ...
-       if (key == NSV::PROP_uuPROTOuu)
+       if (key == NSV::PROP_uuPROTOuu && !nsname)
        {
                if (owner != NULL)
                        *owner = this;

Index: server/as_value.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.cpp,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -b -r1.97 -r1.98
--- server/as_value.cpp 21 Nov 2007 08:29:40 -0000      1.97
+++ server/as_value.cpp 21 Nov 2007 09:21:49 -0000      1.98
@@ -1250,17 +1250,25 @@
        switch (m_type)
        {
                case OBJECT:
-                       getObj()->setReachable();
+               {
+                       as_value::AsObjPtr op = getObj();
+                       if (op)
+                               op->setReachable();
                        break;
-
+               }
                case AS_FUNCTION:
-                       getFun()->setReachable();
+               {
+                       as_value::AsFunPtr fp = getFun();
+                       if (fp)
+                               fp->setReachable();
                        break;
-
+               }
                case MOVIECLIP:
-                       getSpriteProxy().setReachable();
+               {
+                       as_value::SpriteProxy sp = getSpriteProxy();
+                       sp.setReachable();
                        break;
-
+               }
                default: break;
        }
 #endif // GNASH_USE_GC

Index: server/namedStrings.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/namedStrings.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/namedStrings.cpp     29 Oct 2007 21:07:34 -0000      1.5
+++ server/namedStrings.cpp     21 Nov 2007 09:21:49 -0000      1.6
@@ -73,6 +73,7 @@
        { "splice", NSV::PROP_SPLICE },
        { "Stage", NSV::PROP_iSTAGE },
        { "status", NSV::PROP_STATUS },
+       { "super", NSV::PROP_SUPER },
        { "_target", NSV::PROP_uTARGET },
        { "text", NSV::PROP_TEXT },
        { "textColor", NSV::PROP_TEXT_COLOR },

Index: server/namedStrings.h
===================================================================
RCS file: /sources/gnash/gnash/server/namedStrings.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- server/namedStrings.h       29 Oct 2007 21:07:33 -0000      1.7
+++ server/namedStrings.h       21 Nov 2007 09:21:49 -0000      1.8
@@ -93,6 +93,7 @@
                PROP_SIZE,
                PROP_uSOUNDBUFTIME,
                PROP_SPLICE,
+               PROP_SUPER,
                PROP_iSTAGE,
                CLASS_STAGE = PROP_iSTAGE,
                PROP_STATUS,

Index: server/swf_function.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf_function.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- server/swf_function.cpp     20 Nov 2007 01:32:34 -0000      1.40
+++ server/swf_function.cpp     21 Nov 2007 09:21:49 -0000      1.41
@@ -40,7 +40,6 @@
 
 namespace gnash {
 
-
 swf_function::~swf_function()
 {
 #ifndef GNASH_USE_GC
@@ -92,6 +91,24 @@
 
 }
 
+namespace {
+class FrameGuard
+{
+public:
+       FrameGuard(as_environment& env, swf_function *func) : mEnv(env)
+       {
+               env.pushCallFrame(func);
+       }
+
+       ~FrameGuard()
+       {
+               mEnv.popCallFrame();
+       }
+
+       as_environment& mEnv;
+};
+} // end of anonymous namespace
+
 // Dispatch.
 as_value
 swf_function::operator()(const fn_call& fn)
@@ -119,7 +136,8 @@
        unsigned swfversion = VM::get().getSWFVersion();
 
        // Set up local stack frame, for parameters and locals.
-       our_env->pushCallFrame(this);
+       FrameGuard guard(*our_env, this);
+//     our_env->pushCallFrame(this);
 
        if (m_is_function2 == false)
        {
@@ -272,23 +290,19 @@
        catch (ActionLimitException& ale) // expected and sane 
        {
                //log_debug("ActionLimitException got from swf_function 
execution: %s", ale.what());
-               our_env->popCallFrame();
                throw;
        }
        catch (std::exception& ex) // unexpected but we can tell what it is
        {
                log_debug("Unexpected exception from swf_function execution: 
%s", ex.what());
-               our_env->popCallFrame();
                throw;
        }
        catch (...) // unexpected, unknown, but why not cleaning up...
        {
                log_debug("Unknown exception got from swf_function execution");
-               our_env->popCallFrame();
                throw;
        }
 
-       our_env->popCallFrame();
         return result;
 }
 

Index: server/vm/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ActionExec.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -b -r1.58 -r1.59
--- server/vm/ActionExec.cpp    16 Nov 2007 13:24:30 -0000      1.58
+++ server/vm/ActionExec.cpp    21 Nov 2007 09:21:49 -0000      1.59
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: ActionExec.cpp,v 1.58 2007/11/16 13:24:30 strk Exp $ */
+/* $Id: ActionExec.cpp,v 1.59 2007/11/21 09:21:49 cmusick Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -445,36 +445,6 @@
     env.set_target(_original_target);
     _original_target = NULL;
 
-    // Check the call stack depth to be the same as the one we started with
-    // TODO: should this check be switched off based on GNASH_TRUST_SWF_INPUT ?
-    size_t currCallStackDepth = env.callStackDepth();
-    if ( currCallStackDepth != _initialCallStackDepth )
-    {
-       if ( currCallStackDepth > _initialCallStackDepth )
-       {
-               if ( ! expectInconsistencies )
-               {
-                       // TODO: try to produce this error hitting script limits
-                       log_error(_("Call stack at end of ActionScript 
execution "
-                               "(" SIZET_FMT ") exceeds call stack depth at 
start "
-                               "of it (" SIZET_FMT ") - limits hit ?"),
-                                currCallStackDepth, _initialCallStackDepth);
-               }
-               size_t diff = currCallStackDepth-_initialCallStackDepth;
-               // TODO: implement dropCallFrames(diff) ?
-               while (diff--) env.popCallFrame();
-               assert(env.callStackDepth() == _initialCallStackDepth);
-       }
-       else
-       {
-               // TODO: make this an assertion ?
-               log_error(_("Call stack at end of ActionScript execution "
-                       "(" SIZET_FMT ") less then call stack depth at start "
-                       "of it (" SIZET_FMT ") - bad bug !"),
-                        currCallStackDepth, _initialCallStackDepth);
-       }
-    }
-
     // check if the stack was smashed
     if ( _initial_stack_size > env.stack_size() ) {
        log_error(_("Stack smashed (ActionScript compiler bug?)."

Index: testsuite/actionscript.all/LoadVars.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/LoadVars.as,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- testsuite/actionscript.all/LoadVars.as      29 Sep 2007 16:22:57 -0000      
1.15
+++ testsuite/actionscript.all/LoadVars.as      21 Nov 2007 09:21:50 -0000      
1.16
@@ -21,7 +21,7 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: LoadVars.as,v 1.15 2007/09/29 16:22:57 strk Exp $";
+rcsid="$Id: LoadVars.as,v 1.16 2007/11/21 09:21:50 cmusick Exp $";
 
 #include "check.as"
 
@@ -60,8 +60,6 @@
 // test the LoadVars::tostring method
 check_equals (typeof(loadvarsObj.toString), 'function');
 
-var loadvarsObj = new LoadVars; // STRK REMOVEME
-
 //--------------------------------------------------------------------------
 // Test LoadVars::load()
 //--------------------------------------------------------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]