Note that there are some explanatory texts on larger screens.

plurals
  1. POHow are methods found in AVM2 bytecode?
    primarykey
    data
    text
    <p>I've been playing around with ABC bytecode and was hoping someone could clear up a point of confusion for me. I have a simple flash file that places a clip on the stage and has a tiny script to update its position on each frame. The code looks something like:</p> <pre><code>package { import flash.display.MovieClip; import flash.events.Event; public class RedCircle extends MovieClip { public function RedCircle() { this.addEventListener(Event.ENTER_FRAME, moveit); } function moveit(e:Event) { this.x -=1; } } } </code></pre> <p>Which compiles to something like:</p> <pre><code>protected package protected RedCircle { class RedCircle extends flash.display.MovieClip { static () : Void { getlocal_0(); pushscope(); returnvoid(); } RedCircle () : Void { getlocal_0(); pushscope(); getlocal_0(); constructsuper(0); getlocal_0(); getlex(flash.events.Event); getproperty(ENTER_FRAME); getlex(internal .moveit); // ###1 callpropvoid(addEventListener, 2); returnvoid(); } function (anonymous) (flash.events.Event param1) : Void // ###2 { getlocal_0(); pushscope(); getlocal_0(); getlocal_0(); getproperty(x); decrement(); setproperty(x); returnvoid(); } } } </code></pre> <p>My question is how does the 'getlex' operation work (I've marked it with ###1). It is passed a multiname which references the 'moveit' method of the class. Unfortunately, the 'name' field in method info seems never ever to get used by the compiler. All methods have the empty string as its name (Shown above as the unnamed function at ###2).</p> <p>How does the flash player link the multiname to the unnamed method? There appears to be no provision for this in the AVM2 spec.</p> <p>I know it's possible because commercial decompilers like sothink manage to determine the method name. I'm just not sure how they do it, or how the code could ever work.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload