Honey Web

about all things sweet and web-ish

Compiler work

leave a comment »

Puffin pair

Double puffin this week! And that’s to (partly) make up for my short 3 day vacation to Scotland, starting tomorrow.


I’ve been working on the compiler, getting it to cooperate and use the object system. Getting it to use my objects wasn’t too hard, since I designed the objects for that use in the first place, but many other issues surfaced.

First, my object system isn’t just incomplete, but also buggy. I found a few minor bugs and a couple of not so minor bugs, but nothing huge. It appears that overall, it’s sound.

Second, PIR is not very nice. Sometimes it’s too low-level, often it’s too high-level. Almost always it’s surprising, and largely because it does in fact have semantics of its own that can’t be (easily) overriden. And I’ve yet to complain about IMCC, which is just dreadful.

Third, it’s not entirely clear what namespaces/scopes/frames should be implemented as in parrot. I can’t use PIR’s .local/.lex since the semantics are wrong for Python. I can’t use the NameSpace PMC because it doesn’t really work. What I’m doing now is using Python dicts to implement frames, just like CPython. This means a new dict (basically a Hash boxed in a Python.instance) gets created for every module import, function/class declaration, function call, class instantiation, etc. Also, every time any name (symbol) is looked up, at least one Hash lookup is performed.

This is very, very bad for performance. A significant amount of PyPy’s JIT’s performance comes from just virtualising frames (not creating them unless really needed). Theoretically this should be possible on Parrot too, but it would require (1) Parrot having a good JIT and MOP or (2) writing big, ugly C extensions to Parrot especially for puffin. But right now, I don’t care at all. So I’ll likely provide CPython’s sys._getframe() without any performance degradation. Instead, there will be a constant performance degradation. Yay!

It’s not all bad news, though. AFAICT, I will be able to implement correct Python semantics. There’s a lot of work to be done to achieve this, and I doubt I’ll be able to do all of it during GSoC, but I see no major obstacles that cannot be at least worked around.


See you on Friday!


Written by Lucian

June 20, 2011 at 7:49 pm

Posted in parrot

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

%d bloggers like this: