gnash-commit
[Top][All Lists]
Advanced

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

Re: [Gnash-commit] /srv/bzr/gnash/trunk r11169: Make AVM2 scope stack an


From: Benjamin Wolsey
Subject: Re: [Gnash-commit] /srv/bzr/gnash/trunk r11169: Make AVM2 scope stack and stack usage stricter and more correct by dropping
Date: Sat, 27 Jun 2009 21:21:00 +0200

> 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

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


reply via email to

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