gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/avm2 r9497: Change how abc_functions are e


From: Tom Stellard
Subject: [Gnash-commit] /srv/bzr/gnash/avm2 r9497: Change how abc_functions are executed.
Date: Wed, 20 Aug 2008 01:04:30 +0800
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9497
committer: Tom Stellard <address@hidden>
branch nick: gnash_dev
timestamp: Wed 2008-08-20 01:04:30 +0800
message:
  Change how abc_functions are executed.
modified:
  libcore/abc_function.cpp
  libcore/vm/Machine.cpp
  libcore/vm/Machine.h
=== modified file 'libcore/abc_function.cpp'
--- a/libcore/abc_function.cpp  2008-08-19 03:29:32 +0000
+++ b/libcore/abc_function.cpp  2008-08-19 17:04:30 +0000
@@ -21,6 +21,7 @@
 
 namespace gnash{
 
+//TODO: Should we create a new machine for each abc_function.
 abc_function::abc_function(CodeStream* stream, Machine* machine):as_function(){
                mStream = stream;
                mMachine = machine;
@@ -31,7 +32,7 @@
 abc_function::operator()(const fn_call& fn)
 {
        log_debug("Calling an abc_function.");
-       mMachine->executeCodeblock(mStream);
+       mMachine->executeFunction(mStream);
        return as_value();
 }
 

=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp    2008-08-19 16:01:29 +0000
+++ b/libcore/vm/Machine.cpp    2008-08-19 17:04:30 +0000
@@ -1237,6 +1237,9 @@
                }
                else{
                        restoreState();
+                       if(mExitWithReturn){
+                               return;
+                       }
                }
                // Slot the return.
 //             *mGlobalReturn = as_value();
@@ -2623,8 +2626,19 @@
        mRegisters[0] = as_value(global);
 }
 
+//This is called by abc_functions to execute their code stream.
+//TODO: There is probably a better way to do this, once we understand what the 
VM is supposed
+//todo, this should be fixed.
+void Machine::executeFunction(CodeStream* stream){
+       
+       mExitWithReturn = true;
+       saveState();
+       executeCodeblock(stream);
+       mExitWithReturn = false;
+}
+
 void Machine::executeCodeblock(CodeStream* stream){
-       saveState();
+
        mStream = stream;
        execute();
 //     restoreState();
@@ -2636,7 +2650,7 @@
        executeCodeblock(theClass->getConstructor()->getBody());
 }
 
-Machine::Machine(string_table &ST, ClassHierarchy *CH):mST(),mRegisters()
+Machine::Machine(string_table &ST, ClassHierarchy 
*CH):mST(),mRegisters(),mExitWithReturn(false)
 {
        mCH = CH;
        //Local registers should be initialized at the beginning of each 
function call, but

=== modified file 'libcore/vm/Machine.h'
--- a/libcore/vm/Machine.h      2008-08-17 16:26:31 +0000
+++ b/libcore/vm/Machine.h      2008-08-19 17:04:30 +0000
@@ -206,7 +206,7 @@
 
        void initMachine(abc_block* pool_block,as_object* global);
 
-       void executeCodeblock(CodeStream* stream);
+       void executeFunction(CodeStream* stream);
 
        void instantiateClass(std::string className);
 
@@ -344,6 +344,8 @@
                return env;
        }
 
+       void executeCodeblock(CodeStream* stream);
+
        SafeStack<as_value> mStack;
        SafeStack<State> mStateStack;
        SafeStack<Scope> mScopeStack;
@@ -364,6 +366,7 @@
        as_value mIgnoreReturn; // Throw away returns go here.
 
        bool mIsAS3; // Is the stream an AS3 stream.
+       bool mExitWithReturn;
        abc_block* mPoolObject; // Where all of the pools are stored.
 };
 


reply via email to

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