Re: [Flashcoders] Actionscript 3.0 compiler Qs

2006-08-22 Thread Martin Wood

of course :)

thanks Chafic and David..

Chafic Kazoun wrote:
 From what I know (And I am no expert on the Flash Player). The way the 
JIT process works, not everything is actually always JITed. Bytecode 
that is executed once may not tget JITed at all. But code that is 
accessed multiple times or deemed as a performance botleneck will get 
JITed. The main motivation behind this would be to reduce application 
perceived performance by interpreting some code rather than Jitting 
which would alleviate the user from having to wait for the JIT process 
to complete. This is most apparent on application startup where if the 
user had to wait for everything to go through the entire JIT process, 
things would just seem slow. You see this with the Java runtime although 
Sun has improved this over time.


HTH

Chafic

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 compiler Qs

2006-08-21 Thread Kevin Newman

Sweet! Thanks for the info.

Kevin N.


Nicolas Cannasse wrote:
Here are some things I've been wondering about Actionscript 3.0s 
compiler and runtime engines:


I'm assuming AS 3.0 compiles to a bytecode. What kind of bytecode 
does it compile to? Is it more like Java/.NET CLR, or more like 
Mozilla's Spidermonkey compiler?


I don't know about SpiderMonkey, but AS3 bytecode is similar to Java 
one. It's actually more complicated since there is several way to 
access the properties (using prototype, traits or slots).


Does the compiled code get recompiled during runtime to machine code 
(like a JIT compiler) or does it get interpreted?


Some Adobe presentation on the subjet was saying that all the code get 
JIT'ed, except the $iinit and $cinit functions which are the one 
defining the classes and initializing their static variables.


Also, how does the compiler deal with typing? Statically typed, 
compiled languages usually have the type set in stone at compile time 
whereas dynamically typed, interpreted languages like javascript and 
php can do type coercion at runtime on the fly. Which one does the 
Actionscript 3.0 runtime do? Does it do both depending on whether the 
type is static or dynamic?


The complete class structure with type is stored into the Flash9 SWF. 
Then local (per-function) type-inference is performed to check the 
types coherency. There is some bytecode options that perform 
type-casting. For instance everytime a value is stored into an untyped 
variable, the opcode 0x82 is forgetting about the original value type.


