How to make ASC2 alchemy SWC compatible with old compiler

Some time ago I tried to use latest Genome2D SWC with Code Orchestra livecoding tool and, like others, failed (at first). The reason was that COLT, being derived from old compiler, fails to parse SWC made with new compiler, if it uses memory opcodes. In theory, there should be no problem, since memory opcodes are already compiled into SWC’s library.swf and old compiler does not have to care about it. In practice, there is a problem in SWC’s catalog.xml:

<script name="" mod="9223372036854775806">
	<def id="avm2.intrinsics.iteration:hasnext"/>
	<def id="avm2.intrinsics.iteration:nextname"/>
	<def id="avm2.intrinsics.iteration:nextvalue"/>
	<def id="avm2.intrinsics.memory:lf32"/>
	<def id="avm2.intrinsics.memory:lf64"/>
	<def id="avm2.intrinsics.memory:li16"/>
	<def id="avm2.intrinsics.memory:li32"/>
	<def id="avm2.intrinsics.memory:li8"/>
	<def id="avm2.intrinsics.memory:sf32"/>
	<def id="avm2.intrinsics.memory:sf64"/>
	<def id="avm2.intrinsics.memory:si16"/>
	<def id="avm2.intrinsics.memory:si32"/>
	<def id="avm2.intrinsics.memory:si8"/>
	<def id="avm2.intrinsics.memory:sxi1"/>
	<def id="avm2.intrinsics.memory:sxi16"/>
	<def id="avm2.intrinsics.memory:sxi8"/>
	<dep id="Number" type="s"/>
	<dep id="int" type="s"/>

The solution is to remove any mentions of avm2.intrinsics.* from catalog.xml :) SWC continues to work without them for both ASC1 and ASC2. I asked Adobe people why does this garbage has to be there and break compatibility for no reason but got no reply, so I am posting this find as PSA – when some ASC2 SWC suddenly gives you headaches, you will know what to do.


2 Responses to “How to make ASC2 alchemy SWC compatible with old compiler”

  1. 1 MrPoulet May 30, 2013 at 23:30

    instant bookmak ^^

  2. 2 pshtif May 31, 2013 at 16:32

    I actually figured out how to fix it inside IntelliJ when compiling the Genome2D library. Its not possible inside Flash Builder. The difference is that IntelliJ for now doesn’t support AS3 fastmem natively but you need an external library swc for those methods that guys from IDEA provided. In FlashBuilder this is all part of the IDE the intrinsic methods are not part of any swc not even playerglobal.

    So whats the fix? Easy in IntelliJ since its a swc I simply doesn’t merge the intrinsics swc to the Genome2D swc during compilation I just specify it as external dependency. So there will be no defs of avm.intrinsics inside the Genome2D swc.

    Impossible to do in Flash Builder since as I said its part of the IDE and you can’t specify avm.intrinsics as external dependency and they will be always defined in the compiled swc.

Ask a Question

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Old stuff

May 2013
« Apr   Jun »

Oh, btw…


%d bloggers like this: