Tuesday, August 28, 2012

Introducing ASC 2.0

ASC 2.0A few minutes ago we just posted a preview on Adobe Labs of the new ActionScript Compiler (ASC 2.0) as part of the AIR 3.4/FP 11.4 SDK. You can find the complete release notes here. To fully utilize this new AIR 3.4 preview SDK, make sure you use Flash Builder 4.7 Preview also available here, which includes all this, plus things like Concurrency (ActionScript Workers) support for debugging and more.
Here are below the main improvements added to the ActionScript compiler:
  • Flash Builder 4.7 and the ASC 2.0 command-line compiler now share the same code model. This avoids duplicate representations of a program and means the IDE has an accurate representation of the language - matching the compiler.
  • A new multi-threaded architecture allows multiple files to be compiled at once, improving compilation time.
  • Better constant-folding and constant-propagation results in better performing code at runtime.
  • Reduces function overhead by removing unnecessary activation records.
  • Contains some demonstration byte-code optimizations for in-lining and dead code elimination.
  • Non-linear control flow added to AS3 through a new 'goto' keyword.
  • SWF 13 with LZMA compression is now supported.
  • A new symbol management system means Flash Builder 4.7 ActionScript workspaces that mix Flash and AIR projects should incrementally compile much faster.
  • ASC 2.0 based versions of fontswf, optimizer, swfdump and swcdepends command-line tools are available.
  • Legacy versions of asdoc and fdb command-line tools are also still included.
  • Font transcoding has been removed from [Embed] syntax. Fonts should be pre-transcoded and embedded as a SWF, which can be performed using a tool like fontswf or Flash Professional CS6.
  • Relative paths in source code ([Embed] assets, includes, etc...) resolve relatively from the including file. To specify a path relative from a source root, prefix your path with a forward slash '/'.
  • US English compiler error messages have been translated into French, Japanese, and Simplified Chinese. The locale is determined by the JVM and can be overridden using the -tools-locale configuration option.
We also added support for inlining. When the inlining feature is enabled, the compiler will attempt to inline getters, setters and any functions which are decorated with [Inline] metadata. Make sure you also add the -inline compiler argument.
A function can be inlined when the following constraints are met:
  • The function is final, static or the containing scope is file or package
  • The function does not contain any activations
  • The function does not contain any try or with statements
  • The function does not contain any function closures
  • The function body contains less than 50 expressions
Below are some basic examples of functions which the compiler will and won't be able to inline.
Read more: Introducing ASC 2.0

No comments:

Post a Comment