[pypy-dev] [pypy-sprint] AVM2 / Tamarin backend at the sprint

Toby Watson toby at thetobe.com
Thu Jan 3 23:42:26 CET 2008


> Also the latest version does a form of cache of libs, so in the  
> future you go to a site with a pypy interpreter and then go to  
> another one you download pypy only once if the library was corretly  
> built.

Yup! Could be cool. Although my software often changes too much for  
caching to help ;-)

>>> FYI:
>>> * Bytecode is called Actionscript Byte Code (ABC)
>>> * Another language (HaXe) has already targeted this VM successfully.
>
> Is there any assembler for ABC? maybe haxe has one (do they target  
> avm2? I always thought it was only the old flash vm).

Certainly haXe has a generator library which I've used before, I've  
rewritten that lib in AS3 before so a Python port is not out of the  
question.

haXe does target AVM2: http://tinyurl.com/33t2ox . Certainly there's  
plenty of reference to it in the compiler source (O'Caml) that I've  
been looking at today.

Also the Adobe Flex 3 (will be OSS at some point) compiler can be  
coerced to emit a kind of Intermediate Representation, though I don't  
think it will assemble from it. Looks like this:

// ++StartProgram
// ++StartMethod $init
AllocTemp 1
LoadThis [1]
PushScope [0]
FindProperty print 3 { (package-internal) public test.as$0(private) }  
is_strict=true is_qualified=false is_attr=false [1]
PushString hello world [2]
CallProperty print 3 { (package-internal) public test.as$0(private) }  
1 is_qualified=false is_super=false is_attr=false [1]
CheckType * [1]
StoreRegister 1, * [0]
LoadRegister 1, * [1]
Return [0]
FreeTemp 1
// --FinishMethod $init
// --FinishProgram

> I think this is a good idea, probably avm2 can run at least RPython  
> and maybe this could be the idea, just like the javascript backend.  
> This could be quite easier than supporting full python and pypy  
> interpreter.
>
> (I don't know if you have read any docs on the pypy site, but RPyton  
> is the restricted python in wich the pypy interpreter is made on,  
> suporting only it on avm2 would make programing for flex fun).

I'm busy reading them now. I started with the recent some of the  
Google presentation and am now looking at http://codespeak.net/pypy/dist/pypy/doc/cli-backend.html 
  and Antonio Cuni's thesis on the CLI backend. I'll happily look at  
any other recommendations.

I know of the idea of RPython and am familar with similar in SmallTalk  
from their squeak translator. That said I haven't yet stumbled across  
any document saying what the Restrictions are...

oh here, "2.1   RPython Definition, not"

> suporting only it [RPython] on avm2 would make programing for flex  
> fun).


I think you've hit on a key point. This aspect for me would be about  
producing something that is fun...if it turns into something  
productive and worthy later on then so be it. I'm also optimistic that  
the VM could - in time - support some decent optimizations.

But baby steps first...

Toby






More information about the Pypy-dev mailing list