Flash compiler / interpreter optimization

I started working with ActionScript 3 / Flash 9 quite recently, based on a "real" programming background, and I was a little curious about what kind of machine code it ends at the end of the day. I would like to know what optimizers the compiler does when combining SWF with the optimization flag (for example, with a loop unfolding, with a constant value to immediate, etc.), as well as with what kind of machine code the interpreters will generate (will the matrix multiply use SSE instructions on compatible processors, which FPU mode it uses, data structures are automatically aligned, etc.).

Does anyone have any links to documentation on this? Google just sends me to third-party products.

+3
source share
4 answers

Since AS3, there is a new virtual machine that uses JIT .

In addition, I am not a licensing specialist, but the Flex SDK compiler is also open source, if I remember correctly.

+1
source

I recently checked the flash compiler. This is amazing! Here is a simple class code:

    var A : Number = 0.0;
    A = A*2*4;

And here is the code parsed:

5       pushdouble      0
7       convert_d
8       setlocal1
9       getlocal1
10      pushbyte        2
12      multiply
13      pushbyte        4
15      multiply
16      convert_d
17      setlocal1

Wow! In the 21st century, we have a compiler at the level of the 1980s.

+2
source
+1

, , , ActionScript , , php. , ActionScript .swf. , , .

If you are looking for better performance, I would suggest you take a look at Alchemy . I have never worked with this, but this experimental Adobe product should allow you to port C / C ++ code to Flash Player with minimal performance loss.

-2
source

Source: https://habr.com/ru/post/1705479/


All Articles