SWF9 Project
From OpenLaszlo
The goal of this project is to add a SWF9 runtime to the OpenLaszlo 4.x platform.
Contents |
Background
Currently, the Tag compiler takes in LZX code and emits JS1 code, which is a subset of JS2. The Script compiler, which takes the JS2, currently has two backends: one that outpus swf7 or swf8 binaries, and a second that outputs simpler JS1 for DHTML. The goal of this project is to add a third backend that outputs ActionScript3 (or AS3).
To accomplish this, the tag compiler has to be reworked to output JS2 instead of JS1 (because our Script compiler already knows how to convert JS2 to JS1 for DHTML). The Script compiler needs to be refactored to emit ActionScript3 from JS2. Then, we'll take the AS3 output and provide it as input to the Flex compiler, to avoid the time required to write a byte compiler ourselves. The Flex compiler, due to licensing issues, will not be bundled with the compiler, but will instead rely on the user's installation of the Flex compiler. (Another alternative to explore is to output haXe and use that compiler.)
For the runtime, we've already factored out a runtime kernel that maps
LFC to particular runtimes. We will still need to write the kernel to connect it to
the swf9 player. In addition, there are still some vestiges of LFC written in JS1
and we need to finish converting that to JS2 so that the new backend will
have an easier job of translating JS2 to AS3 classes.
Resources: Current Information
More detailed SWF 9 Tasks list
SWF 9 Conversion Tips and Gotchas
How to configure and build the SWF9 branch
Project Plan: High-Level Tasks
| Task | Est.Work Weeks | Target Completion Date | Status |
|---|---|---|---|
| Refactor the compiler to add another runtime (inital pass) | 2 weeks | 9/15/2007 | dda (DONE) |
| Add type declarations to the script compiler [[1]] | 4 weeks | 10/15/2007 | dda (DONE) |
| Refactoring based on design decisions | ongoing | ongoing | dda |
| Modify the tag compiler to emit JS2 a. Change from a list to a class and constructor. Basically, class.java needs to emit a class. LzUser class goes away, and a class is declared with these attributes to instantiate this class. b. TBD | 3 weeks | 11/07/2007 | dda |
| Make a tool to pass AS3 to the Flex compiler | 1 week | 11/15/2007 | dda |
| Write the swf9 kernel: Rewrite the .as kernel to use classes for SWF9.(pbr) Rewrite kernel to swf9 API (hqm) Support new graphic API Support new network/data loading API Performance optimizations | 12 weeks (alpha) | TBD | pbr, hqm + |
| Write performance guidelines to optimize for swf9 | 1 week | independent | Alternate resource |
| Write the ActionScript3 backend for the refactored compiler | 4 weeks | 12/14/2007 | dda |
| Refactor LFC to use classes | 3 weeks | TBD | pbr |
Performance Considerations
Ironically, performance improvements come from making the language less dynamic - so, if the programmer is doing things like adding attributes to classes dynamically at runtime, that will reduce the performance improvements they will see. States, for example, will reduce the performance improvements. We are going to support LZX, and we will publish performance guidelines to help developer's write code to take advantage of the swf9 performance optimizations.