This makes things actually pretty difficult for other languages with 
different type system to be compiled to Flash9 bytecode, but I could 
succeed in doing it for haXe (http://haxe.org).


I started documenting the Flash9 file format on 
http://osflash.org/flash9, you can start reading there, but only the 
haXe swf library sources are containing the complete specification :


http://cvs.motion-twin.com/horde/chora/browse.php?rt=ocamlf=swflib

Nicolas



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 compiler Qs

2006-08-21 Thread Marcelo de Moraes Serpa

Thanks for the valuable information Nicolas. I strongly think you should
write a book on Flash Player internals! This would be the missing piece for
mastering the flash platform... I really miss this kind of information and a
good dummie introduction to them (There's isn't such a book available...)

Cheers,

Marcelo

On 8/21/06, Kevin Newman [EMAIL PROTECTED] wrote:


Sweet! Thanks for the info.

Kevin N.


Nicolas Cannasse wrote:
 Here are some things I've been wondering about Actionscript 3.0s
 compiler and runtime engines:

 I'm assuming AS 3.0 compiles to a bytecode. What kind of bytecode
 does it compile to? Is it more like Java/.NET CLR, or more like
 Mozilla's Spidermonkey compiler?

 I don't know about SpiderMonkey, but AS3 bytecode is similar to Java
 one. It's actually more complicated since there is several way to
 access the properties (using prototype, traits or slots).

 Does the compiled code get recompiled during runtime to machine code
 (like a JIT compiler) or does it get interpreted?

 Some Adobe presentation on the subjet was saying that all the code get
 JIT'ed, except the $iinit and $cinit functions which are the one
 defining the classes and initializing their static variables.

 Also, how does the compiler deal with typing? Statically typed,
 compiled languages usually have the type set in stone at compile time
 whereas dynamically typed, interpreted languages like javascript and
 php can do type coercion at runtime on the fly. Which one does the
 Actionscript 3.0 runtime do? Does it do both depending on whether the
 type is static or dynamic?

 The complete class structure with type is stored into the Flash9 SWF.
 Then local (per-function) type-inference is performed to check the
 types coherency. There is some bytecode options that perform
 type-casting. For instance everytime a value is stored into an untyped
 variable, the opcode 0x82 is forgetting about the original value type.

 This makes things actually pretty difficult for other languages with
 different type system to be compiled to Flash9 bytecode, but I could
 succeed in doing it for haXe (http://haxe.org).

 I started documenting the Flash9 file format on
 http://osflash.org/flash9, you can start reading there, but only the
 haXe swf library sources are containing the complete specification :

 http://cvs.motion-twin.com/horde/chora/browse.php?rt=ocamlf=swflib

 Nicolas


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 compiler Qs

2006-08-21 Thread Martin Wood
Does the compiled code get recompiled during runtime to machine code 
(like a JIT compiler) or does it get interpreted?


Some Adobe presentation on the subjet was saying that all the code get 
JIT'ed, except the $iinit and $cinit functions which are the one 
defining the classes and initializing their static variables.


I just read that the other day and was wondering why?

Personally I cant really think of why constructors and initialization should be 
interpreted and not JIT'ed but im sure someone can think of good reasons.


this is the paper if anyone is interested :

http://www.onflex.org/ACDS/AS3TuningInsideAVM2JIT.pdf


thanks,

Martin
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 compiler Qs

2006-08-21 Thread David Rorex

On 8/21/06, Martin Wood [EMAIL PROTECTED] wrote:

 Does the compiled code get recompiled during runtime to machine code
 (like a JIT compiler) or does it get interpreted?

 Some Adobe presentation on the subjet was saying that all the code get
 JIT'ed, except the $iinit and $cinit functions which are the one
 defining the classes and initializing their static variables.

I just read that the other day and was wondering why?

Personally I cant really think of why constructors and initialization should be
interpreted and not JIT'ed but im sure someone can think of good reasons.


Perhaps because they are only run once? From what I understand, JIT is
a small penalty the first time, then each successive use is sped up.
If there are no successive uses, then it will be a net loss to use
JIT.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 compiler Qs

2006-08-21 Thread Chafic Kazoun
From what I know (And I am no expert on the Flash Player). The way  
the JIT process works, not everything is actually always JITed.  
Bytecode that is executed once may not tget JITed at all. But code  
that is accessed multiple times or deemed as a performance botleneck  
will get JITed. The main motivation behind this would be to reduce  
application perceived performance by interpreting some code rather  
than Jitting which would alleviate the user from having to wait for  
the JIT process to complete. This is most apparent on application  
startup where if the user had to wait for everything to go through  
the entire JIT process, things would just seem slow. You see this  
with the Java runtime although Sun has improved this over time.


HTH

Chafic

http://www.rewindlife.com

On Aug 21, 2006, at 5:40 PM, David Rorex wrote:


On 8/21/06, Martin Wood [EMAIL PROTECTED] wrote:
 Does the compiled code get recompiled during runtime to machine  
code

 (like a JIT compiler) or does it get interpreted?

 Some Adobe presentation on the subjet was saying that all the  
code get

 JIT'ed, except the $iinit and $cinit functions which are the one
 defining the classes and initializing their static variables.

I just read that the other day and was wondering why?

Personally I cant really think of why constructors and  
initialization should be
interpreted and not JIT'ed but im sure someone can think of good  
reasons.


Perhaps because they are only run once? From what I understand, JIT is
a small penalty the first time, then each successive use is sped up.
If there are no successive uses, then it will be a net loss to use
JIT.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 compiler Qs

2006-08-20 Thread Nicolas Cannasse
Here are some things I've been wondering about Actionscript 3.0s 
compiler and runtime engines:


I'm assuming AS 3.0 compiles to a bytecode. What kind of bytecode does 
it compile to? Is it more like Java/.NET CLR, or more like Mozilla's 
Spidermonkey compiler?


I don't know about SpiderMonkey, but AS3 bytecode is similar to Java 
one. It's actually more complicated since there is several way to access 
the properties (using prototype, traits or slots).


Does the compiled code get recompiled during runtime to machine code 
(like a JIT compiler) or does it get interpreted?


Some Adobe presentation on the subjet was saying that all the code get 
JIT'ed, except the $iinit and $cinit functions which are the one 
defining the classes and initializing their static variables.


Also, how does the compiler deal with typing? Statically typed, compiled 
languages usually have the type set in stone at compile time whereas 
dynamically typed, interpreted languages like javascript and php can do 
type coercion at runtime on the fly. Which one does the Actionscript 3.0 
runtime do? Does it do both depending on whether the type is static or 
dynamic?


The complete class structure with type is stored into the Flash9 SWF. 
Then local (per-function) type-inference is performed to check the types 
coherency. There is some bytecode options that perform type-casting. For 
instance everytime a value is stored into an untyped variable, the 
opcode 0x82 is forgetting about the original value type.


This makes things actually pretty difficult for other languages with 
different type system to be compiled to Flash9 bytecode, but I could 
succeed in doing it for haXe (http://haxe.org).


I started documenting the Flash9 file format on 
http://osflash.org/flash9, you can start reading there, but only the 
haXe swf library sources are containing the complete specification :


http://cvs.motion-twin.com/horde/chora/browse.php?rt=ocamlf=swflib

Nicolas
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] Actionscript 3.0 compiler Qs

2006-08-19 Thread Kevin Newman

Anybody?

Kevin N.


Kevin Newman wrote:
Here are some things I've been wondering about Actionscript 3.0s 
compiler and runtime engines:


I'm assuming AS 3.0 compiles to a bytecode. What kind of bytecode does 
it compile to? Is it more like Java/.NET CLR, or more like Mozilla's 
Spidermonkey compiler?


Does the compiled code get recompiled during runtime to machine code 
(like a JIT compiler) or does it get interpreted?


Also, how does the compiler deal with typing? Statically typed, 
compiled languages usually have the type set in stone at compile time 
whereas dynamically typed, interpreted languages like javascript and 
php can do type coercion at runtime on the fly. Which one does the 
Actionscript 3.0 runtime do? Does it do both depending on whether the 
type is static or dynamic?


Thanks, and please correct anything that I may have written if it is 
not accurate. :-)


Kevin N.



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com