From toby at thetobe.com Thu Jan 3 22:18:11 2008 From: toby at thetobe.com (Toby Watson) Date: Thu, 3 Jan 2008 21:18:11 +0000 Subject: [pypy-sprint] AVM2 / Tamarin backend at the sprint Message-ID: <1E748735-C3DC-4E9E-8604-4F097DBE489C@thetobe.com> Hi Everyone, I have a PyPy related idea - one I'd like to explore at the upcoming sprint in Leysin. Briefly the idea is to target Adobe's AVM2/AVMplus, the virtual machine shipped in Flash and donated as Tamarin (to be the Mozilla/ Firefox JS engine). This in turn would open a number of possibilities, not least would be seeing a >>>> prompt sitting in a Flash app on a web page. As I understand it from some of the PyPy CLI/JVM docs I have been reading it is possible certainly to generate an interpreter, but possibly also a compiler for any particular platform, in this case using the oobackend. Just quickly, because I know many people do not know about (or care! ;-) what is happening in Flash, the recent version 9 release introduced: * A new virtual machine (AVM2) * With JITter compilation * Support for prototype and class-based ECMAscript styles (should be suitable as Python target) * Dynamic bytecode generation _and loading_ is possible (should be handy) * ActionScript 3/ECMAScript has strong typing and other more mature language features FYI: * Bytecode is called Actionscript Byte Code (ABC) * Another language (HaXe) has already targeted this VM successfully. With such a 'Flython' interpreter I would hope in time to be able to bind to Adobe's native and library classes and hence by able to : * Compile swf files from Python (for Flash) source * Build Flex apps (Adobe's GUI framework) * Target AIR (Flash desktop apps) About myself, my interests: 30-something developer of many, many interactive systems using a lot of different technology from web Python/PHP, through ActionScript to OpenGL/C++, C#, etc. I have written many small parts of compilers and language transformers, but never a whole compiler. I have experience with Agile development environments and Test-driven development. I've started digging around using Adobe's flex compiler, the open- source Tamarin engine, plus my own small swf decompiler and lots of public information to understand how the AVM2 VM works and Adobe's compiler infrastructure - separate compilation, linking, the bytecode etc. I am actually interested in developing new language/programming styles atop PyPy/Flython (if it did exist) and I like the Flash VM because it is web-borne and so widely distributed - essentially people could try out experiments in their browser without having to download/build anything. I don't know how much is possible in a week and of course much depends on me, but my goal would be to get a skeleton for the interpreter/ translator and to sound out what all the issues are in targetting the AVM, binding to native classes and so on. I was considering writing another compiler specifically for this task, but after looking at Jython, IronPython, Boo and PyPy it became apparent that PyPy is quite mature now, may save a lot of time, and ultimately produce a more interesting result. I would hope that by adding another backend I could contribute to the fleshing-out of PyPy, help participate in the general maturing of the project and hopefully give the group a cool demo too. So...I hope to see some of you at the sprint and look forward to some interesting discussions! Kind regards, Toby From cfbolz at gmx.de Thu Jan 3 22:40:35 2008 From: cfbolz at gmx.de (Carl Friedrich Bolz) Date: Thu, 03 Jan 2008 22:40:35 +0100 Subject: [pypy-sprint] AVM2 / Tamarin backend at the sprint In-Reply-To: <1E748735-C3DC-4E9E-8604-4F097DBE489C@thetobe.com> References: <1E748735-C3DC-4E9E-8604-4F097DBE489C@thetobe.com> Message-ID: <477D5653.1020007@gmx.de> Hi Toby, (ccing pypy-dev) Toby Watson wrote: > I have a PyPy related idea - one I'd like to explore at the upcoming > sprint in Leysin. > > Briefly the idea is to target Adobe's AVM2/AVMplus, the virtual > machine shipped in Flash and donated as Tamarin (to be the Mozilla/ > Firefox JS engine). This in turn would open a number of possibilities, > not least would be seeing a >>>> prompt sitting in a Flash app on a > web page. > > As I understand it from some of the PyPy CLI/JVM docs I have been > reading it is possible certainly to generate an interpreter, but > possibly also a compiler for any particular platform, in this case > using the oobackend. > > Just quickly, because I know many people do not know about (or > care! ;-) what is happening in Flash, the recent version 9 release > introduced: > > * A new virtual machine (AVM2) > * With JITter compilation > * Support for prototype and class-based ECMAscript styles (should be > suitable as Python target) > * Dynamic bytecode generation _and loading_ is possible (should be > handy) > * ActionScript 3/ECMAScript has strong typing and other more mature > language features > > FYI: > * Bytecode is called Actionscript Byte Code (ABC) > * Another language (HaXe) has already targeted this VM successfully. > > With such a 'Flython' interpreter I would hope in time to be able to > bind to Adobe's native and library classes and hence by able to : > > * Compile swf files from Python (for Flash) source > * Build Flex apps (Adobe's GUI framework) > * Target AIR (Flash desktop apps) > > About myself, my interests: > > 30-something developer of many, many interactive systems using a lot > of different technology from web Python/PHP, through ActionScript to > OpenGL/C++, C#, etc. I have written many small parts of compilers and > language transformers, but never a whole compiler. I have experience > with Agile development environments and Test-driven development. > > I've started digging around using Adobe's flex compiler, the open- > source Tamarin engine, plus my own small swf decompiler and lots of > public information to understand how the AVM2 VM works and Adobe's > compiler infrastructure - separate compilation, linking, the bytecode > etc. > > I am actually interested in developing new language/programming styles > atop PyPy/Flython (if it did exist) and I like the Flash VM because it > is web-borne and so widely distributed - essentially people could try > out experiments in their browser without having to download/build > anything. > > I don't know how much is possible in a week and of course much depends > on me, but my goal would be to get a skeleton for the interpreter/ > translator and to sound out what all the issues are in targetting the > AVM, binding to native classes and so on. > > I was considering writing another compiler specifically for this task, > but after looking at Jython, IronPython, Boo and PyPy it became > apparent that PyPy is quite mature now, may save a lot of time, and > ultimately produce a more interesting result. > > I would hope that by adding another backend I could contribute to the > fleshing-out of PyPy, help participate in the general maturing of the > project and hopefully give the group a cool demo too. > > So...I hope to see some of you at the sprint and look forward to some > interesting discussions! I think this task is probably sprint-sized and relevant to PyPy. The question is whether some of the core-devs would like to work on it, so you can pair with that person. Then there are technical questions too, for example whether the tamarin VM is good enough to actually run all the full PyPy Python interpreter on top of it. Cheers, Carl Friedrich From cfbolz at gmx.de Thu Jan 3 23:11:42 2008 From: cfbolz at gmx.de (Carl Friedrich Bolz) Date: Thu, 03 Jan 2008 23:11:42 +0100 Subject: [pypy-sprint] AVM2 / Tamarin backend at the sprint In-Reply-To: <312F3771-1248-4B2C-9787-DD364A14A153@thetobe.com> References: <1E748735-C3DC-4E9E-8604-4F097DBE489C@thetobe.com> <477D5653.1020007@gmx.de> <312F3771-1248-4B2C-9787-DD364A14A153@thetobe.com> Message-ID: <477D5D9E.9060505@gmx.de> Toby Watson wrote: >>> [much snippage of intro to Tamarin/AVM2] > >> I think this task is probably sprint-sized and relevant to PyPy. The >> question is whether some of the core-devs would like to work on it, so >> you can pair with that person. >> >> Then there are technical questions too, for example whether the >> tamarin VM is good enough to actually run all the full PyPy Python >> interpreter on top of it. >> >> Cheers, >> >> Carl Friedrich > > Hi, > > What do you think may be the tripping points? > > - some datatype support problems? surely this is mostly a case of > emulating the correct types modulo gross problems with the 'native' AVM > types. > > - speed. The new VM is a lot faster than the old one and has a JITer. I > know that this has a go at all non-constructor methods as classes are > loaded and can be very fast. AS3 is now running things like the > Papervision3D library which is pretty CPU intensive, though I admit > making particular type of requirements on the VM. My gut feeling is the pure size of our Python interpreter, but maybe I am pessimistic. I think in terms of features we should be fine. > - some piece of machinery like the bytecode verifier getting in the way? > AFAIK this just does relatively simple overflow checks and the like. > > - I've also seen small schemes/LISPs running on the AVM so there's some > confidence there. > Infact I've generated my own images using a basic stack machine > interpreter (a bit like the PyPy JIT test toy). Additionally I've > generated code at runtime, which is then dynamically loaded, bound to > and executed to make the same images. > > With regard to support I was mainly not expecting any unless this effort > started to show some progress on my part and interest from others. > However I expected to benefit from any intro talks (I think some were > muted on 13/14?) and talking to other developers who have written > backends. Not to mention general environment of industriousness ;-) Of > course I'd be delighted if anyone else did become interested in it! Well, the usual mode of programming at a sprint (and one of the main points of doing one) is to work on a problem in pairs. That's why it would be nice if we found somebody else who is interested in this. Of course the general environment of industriousness and being able to ask questions all the time already helps :-). Cheers, Carl Friedrich From arigo at tunes.org Fri Jan 4 12:25:31 2008 From: arigo at tunes.org (Armin Rigo) Date: Fri, 4 Jan 2008 12:25:31 +0100 Subject: [pypy-sprint] Leysin logistics Message-ID: <20080104112531.GA26403@code0.codespeak.net> Hi Leysin sprinters, Here is a repost of the logistics about Leysin. You don't need this if you've been around a few times already. Power plug adapters: most EU cables don't fit in Swiss plugs, so you need an adapter. Ideally, we need a few EU-format plug multipliers so that we can live without many adapters. Wireless is already set up. I'll also have my hub just in case. Contact information: http://www.ermina.ch/ +41 24 494 12 61 My own contact information (no mobile, just fixed): +41 24 494 10 61 (yes, very similar to the previous one) or +41 24 466 40 50 (in Aigle, where I will not be during the sprint itself). Quick geographical reminder for people already present last year: exit at the train station Leysin-Feydey, 3rd stop in Leysin. Follow the street to your left going gently up for 50 meters, and then sharply down. After some 400-500 meters you are at the road U-bend at the cable car station. Go to the right of the large open parking area below. There is a small road going down along the right side of the parking, then left along the south side of the parking. (south=valleywise.) Ermina is 200 meters further. -+- Armin