Jonathan Worthington :: jnthn.net

Blog

Welcome to my page of scribblings about what I'm working on, what I've been doing with my time, how much the weather sucks and other such fascinating stuff.

RSS Feed This blog has an RSS feed.

Filter: All General Parrot Christianity Types & Semantics

Tuesday, 18th December 2007

Parrot 0.5.1

It took most of the day and three release candidates to get it right, with a last minute fix to Pynie (a Perl 1.0 compiler) being sneaked in too, but Parrot 0.5.1 is now with us! So why the release name "Hatachi"? Perl is 20 years old today, and in Japan, you come of age at 20, and then are known as "hatachi" (and, importantly, not Hitachi, who make electrical goods...I swear I never confused the two). And, well, there you go. :-) Anyway, enjoy it, and I'm happy to have written myself into the list of Parrot Pumpkings. :-)

Read With Comments (27373 Comments) | Post Comment

Monday, 17th December 2007

Chipping away at perl6

Happily, of late I've found time, energy and brain cycles to insert myself back into Parrot development again. The real fun, though, has been digging into perl6, the Parrot Perl 6 implementation. Recently, Patrick Michaud has been doing some incredible work building NQP (Not Quite Perl 6), a bootstrapping language for implementing Perl 6, and extensively refactoring the existing Perl 6 on Parrot compiler to fit with it. I'm still very much getting my head wrapped around the whole thing, but it's been easy enough to start digging into and implementing and fixing a few things.

After my previous attempt at junctions at the French Perl Workshop, where I wrote a PMC, I am now implementing it in PIR, and aiming to translate it to NQP when that's possible. I've got the very basics in: constructing junctions by the operators and functions, as well as the .values and .pick methods. I'm now starting to implement various v-table methods; only increment and decrement are done so far, but more will be on the way. It's a start, anyway, and unlike the work I did at FPW I'm checking in my progress as I go, so you can try out the few bits I've got done. In implementing the pick method, I discovered the rand function hadn't been implemented yet, so I also did that.

Tonight I set about fixing a parsing/AST issue with calling sub names including a namespace; that now works. I also did the final bits that needed doing to get hashes basically working, so you can do keyed lookups an insertions on those now too.

A week or so ago, I implemented the arity method on the Parrot Sub PMC, which allows you to get the arity of a sub or method (that is, the number of arguments it takes). Tonight, for my final trick, I added the & (code) sigil to the parser, added a couple of lines to do a symbol table insertion, tweaked the variable lookup AST generation and now you can say:

sub foo($a, $b) { } say &foo.arity(); # 2 say &foo.WHAT; # Code

It's really good fun to actually be hacking on the compiler, and making little bits of Perl 6 come to life! I'll have to dig back into the C and hack some Parrot internals again at some point again soon though, I'm sure. :-)

The other bit of exciting news is that being release manager has fallen to me this month. And it's not just any release - this one falls on the 20th birthday of Perl; exactly 20 years to the day Perl 1.000 was released. So it's an honor to be doing this special release.

Read With Comments (8166 Comments) | Post Comment

Sunday, 18th November 2007

The French Perl Workshop

On Thursday, I did the long train journey down to Lyon for the French Perl Workshop. The strikes resulted in me nearly getting crushed on the metro in Paris, but that aside only led to a 30 minute delay to my overall journey - not bad at all! Going by train worked out quite nicely; I had plenty of space to work on the train to York, which I used to tidy up the slides for my security talk, and wifi on the train to London, which I mostly ended up using to chat with people on IM (the intention was there to work, honest). There was power at the shiny new St Pancras (which I was generally quite impressed by - seems we can get something transport related correct in Britain occasionally). I spent the Eurostar journey eating and drinking, and by the time I was in Paris that was most of the journey done. Sure, flying would have taken a bit less time, and probably have been cheaper, but even with the problems from the strikes it was still more enjoyable to go by train. The most exciting bit of news I heard while en route is that in the coming years you'll be able to go from London direct to Germany too, all at high speed.

The workshop itself was great fun - even more so than last year. I had 100 minutes of talks to give this year - the most I have ever given at any conference - which thanks to a great audience was very enjoyable. I didn't feel I gave the security talk as well as I wanted to - it was quite rushed through the section on exploits - but a few people told me they enjoyed it afterwards. My new talk on parallelism went pretty well; I'll do some tweaks before giving it again in Israel, but not much will change. The final talk, on the Perl 6 object model, ended up with strange and amusing diversions into religious freedom and puppies falling over due to inappropriate use of parallelism - not the usual direction that talk takes! The evenings were great, especially Friday with the conference dinner (totally delicious food and fun company). The day after the conference, we had a mini-hackathon for part of the day.

Probably the most important thing that I got out of the conference was the time to jump back into Parrot and Perl 6 development. After a few months out for personal reasons, it's a big project to get back into again. Anyway, the news is: I'm back. :-) I started by reading through the design documents to see what's been going on. There are lots of changes, and lots of thing specified that weren't before, which is good (and means there's plenty of stuff to implement). I looked over the PAST specification (Parrot Abstract Syntax Tree) and noted that there weren't really any nodes related to object oriented constructs, such as roles and classes. I then went about writing a proposal for this - I'm keen to have these in PAST so many languages can take advantage of it, but I also really want to get some OO support into the Perl 6 compiler. After that, I worked on and resolved a couple of tickets in RT relating to objects stuff. With that done, I set about starting to make good on something I said I'd do all the way back at OSCON: working on getting junctions support into the Perl 6 compiler. I've not got anything checked in yet, and since it's my first time hacking on the compiler itself I will be sending it to the list for review before then anyway. However, a few very basic things are working:

my $x = 1 | 2 | 3; $x = $x * 5; my @y = $x.values; say @y; 5 10 15 my $x = all(1,2,3); $x++; my @y = $x.values; say @y; 2 3 4 my $x = 1 | 2 | 3; if $x == 2 { say "true" } else { say "false" } true my $x = 1 & 2 & 3; if $x == 2 { say "true" } else { say "false" } false if none(1,2,3) == 4 { say "true" } else { say "false" } true if none(1,2,3) == 3 { say "true" } else { say "false" } false say all(1,2,3).pick; 3 say all(1,2,3).pick; 2 say all(1,2,3).pick; 2

So, lots and lots more to do, but it's a start at least. :-)

Read With Comments (1 Comments) | Post Comment

Tuesday, 4th September 2007

Slides!

I have just put up the slides for my talks at YAPC::EU::2007. Somewhat embarrassingly, I only got around to putting up the slides for my OSCON talk today too. Very embarrassingly, I hadn't put up those from the Nordic Perl Workshop either. Anyway, that's all cleared up now. I've also put a notice of when I'll next be speaking - the 2007 French Perl Workshop. No hints what I'll be talking about just yet, though I will certainly be writing a brand new talk (or maybe even two) to tour around Europe for the 2007/2008 season. Also, at YAPC::EU::2007 I smashed through the 20 Perl-related talks barrier. Let's see if I can make it to 50!

Read With Comments (5038 Comments) | Post Comment

Friday, 20th July 2007

Off to OSCON!

I'm heading to the train station in half an hour and taking the train for London. I'll hang out with some London Perl folks this evening, then fly off to Portland tomorrow. There are rumours of a mini Parrot Hackathon on Sunday, though currently I know only of Andy Lester and myself that are up for it. We'll see what happens. Otherwise, I'll go exploring Portland. My talk is ready and submitted, and hopefully I will be able to deliver it well on Wednesday. So, here goes for my first OSCON, which is also my first conference in the US!

Read With Comments (1701 Comments) | Post Comment

Thursday, 7th June 2007

Digging back in

So my month's holiday is over, I've spent a week madly catching up on what's been going on and now I'm ready to dig back into Parrot stuff. I seem to have spent more than my normal share of Parrot time fixing the build on Windows of late, but tonight I finally found energy and motivation to dive back into some more serious work.

Allison has been doing some great work on tying up some loose ends with the PDD15 implementation (classes and objects) and also working on PDD17 (PMCs). Tonight I started working on a PMCProxy PMC, instances of which will represent other PMCs (and yes, that does mean it will be able to describe itself too...which if I've twisted my head around metamodel stuff correctly is what's needed; I'm still not convinced my head is twisted enough yet, though). This PMCProxy object will then be able to sit in inheritance hierarchies of normal classes, helping bridge the gap between HLL classes and PMCs, and also allow PMCs to be introspected just like HLL classes. Beyond this, I plan to continue to do the work to get inheritance from PMCs working with PDD15 classes, which pmichaud is waiting on as he works on the Perl 6 implementation.

Read With Comments (1 Comments) | Post Comment

Friday, 18th May 2007

OSCON

I will be speaking at OSCON this year about my work on virtual machine bytecode translation. This is my first OSCON, and the invitation to speak there was a surprise, albeit a nice one. So, see you there, if you're going. :-)

Read With Comments (2 Comments) | Post Comment

Thursday, 5th April 2007

Implementing the new object model - complete with roles!

I've been finding plenty of time to hack on Parrot lately, which is nice. The bulk of my time has been going into implementing PDD15, the new object system design. One of the big new things that has been specified is roles - needed for implementing Perl 6. I worked somewhat on the specification side of this after discussions with others, making a proposal and implementing it. Allison's review of what I'd done made only a few (very good) changes, which I've now put into the implementation. Net result: you can now compose roles into classes, as well as make roles up from other roles. Only methods are composed at the moment, though attributes are coming once some design issues are resolved.

Work goes on. Inheritance now works just as well as under the original object model, aside from being able to inherit from PMCs is not yet specified (though it's next in the design pipeline). Attributes, methods and instantiation are all in place. A lot of the curernt work is on changes to allow interoperability between different class systems. My goal for this week is to get a lot of that stuff sorted out.

I've also been eyeing up the Perl 6 to Parrot compiler. My hope is that I can contribute to that in order to get some basic object stuff working. My dream is to have something working in time for NPW, where I'm talking about the Perl 6 object model. It'd be really great to be able to say "and Perl 6 on Parrot can do some of this stuff now too". The hacking goes on... :-)

Read With Comments (8112 Comments) | Post Comment

Saturday, 24th March 2007

Slides From UKUUG

The slides from my talks at UKUUG are now uploaded and on the talks page. I gave the two talks I was originally scheduled to give: one on the Perl 6 langauge and one on deployment related issues (including Parrot, module naming, Perl 5 to Perl 6 migration and CPAN6). Both were well attended, the first one having a really great question and answer session at the end (thanks to everyone for asking such great questions). My feeling from talking to people is that many have gone away with a much better opinion of Perl 6 than before my talks - some now believing that it would actually happen and others really looking forward to the new language features.

Additionally, after a bit of persuasion from CLK, I gave a talk called "PowerShell Rocks!" - a talk on Microsoft's new shell. This was somewhat crazy given I was at a UNIX conference, so I made sure to poke fun at myself for that. I think I provied a bit of amusement at the end of the conference - I was the last of the lightning talks - as well as showing that there is Another Way to the traditonal shells we know and love.

Read With Comments (0 Comments) | Post Comment

Monday, 12th March 2007

Playing with bird guts

After a serious lack of time for hacking on Parrot in much of January and February, I'm now digging back in. This was much inspired by the recent hackathon in Arnhem, where I spent a lot of my time working with Allison Randal and others on the design of the Parrot object model. It's also due to free time being more available, which is always helpful.

I started working on implementing the new objects design, and wanted to use PMETHOD (where you write a method in a PMC, but it takes parameters using the Parrot Calling Conventions) and PMINVOKE (which calls a PMETHOD from within a PMC - again, using the Parrot Calling Conventions rather than the C ones). However, I discovered that PMINVOKE wasn't fully implemented, so I went and did that. A little while later, I'd got attribute lookup and the attribute lookup cache implemented and working. Then I started on implementing inheritance and...BOOM! Segfault! Win a kitten.

Turns out that PMETHODs and PMINVOKE did not take a return continuation at the Right Time (namely, before pushing a new context onto the context linked list) or even at all. First, here's a little bit of background into contexts. A context is kinda important, because it's where the registers live. One important thing to know about a context is that it is not, in itself, a garbage collectable object. It's just a C structure. That means that unless some PMC is referencing it and requests that its registers are marked during garbage collection, the contents of its registers will never get seen by the garbage collector. If that happens, you end up with PMCs still referenced by registers but not anywhere else (this is not an unusual situation) being garbage collected. Then you try and use them garbage collected PMCs, and things really don't work out.

Parrot uses Continuation Passing Style internally. There are some nice diagrams describing this in a couple of my Parrot talks (the LPW 2005 one has 'em) if you want to see those. But basically, a return continuation is a PMC that references the context of the caller (noting that you have one context per sub call). A context in turn refers to its current return continuation. To make it clear - the garbage collector does not walk down the chain of contexts by looking at the caller context in them. Instead, the return continuation PMCs form a chain - though not with each other, but via the contexts. Basically, a return continuation points to the context of the caller, which holds a return continuation that points to the context of its caller, and so on.

When you take a return continuation, it grabs the current context. That means you must do it *before* you create a new context, so that the return continuation is referencing the previous context. It also means you must do it *whenever* you create a new context, even if it's not for a real sub, but just a fake one that arguments can be returned into.

Anyway, I hope that's a little bit of insight into contexts and return continuations for anyone who looked at my check-in and thought "it's cool he fixed it, but I've no clue what he did". :-)

Read With Comments (0 Comments) | Post Comment

Older Stuff
All content Copyright (C) Jonathan Worthington 2003-2006 unless otherwise stated.