[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gnash-commit
Subject:    Re: [Gnash-commit] /srv/bzr/gnash/trunk r11169: Make AVM2 scope
From:       Benjamin Wolsey <bwy () benjaminwolsey ! de>
Date:       2009-06-27 19:21:00
Message-ID: 1246130460.5458.17.camel () localhost
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


> Chad designed it with the AVM2 semantic in mind.
> It's use from AVM1 is correct (no cleanup on exit).
> Just for the record...
> 

SafeStack seems to work quite well for AVM1 too, but the extra thing
that AVM2 needs for the scope stack is behaviour like this:

1. Main scope: push 'global' to the scope stack

Scope stack: global

2. Function call, in function scope push an object to the scope stack
(It seems that the first thing you push must be the class itself).

Scope stack: [ global ] A::a

3. Function call, pop scope stack

Scope stack: [ global ]

At this point if you try to pop anything from the scope stack or even
access any element of it (there's an opcode for that too), you get a
scope stack underflow or an 'element doesn't exist' exception, so it
*appears* as though it's empty to the function; but if you call any
opcode that needs the scope stack - e.g. GetLex or FindPropStrict, it
will still use what's in it (here: global).

4. Push to scope stack again:

Scope stack: [ global ] A::a
 
5. Return to main scope - stack returned to previous state

Scope stack: global

6. pop scope stack

Scope stack:

Calling FindPropStrict or GetLex produces an exception because the scope
stack is empty.

With the normal stack, there of course isn't any use of inaccessible
elements, but, like the scope stack, it's returned to its previous state
on leaving a function. The misnamed test scope2.xml in misc-swfmill.all
should verify this difference from AVM1. The longer test scope1.xml
tests both stacks, but fails for other reasons.

bwy

--
Yes, YouTube does work in Gnash
http://www.gnu.org/software/gnash/

Benjamin Wolsey, Software Developer - http://benjaminwolsey.de

["signature.asc" (application/pgp-signature)]

_______________________________________________
Gnash-commit mailing list
Gnash-commit@gnu.org
http://lists.gnu.org/mailman/listinfo/gnash-commit


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic