preilly at adobe.com
Tue Jun 10 13:29:44 PDT 2008
"Par Winzell" <preilly at adobe.com> writes:
> We have a pretty massive ActionScript 3 application; upwards of 2000
> classes, currently running client-side. About a third of this bulk will
> also now be running server-side thanks to the glory of Tamarin.
> But we're running into pretty substantial compiler problems.
> ASC, on one hand, has no concept of class->file mapping, so it cannot be
> given a target file and incrementally bring in referenced source from
> class paths; in fact, even if you feed it a huge list of files, the
> com.macromedia.embedding.Main version won't try to sort them according
> to inheritance dependency. It seems clear that ASC as it stands now is
> meant to compile small scripts, not large structured applications.
> Rather than trying to rewrite ASC (perhaps port ScriptCompiler's
> ordering code to Main), I just recently turned my attention to
> Compc/Mxmlc in the hope that they could be convinced to generate ABC
> directly. I had some success here, playing with ConsoleApplication, but
> I've yet to be able to get these programs to read ABC files as imports.
> Having to generate both SWC's (for compiling applications) and ABC's
> (for feeding to Tamarin) is possibly doable but a bit cumbersome.
> So, what I'm curious about is, are there any plans at Adobe or Mozilla
> to extend either the abilities of ASC or the binary-friendliness of
> Compc/Mxmlc to fill this gap?
> If not, is there something I missed that might make our task easier? I'm
> not averse to a fair bit of hacking on the source, I just don't want to
> needlessly reproduce efforts already undertaken.
> I realize this query may not address Tamarin development directly, and
> that likely you're much more interested in ES4 and Tracing than what we
> are trying to do -- but it does still seem relevant to Tamarin
> generally; most AS3 developers are surely used to packages being
> mirrored by directory structure, and not having to list every dependency
Using the Flex SDK's subversion trunk, it should be easy to modify
As3Compiler.generate() to write an .abc file after the BytecodeEmitter
fills in the CompilationUnit's bytes.
I don't think anything special would need to be done to import .abc
files. The flex2.compiler.abc.AbcCompiler already supports the .abc
mime type. In addition, I bet it supports the source path, too. Such
that it would find foo/Bar.abc, if you used foo.Bar. I haven't tested
Alternatively, you could leave mxmlc as is and then use a modified
swfdump, see flash.swf.tools.SwfxPrinter, to extract the abc blocks.
The modification would just be to change doABC() to write the bytes to
a file, kinda like -external does for defineBits(). This would allow
the global optimizer to run and if desired the abc blocks would be
More information about the Tamarin-devel