chromatic is currently certified at Master level.

Name: chromatic
Member since: 2000-03-20 04:52:20
Last Login: 2008-05-07 05:43:30

FOAF RDF Share This

Homepage: http://wgz.org/chromatic/

Notes:

chromatic @ wgz . org

I'm the Open Source and Free Software editor at the O'Reilly Network. I'd like to discuss good software development practices more frequently; we'll see if it happens.

ESR Doesn't Speak for Me.

Projects

Recent blog entries by chromatic

Syndication: RSS 2.0

10 May 2008 »

Doing Nothing Better in Perl 5

Perl 6 has three code placeholder operators, known affectionately as the "yada, yada, yada" operator (see List Prefix Precedence in Synopsis 3). It's a matter of (very sarcastic) public record how much I love writing, maintaining, and patching parsers, so I've just sent a very preliminary five-line patch to p5p to add support for<nobr> <wbr></nobr>... to Perl 5.

--- perly.y~    2008-05-09 17:47:35.000000000 -0700
+++ perly.y    2008-05-09 17:47:41.000000000 -0700
@@ -1227,6 +1227,11 @@
             }
     |    WORD
     |    listop
+    |    DOTDOT
+            {
+              $$ = newUNOP(OP_DIE, 0,
+                  newSVOP(OP_CONST, 0, newSVpvs("Unimplemented")))
+            }
     ;

<nobr> <wbr></nobr>/* "my" declarations, with optional attributes */

Apply this to recentish bleadperl sources, run perl regen_perly.pl, rebuild, and now you can run programs such as:

sub foo {<nobr> <wbr></nobr>... }
foo();

And get an "Unimplemented at file line line." error message.

(Now everyone who complains that I don't code enough to match my talk, please punch yourself in the face.)

Syndicated 2008-05-10 02:24:04 from pudge

9 May 2008 »

Perl 6 Design Minutes for 07 May 2008

<summary type="xhtml">

The Perl 6 design team met by phone on 07 May 2008. Larry, Allison, Patrick, Will, Jerry, Nicholas, Jesse, and chromatic attended.

Allison:

  • spent my time this week slicing and dicing the exceptions implementation
  • replaced the old internals with the new system
  • checked that in yesterday
  • still a few failing tests in edge cases on the branch
  • did more work on the Parrot Foundation

c:

  • I own an acre of Mars, we could incorporate there

Allison:

  • don't you own a cow in the Philippines?

c:

  • yes, but that doesn't give me any governmental powers

Patrick:

  • isn't that worth a lot?

c:

  • the peso is improving against the dollar

Jesse:

  • moving on...

Larry:

  • clear bill of health from my medical reports
  • hacking a lot against the standard grammar in my STD5 implementation
  • lots of refactoring
  • all of the various parameters that used to go through separately now go through as part of the Match object
  • including the "fate" and whether we're peeking at the longest token set
  • the longest token matcher works now
  • I threw out my old mechanism for gathering Match objects
  • it now creates the more-or-less correctly
  • lots of grammar tweaks, as suggested by Mitchell Charity
  • lots of refactoring of how logging works so that it doesn't always spew enormous quantities of information to the screen
  • I can actually run the parser quite quickly now, for some definition of quickly that approximates 2000 characters per second
  • matches symbols directly, rather than calling a rule, which is faster
  • does the backoff now on longest token matching
  • started refactoring the grammar on the assumption that I cna trust the longest token matcher
  • no longer any nofat rule
  • the longest token should match the fat arrow, if there is one
  • started refactoring the quoting rules to parse as if they were sublanguages
  • getting rid of extra rigamarole to recreate the other mechanism we already use for other languages
  • working out the linkage for switching in and out of sublanguages
  • how to get to the outer language from the inner language
  • calling into pure Perl from closures in a regex
  • or the host language if you're calling the regex from another language
  • nailed down the available methods for Match objects in the specs
  • giving a talk in Seattle on Friday at SPU
  • flying to Japan on Saturday

Patrick:

  • spent a lot of time teaching this past week
  • cleared up now
  • mostly I've answered questions on mailing lists and IRC
  • I'm not always sure that I'm helpful, but I'm there
  • yesterday I worked on trying to get a bunch of little small things here and there
  • fixed up a few things in PCT internals
  • today I'm bringing PGE up to date with some of the latest changes in S05
  • these all help Rakudo and other languages in small ways
  • trying to clean out my backlog and clean up a bunch of RT tickets
  • I'll continue over the next couple of days
  • and blogging about it as I go

Jerry:

  • things are busy, mostly non-Parrot related stuff
  • submitted a ticket that I hope Patrick can close today

Patrick:

  • many languages depend on the old behavior, including Plumhead
  • I'm not certain about some of them

Jerry:

  • mostly otherwise answering questions on #parrot
  • making sure that things are set up for the real work phase of GSoC
  • making sure that students have their CLAs, if not commit bits
  • astonished to see how much work Jonathan is getting done in just two funded days
  • it's amazing to see how much a motivator money can be
  • I'd like to see more of it, hint hint

c:

  • working on closing as many open Parrot bugs as possible
  • applying as many open patches as possible
  • should be able to help on the concurrency branch soon
  • otherwise preparing for the release
  • going to check on received CLAs this week

Nicholas:

  • found it curious that Perl 5.10 has the best state implementation of any language
  • wanted to steal tests from another implementation
  • had a discussion with Leon about SMOP
  • there's no real description of how all of these implementations fit together
  • Rakudo plus Parrot is a complete implementation
  • SMOP and kp6 fit together nicely

Jesse:

  • I started a wiki page on the Perl 6 wiki at Perl_6_Implementations

Patrick:

  • I don't know that it says how things fit together

Jesse:

  • I tried to encourage other people to contribute stuff
  • didn't get much uptake

Nicholas:

  • should we suggest to Daniel that he should help explain things?

Jesse:

  • that's more likely to get people contributing to it

Will:

  • there's definitely some confusion about it within the Grants Committee

Jerry:

  • SMOP has the highest documentation-to-line-of-code ratio of any implementation

Patrick:

  • it needs a good overview though

Nicholas:

  • I'll ask Daniel to explain more
  • especially its relationship to Parrot and Rakudo

Jerry:

  • it sounds like it could be an alternate runcore for Perl 5 as well

Jesse:

  • tried a few different things
  • decided to write a test for Rakudo
  • tried a simple arithmetic test pulled from Pugs
  • found that Rakudo didn't implement a function specified in the S29 draft
  • Patrick helped me write a couple of lines of code to implement it
  • then discovered that fudge didn't support try blocks in a specific way
  • Larry patched that
  • then found that incrementing an undefined value didn't work in Rakudo
  • that was the end of my day
  • I still need to write up my findings
  • how easy is it for someone without experience in Rakudo and its internals to pick things up and contribute something?
  • more difficult than I thought it might be, but it's getting more doable
  • it's important to understand how it might fail before trying to get people to do it
  • then I started trying to play with MAD on the weekend
  • found and fixed a bug in its XML
  • refactored it such that you can run MAD's tests in the core if you add a copy of XML::Parser to the core
  • it's not far enough yet, but it's a start

Nicholas:

  • is it going to be difficult to restructure the Parrot foundation from 501(c)(3) to 501(c)(6)?

Allison:

  • you can do pretty much the same thing
  • sponsors are on the board in a c6
  • they're only advisory in a c3
  • the sponsors we've talked to are mostly only interested in getting regular status reports and the like

Jesse:

  • is there any jumping around to transfer copyright to the new foundation?

Allison:

  • we'll do a copyright assignment from the Perl Foundation to the Parrot Foundation
  • all of the CLAs that went into the code up to the point of signover will be fine
  • but we'll essentially copy the Perl Foundation CLA to a Parrot Foundation CLA

Will:

  • do we need to contact committers who haven't signed a CLA?

Patrick:

  • where does Rakudo fall?

Allison:

  • still under the Perl Foundation
  • it doesn't move at all

Will:

  • do we want to split up the repository at that point?

Allison:

  • eventually, we'll want to do so anyway
  • it's not an urgent thing

Jerry:

  • what would it take to version a Perl6Regex frontend to PGE?
  • let grammars specify a version of the grammar

Patrick:

  • I did that before by having a separate compiler
  • you're talking about something a bit finer grained
  • I don't want to do that
  • as we get closer to 1.0, that'd be fine
  • I already have enough to do keeping up with the latest versions

Will:

  • I don't think we want to keep up old versions

Patrick:

  • I don't mind sticking to our deprecation cycle
  • I hadn't put the change from today into the deprecation list yet
  • we'll get to it in a couple of weeks

Jerry:

  • just trying to figure out how to push forward with changes to PGE without having to update every language in the repository

Patrick:

  • freeze S05?
  • not a great solution

Larry:

  • I heard that

Patrick:

  • the last few changes have been great
  • I'm not really serious about that

Larry:

  • some of them you even asked for

c:

  • it's an advantage to have these languages in the repository
  • we can update them
  • but only if we can run the tests before and after and know that they pass

Will:

  • we might consider removing languages with failing tests and no recent updates
  • there are 17 grant proposals, some of them Perl 6-related
  • please comment on the TPF blog
  • it'll help

Jesse:

  • blog.perlfoundation.org
</summary>

Syndicated 2008-05-08 22:42:28 from pudge

7 May 2008 »

Good Error Messages are Important

Parrot r27355 was fun to write.

One of the persistent error messages Parrot emits for compiler writers is Null PMC access in invoke(). If you've had your hands deep in the guts of Parrot, you know what that means -- you tried to call a Sub PMC when you don't have a Sub PMC, you have no PMC. (If you don't know what that means, this entry is for you.)

Sometimes this means that there's a problem in Parrot. We've fixed almost all of those problems though, so the error usually comes from elsewhere. If you're writing a compiler, or running a compiler built on Parrot, the error usually means "You tried to call a function that doesn't exist."

Parrot's optimizer does something interesting at the end of compilation time. You've probably heard that Parrot's compiler, IMCC, translates PIR into PBC. That is, it turns source code into bytecode, which Parrot can either serialize t to disk or execute immediately. That bytecode is just a chunk of linear data in memory. It's not really a data structure. (Okay, it's a C array, but that doesn't make it a data structure.)

After IMCC has finished building a standalone chunk of bytecode, it performs a constant fixup phase. The notable part of this phase is that it edits the bytecode in place to replace all named invocations of functions known at fixup time with offset invocations.

The previous code looks something like:

invoke known_function
null    # padding
null    # padding

If IMCC has already seen known_function by this time, the direct invocation of known_function can continue. There's no runtime lookup necessary; all functions already compiled and ready are available in the bytecode.

If IMCC hasn't seen that function, runtime lookup is necessary, and so this function replaces the bytecode earlier with the equivalent of:

<nobr> <wbr></nobr>.local pmc func
func = find_name 'unknown_function'
invoke func

(I've simplified what actually happens slightly, because the concepts are more important than the details. Hopefully you see why the padding is necessary. If not, just imagine trying to splice additional opcodes into what may presumably be a lengthy C array -- like I said, barely a data structure.)

The problem with this second form occurs when find_name returns a NULL PMC, which it can legitimately do. In that case, the invoke opcode tries to invoke a NULL PMC and fails, and Parrot throws an exception saying "There's nothing here to invoke." There's the error message.

It's clear why that happens, but it's not useful. It would be more useful to see the name of the function you tried to invoke in the error message. Unfortunately, by the time Parrot calls the invoke op, that name is long gone.

My first idea was to rewrite the dynamic lookup form into something resembling:

<nobr> <wbr></nobr>.local pmc func
func = find_name 'unknown_function'
if defined func goto call_it
die "Can't invoke 'unknown_function'"

call_it:
invoke func

Unfortunately, I didn't have the space in the bytecode stream to insert that many ops, and I had no desire to move chunks of memory around in that C array. I could have added more padding after an invocation, but to be fair I'm only mostly sure that it exists there in the first place.

I had room for one op with a destination PMC and a string constant argument. I added an experimental op called find_sub_not_null which does the same thing as find_name but throws an exception which includes the requested name if Parrot can't find a PMC of that name.

This isn't entirely an ideal situation. It's a special case op, and I prefer to remove ops where possible. It's also nearly code duplication, though it's effectively three lines of code in an op, which isn't awful. I still want to be able to perform these kinds of transformations in PBC itself, but we need a different way to generate PBC and perform op-level transformations in PIR before we can do this effectively.

There are always tradeoffs, though. Doing this check in C is slightly faster than doing it in PIR. The standard Perl 5 rule of optimization applies even in Parrot -- the fewer ops, the mostly faster you can go. As well, I was able to improve the warning message today, rather than at some point in the future when we have better PBC optimization possibilities.

After all, I can always remove this op in the future.

Syndicated 2008-05-07 05:42:03 from pudge

4 May 2008 »

What are You Going to Do, SMS at Me?

<summary type="xhtml">

For years, I've thought that the only thing sillier than complaining about disaffection and how the world really should work differently in IRC was to sign silly Internet petitions about it. Now I realize that people who feel compelled to register their righteous indignation in 141 characters of chatspeak matter least.

Here's a quarter, kid. Go buy a postcard.

</summary>

Syndicated 2008-05-04 00:23:56 from pudge

28 Apr 2008 »

What a GC Bug Looks Like in Parrot

<summary type="xhtml">

Every so often someone reports weird behavior in #parrot, and someone says "Hey, that looks like a GC bug!"

Most of them aren't. (Most of them lately seem to be that we're changing the way bytecode works, and we don't have all of the dependencies for all of the generated PBC files correct, so you have to run make realclean and rebuild.)

While adding the vtable override cache the other day, I did create a forehead-slapper of GC bug, but I caught it before I checked in the code. How did I know it was a GC bug? Easy.

The Class PMC itself contains pointers to several other PMCs and GC entities, including the name of the class and its corresponding namespace. I added a pointer to a Hash PMC which maps the names of vtable overrides to Sub PMCs.

I remember thinking at the time "Hey, it's just a cache. I don't have to mark it during the mark phase explicitly. All of the Subs it refers to will stay alive as long as their namespaces live. That's easy."

When I ran the tests, I saw a weird error about not being able to perform a keyed index PMC lookup on a Key PMC. I set a breakpoint on the real_exception function (which reports these kinds of errors) in the debugger, and the backtrace showed that the cause of the call was my cache lookup function.

"That's weird," I thought. Then I realized what I had done.

My line of thinking was correct in that I don't have to mark all of the PMCs contained in the cache PMC. They're already reachable from the rootset through the namespace. The GC won't collect them.

The problem is that the cache itself -- the Hash PMC -- is only reachable through the Class PMC. Unless it gets marked as live, the GC will reclaim its header and put it on the free list again.

The Class PMC still has a pointer to that header, but the next PMC allocated from the GC which uses that header will overwrite the PMC's information, effectively morphing my lovely cache into something else. In this case, my Hash PMC turned into a Key PMC.

Usually they're not this obvious, but I've gone through all of the PMCs in Parrot to make sure they mark their contained GCable entities appropriately.

</summary>

Syndicated 2008-04-28 07:19:51 from pudge

315 older entries...

 

chromatic certified others as follows:

  • chromatic certified mishan as Journeyer
  • chromatic certified jlp as Apprentice
  • chromatic certified jbontje as Apprentice
  • chromatic certified mcelrath as Apprentice
  • chromatic certified fozbaca as Apprentice
  • chromatic certified wrvh as Journeyer
  • chromatic certified hexmode as Journeyer
  • chromatic certified JB318 as Apprentice
  • chromatic certified dlc as Apprentice
  • chromatic certified thewatcher as Apprentice
  • chromatic certified japhy as Journeyer
  • chromatic certified extremely as Apprentice
  • chromatic certified renster as Apprentice
  • chromatic certified hoffman as Apprentice
  • chromatic certified ebizo as Apprentice
  • chromatic certified apgarcia as Apprentice
  • chromatic certified redmist as Apprentice
  • chromatic certified monk as Apprentice
  • chromatic certified dirtyrat as Apprentice
  • chromatic certified gary as Apprentice
  • chromatic certified bikeNomad as Journeyer
  • chromatic certified jmcnamara as Apprentice
  • chromatic certified footpad as Apprentice
  • chromatic certified OeufMayo as Journeyer
  • chromatic certified gregor as Journeyer
  • chromatic certified Simon as Master
  • chromatic certified jaybonci as Apprentice
  • chromatic certified kwoo as Apprentice
  • chromatic certified hv as Master
  • chromatic certified gbarr as Master
  • chromatic certified Abigail as Journeyer
  • chromatic certified freeside as Journeyer
  • chromatic certified adrianh as Journeyer
  • chromatic certified chip as Master
  • chromatic certified gc as Master
  • chromatic certified DaveGoehrig as Journeyer
  • chromatic certified tcopeland as Journeyer
  • chromatic certified RogerBrowne as Journeyer
  • chromatic certified bradfitz as Master

Others have certified chromatic as follows:

  • henrik certified chromatic as Apprentice
  • davej certified chromatic as Apprentice
  • jdube certified chromatic as Apprentice
  • mishan certified chromatic as Journeyer
  • kelly certified chromatic as Journeyer
  • lukeh certified chromatic as Apprentice
  • JB318 certified chromatic as Apprentice
  • jrennie certified chromatic as Apprentice
  • jlp certified chromatic as Journeyer
  • mojotoad certified chromatic as Journeyer
  • jbontje certified chromatic as Journeyer
  • mcelrath certified chromatic as Journeyer
  • lazarus certified chromatic as Apprentice
  • wrvh certified chromatic as Journeyer
  • fozbaca certified chromatic as Journeyer
  • beppu certified chromatic as Journeyer
  • nixnut certified chromatic as Journeyer
  • DrCode certified chromatic as Journeyer
  • hexmode certified chromatic as Journeyer
  • cwinters certified chromatic as Journeyer
  • Wheat certified chromatic as Journeyer
  • ErikLevy certified chromatic as Journeyer
  • manu certified chromatic as Journeyer
  • cpw certified chromatic as Journeyer
  • dlc certified chromatic as Journeyer
  • jimw certified chromatic as Journeyer
  • renster certified chromatic as Journeyer
  • sh certified chromatic as Journeyer
  • dneighbors certified chromatic as Journeyer
  • jao certified chromatic as Journeyer
  • thelema certified chromatic as Journeyer
  • apgarcia certified chromatic as Journeyer
  • redmist certified chromatic as Master
  • monk certified chromatic as Journeyer
  • OeufMayo certified chromatic as Journeyer
  • adulau certified chromatic as Journeyer
  • mdillon certified chromatic as Journeyer
  • jmcnamara certified chromatic as Journeyer
  • overclocker certified chromatic as Journeyer
  • MikeGTN certified chromatic as Master
  • footpad certified chromatic as Master
  • roguemtl certified chromatic as Journeyer
  • jono certified chromatic as Journeyer
  • robhudson certified chromatic as Journeyer
  • technik certified chromatic as Journeyer
  • omarius certified chromatic as Journeyer
  • ignatz certified chromatic as Journeyer
  • fxn certified chromatic as Journeyer
  • stevej certified chromatic as Journeyer
  • neurogato certified chromatic as Journeyer
  • merlyn certified chromatic as Journeyer
  • thraxil certified chromatic as Journeyer
  • Qbert certified chromatic as Journeyer
  • forrest certified chromatic as Master
  • jaybonci certified chromatic as Master
  • arhuman certified chromatic as Master
  • pop certified chromatic as Journeyer
  • ib certified chromatic as Master
  • kwoo certified chromatic as Journeyer
  • cm certified chromatic as Master
  • richdawe certified chromatic as Master
  • pasky certified chromatic as Master
  • IlyaM certified chromatic as Journeyer
  • gbarr certified chromatic as Journeyer
  • petdance certified chromatic as Journeyer
  • wiggly certified chromatic as Master
  • iamsure certified chromatic as Master
  • adrianh certified chromatic as Master
  • gobry certified chromatic as Master
  • kjwoo certified chromatic as Journeyer
  • rooneg certified chromatic as Journeyer
  • RogerBrowne certified chromatic as Master
  • mchirico certified chromatic as Master
  • pcburns certified chromatic as Master
  • tagishandy certified chromatic as Master
  • samanderson certified chromatic as Master
  • drwat certified chromatic as Master
  • Purdy certified chromatic as Journeyer
  • fzort certified chromatic as Master

[ Certification disabled because you're not logged in. ]

New Advogato Features

FOAF updates: Trust rankings are now exported, making the data available to other users and websites. An external FOAF URI has been added, allowing users to link to an additional FOAF file.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!

X
Share this page