CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/08/01 15:56:54
Modified files: . : ChangeLog server/asobj : Boolean.cpp Number.cpp string.cpp server/vm : VM.cpp VM.h Log message: * server/asobj/: Boolean.cpp, Number.cpp, string.cpp: register static constructors and prototypes with the VM. * server/vm/VM.{cpp,h}: Add support for registering arbitrary as_object for reachability. Intended to be used whenever a static as_object pointer is allocated. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3897&r2=1.3898 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Boolean.cpp?cvsroot=gnash&r1=1.15&r2=1.16 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Number.cpp?cvsroot=gnash&r1=1.31&r2=1.32 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/string.cpp?cvsroot=gnash&r1=1.33&r2=1.34 http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.cpp?cvsroot=gnash&r1=1.11&r2=1.12 http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.h?cvsroot=gnash&r1=1.12&r2=1.13 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.3897 retrieving revision 1.3898 diff -u -b -r1.3897 -r1.3898 --- ChangeLog 1 Aug 2007 13:32:17 -0000 1.3897 +++ ChangeLog 1 Aug 2007 15:56:53 -0000 1.3898 @@ -1,5 +1,13 @@ 2007-08-01 Sandro Santilli <[EMAIL PROTECTED]> + * server/asobj/: Boolean.cpp, Number.cpp, string.cpp: + register static constructors and prototypes with the VM. + * server/vm/VM.{cpp,h}: Add support for registering + arbitrary as_object for reachability. Intended to + be used whenever a static as_object pointer is allocated. + +2007-08-01 Sandro Santilli <[EMAIL PROTECTED]> + * gui/gnash.in: don't loose parameters layout. Fixes bug #20651. * gui/Makefile.am: distribute gnash.in Index: server/asobj/Boolean.cpp =================================================================== RCS file: /sources/gnash/gnash/server/asobj/Boolean.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -b -r1.15 -r1.16 --- server/asobj/Boolean.cpp 1 Jul 2007 10:54:26 -0000 1.15 +++ server/asobj/Boolean.cpp 1 Aug 2007 15:56:54 -0000 1.16 @@ -27,6 +27,7 @@ #include "smart_ptr.h" // for boost intrusive_ptr #include "builtin_function.h" // need builtin_function #include "GnashException.h" +#include "VM.h" // for registering static GcResources (constructor and prototype) namespace gnash { @@ -48,6 +49,8 @@ if ( ! o ) { o = new as_object(); + VM::get().addStatic(o.get()); + attachBooleanInterface(*o); } return o.get(); @@ -122,6 +125,8 @@ if ( cl == NULL ) { cl=new builtin_function(&boolean_ctor, getBooleanInterface()); + VM::get().addStatic(cl.get()); + // replicate all interface to class, to be able to access // all methods as static functions attachBooleanInterface(*cl); Index: server/asobj/Number.cpp =================================================================== RCS file: /sources/gnash/gnash/server/asobj/Number.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -u -b -r1.31 -r1.32 --- server/asobj/Number.cpp 1 Jul 2007 10:54:29 -0000 1.31 +++ server/asobj/Number.cpp 1 Aug 2007 15:56:54 -0000 1.32 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: Number.cpp,v 1.31 2007/07/01 10:54:29 bjacques Exp $ */ +/* $Id: Number.cpp,v 1.32 2007/08/01 15:56:54 strk Exp $ */ #include "log.h" #include "tu_config.h" @@ -27,6 +27,7 @@ #include "as_object.h" // for inheritance #include "as_value.h" // for doubleToString #include "builtin_function.h" // need builtin_function +#include "VM.h" // for registering static GcResources (constructor and prototype) #include <sstream> #include <cmath> @@ -80,6 +81,8 @@ if ( o == NULL ) { o = new as_object(); + VM::get().addStatic(o.get()); + attachNumberInterface(*o); } return o.get(); @@ -146,6 +149,8 @@ if ( cl == NULL ) { cl=new builtin_function(&number_ctor, getNumberInterface()); + VM::get().addStatic(cl.get()); + // We don't want to attach Number prototype methods to the Number // class itself. //attachNumberInterface(*cl); Index: server/asobj/string.cpp =================================================================== RCS file: /sources/gnash/gnash/server/asobj/string.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -u -b -r1.33 -r1.34 --- server/asobj/string.cpp 1 Jul 2007 10:54:32 -0000 1.33 +++ server/asobj/string.cpp 1 Aug 2007 15:56:54 -0000 1.34 @@ -16,7 +16,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: string.cpp,v 1.33 2007/07/01 10:54:32 bjacques Exp $ */ +/* $Id: string.cpp,v 1.34 2007/08/01 15:56:54 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -32,7 +32,7 @@ #include "as_value.h" #include "GnashException.h" #include <boost/algorithm/string/case_conv.hpp> -#include "VM.h" +#include "VM.h" // for registering static GcResources (constructor and prototype) #define ENSURE_FN_ARGS(min, max, rv) \ if (fn.nargs < min) { \ @@ -98,8 +98,11 @@ { static boost::intrusive_ptr<as_object> o; - if ( o == NULL ) { + if ( o == NULL ) + { o = new as_object(); + VM::get().addStatic(o.get()); + attachStringInterface(*o); } @@ -530,8 +533,11 @@ static boost::intrusive_ptr<builtin_function> cl; - if ( cl == NULL ) { + if ( cl == NULL ) + { cl=new builtin_function(&string_ctor, getStringInterface()); + VM::get().addStatic(cl.get()); + // replicate all interface to class, to be able to access // all methods as static functions attachStringInterface(*cl); @@ -549,11 +555,9 @@ // Register _global.String global.init_member("String", cl.get()); - } boost::intrusive_ptr<as_object> - init_string_instance(const char* val) { boost::intrusive_ptr<builtin_function> cl = getStringConstructor(); Index: server/vm/VM.cpp =================================================================== RCS file: /sources/gnash/gnash/server/vm/VM.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -b -r1.11 -r1.12 --- server/vm/VM.cpp 1 Jul 2007 10:54:37 -0000 1.11 +++ server/vm/VM.cpp 1 Aug 2007 15:56:54 -0000 1.12 @@ -16,7 +16,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: VM.cpp,v 1.11 2007/07/01 10:54:37 bjacques Exp $ */ +/* $Id: VM.cpp,v 1.12 2007/08/01 15:56:54 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -152,9 +152,18 @@ VM::markReachableResources() const { #ifdef GNASH_USE_GC + _root_movie->markReachableResources(); + _global->setReachable(); + + /// Mark all static GcResources + for (ResVect::const_iterator i=_statics.begin(), e=_statics.end(); i!=e; ++i) + { + (*i)->setReachable(); + } #endif + } void Index: server/vm/VM.h =================================================================== RCS file: /sources/gnash/gnash/server/vm/VM.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -b -r1.12 -r1.13 --- server/vm/VM.h 1 Jul 2007 10:54:37 -0000 1.12 +++ server/vm/VM.h 1 Aug 2007 15:56:54 -0000 1.13 @@ -127,6 +127,13 @@ /// void setGlobal(as_object*); + /// A vector of static GcResources (tipically used for built-in class constructors) + // + /// The resources in this list will always be marked as reachable + /// + typedef std::vector< boost::intrusive_ptr<GcResource> > ResVect; + ResVect _statics; + public: /// \brief @@ -187,8 +194,19 @@ std::locale& getLocale() const; /// Mark all reachable resources (for GC) + // + /// - root movie / stage (_root_movie) + /// - Global object (_global) + /// - registered static GcResources (_statics) + /// + /// void markReachableResources() const; + void addStatic(GcResource* res) + { + _statics.push_back(res); + } + }; } // namespace gnash _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit