<?xml version="1.0"?>
<rss version="2.0">

<channel>
	<title>Planet Parrot</title>
	<link>http://planet.parrotcode.org/</link>
	<language>en</language>
	<description>Planet Parrot - http://planet.parrotcode.org/</description>

<item>
	<title>chromatic: Perl 6 Design Minutes for 20 May 2009</title>
	<guid>http://use.perl.org/~chromatic/journal/39216?from=rss</guid>
	<link>http://use.perl.org/~chromatic/journal/39216?from=rss</link>
	<description>&lt;p&gt;The Perl 6 design team met by phone on 20 May 2009. Larry, Allison, Patrick, Jerry, and chromatic attended.&lt;/p&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;changed the &lt;code&gt;time&lt;/code&gt; function to return a &lt;code&gt;Rat&lt;/code&gt; &lt;/li&gt;&lt;li&gt;thinking about the traits that have been bothering Jonathan and others&lt;/li&gt;&lt;li&gt;have some changes to check into the spec when I'm happy with them&lt;/li&gt;&lt;li&gt;thinking about the primitives we use to define &lt;code&gt;use&lt;/code&gt; &lt;/li&gt;&lt;li&gt;breaks down into load and import&lt;/li&gt;&lt;li&gt;thinking of establishing compile-time keywords for both concepts&lt;/li&gt;&lt;li&gt;intended so that I can import from anything acting like a module -- an inlined role, for example&lt;/li&gt;&lt;li&gt;otherwise trying to keep up with the flow of IRC&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Allison:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;working on the Parrot book&lt;/li&gt;&lt;li&gt;changed its focus to a small, 100-page PIR book from a monolithic Parrot book&lt;/li&gt;&lt;li&gt;the intent is to get something out for YAPC and OSCON&lt;/li&gt;&lt;li&gt;will send out a draft for review&lt;/li&gt;&lt;li&gt;will merge my changes into the repo later this week&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;released Rakudo #17 last week&lt;/li&gt;&lt;li&gt;was easy again&lt;/li&gt;&lt;li&gt;875 more tests since #16, so we pass 68% of the spectest suite&lt;/li&gt;&lt;li&gt;finished implementing the &lt;code&gt;root_new&lt;/code&gt; opcode in Parrot&lt;/li&gt;&lt;li&gt;cleans up a lot of the PMCProxy issues from moving Rakudo to its own HLL&lt;/li&gt;&lt;li&gt;gained half of the speed we lost from the migration&lt;/li&gt;&lt;li&gt;we'll get more back as we update more places that need it&lt;/li&gt;&lt;li&gt;NQP never expected anything like that&lt;/li&gt;&lt;li&gt;I have to rework some it and PCT&lt;/li&gt;&lt;li&gt;haven't quite figured out how to do that&lt;/li&gt;&lt;li&gt;refactoring &lt;code&gt;use&lt;/code&gt; and &lt;code&gt;import&lt;/code&gt; in Rakudo&lt;/li&gt;&lt;li&gt;the current implementation doesn't work&lt;/li&gt;&lt;li&gt;will hopefully match with what Larry's putting in the spec&lt;/li&gt;&lt;li&gt;it seems like the logical way to do things&lt;/li&gt;&lt;li&gt;updated Rakudo's ROADMAP in &lt;em&gt;docs/ROADMAP&lt;/em&gt; &lt;/li&gt;&lt;li&gt;gives us an idea of dependencies and next tasks&lt;/li&gt;&lt;li&gt;may also help people understand what blocks features they want&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Jerry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;the bonding period has ended for GSoC&lt;/li&gt;&lt;li&gt;time for students to start coding&lt;/li&gt;&lt;li&gt;everyone on the Perl 6 and Parrot projects is ready&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;c:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;fixed some memory leaks in Parrot and Rakudo&lt;/li&gt;&lt;li&gt;there are still some in Rakudo, but the web examples should be able to live longer&lt;/li&gt;&lt;li&gt;did more profiling&lt;/li&gt;&lt;li&gt;think NFG is important for Parrot in the near term&lt;/li&gt;&lt;li&gt;have some documentation to write&lt;/li&gt;&lt;li&gt;have been editing the Parrot book&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;how's the command line for Rakudo coming?&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Jerry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;I expect to get back to that&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;the &quot;parens build captures&quot; decision surprised me&lt;/li&gt;&lt;li&gt;what's the rationale?&lt;/li&gt;&lt;li&gt;I really liked &quot;parens mean grouping&quot;&lt;/li&gt;&lt;li&gt;maybe I haven't reconfigured my worldview yet, but it feels messy&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;when used in an argument list, it has the same effect as a capture&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;it even works when they're used as a term&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;they still mean that you have to look at what you're binding to and decide&lt;/li&gt;&lt;li&gt;am I binding this to a scalar or to an array?&lt;/li&gt;&lt;li&gt; &lt;code&gt;(1, 2, 3)&lt;/code&gt; bound to an array...&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;I'm going to have to think about that&lt;/li&gt;&lt;li&gt;the &lt;code&gt;zip&lt;/code&gt; operator in slice context....&lt;/li&gt;&lt;li&gt;is this three or one positional arguments?  &lt;code&gt;zip($a,$b,$c)&lt;/code&gt; &lt;/li&gt;&lt;li&gt;how many positional arguments are in this case? &lt;code&gt;zip($a,$b,$c;$d)&lt;/code&gt; &lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;one slice&lt;/li&gt;&lt;li&gt;you wouldn't want to write that&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;what in the arg list distinguishes the use of the semicolon versus the comma&lt;/li&gt;&lt;li&gt;inside of an argument list we have to recognize a variety of syntactic things&lt;/li&gt;&lt;li&gt;comma, semicolon, colon, array or hash sigil, named parameters&lt;/li&gt;&lt;li&gt;seems like captures need more information than just positional&lt;/li&gt;&lt;li&gt;they need to store metadata about positional arguments&lt;/li&gt;&lt;li&gt;I like the syntactic stuff showing up in the argument list&lt;/li&gt;&lt;li&gt;but I don't want to handle them in three different ways&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;I'll have to think about that&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;haven't figured out how to deal with slice context either&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;might say that the presence of a semicolon implies the presence of other parens&lt;/li&gt;&lt;li&gt;the comma implies...&lt;/li&gt;&lt;li&gt;that might be more consistent binding for a top-level list&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;I half expected that answer&lt;/li&gt;&lt;li&gt;I can see the semicolon as just a lower precedence grouping operator&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;otherwise you have a semicolon that's just not there in every other argument list&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;assuming that, the other commas form an argument list through the infix semicolon&lt;/li&gt;&lt;li&gt;an array in there means Capture of Capture of Capture&lt;/li&gt;&lt;li&gt;we were about to refactor List and Array in Rakudo anyway&lt;/li&gt;&lt;li&gt;the question is &quot;Do we really have a List type now?&quot;&lt;/li&gt;&lt;li&gt;Rakudo assumes that&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;if we can unify args list with List, that's probably healthy&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;I'd really like that&lt;/li&gt;&lt;li&gt;that makes things a lot cleaner&lt;/li&gt;&lt;li&gt;infix comma and infix semis now just create arglists&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;or Lists&lt;/li&gt;&lt;li&gt;if you define List as &quot;something that has out of band metadata&quot;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;any more decisions that you can make about that will help our implementation&lt;/li&gt;&lt;li&gt;I probably won't get around to that this week&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;we make syntactic distinctions&lt;/li&gt;&lt;li&gt;we know that this is an arg list&lt;/li&gt;&lt;li&gt;we treat pairs as named arguments&lt;/li&gt;&lt;li&gt;we don't do that if we know it's not an argument list&lt;/li&gt;&lt;li&gt;it stays positional&lt;/li&gt;&lt;li&gt;that's the only distinction between an arg list and a List&lt;/li&gt;&lt;li&gt;purely syntactic&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;to summarize&lt;/li&gt;&lt;li&gt; &lt;code&gt;zip($a, $b, $c)&lt;/code&gt; has three positional arguments&lt;/li&gt;&lt;li&gt; &lt;code&gt;zip($a, $b, $c; $d)&lt;/code&gt; has two, the first of which is itself a list/capture&lt;/li&gt;&lt;/ul&gt;</description>
	<pubDate>Thu, 02 Jul 2009 23:03:51 +0000</pubDate>
</item>
<item>
	<title>Andrew Whitworth: Writing PMCs in NQP</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-2234611288791513705</guid>
	<link>http://wknight8111.blogspot.com/2009/07/writing-pmcs-in-nqp.html</link>
	<description>So the question has arisen lately, what is L1 going to look like, and how hard is it going to be to write ops and PMCs in it? The answer is that we aren't going to be writing in L1 directly, we have PCT and will be writing it in a higher level language and compiling it down directly to Parrot bytecode. Here is an example of what the FixedPMCArray PMC type will look like rewritten in NQP:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class FixedPMCArray :need_ext :provides('array') {&lt;br /&gt;    has $.size as int;&lt;br /&gt;    has @.pmc_array as pmc;&lt;br /&gt;&lt;br /&gt;    vtable elements() as int {&lt;br /&gt;        return $this.size;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    vtable destroy() {&lt;br /&gt;        if $this.pmc_array != null&lt;br /&gt;            Parrot::mem_sys_free($this.pmc_array);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    vtable get_integer() as int {&lt;br /&gt;        return $this.elements();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    vtable get_bool() as bool {&lt;br /&gt;        return $this.elements() != 0;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    vtable get_integer_keyed_int($idx as int) as int {&lt;br /&gt;        my $intval as int = +( $this.pmc_array[$idx] );&lt;br /&gt;        return $intval;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    vtable set_integer_keyed_int($idx as int, $val as pmc) {&lt;br /&gt;        if $this.elements &amp;lt; $idx&lt;br /&gt;            $this.set_integer_native($idx);&lt;br /&gt;        $this.pmc_array[$idx] = $val;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    vtable get_string_keyed_int($idx as int) as str {&lt;br /&gt;        my $strval as str = ~( $this.pmc_array[$idx] );&lt;br /&gt;        return $strval;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    vtable mark() {&lt;br /&gt;        for(my $i = 0; $i &amp;lt; $this.size; $i++) {&lt;br /&gt;            my $pmc = $this.pmc_array[$i];&lt;br /&gt;            if !Parrot::PMC_IS_NULL($pmc)&lt;br /&gt;                Parrot::Parrot_gc_mark_PObj_alive($INTERP, $pmc);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    vtable set_integer_native($size as int) {&lt;br /&gt;        if $this.size &amp;gt;= $size&lt;br /&gt;            return;&lt;br /&gt;&lt;br /&gt;        my $pmc_size = Parrot::sizeof_pmc_ptr();&lt;br /&gt;        my @new_pmc_array = Parrot::mem_sys_allocate($size * $pmc_size);&lt;br /&gt;        loop (my $i = 0; $i &amp;lt; $this.size; i++) {&lt;br /&gt;            @new_pmc_array[$i] = $this.pmc_array[$i];&lt;br /&gt;        }&lt;br /&gt;        $this.size = $size;&lt;br /&gt;        $this.pmc_array = new_pmc_array;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;There are a few points to note here: First, I know this isn't perfect Perl 6 and I'm sure I screwed up some syntax here and there. I apologize for that, but I'm not really interested in going back line-by-line to fix it. This is just a thought experiment after all, and the important point isn't getting the syntax correct but instead proving the efficacy of this method. Second, I'm treating NQP here as just a particular syntax over very low-level semantics. The code &lt;code&gt;has @.pmc_array as pmc&lt;/code&gt; is going to be equivalent to the C-ish code &lt;code&gt;ATTR PMC** pmc_array&lt;/code&gt;. That is, we just assume that everywhere we see &lt;code&gt;as pmc&lt;/code&gt;, that will become the equivalent C code &lt;code&gt;PMC*&lt;/code&gt; and the @ sigil just adds another &lt;code&gt;*&lt;/code&gt; to it.&lt;br /&gt;&lt;br /&gt;One more thing worth noting is that I am assuming the management of the ATTR structure will be automated. The PMC compiler will recognize that this PMC type has attributes and will automatically allocate them on initialization and automatically deallocate them on destruction.&lt;br /&gt;&lt;br /&gt;Since NQP is going to be compiled down into a very low-level bytecode that should be capably equivalent to C code, it is going to have direct access to C functions in libparrot. It will not be calling functions through NCI, it will be constructing machine-level call frames and executing functions directly. I show this using the syntax &lt;code&gt;Parrot::FUNCNAME&lt;/code&gt;. The &lt;code&gt;$INTERP&lt;/code&gt; contant is a reference to the current interpreter. This helps to differentiate functions which must be called with C semantics (pushing arguments onto the system stack) and those functions which can be called with L1 semantics instead (and I'm not entirely sure what those will look like anyway, but they won't be stack-based you can be sure of that). Instead of writing &lt;code&gt;Parrot::&lt;/code&gt;, we could easily write &lt;code&gt;C::&lt;/code&gt; instead&lt;br /&gt;&lt;br /&gt;So that's a quick look at what a basic core PMC could look like in NQP. If we all remember that in this particular case the NQP is going to be compiled down to low-level code and not into higher-level PIR/PASM, this all starts to make a lot more sense. Think of it like writing C but with slightly different syntax (and different underlying semantics), and without any of the high-level features that you would expect from Perl6.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-2234611288791513705?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Thu, 02 Jul 2009 19:20:22 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>Andrew Whitworth: Understanding Opcode Dispatch</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-8607757243709260464</guid>
	<link>http://wknight8111.blogspot.com/2009/06/understanding-opcode-dispatch.html</link>
	<description>I've been reading a lot of papers lately with respect to opcode dispatch because I've been trying hard to prepare for a &lt;a href=&quot;http://wknight8111.blogspot.com/2009/06/yapc-l1-recap.html&quot;&gt;possible migration to L1&lt;/a&gt;. As I've mentioned on other posts before, L1 is going to enable a number of cool techniques and optimization possibilities that we don't really have access to right now, and make a number of other optimizations which are currently possible more beneficial. What I want to do is understand all these possibilities and their requirements so we can design L1 specifically to provide them. The goal of this post is to go over some ideas about opcode dispatch and runcores from the literature I've been reading, to make sure everybody has a basic understanding of some of these concepts.&lt;br /&gt;&lt;br /&gt;This is the start of what I hope will be an ongoing series of posts where I try to discuss theory and algorithms behind some of Parrot's systems, and theories about things we would like to add to Parrot in the future. I'll tag posts like this &quot;&lt;a href=&quot;http://wknight8111.blogspot.com/search/label/ParrotTheory&quot;&gt;ParrotTheory&lt;/a&gt;&quot;.&lt;br /&gt;&lt;br /&gt;&quot;Dispatch&quot; is the action of moving control flow into the logic body of an opcode, based on the value of a &quot;&lt;span&gt;program counter&lt;/span&gt;&quot; (PC) pointer. In microprocessor hardware terminology, the PC is a hardware register that points to the memory address of the currently executing machine code instruction. x86 aficionados will probably recognize this as the &quot;IP&quot; (Instruction Pointer) register. Same concept, different name. Bytecode comes in to the interpreter as a large block of sequential opcodes, and the current opcode is pointed to by *PC. Moving to the next opcode means we increment PC, so PC++ or something similar.&lt;br /&gt;&lt;br /&gt;Most simplistic VMs will use a &lt;span&gt;switch-based core&lt;/span&gt;, which uses the C switch statement to dispatch:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;for(pc = program_start; pc &amp;lt; program_end; pc++) switch(*pc) {&lt;br /&gt; case INSTR_PRINT:&lt;br /&gt;   ...&lt;br /&gt;   break;&lt;br /&gt; case INSTR_PUSH:&lt;br /&gt;   ...&lt;br /&gt;   break;&lt;br /&gt; case INSTR_POP:&lt;br /&gt;   ...&lt;br /&gt;   break;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Control flow in this snippet is a complete mess because we're following the switch, breaking to the bottom of the switch, and then jumping back up to the top of the loop to repeat the process. A good optimizing C compiler will probably convert this switch statement into a dispatch table of jump addresses, which creates a series of &lt;span&gt;indirect jumps&lt;/span&gt;. Hardware has trouble with indirect jumps in general because it needs to load the address to jump to from a different address in memory (which can change at runtime and therefore cannot be easily predicted). I can describe this in more detail elsewhere for anybody who is interested (I'm doing a particularly shitty job right now). We end up running the CPU at a fraction of it's maximum throughput speed. It has to keep refilling the instruction pipeline because it can't anticipate where control flow will move to next. This is bad.&lt;br /&gt;&lt;br /&gt;A system called &lt;span&gt;direct threading&lt;/span&gt; stores all the opcode bodies together in a single large function, similar to the switch core. However, instead of using a loop and a switch, it uses a &lt;span&gt;goto instruction&lt;/span&gt; to jump directly to a label. Each opcode has a label, and those are usually stored in a table somewhere. So instead of the example above, we have this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;INSTR_PRINT:&lt;br /&gt;...&lt;br /&gt;goto jmptable[*pc++];&lt;br /&gt;INSTR_PUSH:&lt;br /&gt;...&lt;br /&gt;goto jmptable[*pc++];&lt;br /&gt;INSTR_POP:&lt;br /&gt;...&lt;br /&gt;goto jmptable[*pc++];&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;It turns out that this is a little faster, but the hardware microprocessor is still not able to properly anticipate where all the indirect jumps lead. Sometimes it can, and some architectures handle this case better then others, but it's far from perfect. Parrot has two cores that implement direct-threading: the computed goto (CG) and predereferenced computed goto (PCG or CGP) cores. Because of limitations in some compilers and the C99 spec, CG and PCG are only available when Parrot is built with GCC. These can be accessed with the &quot;-R cgoto&quot; and &quot;-R cgp&quot; flags respectively.&lt;br /&gt;&lt;br /&gt;[&lt;span&gt;Update 01/07/09&lt;/span&gt;: As a note of clarification, switch-based cores and indirect-threading cores perform differently on different systems. Some platforms handle one better then the other. Most compilers will generate bounds-checking logic for the switch core that does not exist in the direct-threaded core. I've seen numbers that show the switch core leads to almost a 100% branch prediction failure on some systems, while direct-threading leads to only about a 50% branch misprediction on those same systems. I would like to see a more robust cross-platform comparison of these two.]&lt;br /&gt;&lt;br /&gt;In these cases, it's really interesting to note that the number of machine code instructions needed to dispatch an opcode is not nearly as important to system performance as the ability of the microprocessor to anticipate control flow and keep it's pipeline full. Getting a speculation wrong means that the processor will have to flush it's pipeline and reload instructions. Some processors will even stall, and not execute anything until the new address is known. These problems, called &lt;span&gt;pipeline hazards&lt;/span&gt; are very very bad for performance.&lt;br /&gt;&lt;br /&gt;Pipeline hazards are bad for performance, but &lt;span&gt;cache hazards&lt;/span&gt; are even worse. Cache hazards occur when the processor attempts to access memory that is not stored in it's cache, and has to load the necessary data from the comparatively slow RAM. We run into a cache hazard in terms of opcode dispatch when the code size of the opcodes is very large, and we can't fit it all into the processor cache. So what we want is a dispatch mechanism that is good in the processor cache, but also makes things easier on the branch predictor. This is one of my motivations for making L1 a very small opcode set, to ensure that all opcodes can easily fit into the processor cache without creating all sorts of cache hazards.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Inlining&lt;/span&gt;, which is a technique frequently used in JIT and modern optimizers, tries to help with branch prediction by converting a stream of opcodes with indirect branches into a stream of machine code instructions with relative branches. Instead of dispatching to the opcode body, the opcode body is copied into a running stream of machine code and executed directly by the processor. This completely eliminates pipeline hazards due to indirect opcode dispatch. However, you end up with more code to cache because you have an entire stream of machine code, where there may be duplication of individual ops. You also spend a lot of overhead calling memcpy repeatedly on the opcodes. This technique increases memory footprint and can reduce cache performance.&lt;br /&gt;&lt;br /&gt;A &lt;span&gt;subroutine-threaded&lt;/span&gt; core stores each opcode as a separate C-level function. Each op in sequence is called and then the op returns back to the runcore. This is two branch instructions to dispatch each op, compared to only one for a direct-threaded core. However, recent benchmarks I have seen in Parrot show that the subroutine core actually performs faster then the direct-threaded core does. This is because modern microprocessors have lots of hardware dedicated to predicting and optimizing control flow in call/return situations, because that is one of the most common idioms in modern software. This is a nonintuitive situation where &lt;span&gt;more machine code instructions actually execute faster then fewer instructions&lt;/span&gt;. Parrot's default &quot;slow&quot; core (&quot;-R slow&quot;) and the so-called &quot;fast&quot; core (&quot;-R fast&quot;) use this technique (actually, these cores aren't exactly &quot;subroutine-threaded&quot;, but it's close). From the numbers I have seen, the fast core is the fastest in Parrot. Here's how it works, basically:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;for (pc = program_start; pc &amp;lt; program_end; pc++) {&lt;br /&gt;   functable[*pc](interp, args);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;[&lt;span&gt;Update&lt;/span&gt; &lt;span&gt;01/07/09&lt;/span&gt;: There is some disagreement in the literature about what &quot;Subroutine-threading&quot; really is. &lt;a href=&quot;http://www.complang.tuwien.ac.at/forth/threaded-code.html&quot;&gt;Some sources&lt;/a&gt; refer to the example I posted above as being &lt;span&gt;Call-Threaded&lt;/span&gt; code, and use the term &quot;subroutine threading&quot; more in the way that I am describing context-threading below.]&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Context threading&lt;/span&gt;, which is a slightly more advanced technique, combines some ideas from the subroutine-threaded and direct-threaded modes, and a little bit of JIT magic. We create what's called a Context Thread Table, which is actually a memory buffer of executable machine code. We store opcodes as functions like we do in the subroutine-threaded system, and use a simple JIT engine to create a series of calls to those functions. This PASM code:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;new P0, 'foo'&lt;br /&gt;add_i P0, 1&lt;br /&gt;push P1, P0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Becomes this sequence in machine code:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;call Parrot_op_new&lt;br /&gt;call Parrot_op_add_i&lt;br /&gt;call Parrot_op_push&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;What context threading does, in essence, is aligns the VMs PC pointer with the hardware IP register, and maximizes the ability of the hardware to predict branches. There are some complexities here involving branches at the PIR level, but they aren't insurmountable. Parrot does not currently have a context-threaded core, but I would very much like it if somebody added one. Numbers I've seen show that a good context-threaded core reduces pipeline and cache hazards by significant amounts, which has the effect of increasing performance significantly.&lt;br /&gt;&lt;br /&gt;So that's a quick overview of some basic opcode dispatch mechanisms. I know I am leaving a few issues out, and I know I misrepresented a few topics here for brevity and clarity. Next time I think I will talk about method dispatch and some optimization techniques used for that.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-8607757243709260464?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Wed, 01 Jul 2009 09:46:03 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>Patrick Michaud: Rakudo day:  operators in setting and lots of RT bugfixes</title>
	<guid>http://use.perl.org/~pmichaud/journal/39199?from=rss</guid>
	<link>http://use.perl.org/~pmichaud/journal/39199?from=rss</link>
	<description>&lt;p&gt;At the beginning of June the Vienna.pm organization generously
committed to funding me for 1-day-per-week of Rakudo effort,
but because of the Rakudo release, Parrot Virtual Machine Workshop,
YAPC::NA, and a short vacation, today is the first day that I
had available to really dedicate to the task.  In fact, to catch
things up a bit I plan to do another Rakudo day tomorrow or Thursday.
&lt;/p&gt;&lt;p&gt;Here's what I accomplished for today's Vienna.pm-funded Rakudo day.
&lt;/p&gt;&lt;p&gt;The biggest task I tackled for the Rakudo day was to be able to
write operators in the setting (Perl 6) instead of PIR (RT #66826).
In fact, I had actually done most of this last week during the
YAPC::NA hackathon day, but interruptions then and a few annoying
Parrot bugs kept me from marking the task as completely accomplished
then.  What this means is that we can now begin defining operators
directly in Perl 6 code (perhaps with some inlined PIR), which
moritz++ has already been exercising for infix:&amp;lt;...&amp;gt;, infix:&amp;lt;eqv&amp;gt;,
and a few other operators.  Over the next few weeks I expect we'll
move even more operators out of PIR and into the setting.
&lt;/p&gt;&lt;p&gt;The rest of today's Rakudo day was spent reviewing and cleaning up
the RT queue; it had grown to over 400 tickets but by the end of
the day Jonathan and I have shrunk it back down to 387.  I think
we collectively closed about 16 tickets today, and I responded with
requests for clarification or updates on several more.  Here are
some of the highlights:
&lt;/p&gt;&lt;p&gt;RT #66060 noted a problem that the .uc method would fail on some
strings where .lc worked.  I tracked this down to a Parrot issue
in its handling of Unicode strings when ICU wasn't present, and
refactored the code to be a bit more robust there.
&lt;/p&gt;&lt;p&gt;RT #66640 noted that the minmax operator wasn't implemented, so after
some discussion about what it should do I added it to the setting
(using the operator features mentioned above).
&lt;/p&gt;&lt;p&gt;In RT #66624, the exception message coming back from
not finding a substring within a string was particularly misleading;
I adjusted .substr to provide a more useful error message.
&lt;/p&gt;&lt;p&gt;For RT #66928 .WHAT would not work on some subs like &amp;amp;infix:&amp;lt;+&amp;gt;;
this was because some of the builtin operators are still using
Parrot's MultiSub PMC instead of the Perl6MultiSub PMC, and those
didn't have a mapping to the type object.  Eventually all of the
operators will become Perl6MultiSub; in the meantime I set Parrot
MultiSub PMCs to map to the Multi() type objects in the same
manner that other Parrot PMC classes are mapped to Perl 6 types.
&lt;/p&gt;&lt;p&gt;RT #66818 noted a problem with unwanted flattening of %*VM
in a for statement; this was because the contents of %*VM were
incorrectly bound to the Hash directly instead of going through
a non-flattening reference (Perl6Scalar).  Eventually I expect
%*VM to be initialized in the setting, though, which will provide
a more robust and direct solution to this problem.
&lt;/p&gt;&lt;p&gt;In RT #66840 it was discovered that precedence errors in the
ternary operator would cause Rakudo to issue an error message
and exit completely, instead of throwing a catchable exception.
I tracked this down to PGE's OPTable handling of the ternary
operator, it was actually using &quot;exit&quot; when the error occurred
(probably because it came from before Parrot's exception model
was firmly in place).  This was changed to throw an exception
instead; the actual exception message needs a bit of work but
I expect that will come from the much larger PGE refactoring
that will be done as part of the Hague grant.
&lt;/p&gt;&lt;p&gt;Lastly, today I spent a good bit of time discussing Rakudo
and Parrot build/install issues with Allison, and I think we
have basic agreement on the changes we'll be making in order to
get those working.  Hopefully we can get all of that done
in time for the July release.
&lt;/p&gt;&lt;p&gt;So, that's my first Vienna.pm Rakudo day -- lots of little
pestering bug fixes, and a key bit of infrastructure to fully
enable writing the builtin operators in Perl 6.  Later this week I
plan to do a long-needed refactor of container handling in
Rakudo, and maybe to get a more complete implementation of BEGIN
blocks (which we massively cheat on at the moment).
&lt;/p&gt;&lt;p&gt;Thanks again to Vienna.pm for sponsoring this work.
&lt;/p&gt;&lt;p&gt;Pm
&lt;/p&gt;</description>
	<pubDate>Wed, 01 Jul 2009 04:08:20 +0000</pubDate>
</item>
<item>
	<title>Jonathan Worthington: Lots of little improvements</title>
	<guid>http://use.perl.org/~JonathanWorthington/journal/39196?from=rss</guid>
	<link>http://use.perl.org/~JonathanWorthington/journal/39196?from=rss</link>
	<description>&lt;p&gt;I'm back from a nice break in Italy and have been digging back in to Perl 6 stuff again. Today I've been doing a Vienna.pm-funded Rakudo day, and here's what I got up to.&lt;/p&gt;&lt;p&gt;First off, I went for a look through our RT queue. We now have over 400 tickets that are either new or open. While on the one hand that means we've a lot of work to do, it's also a sign that people, more and more, are playing with and exercising Rakudo. In just browsing through it, I found a bunch of things I could work on and hopefully resolve fairly easily during the day, and also another bunch of things that were already resolved. Just spotting the latter allowed me to mark 3 tickets resolved.&lt;/p&gt;&lt;p&gt;A couple of the things I worked on related to subtyping. Of note, the standard grammar accepted:&lt;/p&gt;&lt;p&gt;

&lt;code&gt;subset Foo of Int;&lt;br /&gt; &lt;/code&gt;

&lt;/p&gt;&lt;p&gt;Without requiring a where clause. Rakudo now also accepts this, and our parsing is a little closer to STD.pm too (we parse traits on subtypes, but we don't do anything with them just yet). Next, I got Rakudo to support a neater syntax for declaring anonymous subtypes in signatures. If you just want to match a specific value, you can write the value in the signature, and that's it. For example, here is yet another way to do factorial (a recursive version).&lt;/p&gt;&lt;p&gt;

&lt;code&gt;multi factorial(0) { 1 }&lt;br /&gt;
multi factorial(Int $n) { $n * factorial($n - 1) }&lt;br /&gt;
say factorial(5); # 120&lt;br /&gt; &lt;/code&gt;

&lt;/p&gt;&lt;p&gt;A signature :(0) is equivalent to :(Int $ where 0). This means that it will sort in the candidate list with Int. More generally, any literal value in where will get a nominal type based on the .WHAT of the value and have the value made into an anonymous subtype, so the signature :(&quot;tava&quot;) is just like :(Str $ where &quot;tava&quot;). I added some tests for all of this too.&lt;/p&gt;&lt;p&gt;Lyle++ had sent in a patch a while back for $*CWD and chdir. I took a look at these today. The $*CWD one looked pretty good, so I applied that with just a minor tweak. The chdir one needed some more attention and fixing up first, but I got that applied and extended the tests to better exercise it. Then I got both test files added to spectest.data. So now chdir and $*CWD are both functional. Here's some play with them in the REPL.&lt;/p&gt;&lt;p&gt;

&lt;code&gt;&amp;gt; my $fh = open(&quot;spectest.data&quot;, :r);&lt;br /&gt;
Unable to open filehandle from path 'spectest.data'&lt;br /&gt;
in Main (:1)&lt;br /&gt;
&amp;gt; say $*CWD;&lt;br /&gt;
C:\Consulting\parrot\trunk\languages\rakudo&lt;br /&gt;
&amp;gt; chdir &quot;t&quot;;&lt;br /&gt;
&amp;gt; say $*CWD;&lt;br /&gt;
C:\Consulting\parrot\trunk\languages\rakudo\t&lt;br /&gt;
&amp;gt; my $fh = open(&quot;spectest.data&quot;, :r);&lt;br /&gt;
&amp;gt;&lt;br /&gt; &lt;/code&gt;

&lt;/p&gt;&lt;p&gt;We had a couple of tickets relating to the interaction of //= and state variables. A little investigation, some discussion on #parrot and a fix later, I was able to unfudge tests and mark those resolved. A small inheritance bug was a similar story.&lt;/p&gt;&lt;p&gt;Finally, in preparation to improve type check failure error reporting and resolve at least one ticket in that area, I factored all type check error generation out to one routine, which we now call consistently. That means errors that previously missed out mentioning the expected and received types now do so, and the other issues I can fix - on some future Rakudo day - in one place, and everywhere that reports such errors will benefit.&lt;/p&gt;&lt;p&gt;In the course of the day, I also discovered a couple of other tickets that I had opened up to investigate at the start of the day were also already-fixed issues, so I made sure we had proper test coverage and got them closed up.&lt;/p&gt;&lt;p&gt;So, a pretty productive day. Thanks to Vienna.pm for funding!&lt;/p&gt;</description>
	<pubDate>Tue, 30 Jun 2009 21:09:56 +0000</pubDate>
</item>
<item>
	<title>Andrew Whitworth: Juggling Projects</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-5029372268238301131</guid>
	<link>http://wknight8111.blogspot.com/2009/06/juggling-projects.html</link>
	<description>Lot's of work has been going on in Parrot land post-YAPC. Lots of people are doing cool new work, and there has been a steady influx of interested new participants. Some people suggested that my &lt;a href=&quot;http://wknight8111.blogspot.com/search/label/Parrot4Newbies&quot;&gt;Parrot4Newbies&lt;/a&gt; posts recently have been bringing them in, but the reality is that there are lots of interested people already who are just looking for opportunities to get involved, and anybody can make those opportunities public.&lt;br /&gt;&lt;br /&gt;I have been blogging like a wild man this past week, and particle suggests I can lower the rate of Parrot4Newbies posts to give the community time to think of new ideas for it. I'm fine with that, I'll try to get a nice good post for it out again next week. As is my style, I have about half a dozen posts written, they just need some finishing touches before I publish them.&lt;br /&gt;&lt;br /&gt;During YAPC I was working on a &lt;a href=&quot;http://wknight8111.blogspot.com/2009/06/io-work-at-yapc.html&quot;&gt;new IO architecture&lt;/a&gt; where IO PMC types delegated non-subclassable attributes to a new Handle type. The idea was to make things like &lt;a href=&quot;https://trac.parrot.org/parrot/ticket/681&quot;&gt;FileHandle and Socket types subclassable&lt;/a&gt; from PIR, and just delegate the messy stuff to a non-subclassable type. Basically, it was a utilitarian solution that resolved the immediate need while not addressing the underlying problem of subclassing PMC types. Allison convinced me that the right way forward was not to write a hackaround that's specific to the IO system, but to &lt;a href=&quot;https://trac.parrot.org/parrot/ticket/789&quot;&gt;fix PMC subclassability entirely&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The real problem is that some PMC attributes are subclassable (PMC*, STRING*, INTVAL, FLOATVAL), and all other types are not. So when you create an object of a C type, only the subclassable attributes are accessable. If you try to access non-subclassable attributes, Parrot throws an exception. This behavior is obviously wrong, we shouldn't be allowed to even create a subclass of a type that's going to be unusable for what we want. Or, we should find a way to make all attribute types properly subclassable. The way to do this is to allow arbitrary C types to autobox into PMCs so that they can be stored in the ResizablePMCArray of the Object's attributes. Then, the GETATTR/SETATTR macros need to be taught how to box and unbox types at runtime. It's simultaneously a very hard and very easy problem to solve, and if anybody is interested in attacking it before I am ready myself, that would be awesome.&lt;br /&gt;&lt;br /&gt;So, I backed out all the changes concerning the subclassability issue from the IO work, and focused on other things. Right now I'm stalled on that because there are some issues involving the new Pipe code that Infinoid wrote not playing well with the old FileHandle code. Hopefully we can get that branch fixed and merged to trunk this week, and then the field is &lt;a href=&quot;http://wknight8111.blogspot.com/2009/05/path-to-aio-on-parrot.html&quot;&gt;set for AIO&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Austin Hastings put his &lt;a href=&quot;http://code.google.com/p/close/&quot;&gt;Close compiler&lt;/a&gt; source code up onto Google Code, and I've been eagerly reading through it. Haven't had a chance to play with it yet, but it looks awesome: like the replacement for PIR that we've always wanted. A few changes and improvements need to be made, but it's awesome already.&lt;br /&gt;&lt;br /&gt;A few days ago Coke started a new branch to begin the conversion of &lt;a href=&quot;http://wknight8111.blogspot.com/2009/05/contexts-into-pmcs-plan.html&quot;&gt;Contexts into a new PMC type&lt;/a&gt;. This will make them properly garbage collectable and fix all the leaky memory that's associated with Contexts right now. At least, that's the hope. I started playing with this branch yesterday, doing some of the conversions, and I have to say that it is &lt;span&gt;a lot&lt;/span&gt; of work. Contexts, simply put, are fundamental to the operations of Parrot. Also, interacting with them doesn't happen through a particularly clean or well-encapsulated API. In hindsight we probably should have worked to encapsulate it better first, but we've got an open branch right now and might as well get to work on it. Hopefully any lessones that we're going to learn the hard way can be learned quickly. I have some hopes that this branch may succeed, but I'm also planning backup steps in case it doesn't&lt;br /&gt;&lt;br /&gt;I've also been looking closely at the GC now, and have even put together a little bit of test code locally for implementing a &quot;&lt;a href=&quot;http://wknight8111.blogspot.com/2009/06/concurrent-garbage-collection.html&quot;&gt;very concurrent&lt;/a&gt;&quot; GC core based on a paper cotto sent me a while back. I probably won't have time to break ground on this before 1.5, so if anybody is interested in helping with the GC please let me know and we can start putting together a game plan now.&lt;br /&gt;&lt;br /&gt;I've also seen some interest in the threading system recently. Infinoid found some problems with it while trying to write tests for the new Pipe types, and we've had some new hackers interested in working on the threading system to support the concurrency primitives in Rakudo, so maybe we will get some good work done on that system in the near future.&lt;br /&gt;&lt;br /&gt;So that's a brief glimpse of some of the things that are going on in Parrot this week, I would love to hear about some other projects that people are working on too (especially since we didn't have #parrotsketch last week to share).&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-5029372268238301131?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Sun, 28 Jun 2009 12:34:29 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>partcl: Improved interactive mode</title>
	<guid>tag:blogger.com,1999:blog-134339605383818351.post-279784817084305129</guid>
	<link>http://partcl.blogspot.com/2009/06/improved-interactive-mode.html</link>
	<description>In real tcl, you can use interactive mode to run commands like a shell; There's now just enough logic in partcl to do this as well.&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Most of the infrastructure for this was already in place; just added a minimal version of&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;[file executable] - only checks executable status for other, not group or owner.&lt;/li&gt;&lt;li&gt;[file split] - isn't windows-friendly, nor does it deal with potentially confusing chars like '~'&lt;/li&gt;&lt;li&gt;[exec] - ignores all of the shell metachars and just invokes parrot's spawnw opcode as is.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;$ ~/bird/bin/parrot tcl.pbc&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;% ls src&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;binary.c  binary.h  binary.o  class  grammar  macros.pir  mathops.pir  ops  pmc  returncodes.pasm  tclsh.pir&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;% rm src/binary.o&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;% ls src&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;binary.c  binary.h  class  grammar  macros.pir  mathops.pir  ops  pmc  returncodes.pasm  tclsh.pir&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Most of the heavy lifting is done by init.tcl from the standard library.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/134339605383818351-279784817084305129?l=partcl.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Sat, 27 Jun 2009 10:01:08 +0000</pubDate>
	<author>noreply@blogger.com (Coke)</author>
</item>
<item>
	<title>Andrew Whitworth: L1: Let's Review FAQ</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-5885986333852282731</guid>
	<link>http://wknight8111.blogspot.com/2009/06/l1-lets-review-faq.html</link>
	<description>Buzz has been steadily increasing about this whole L1 idea, especially after some initial information about it was loaded onto the &lt;a href=&quot;https://trac.parrot.org/parrot/wiki/L1Recap&quot;&gt;Parrot website&lt;/a&gt;. We had &lt;a href=&quot;http://irclog.perlgeek.de/parrot/2009-06-25#i_1266137&quot;&gt;a big conversation&lt;/a&gt; last evening on #parrot, and I've received a few emails and blog comments about it as well. I would like to go through and try to address some of the common questions and concerns that I've been hearing.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Question 1: Why Is L1 Better Then PASM?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Another common rephrasing of the question would be &quot;Why don't we just extend PASM to do what we want L1 to do?&quot;. I would turn the tables and ask &quot;What is so good about PASM that we can't even conceive of a replacement?&quot;. Popular lore has it that Thomas Edison churned through 10,000 failed designs before he came up with the working lightbulb. We should not be so foolhardy as to think that we can't have made a fundamental mistake with PASM.&lt;br /&gt;&lt;br /&gt;The problem with PASM is that it's the wrong level of abstraction. Frankly, it's too high level and is focused more on ease of use by the programmer then ease of execution by the VM. Don't believe me? I suggest you look at all the hundreds of files that are currently written in PIR: Main programs for HLLs, runtime libraries in HLLs, NCI wrappers for libraries, the entire test suite, etc. If PIR wasn't so great for people to be writing, it would long ago have been identified as a pain point and replaced with something better. Writing PIR is currently a required part of building an HLL compiler, and very few people are complaining about that, or complaining enough to have it changed! This in and of itself is proof that PIR (which is just PASM in disguise) is more suited for use by humans then by the machine.&lt;br /&gt;&lt;br /&gt;And it's not like we don't have the tools or the skills necessary to write a replacement language compiler. In Parrot world you can't shake a stick without hitting somebody who has written one. If PIR was too low-level, we would have a compiler for a replacement language prototyped in less then 5 hours. Seriously.&lt;br /&gt;&lt;br /&gt;L1 is better then PASM/PIR in this case because we can specially design it from the ground up with the purpose that it should be easy and fast for the machine to execute. We can take lots of steps to make it easy and fast to execute, a lot of steps that the designers of PASM didn't take because they didn't know. Back when Parrot was first being designed, how could the developers have know about the amazing performance of JavaScript engines such as SquirrelFish or TraceMonkey that have come out recently? The answer is that they couldn't have known what we know now about VM design.&lt;br /&gt;&lt;br /&gt;We can focus on execution performance to the exclusion of human readability because people shouldn't be writing it directly. Let me repeat: we have the tools, the expertise, and the experience as a community to write a higher-level language compiler to do the hard work for us. Regardless of what intermediate language we end up with on Parrot, I don't expect humans will have to be manually writing any of it.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Question 2: Won't another layer make things slower?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here's what we have right now:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://2.bp.blogspot.com/_ztFc4AiNk_k/SkTVn7-wNnI/AAAAAAAAAIg/qkqpX8J0_M4/s1600-h/flow1.png&quot;&gt;&lt;img src=&quot;http://2.bp.blogspot.com/_ztFc4AiNk_k/SkTVn7-wNnI/AAAAAAAAAIg/qkqpX8J0_M4/s400/flow1.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5351637139315504754&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;People assume that I'm planning about just adding another compiler step and then another target interchange format for L1 at the end of this list. Not so. PCT has the potential (though it hasn't been implemented yet) to output code in any format. Why don't we do this instead:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://4.bp.blogspot.com/_ztFc4AiNk_k/SkTVzeb4u1I/AAAAAAAAAIo/_rJVw69YH6s/s1600-h/flow2.png&quot;&gt;&lt;img src=&quot;http://4.bp.blogspot.com/_ztFc4AiNk_k/SkTVzeb4u1I/AAAAAAAAAIo/_rJVw69YH6s/s400/flow2.png&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5351637337543064402&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And if you see that image and ask &quot;Why do we need PIR/PASM in this case at all?&quot;, now you're thinking along the right lines. Imagine a world where we never ever need to write anything in PIR or PASM by hand again. Now imagine that same world where our tools like PCT don't output PIR as an intermediate form but, unbeknownst to you the programmer, directly outputs executable bytecode like L1. In such a world as we are imagining here, do we need to keep PIR or PASM around? Do they serve any purpose? Maybe as a very small bootstrapping layer to build PCT in the first place, in which case there is a lot of bloat that we could throw away, and we would only need a PIR compiler for the miniparrot build step and wouldn't need to build IMCC into libparrot or the Parrot executable.&lt;br /&gt;&lt;br /&gt;It's not that we're adding a new layer of complexity, we're starting to realize that PASM &lt;span&gt;is the wrong level of abstraction&lt;/span&gt; for our needs in Parrot, so we are replacing it wholesale with L1.&lt;br /&gt;&lt;br /&gt;Now obviously there are intermediate steps betwen here and there where things are going to be slower and more complicated: We will need to use PIR as an intermediate step until PCT is capable of outputting L1 directly. But let me ask this: Do we want PCT to output something that executes slowly, or something that executes more quickly, when all the necessary work is done?&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Question 3: L1 is going to be lower-level then programmers like&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;No question that PASM/PIR are far more friendly to the programmer then any conception of L1 is going to be. PIR and PASM are supposed to be sufficiently low-level that people don't want to program in them, but at the same time they aren't enough of a pain point that we made a replacement language into a priority. If L1 is such a pain point for programmers as I think it will be, we will write a compiler for a better language so we never need to write L1 directly.&lt;br /&gt;&lt;br /&gt;We already have NQP which is a thin Perl6-like language that works well with Parrot's execution model. We also have Close in development which is going to be a C-like language that does almost the same thing. Assuming both these two languages have all the capabilities, why wouldn't we use these to do all our coding and never use PIR, PASM, or L1 again? Remember, I keep saying this: We have PCT, one of the most powerful compiler construction tools ever conceived. We should be using that to make languages that insulate us from whatever intermediate language Parrot uses. We should be reaching a point where we never ever ever have to write or even read another line of PIR or PASM ever again. Ever.&lt;br /&gt;&lt;br /&gt;And when we do reach that point where we are so completely insulated from it, it won't matter to the programmer what intermediate language Parrot uses, because we won't be seeing it.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Question 4: A lot of development effort is going to be wasted&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is a good concern, that a lot of things people have spent a lot of effort to develop are basically going to become obsolete. But I have to also ask the question: &quot;Why don't we all just write in Fortran, considering that so many people have spent so much energy on that compiler?&quot;. The effort isn't all wasted, we did learn a lot of important lessons about Parrot and the right way forward, and we've used all the things we've developed to bootstrap the creation of better tools and better ideas.&lt;br /&gt;&lt;br /&gt;PIR and PASM got us to a place where we have PCT and several HLLs in active development. That doesn't mean we need to be trapped underneath these languages forever. We use them as a bootstrapping layer to build better tools, and use those instead.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Question 5: How does L1 compare to C?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Alternatively, why are we rewriting all our C code in L1? Let me ask what is the difference between C code and Assembly code? Everything you can do in assembly you can do in C. You will probably need to call a library to do some things, but if you can do it in ASM, you can do it in C. A compiler converts both down to the same machine code that is executed by the same hardware. You can say that one is &quot;faster&quot; then the other, because your average compiler isn't always smart enough to generate &quot;good&quot; machine code, but given the proper optimizations, there should be no speed difference. In other words, given the exact same machine code, it doesnt matter to the processor whether that code was written by a human in assembly and assembled to machine code, or written in C and compiled into machine code.&lt;br /&gt;&lt;br /&gt;All that information out of the way, let's conceive of L1 as being a portable assembly language with all the same exact capabilities as C. Given the same exact capabilities and a good compiler (for our purposes, a JIT engine is just a &quot;compiler&quot;), both sets will be able to do the same stuff, and can be converted down into the same machine code for execution by the hardware at the same speed.&lt;br /&gt;&lt;br /&gt;So given that the two are equivalent, why have L1 at all, and why not keep everything in C? The difference is semantics and algorithmic complexity. It's a difference of where the primary control flow happens. Right now we have a register-based system (PIR) running on top of a stack-based system (C). Switching between the two is slow, and unfortunately we switch pretty often because neither one supports all the semantics we need. L1 gives us an opportunity to access the low-level details that C has (calling native functions, accessing memory pointers, etc) but to use the high-level semantics that PIR requires (register-based operation, etc). We gain the ability to keep control flow executing in only a single context, and to eliminate all the algorthmic complexity of switching between semantic contexts.&lt;br /&gt;&lt;br /&gt;An L1 dispatcher handles all control flow, able to call C functions directly as needed and redirect to offsets in bytecode. It can handle function calls, exception throwing, vtable overrides, and other CPS magic without having to recurse down the C system stack. And we gain all sorts of potential for optimizations because we have a unified environment like this.&lt;br /&gt;&lt;br /&gt;In short, L1 allows us to design a language with the power and flexibility of C and the semantics of PIR, which in turn will let us reduce algorithmic complexity at the global level.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Question 6: Why not just fix PASM/PIR?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We can't really fix PASM in place because we have conflicting needs: We simultaneously need to extend it in order to match all the power of C, and shrink it to make it easier to analyze, optimize and JIT compile it. What we would end up doing is growing PASM to include what I now think of as being &quot;L1&quot;, and then we would need to shrink away most of what we now think of as being &quot;PASM&quot;, and we would be essentially left with only L1.&lt;br /&gt;&lt;br /&gt;Keep in mind that this is not necessarily a bad development path for us to follow, but the end result is L1, not what we currently know as PASM. We can start by creating an op library for the new L1 ops, start transitioning everything over to use them, and then start deprecating away our old PIR ops (or rewriting them in terms of L1). What remains at the end of this is the small selection of L1 ops and various HLLs (I'm including PIR/PASM here as an HLL) which compile to L1, and L1 is executed directly by Parrot.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Question 7: What does L1 Buy Us?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;L1 is going to give us a number of benefits:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Decreased algorithmic complexity, because we're not having to shuffle data between the PIR registers and the C system stack&lt;/li&gt;&lt;li&gt;Improved, easier, faster JIT. A &quot;fixed&quot; JIT&lt;/li&gt;&lt;li&gt;Potential to plug more easily into existing JIT engines (LLVM and libJIT)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Potential for trace-based JIT, where we trace out &quot;hot spots&quot; in the code and JIT them with type-specific information to speed up dispatch.&lt;/li&gt;&lt;li&gt;Potential for high-level optimizations including subroutine inlining, dead code elimination, etc&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Potential for context threading, where we try to align the VM with the control flow of the underlying machine, to maximize branch prediction and caching at the hardware level&lt;/li&gt;&lt;li&gt;Potential for improved GC and resource allocation performance because it will be easier to analyze where memory is allocated and where it falls out of scope. This includes &quot;escape analysis&quot;, where we determine the lifespan of a reference and are able to deallocate it more quickly and efficiently.&lt;/li&gt;&lt;li&gt;Potential for easier profiling, because everything will be in L1, we only need one tool to analyze L1 control flow (which we can share with the trace-based JIT and the GC escape analyzer)&lt;/li&gt;&lt;/ol&gt;It's quite an impressive list of possibilities, but I will stress that L1 doesn't get us these things for free: It does however give us the &lt;span&gt;potential&lt;/span&gt; to do these things, a potential that we don't have right now with C/PIR.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-5885986333852282731?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Fri, 26 Jun 2009 16:22:07 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>Andrew Whitworth: Parrot4Newbies: PMCs</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-775038861357732174</guid>
	<link>http://wknight8111.blogspot.com/2009/06/parrot4newbies-pmcs.html</link>
	<description>This is the third installment in my series of &lt;a href=&quot;http://wknight8111.blogspot.com/search/label/Parrot4Newbies&quot;&gt;&lt;span&gt;Parrot4Newbies&lt;/span&gt;&lt;/a&gt;, and today I am going to talk about PMCs. As a general reminder, if you're interested in any of the topics I've discussed so far, make sure to keep track of the comments. I'm going to post more tasks on each topic in the comments, and I hope other people will post new ideas there as well.&lt;br /&gt;&lt;br /&gt;I've talked about &lt;a href=&quot;http://wknight8111.blogspot.com/2009/06/parrot4newbies-documentation.html&quot;&gt;documentation&lt;/a&gt; and &lt;a href=&quot;http://wknight8111.blogspot.com/2009/06/parrot4newbies-test-suite.html&quot;&gt;the test suite&lt;/a&gt; as great places to get involved in Parrot quickly. However, neither of these involve a lot of code, especially not a lot of C code which many people know very well. If you know C pretty well and want to get right into Parrot's guts, I can't think of any place better to get started then the PMC system. PMC types are defined in /src/pmc/*.pmc files. Parrot's core API for dealing with PMCs is located in src/pmc.c, and our implementation of objects (which are based on the Object PMC) is located in src/oo.c. The current compiler tool for converting PMCs from their strange C-like language into pure C is located in lib/Parrot/Pmc2c/*.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Refactor Messy Code&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Several of the core PMC types are very old and in need of a major cleanup. Some things need to be refactored for readability and to maximize code reuse. Other things, especially critical core types, need a little bit of optimization lovin'.  Some good candidates here for general cleanup are Integer, Float and String PMCs, which are used frequently to autobox INTVAL, FLOATVAL, and STRING* core primitive types. Also, some of the newer types such as Socket and Sockaddr could use some tweaking to become more mature and stable.&lt;br /&gt;&lt;br /&gt;Certain types that deal with the underlying system, such as OS, Env, and File, always need tweaking, extending, and testing to provide all the functionality that users are going to expect in order to examine and manipulate the underlying machine in a consistent way.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Verify the Spec&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The various design documents in docs/pdds/* refer to some of the Core PMC types and discuss some of the important components of each. Of specific interest are PDDs 15, 17, 20, 21, 22, 23, 24, and 28. Also, there are several design documents still in draft in docs/pdds/draft/*. Take a look through some of these documents to see how the drafts compare to the current implementations. Feel free to make one conform more to the other, and submit patches for both the PMC types &lt;span&gt;and&lt;/span&gt; the spec documents to update them. Of particular interest here are PDDs 8 and 14.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Rename API Functions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is a task that actually applies to multiple subsystems, not just the PMC system. There is a page on the &lt;a href=&quot;https://trac.parrot.org/parrot/wiki/APIFuncRenaming&quot;&gt;Parrot Wiki&lt;/a&gt; that we're editing right now to provide more details about other projects in this area.&lt;br /&gt;&lt;br /&gt;Basically, functions in src/pmc.c need to all be renamed to Parrot_pmc_*. We also need to evaluate which functions represent the public-facing PMC API (which should all have the PARROT_EXPORT directive), and which items should not be part of that API. So the function pmc_new, should be renamed to Parrot_pmc_new.&lt;br /&gt;&lt;br /&gt;Renaming just one function at a time (which would be ideal in terms of small, easy-to-review patches) should be a trivial matter for a coder who's any good with Perl5 (or even sed, if you're into that kind of stuff).&lt;br /&gt;&lt;br /&gt;Also, the file src/pmc.c should probably be moved to src/pmc/api.c, and broken into subfiles depending on functionality. Check out the page on the wiki for details about a move like this.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Conclusion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;PMCs are Parrot's basic aggregate structure, and the various core PMC types encapsulate a large amount of Parrot's functionality. Unfortunately, many of the central PMCs and PMC mechanisms are old and in need of some tender loving care from a decent coder. It's a system that's easy to get involved in, and there are some real benefits to the project that won't cost more then a small amount of time with the right tools and right knowhow.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-775038861357732174?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Fri, 26 Jun 2009 10:24:28 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>Andrew Whitworth: Concurrent Garbage Collection</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-5452027422077109460</guid>
	<link>http://wknight8111.blogspot.com/2009/06/concurrent-garbage-collection.html</link>
	<description>I mentioned in passing a few posts ago that cotto sent me a link to a &lt;a href=&quot;http://doc.cat-v.org/inferno/concurrent_gc/&quot;&gt;paper about a concurrent garbage collector VCGC&lt;/a&gt;. eternaleye sent me &lt;a href=&quot;http://cs.nju.edu.cn/gchen/paper/ipdps2002/DATA/13_161.PDF&quot;&gt;another paper&lt;/a&gt; that proposed improvements to the VCGC algorithm, while following the same general concept. The second one is called MCGC. I read over those two quite enthusiastically, and then moved on to read &lt;a href=&quot;http://research.sun.com/jtech/pubs/04-g1-paper-ismm.pdf&quot;&gt;a paper about G1&lt;/a&gt;, the &lt;a href=&quot;http://java.sun.com/javaone/sf/2008/articles/rockstar_tonyprintezis.jsp&quot;&gt;new Java VM garbage collector&lt;/a&gt;. There are some similarities between the two approaches, but plenty of differences too. In the end I think a collector somewhere in this family is going to be the GC of choice for Parrot (at least, for birds built on multithreaded systems). Of course, it may be just one of a &lt;a href=&quot;http://blogs.sun.com/jonthecollector/entry/our_collectors&quot;&gt;possibly large stable of collectors&lt;/a&gt;, each suited for different needs.&lt;br /&gt;&lt;br /&gt;The first paper introduces the &quot;Very Concurrent GC&quot; (VCGC) which is able to use a multithreaded approach without the need for fine-grained thread synchronization. &quot;Balderdash!&quot; I can hear you saying, but have faith: I've read the paper and the algorithm is so beautiful in it's simplicity that I can't believe I didn't think of it first. And it's very plausible. Here's the gist of it: Each memory allocation round has a color. We allocate memory with color x and operate like normal until we hit a synchronization point. At the synchronization point, we increase x++. All memory allocated before the synchronization point now has color x-1, and all memory allocated thereafter will have a color of x. We continue executing again until the next synchronization point, and then we bump x up again. Memory allocated in the first window now have color x-2, Memory allocated in the second window now have color x-1, etc. All memory chunks with color x-2 are swept and reclaimed to the system.&lt;br /&gt;&lt;br /&gt;In this system, memory blocks implicitly change color because we change what the color numbers mean at each synchronization point. Without proactive marking, the blocks &quot;fall off&quot; the end of the window and get collected by a collection thread. The collection thread has no other job then to iterate over the allocation space and free all memory with color x-2. We call this thread the &quot;Sweeper&quot;. Saving chunks from certain doom is the job of the &quot;Marker&quot;, a thread that is the only thread in the system capable of changing the color of a block. The Marker runs a normal GC mark algorithm, starting at the root set and bumping all memory that's reachable to color x. The point when both the Marker thread and the Sweeper thread have completed their current run is called the synchronization point, which is when we increment x (called the &quot;epoch&quot;) and restart both threads to run again. It's simple and low-overhead because it doesn't require any moving or compacting, and it only has to twiddle a handful of bits to make everything work. Also, it appears to scale well to multicore systems and multithreaded programs.&lt;br /&gt;&lt;br /&gt;G1 is a very interesting collector which I find is conceptually not entirely dissimilar from VCGC, although I'm probably minimizing the differences in my own mind. It seems to be based on more of a lazy approach, picking low-hanging fruit to reduce the need for complete end-to-end GC runs and making allocation more efficient. G1 divides the heap into regions, and focuses on regions where there are the fewest active blocks. In the region, G1 frees any garbage it finds and copies any live items to a &quot;dense prefix&quot; somewhere else. This allows the entire region to be used by the allocator for easy linear allocations.&lt;br /&gt;&lt;br /&gt;G1 appears to be very heterogenous in that memory of all sizes is allocated from a single pool. In that sense, a G1-like collector may be suitable for use with our STRING system, which is badly in need of performance tuning. Something like VCGC would probably be more useful for the common case of homogenous header pools, like our PMC pools and our sized pools, which facilitate very rapid array indexing through the pool.&lt;br /&gt;&lt;br /&gt;VCGC and variants suffer from a few worst-case scenarios, such as situations where garbage is very long-lived (thus wasting time where the sweeper repeatedly checks things that are not garbage) and situations where garbage is very short-lived (where blocks become garbage quickly, and need to wait for two epochs to be swept, which increases memory consumption). The benefit of course is simplicity in the algorithm. Adding complexity, such as in MCGC, can reduce these problems.&lt;br /&gt;&lt;br /&gt;My plan in the near future, probably after the &lt;a href=&quot;http://wknight8111.blogspot.com/2009/05/asynchronous-io-in-parrot.html&quot;&gt;AIO project&lt;/a&gt;, is to start prototyping a new concurrent collector core modeled on VCGC. I will use a simple and direct implementation of it initially, no bells or whistles or fancy-schmance optimizations. Once we have a basic concurrent core installed and working properly, it will be easier to add these kinds of optimizations in an incremental fashion.&lt;br /&gt;&lt;br /&gt;And I have &lt;span&gt;plenty&lt;/span&gt; of potential optimizations in mind, including some simple tweaks to the basic algorithm that I think will add some time-saving generational semantics. If you have some ideas too, I would love to hear them. I may create a planning page on the wiki soon to start putting ideas together for this.&lt;br /&gt;&lt;br /&gt;What's really most important at this point, and &lt;a href=&quot;http://www.pmichaud.com/&quot;&gt;pmichaud&lt;/a&gt; mentioned this several times at &lt;a href=&quot;http://yapc10.org/yn2009/wiki?node=Parrot%20Virtual%20Machine%20Workshop%202009&quot;&gt;YAPC::NA&lt;/a&gt;, was just getting a second core working. We don't even care what core it is, we just need a second one to prove that our architecture is pluggable and work out any kinks in &lt;a href=&quot;http://wknight8111.blogspot.com/2009/05/parrot-gc-refactor-work.html&quot;&gt;the API&lt;/a&gt;. Once we have a second core in place, it will be that much easier to add a third and a fourth, etc. With all this in mind, we really don't need to be swinging for the fences right now, just looking to add something quick that maybe offers some small performance benefit over the current system.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-5452027422077109460?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Thu, 25 Jun 2009 13:00:30 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>Andrew Whitworth: Parrot4Newbies: Test Suite</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-8339473291599094777</guid>
	<link>http://wknight8111.blogspot.com/2009/06/parrot4newbies-test-suite.html</link>
	<description>The second post in my &lt;span&gt;Parrot4Newbies&lt;/span&gt; series, today I am going to talk about Parrot's test suite. This is another great way for the average new user to get a deeper understanding about Parrot's capabilities because the test suite is, in theory, a comprehensive exercise of Parrot.&lt;br /&gt;&lt;br /&gt;Parrot's test suite has historically been written in Perl 5, with a series of modules derived from Test::More and Test::Builder and others with some custom methods to handle creating, compiling, and executing PIR and PASM code. Now don't get me wrong, we do like Perl 5. However, we want to get rid of as much Perl 5 from the Parrot repository as we possibly can. For one thing we want to reduce the number of dependencies. For another, we have to look forward to a future where Perl 5 is actually running on Parrot, which would create a very fun bootstrapping problem. Maybe that's just wishful thinking on my part, but it's a fun goal to have in mind (and a fun project for an adventurous team of new developers to attempt!)&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Run Tests, Report Problems&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The fastest way to get started with tests is to get the current version of Parrot from SVN, and run this little script:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;perl Configure.pl [args]&lt;br /&gt;make&lt;br /&gt;make test&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The &quot;test&quot; target runs the core functionality tests, the documentation tests, and the coding standards tests, plus a few others. This can take quite a long time to execute, so running the &quot;make coretest&quot; is probably more attractive for most coders. The &quot;coretest&quot; target only runs tests of the core functionality.&lt;br /&gt;&lt;br /&gt;If you're looking to really optimize and run tests quickly, you will want this incantation:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;make -j9 [testname] TEST_JOBS=5&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Where [testname] can be &quot;test&quot;, &quot;coretest&quot;, &quot;fulltest&quot;, &quot;distro_tests&quot;, or any of the other test targets. This particular command executes testing in 5 threads in parallel, which can go very very quickly on some systems.&lt;br /&gt;&lt;br /&gt;When you run tests and see failures, you can either submit a bug report to trac, or you can be ambitious by fixing it and submitting a patch. Patches are always very nice to have, but even reports of failures (including information about your system and build options) are very good too.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Upload Smolder Reports&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The smolder service maintains an online log of test progress, so we can see what tests are doing on each platform. If you're running tests regularly, please consider &quot;make smolder_tests&quot;. This will run through the test suite and upload the results to the smolder server so our developers can keep track of them.&lt;br /&gt;&lt;br /&gt;Even better would be to set up a &lt;a href=&quot;https://trac.parrot.org/parrot/wiki/SmokingParrot&quot;&gt;smolder slave bot&lt;/a&gt;. Set up a script on your system to run this sequence at intervals:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;cd $HOME &amp;amp;&amp;amp;&lt;br /&gt;svn co https://svn.parrot.org/parrot/trunk parrot-smoke &amp;amp;&amp;amp;&lt;br /&gt;cd parrot-smoke &amp;amp;&amp;amp;&lt;br /&gt;perl Configure.pl &amp;amp;&amp;amp;&lt;br /&gt;make &amp;amp;&amp;amp;&lt;br /&gt;make smoke&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This is &lt;span&gt;especially important&lt;/span&gt; if you're on a rare system (something that isn't x86+Windows, x86+Linux, or x86+Darwin). We can never have enough reports from rare systems.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Convert Tests to PIR&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Many of our tests are written in old-style PASM, and many of them are still managed by Perl 5 scripts. We need to rewrite all these test files to use pure PIR instead. Here's an example of a Perl 5 test:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;use strict;&lt;br /&gt;use warnings;&lt;br /&gt;use Test::More&lt;br /&gt;use Parrot::Test tests &gt; 1;&lt;br /&gt;pasm_output_is( &amp;lt;&amp;lt;'CODE', &amp;lt;&amp;lt;OUTPUT, &quot;gt_ic_i_ic&quot; );&lt;br /&gt;     set I0, 10&lt;br /&gt;     gt 11, I0, ok1&lt;br /&gt;     print &quot;nok gt\n&quot;&lt;br /&gt;ok1:&lt;br /&gt;     print &quot;ok 1\n&quot;&lt;br /&gt;     gt 9, I0, nok1&lt;br /&gt;     print &quot;ok 2\n&quot;&lt;br /&gt;     branch ok2&lt;br /&gt;nok1:&lt;br /&gt;     print &quot;nok gt 2\n&quot;&lt;br /&gt;ok2:&lt;br /&gt;     end&lt;br /&gt;CODE&lt;br /&gt;ok 1&lt;br /&gt;ok 2&lt;br /&gt;OUTPUT&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;And here is that same test rewritten in PIR:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;.sub main :main&lt;br /&gt;plan(2)&lt;br /&gt;gt_ic_i_ic_1()&lt;br /&gt;gt_ic_i_ic_2()&lt;br /&gt;.end&lt;br /&gt;&lt;br /&gt;.sub gt_ic_i_ic_1&lt;br /&gt;I0 = 10&lt;br /&gt;if 11 &gt; $I0 goto ok_1&lt;br /&gt;ok(0, &quot;gt_ic_i_ic1&quot;)&lt;br /&gt;goto end_1&lt;br /&gt;ok_1:&lt;br /&gt;ok(1, &quot;gt_ic_i_ic1&quot;)&lt;br /&gt;.return()&lt;br /&gt;.end&lt;br /&gt;&lt;br /&gt;.sub gt_ic_i_ic_2&lt;br /&gt;$I0 = 10&lt;br /&gt;if 9 &gt; $I0 goto ok_2&lt;br /&gt;ok(1, &quot;gt_ic_i_ic1&quot;)&lt;br /&gt;goto end_2&lt;br /&gt;ok_2:&lt;br /&gt;ok(0, &quot;gt_ic_i_ic2&quot;)&lt;br /&gt;.return()&lt;br /&gt;.end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;So the transformation isn't entirely straight forward but the end result is pure PIR, not a hard-to-read mixture of PASM and Perl 5. Notice that I am not line-for-line translating the PASM into PIR, I rearrange it a lot to make it more readable. The end result, the features being tested, are absolutely the same.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;PMC Testing&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;As the policy stands right now, every file in src/pmc/ should have an associated file in t/pmc/. There is actually a test to verify that we have all these necessary tests! Just having these test files isn't enough, we need to make sure the tests are actually giving the PMCs a good workout. Look through the various tests and make sure each PMC is well tested. Some PMCs such as Integer implement many VTABLEs, and we want at least one test to exercise each of them. Writing tests like this helps not only to figure out what all the core PMC types do, but you're also forced to trace through some code to figure out where the various VTABLEs are called from so you can figure out how to test them.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Conclusion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The test suite is a key part of the Parrot development process. It helps us to find small regressions and bug earlier so they don't grow and fester into larger bugs later. The more comprehensive our test suite is, the more comfortable we can be making Parrot releases because we know that HLLs and other users of Parrot that use the features we test for will work as expected. It's also a great way for new developers to get involved and start getting an idea about the capabilities, current state, and limitations of Parrot. Once you see for yourself the areas where Parrot needs some work, you'll be more able to start making the necessary fixes yourself.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-8339473291599094777?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Thu, 25 Jun 2009 09:07:42 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>Jeff Horwitz: Lightning Talk Slides</title>
	<guid>http://www.smashing.org/56 at http://www.smashing.org/jeff</guid>
	<link>http://www.smashing.org/jeff/node/56</link>
	<description>&lt;p&gt;I've already had requests for slides from my &quot;LOLCAT History of Perl 6 and Parrot&quot; lightning talk.  The slides don't really have any meaning without the narration, so I'm going to make a video slideshow and post it here and on the YAPC site.  Stay tuned.&lt;/p&gt;</description>
	<pubDate>Wed, 24 Jun 2009 19:10:35 +0000</pubDate>
</item>
<item>
	<title>Bernhard Schmalhofer: Basic OO-features in Pipp</title>
	<guid>http://use.perl.org/~Bernhard/journal/39168?from=rss</guid>
	<link>http://use.perl.org/~Bernhard/journal/39168?from=rss</link>
	<description>&lt;p&gt;
When starting on the ReflectionExtension class for Pipp, I got reminded that some very basic OO-features were not working yet. The good think is that I can all that stuff from Rakudo. So simple inheritance and reading member of class instances are working now.
&lt;/p&gt;&lt;p&gt;
I also simplified my Test.php. The current test number is now tracked in a global variable. Before that change, the test number had to be passed in from the test script.
&lt;/p&gt;</description>
	<pubDate>Wed, 24 Jun 2009 13:35:34 +0000</pubDate>
</item>
<item>
	<title>Andrew Whitworth: Parrot4Newbies: Documentation</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-3318981477990437481</guid>
	<link>http://wknight8111.blogspot.com/2009/06/parrot4newbies-documentation.html</link>
	<description>In response to some requests I received and some signs of interest that I saw at YAPC, I decided to start a little series of posts that I am going to call &lt;span&gt;Parrot4Newbies&lt;/span&gt;. The goal of these posts are to take a look at some particular subsystems and projects in Parrot-land, describe what kinds of jobs and work need to be done, and break down these tasks into small steps that new users can follow in order to become acclimatized and familiarized to the Parrot development process. I will be publishing these posts pretty frequently, in addition to my &quot;normal&quot; posts which I try to put out at least 5x per week, so the volume here may be getting pretty heavy. I will be using the &quot;Parrot4Newbies&quot; tag on these posts, so you can filter them if you want.&lt;br /&gt;&lt;br /&gt;The first area where Parrot needs help, which is actually a common need of most open source software projects, is &lt;span&gt;documentation&lt;/span&gt;. Writing and improving documentation is a great way to get familiarized with the codebase for people new to Parrot internals. There are actually several components to our documentation, all of which need help.&lt;br /&gt;&lt;br /&gt;There are two good ways to help: (1), &lt;a href=&quot;https://trac.parrot.org/parrot/newticket&quot;&gt;open a bug report&lt;/a&gt; (requires a username) when you find a problem that you would like somebody else to fix. (2) Even better is to fix the problem yourself and create a bug report with an attached patch.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Project Documentation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We have a lot of documentation in the repository in the folders docs/. However, our documentation is far from comprehensive. Find files that look incomplete, out-of-date, or just plain confusing and misleading, and fix them up.&lt;br /&gt;&lt;br /&gt;Our design documents in docs/pdds/ are the documentation that describes what Parrot is and how it is implemented. Read through these to get a good understanding of Parrot, and look for places that are incomplete, not true to reality (which may mean the code is wrong &lt;span&gt;or the specs are wrong&lt;/span&gt;), or misleading.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Parrot Book&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We have a book at docs/book/ that needs work. We have a first edition being published soon, but it needs a lot of work so we can put out a second edition after Parrot 2.0 is released. Read over the book and find things like core topics that aren't covered (or aren't covered well), typos, out-of-date errors, etc.&lt;br /&gt;&lt;br /&gt;When you see code examples, try them and make sure they work too! Don't just trust our word for it make sure it does what it says it does!&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Examples and Tutorials&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We have a large amount of examples in examples/, and a PIR tutorial in examples/tutorial/ that need lots of help. Read through the examples, try them out locally to see if they work and how, and clean them up a little. Our tutorials especially are incomplete and don't cover all the topics that a new user needs to know. Feel free to write new tutorial pages entirely if a particular topic isn't well covered already.&lt;br /&gt;&lt;span&gt;&lt;br /&gt;File- and Function-Level Documentation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;All our .c files contain POD-formatted documentation. This is broken into two distinct types: File-level which is the stuff at the top of the file that describes the particular system in a high-level overview; and Function-level which provides documentation for each individual function. Both of these things are required and are verified by our test suite. To run these tests, you type &quot;make codetest&quot; from the parrot repo, after configuring and building Parrot. This will run through a series of tests in addition to the documentation ones. Specifically, the test t/codingstd/c_function_docs.t covers the function-level tests, and there are several files failing this test:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span&gt;compilers/imcc/instructions.c&lt;br /&gt;compilers/imcc/optimizer.c&lt;br /&gt;compilers/imcc/parser_util.c&lt;br /&gt;compilers/imcc/pbc.c&lt;br /&gt;compilers/imcc/pcc.c&lt;br /&gt;compilers/imcc/reg_alloc.c&lt;br /&gt;compilers/imcc/symreg.c&lt;br /&gt;compilers/pirc/src/bcgen.c&lt;br /&gt;compilers/pirc/src/pircapi.c&lt;br /&gt;compilers/pirc/src/pircompiler.c&lt;br /&gt;compilers/pirc/src/piremit.c&lt;br /&gt;compilers/pirc/src/pirmacro.c&lt;br /&gt;compilers/pirc/src/pirpcc.c&lt;br /&gt;compilers/pirc/src/pirregalloc.c&lt;br /&gt;compilers/pirc/src/pirsymbol.c&lt;br /&gt;config/gen/platform/ansi/dl.c&lt;br /&gt;config/gen/platform/ansi/exec.c&lt;br /&gt;config/gen/platform/ansi/time.c&lt;br /&gt;config/gen/platform/darwin/dl.c&lt;br /&gt;config/gen/platform/darwin/memalign.c&lt;br /&gt;config/gen/platform/generic/dl.c&lt;br /&gt;config/gen/platform/generic/env.c&lt;br /&gt;config/gen/platform/generic/exec.c&lt;br /&gt;config/gen/platform/generic/math.c&lt;br /&gt;config/gen/platform/generic/memalign.c&lt;br /&gt;config/gen/platform/generic/memexec.c&lt;br /&gt;config/gen/platform/generic/stat.c&lt;br /&gt;config/gen/platform/generic/time.c&lt;br /&gt;config/gen/platform/netbsd/math.c&lt;br /&gt;config/gen/platform/openbsd/math.c&lt;br /&gt;config/gen/platform/openbsd/memexec.c&lt;br /&gt;config/gen/platform/solaris/math.c&lt;br /&gt;config/gen/platform/solaris/time.c&lt;br /&gt;examples/c/nanoparrot.c&lt;br /&gt;examples/compilers/japhc.c&lt;br /&gt;examples/embed/lorito.c&lt;br /&gt;src/atomic/gcc_x86.c&lt;br /&gt;src/debug.c&lt;br /&gt;src/gc/gc_malloc.c&lt;br /&gt;src/gc/generational_ms.c&lt;br /&gt;src/gc/res_lea.c&lt;br /&gt;src/io/io_string.c&lt;br /&gt;src/jit/amd64/jit_defs.c&lt;br /&gt;src/jit/arm/exec_dep.c&lt;br /&gt;src/jit/i386/exec_dep.c&lt;br /&gt;src/jit/ppc/exec_dep.c&lt;br /&gt;src/nci_test.c&lt;br /&gt;src/pbc_dump.c&lt;br /&gt;src/pbc_info.c&lt;br /&gt;src/pic.c&lt;br /&gt;src/pic_jit.c&lt;br /&gt;src/string/charset/ascii.c&lt;br /&gt;src/string/charset/binary.c&lt;br /&gt;src/string/charset/iso-8859-1.c&lt;br /&gt;src/string/charset/unicode.c&lt;br /&gt;src/tsq.c&lt;br /&gt;src/jit/alpha/jit_emit.h&lt;br /&gt;src/jit/arm/jit_emit.h&lt;br /&gt;src/jit/hppa/jit_emit.h&lt;br /&gt;include/parrot/atomic/gcc_pcc.h&lt;br /&gt;src/jit/ia64/jit_emit.h&lt;br /&gt;src/jit/mips/jit_emit.h&lt;br /&gt;src/jit/ppc/jit_emit.h&lt;br /&gt;src/jit/skeleton/jit_emit.h&lt;br /&gt;src/jit/sun4/jit_emit.h&lt;/span&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Some of these files are complicated, which is why nobody has been brave enough to document them. However, while documenting things you should feel free to clean the code up a little bit so it becomes easier to document and understand. Also, most of these are not core files, they tend to be files on the edge of the codebase in some of our complicated systems: JIT, the IMCC and PIRC compilers, etc, so you're going to need to read up on some core systems in order to what is going on in all of these. More reading and looking at code means you learn more, more quickly!&lt;br /&gt;&lt;br /&gt;Most of the rest of the code files in the repository have some documentation, but it might not be high quality. Feel free to look into other files that interest you as well and improve existing documentation to be easier to read and more accurate. This is a great way to get started as well!&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Conclusion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So that's a quick list of things that a new user should feel free to take a look at as a way of getting familarized with Parrot and it's documentation. Documentation is a great way to learn the code because you have to understand it and describe it in your own words in order to write the docs. It's a great way to get involved and will have an immediate impact on the quality of Parrot and our ability to attract even more new developers. Fixing some documentation&lt;br /&gt;&lt;br /&gt;Please do not hesitate to send in patches, however small. Also, if you have questions and need clarifications, please feel free to ask on #parrot or on the &lt;a href=&quot;https://www.google.com/accounts/ServiceLogin?passive=true&amp;amp;service=groups2&amp;amp;continue=http%3A%2F%2Fgroups.google.com%2Fgroup%2Fparrot-dev&amp;amp;cd=US&amp;amp;hl=en&quot;&gt;parrot mailing list&lt;/a&gt;. We would love to help you help us.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-3318981477990437481?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Wed, 24 Jun 2009 12:32:19 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>Andrew Whitworth: YAPC: L1 Recap</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-2457481931998010173</guid>
	<link>http://wknight8111.blogspot.com/2009/06/yapc-l1-recap.html</link>
	<description>On request, I have been asked to summarize some of the discussions we had about L1 at YAPC. We talked about L1 as a small group on Sunday during the PVMW unconference (Myself, cotto, particle plus two others), and again as a slightly larger group at Lulu's restaurant for Tuesday lunch (Myself, chromatic, pmichaud, particle, cotto, jhorwitz and three others). I will try, as well as I am able, to summarize what we discussed both times. I'm going to post most of this post also to the &lt;a href=&quot;https://trac.parrot.org/parrot/wiki/L1Recap&quot;&gt;Parrot wiki&lt;/a&gt; so more then just my readers here will have access to it.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Microprocessor analogy&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When you look at modern microprocessors, you see these complex instruction sets like x86. In traditional machine code, each bit in a machine code opcode travels down wires and acts as control signals to the actual circuit hardware. The problem with this is that the opcode structure becomes intimately tied to the architecture of the hardware: If you change one, you need to change the other (because different bits now need to travel down different wires to different circuits), and then things built on top break: Your assemblers now need to output new machine code, your pre-existing binary executables are no longer valid, etc.&lt;br /&gt;&lt;br /&gt;In addition to this, some machine code words are very complex. x86 has hundreds of operations, and each operation can use a large number of addressing modes. Combine these together and you get hundreds, maybe millions of permutations. A single op, depending on the types of the sources and the destinations can have a number of distinct behaviors. add ax, bx is pretty far different from add [ax], bx, which is different from add ax, [bx], etc. Having to decide what behaviors to activate for each opcode from a large set of opcodes is hard to do.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Reasons for L1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Consider the idea now of converting those &quot;high-level&quot; machine code words into &quot;low-level&quot; microcode where each microcode operation is small, simple, atomic, and fast. Because each of these lower level instructions is more simple and atomic, they are easier to use in automated translation and with JIT.&lt;br /&gt;&lt;br /&gt;Right now we have a lot of our critical code paths are written in C, and a lot of them are written in PIR. It's immensely expensive moving data between PIR registers and the C system stack to call functions in each language, and we are incurring that cost very frequently. In addition, we lose out on lots of opportunities because of the boundary between the two: We cannot easily optimize, we cannot easily inline functions, we cannot easily profile (we can typically profile C or profile PIR, not both at once), etc.&lt;br /&gt;&lt;br /&gt;L1 is an abstraction that allows us to insert a new abstraction layer into Parrot to help reduce algorithmic complexity on the global level and give us more opportunities for optimization then we have in the PIR/C combination so far. Other projects like TraceMonkey are using cool optimization techniques such as polymorphic inline caching (which Parrot has a basic and messy implemenation of now, which has been deprecated), trace-based JIT, and context threading. These optimizations together are producing some stunning benchmark results for leading-edge javascript interpreters.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;What L1 will look like&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So the question invariably arises, what will L1 look like to the average programmer? Will it look like some grizzled assembly language? Will we be forced to reimplement large swaths of Parrot in some freaky home-brewed assembly? The answer, I think we are all pleased to consider now, is no. We have skills and background and tools for programming language design and we have several existing parsers for languages that we could utilize. One specific example of things that we could do, as mentioned by pmichaud, is to write core PMC types in NQP. It would have to have some extensions to allow direct register addressing, definition of vtables, and definition of attributes which may be references to arbitrary C data structures. Also, it would have to have a new backend which outputs L1 bytecode instead of PIR-&gt;PBC as PCT normally does now. We also have a new language in development by Austin Hastings called &quot;Close&quot;, which is a very low-level language based on C that will eventually have all the capability of PIR (and therefore L1), but with familiar C-like syntax.&lt;br /&gt;&lt;br /&gt;What this means is that there won't be a human-editable form of L1 bytecode, because we can write it in NQP, Close, or even other high-level languages which currently run on Parrot (although we will want to find one with a small runtime, or even a variant with no runtime). The short answer: L1 looks like any language we want it to look like (but probably Perl6-like in NQP or C-like in Close).&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Next Steps&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;So what are the next steps? Well, pmichaud suggests that a good way forward is to actually start prototyping some key core PMC types in NQP now, so we can get a feel for what syntax and semantics we will actually want and need. Once we know what our needs are, we can start modifying NQP to support our new syntax for dealing with these things.&lt;br /&gt;&lt;br /&gt;With the synatx requirements set, we can then modify the NQP parser to output normal C for now, and eventually redo the backend to output L1 instead.&lt;br /&gt;&lt;br /&gt;chromatic suggests that with our current plug-in architecture we could create a library of L1 dynops, and create an NQP backend to target those. Once we have core PMCs as written in NQP executing only on L1 dynops, we can start the rest of the conversion process.&lt;br /&gt;&lt;br /&gt;Here is a quick checklist:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Write core PMC types in NQP, making careful note of what syntax we need to add to support all existing operations. Good candidates for this prototyping would be Integer, ResizablePMCArray, and Hash (which is soon to be renamed to AssociativePMCArray).&lt;/li&gt;&lt;li&gt;Write existing PIR opcodes in NQP, making careful note of what syntax we need to add to support existing operations.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Write a dynop lib for L1 ops&lt;/li&gt;&lt;li&gt;Modify the NQP compiler to have all the necessary syntax from steps #1 and #2, and to output only those L1 opcodes created in step #3.&lt;/li&gt;&lt;li&gt;Modify IMCC (or PIRC, depending on time frame) to output L1 or PBC, depending on some kind of switch&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Move L1 opcodes into the core instead of being a dynoplib.&lt;/li&gt;&lt;li&gt;Make the final switch. All ops and PMCs get compiled from NQP into L1 during the normal build process (possibly using a bootstrapping step)&lt;/li&gt;&lt;li&gt;Optimize like rabid ferrets.&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-2457481931998010173?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Wed, 24 Jun 2009 11:27:25 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>Jeff Horwitz: YAPC talk</title>
	<guid>http://www.smashing.org/55 at http://www.smashing.org/jeff</guid>
	<link>http://www.smashing.org/jeff/node/55</link>
	<description>&lt;p&gt;I just finished giving my talk at YAPC.  It went okay, but not great.  Everything worked, but as this was a new talk, it wasn't as polished as I would have liked.  Next time will be smoother.&lt;/p&gt;
&lt;p&gt;Slides are available here: &lt;a href=&quot;http://www.smashing.org/jeff/talks&quot; title=&quot;http://www.smashing.org/jeff/talks&quot;&gt;http://www.smashing.org/jeff/talks&lt;/a&gt;&lt;/p&gt;</description>
	<pubDate>Mon, 22 Jun 2009 21:07:25 +0000</pubDate>
</item>
<item>
	<title>Andrew Whitworth: IO work at YAPC.</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-4363294659627983125</guid>
	<link>http://wknight8111.blogspot.com/2009/06/io-work-at-yapc.html</link>
	<description>The sysadmin heritage of Perl has really been shining through here at YAPC, a lot of our newcomers are really interested in process management and interprocess communication topics. Unfortunately, this seems to be an area where Parrot is particullarly weak. Luckily I managed to get a pretty good idea of the kinds of things that the workshop attendies are interested in, and even picked up a few good ideas about implementation. We had an &quot;unconference&quot; yesterday which is so awesome I would like to do it again some time. Earlier this morning I talked to a group of interested parties about the state of Parrot's GC, and may have found a volunteer to help implement the concurrent GC core I've been planning. I also did a little bit of talking about L1 to introduce the idea to people who haven't been following my blog (everybody on the planet besides myself). I'm just finishing up a session about IPC now, and have heard a lot about the things that people want, and heard lots of cool ideas about how to implement them.&lt;br /&gt;&lt;br /&gt;I've been doing a lot of hacking on the &lt;a href=&quot;https://trac.parrot.org/parrot/log/branches/io_cleanups?rev=39688&quot;&gt;io_cleanups branch&lt;/a&gt;, which I started two days ago. It was started with the goal of cleaning up the IO system a little bit and better integrating Sockets and Pipes. It's gone a little bit beyond that now, and I'm getting pretty close to having a cool result to share. I posted a patch to the IRC chatroom in hopes Infinoid would work his magic and tell me what I'm doing wrong. What I need to do is hunker down with the debugger and see where my stuff isn't working correctly, I just haven't been able to focus on it for long enough because of the festivities. I'm sure the problem has to do with my mishandling of the buffering code somewhere.&lt;br /&gt;&lt;br /&gt;The gist of the work in the branch is this: The IO system should sanely handle all it's PMC types (FileHandle, Socket, Pipe, StringHandle), and handle them in a way such that they are subclassable from PIR. Currently we don't even have a separate Pipe type in trunk yet. Infinoid sent me a patch to add Pipes, and once I get past my current set of issues I will add it into the branch.&lt;br /&gt;&lt;br /&gt;In order to make this all work, I changed the Handle type (which had been a mostly-useless parent type of all the IO PMCs) into a delegate type that implements all the non-subclassable attribute types that FileHandle used to use: the low-level file descriptor, the output buffer, etc. So now, FileHandle does not extend Handle, instead it has a Handle PMC as an attribute. Initially I ran into an interesting memory corruption problem where Handles were being destroyed before their parent. When FileHandle was destroyed it tried to flush it's contents to the Handle (which had already been garbage collected), and hilarity ensued. To get around that problem I moved all the buffering logic into Handle, which means any other PMC types that delegate to Handle (specifically Pipe seems like a good candidate for this) will get to have buffering for free if they want to use it. There are still some kinks to work out with this method, but once I get the implementation working it will be easier to get feedback from people.&lt;br /&gt;&lt;br /&gt;In other YAPC news, Austin Hastings is working on a very cool C-like language compiler called Close. Basically, it's C-like syntax (curly brackets, if/else/for/while, etc). It looks to be on the same kind of level as NQP (low complexity, no runtime, good for writing PIR-level stuff that's not in PIR, etc). It really appeals to me because it's essentially a familiar syntax layer over PIR, which I find can be very tedious to write large things in as-is. He says he has a 0.1 release he's going to make public sometime soon, and I'm looking forward to that.&lt;br /&gt;&lt;br /&gt;I talked to Patrick yesterday about my AIO plans, and he suggested I speak up about it on #perl6 to get some use-case information there. Obviously I don't want to tailor the work directly to Perl6's needs, but a flexible-enough system should satisfy them without too much wrapping and layering. Unfortunately the IO Synopses isn't entirely finalized, and there are a lot of things up in the air still. My AIO implementation, if well-enough received, could play a part in influencing that document.&lt;br /&gt;&lt;br /&gt;Also, &lt;span&gt;&lt;span&gt;I MET LARRY WALL. HE WAS IN MY CAR!&lt;/span&gt;&lt;/span&gt; It was like nerd nirvana. I did, fortunately, manage to contain my school girl giggles and get us to the arrival dinner without making a complete ass of myself. Awesomeness.&lt;br /&gt;&lt;br /&gt;So that was my Sunday at YAPC. It's now Monday morning and I'm looking forward to a full day of meeting people, watching cool presentations, and hacking hacking hacking. More blog posts to come, I'm sure.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-4363294659627983125?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Mon, 22 Jun 2009 08:25:35 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>Andrew Whitworth: YAPC: Day 1</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-7088280191885116156</guid>
	<link>http://wknight8111.blogspot.com/2009/06/yapc-day-1.html</link>
	<description>Wake up at 3am. Get in the car, drive 5 hours through the pounding rain. Get lost on CMU's godforsaken labyrinth of a campus. Finally, a local student showed me how to get to the PVM workshop (I think he had to answer the riddle of the sphinx first, I didn't see).&lt;br /&gt;&lt;br /&gt;But here I am, and it's kicking ass. Already I've met cotto, particle, pmichaud, Util, kid51 and a whole bunch of new faces. I've seen some great presentations (all by pmichaud, I missed the earlier ones by particle) and I've gotten a lot of good hacking done already.&lt;br /&gt;&lt;br /&gt;Infinoid was digging through the threading code and managed to plug a &lt;span&gt;62MB leak&lt;/span&gt; from the threading code. Spurred on by that, I made a few small cleanups to the GC and PMC reuse code, and then started getting to work on the io_cleanups branch. The task on the front burner right now is getting sockets optimized away from unnecessary PCCINVOKE calls like we did for FileHandles and StringHandles in the io_rewiring branch. I also want to get working on Pipes too. In fact, it was this pipe work that clued Infinoid in to the problems in the threading code in the first place. Hopefully we get moving forward with that soon.&lt;br /&gt;&lt;br /&gt;So the threading system needs a lot of work, and I may push that into my task queue in the not-so-distant future. I'm sure I'm going to have to do some refactors and fixups on the road to AIO, but I will tackle that when I get there.&lt;br /&gt;&lt;br /&gt;I'm watching cotto do some awesome work on the pmcc (the PCT-based utility to parse PMCs). I can't really help with that so I'm just an enthusiastic spectator for now. &lt;br /&gt;&lt;br /&gt;Several of the attendees are giving Parrot and Rakudo a workout and are filing tickets and patches. I look forward to digging through some of those later, if nobody beats me to them.&lt;br /&gt;&lt;br /&gt;A good start to the conference today, I'm looking forward to the next 3 days here.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-7088280191885116156?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Sat, 20 Jun 2009 18:33:39 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>Andrew Whitworth: L1: The Big Picture</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-4225166266751353333</guid>
	<link>http://wknight8111.blogspot.com/2009/06/l1-big-picture.html</link>
	<description>What I think I have been missing in my &lt;a href=&quot;http://wknight8111.blogspot.com/2009/06/l1-language-of-parrot-internals.html&quot;&gt;past&lt;/a&gt; &lt;a href=&quot;http://wknight8111.blogspot.com/2009/06/l1-possibilities.html&quot;&gt;several&lt;/a&gt; &lt;a href=&quot;http://wknight8111.blogspot.com/2009/06/l1-implementation.html&quot;&gt;blog posts&lt;/a&gt; about L1 (and the ensuing comments), as judged from questions I've received, is an idea about the big picture. What exactly is this thing called L1, and what would it mean for the average Parrot developer? This question is the subject of this post, which by necessity will be quite long.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;What Changes?&lt;/span&gt;&lt;br /&gt;Let's take a look at normal work flow from the perspective of the VM. The programmer writes a program. This could be directly in PIR, or in a high-level language which is compiled down to PIR. The exact path doesn't matter as far as Parrot is concerned, in either case it takes a PIR input file to execute.&lt;br /&gt;&lt;br /&gt;IMCC, Parrot's PIR compiler front-end compiles the PIR code into PBC byte code. It's this PBC that's actually executed by Parrot. Parrot's runcore (I use the singular here, but Parrot actually has several distinct cores, a fact that is not important here) reads the bytecode and separates out the various elements. The opcodes, which have a one-to-one relationship with the PIR statements, are integer numbers in PBC. These opcode numbers are typically passed into a lookup table and a corresponding handler function is called to perform the actions of that op. In C, this operation looks similar to this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;while(!halt) {&lt;br /&gt;    (interp-&gt;opcode_table[opcode])(interp, args)&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This, in essence, is the &quot;core&quot; of Parrot. Each opcode is implemented by a separate C function which is called from a dispatch table by numerical index. Those opcode functions in turn call various API functions to do their calculations. Quick Recap: Opcode is a numerical index into a lookup table. It calls a C function, which in turn calls API functions to perform the required operation. Execution state is saved in the interpreter object (or in a large variety of structures which are attached to it, including the register arrays).&lt;br /&gt;&lt;br /&gt;So what does L1 do to change this picture? Actually, not a whole hell of a lot, despite all the wonderful things I've tried to claim that L1 will do. The runcore? doesn't really change. The internal APIs? no change at all really (well, maybe a small change to the interface, but nothing huge). L1 ops are written in C, taking the place that PASM ops occupy now, and PASM ops instead are written in terms of L1 ops. Also, we're going to rewrite PMC VTABLEs in L1, but that's not exactly the core. The runcore now executes L1 bytecode instead of PASM bytecode, but almost everything else is the same.&lt;br /&gt;&lt;br /&gt;So what changes? Why add that new layer? I'll explain a few reasons below.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;L1 and JIT&lt;/span&gt;&lt;br /&gt;Let's look at the JIT system again, god knows&lt;a href=&quot;http://wknight8111.blogspot.com/2009/04/parrot-jit-extravaganza.html&quot;&gt; I love talking about it&lt;/a&gt;. What JIT does is convert an incoming bytecode stream into a machine code stream and executes that directly. So instead of the runcore loop example I showed above, we unroll the loop entirely and call all the functions in a long precompiled sequence. Or, we can get more fancy and eliminate the function calls entirely and simply execute the function guts in sequence. In this case, JIT &lt;span&gt;is the runcore&lt;/span&gt;, not just a component of it. JIT takes over the execution of the opcodes by assembling them into machine code and executing the whole block of code directly. Basically, JIT executes the same opcode function logic, but gives us the ability to eliminate the dispatch logic that my previous runcore example used.&lt;br /&gt;&lt;br /&gt;Also, a good JIT engine will perform machine-level optimizations, which gives us an added boost.&lt;br /&gt;&lt;br /&gt;We want JIT because it lets us squeeze performance out of every loop iteration, and a program with one million opcodes will iterate over that runcore loop one million times. Plus, JIT gets us another benefit, which comes more or less for free: the ability to compile PIR programs into &lt;span&gt;native machine code executables&lt;/span&gt;, like you can do already with C. You already have the machine code in memory, all we need to do is output the right file structure and then dump that machine code into a file. Bada-bing, executables.&lt;br /&gt;&lt;br /&gt;So we want JIT. No question about that.&lt;br /&gt;&lt;br /&gt;The big problem is that the opcode definition itself is very different from the JIT version of that opcode. The opcode logic is written in C and executed directly. The JIT version is a C function that writes the opcode logic at runtime and then executes it. Currently in Parrot, we have to write these things differently. I wrote a &lt;a href=&quot;http://wknight8111.blogspot.com/2009/06/l1-language-of-parrot-internals.html&quot;&gt;post recently that shows examples of each&lt;/a&gt;. See the files in /src/ops/* for the opcode definitions, and src/jit/* for the JIT versions of them (which are messy and ugly). When we change one we have to manually change the other &lt;span&gt;for all platforms&lt;/span&gt;, which can be difficult if the person making the changes aren't familiar with all our platforms.&lt;br /&gt;&lt;br /&gt;What we need is a way to automatically translate PASM opcodes into their JIT definitions AND their direct-executable function definitions. We do this by taking arbitrarily complex ops and decomposing them into atomic parts.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;L1 and Control Flow&lt;/span&gt;&lt;br /&gt;Let's now look at control flow. We have a PIR program that defines a class Foo and instantiates an object of that type.  Here's a snippet:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;$P0 = new 'Foo'&lt;br /&gt;$P0 = 1&lt;br /&gt;$P0 += 1&lt;br /&gt;&lt;br /&gt;.namespace [&quot;Foo&quot;]&lt;br /&gt;&lt;br /&gt;.sub add_i :vtable&lt;br /&gt;...&lt;br /&gt;.end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The third line in this snippet calls the add_i VTABLE, which calls the function src/pmc/object.pmc:add_i(). This in turn checks to see if we have a PIR-based override. We do, so we call back into PIR to execute that override. This creates a new runloop further down on the C stack to execute the PBC of the override. When that returns, the sub-runloop exits, returns to the C code in object.pmc, returns to the op definition in the top runloop, and then returns to the top runloop to execute the next op in our hypothetical little program.&lt;br /&gt;&lt;br /&gt;This creates all sorts of problems here, and &lt;a href=&quot;http://rt.perl.org/rt3/Ticket/Display.html?id=38432&quot;&gt;I'll give an example of one&lt;/a&gt;. Let's say an unhanded exception is thrown in the vtable override. The interpreter can't find a handler, so the runloop terminates and exits. This returns back to the code in object.pmc, which returns back to the opcode definition, which returns back to the top runloop, &lt;span&gt;which has absolutely no knowledge of the exception&lt;/span&gt;. An unhandled exception should cause the VM to exit, but it gets lost in the call stack and does not have this behavior. The problem is that we have recursive calls into separate runloops separated by an arbitrary depth of C functions in between.&lt;br /&gt;&lt;br /&gt;The solution to this problem is to unify to have only a single runloop active at any time in a given execution context, and to not allow recursive calls into other runloops. We do this, in turn, by having a single execution environment that is consistent on itself. This is L1.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;L1 and Optimization&lt;/span&gt;&lt;br /&gt;Besides the benefits in simplifying JIT, I haven't really discussed how L1 will help speed up Parrot. It's not what L1 itself will do that provides optimizations, it's what L1 enables that will do it. L1 provides a consistent input language where flow control and variable usage can be analyzed. We don't have that now because some of our flow control happens in C and some in PIR, and there's just no way to consistently analyze that. We can do flow analysis to optimize algorithms at the high level before we pass it to the JIT engine to optimize at the low level. We also gain the ability to do escape analysis and lifetime analysis on our PMCs for a variety of optimizations, especially in the GC, the PMC allocator, and maybe a few other places. We can also simplify (maybe eliminate entirely!) the stackwalking code in the GC. We can do all these things only after we have L1.&lt;br /&gt;&lt;br /&gt;&lt;span&gt;Conclusion&lt;/span&gt;&lt;br /&gt;So I've tried to give a wholistic high-level overview of the current environment and why I think we need a new low-level code form. In terms of architecture, not a lot has to change to enable L1. However, the benefits that we can get from having it are huge in the long run.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-4225166266751353333?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Fri, 19 Jun 2009 22:20:53 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>Andrew Whitworth: L1: The Implementation</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-3646532211850591693</guid>
	<link>http://wknight8111.blogspot.com/2009/06/l1-implementation.html</link>
	<description>Finishing my short trilogy of L1-related posts today, I am going to talk about the actual implementation of this phantasm. This is an area where chromatic and I disagree pretty strongly, so I will just say that this is not canonical and there are plenty of other differing opinions about all this stuff. PerlJam said pretty eloquently on IRC today:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;PerlJam&gt; whoever implements something first is likely to have a strong influence on what the final implementation looks like&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;With that in mind, I've been reticent to publish this blog post for fear any lousy ideas and misconceptions I have will negatively taint the entire design process. I was even more hesitant when I saw three times today alone my previous L1 blog posts being used to explain the idea to other parroteers. It turns out that what I've written so far is the only concise written account of this little language, besides the disjoined conversations that have occurred randomly on IRC and email.&lt;br /&gt;&lt;br /&gt;My conception of L1 is a low-level set of operations that represents a nearly direct way to interface with the Parrot API. I'm envisioning a one-to-one relationship between special API functions (in C), including VTABLEs, and L1 operations. We will have L1 ops for most of the VTABLE functions (with the implicit understanding that the number of VTABLE functions is going to shrink dramatically). I've mentioned the analogy of microcode before, and I think it's a fitting one. &lt;a href=&quot;http://en.wikipedia.org/wiki/Microcode&quot;&gt;Microcode&lt;/a&gt;, as traditionally used, is a set of lowest-level machine instructions that usually map pretty closely to the underlying circuitry. Complicated and multi-stage operations can be implemented as a sequence of multiple atomic micro-ops. Also, there is the benefit that the machine code format becomes divorced from the underlying circuitry, so that one can be more easily modified without having to modify the other.&lt;br /&gt;&lt;br /&gt;In my mind L1 should satisfy these conditions:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Should map closely to the underlying &quot;circuitry&quot;. That is, the operations that Parrot understands (API Functions) should map directly to individual L1 ops. Notice that the capabilities of our &quot;machine&quot; (virtual machine) is more expansive then the capabilities of an ordinary hardware machine.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;We need to be able to separate PIR (which should stay relatively stable for our end users) from the underlying engine that runs it. This way we can make major improvements to one without having to redo the other.&lt;/li&gt;&lt;li&gt;The operations should be simple and atomic enough to be executed quickly, &lt;a href=&quot;http://en.wikipedia.org/wiki/Just-in-time_compilation&quot;&gt;JITted&lt;/a&gt; without much effort, and easily analyzed for optimization. This means they should be very simple logically, and as much as possible approach a common implementation pattern.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Provide all the functionality needed to implement all flow control devices currently implemented in PIR &lt;span&gt;and&lt;/span&gt; C. Right now we switch back and forth between PIR -&gt; C, and that's costly for a number of reasons. In an L1-enabled Parrot, control flow should never leave L1, and should be able to do everything both PIR and C do (including calling into arbitrary external library functions and arbitrary PIR functions).&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;All that said, here's a basic list of operators that &lt;span&gt;I think&lt;/span&gt; will be good L1 ops:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span&gt;Converting to/from PMCs:&lt;/span&gt; boxint, boxfloat, boxstring, unboxint, unboxfloat, unboxstring&lt;/li&gt;&lt;li&gt;&lt;span&gt;PMC Ops: &lt;/span&gt;clone (shallow), new, destroy, getattr, setattr, vtable (this could be one large op, or a family of ops to call each VTABLE entry)&lt;/li&gt;&lt;li&gt;&lt;span&gt;Register Ops&lt;/span&gt;: move, clear&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Basic Arithmetics:&lt;/span&gt; addint (i = i + i), addfloat (f = f + f), subint, subpmc, subfloat. (Include int, and float variants of arithmetic operators mul, div and mod).&lt;/li&gt;&lt;li&gt;&lt;span&gt;String ops:&lt;/span&gt; concat (s = s . s), sfront (s = substr s, 0, n), sback (s = substr s, n)&lt;/li&gt;&lt;li&gt;&lt;span&gt;Parrot Core Ops:&lt;/span&gt; sched (sets a PMC for execution, backend for throw, raise, schedule. Also used for launching a new thread, etc), findpfunc, findcfunc, findfuncsig (find a function by name and signature) loadlib, exec (basically &quot;invoke&quot;), cont (create continuation. a return is a &quot;p = cont, exec p&quot; operation). setnamespace, getnamespace.&lt;/li&gt;&lt;li&gt;&lt;span&gt;Control Flow&lt;/span&gt;: jump and branch primitives, halt, etc.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;This is a pretty limited list of ops, and I admit that I'm probably missing a few and have probably added a few that are extraneous. Keep in mind when reading this though that L1 is designed for speed and ease of execution, not for programmer convenience. L1 ops need to be trivially simple: a single arithmetic operation, a single VTABLE call, a single API function call, etc. Painfully, obnoxiously simple. PASM and PIR are better for the average programmer to use.&lt;br /&gt;&lt;br /&gt;L1 is going to be register based, it doesn't make sense to do it any other way. I don't know how exactly we are going to handle registers, since each L1 op is going to need to be able to take in registers for its destination and source arguments, and also needs access to temporaries so that the underlying L1 op stream isn't overwriting data in PIR-level registers. I draw strong parallels to the MIPS architecture which reserves certain hardware registers to be used for implementing instruction macros without having to overwrite user-accessable registers.&lt;br /&gt;&lt;br /&gt;Enough with the explanations, here's a quick idea of some ways that PIR ops could be written in L1:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;op add(out PMC, in PMC, in PMC) {&lt;br /&gt;vtable[add] $1, $2, $3&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;This snippet shows a few things. First off, I have no idea how to intelligently provide access to several hundred VTABLEs. Do we have one L1 op per vtable, or do we provide a lookup mechanism? I don't think we want anything like this (in pseudocode):&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;func = find_vtable obj, &quot;add&quot;&lt;br /&gt;result = call func, args&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;VTABLE calls are very common operations and it makes good sense that it would be a simple, atomic operation to invoke one. Looking it up by string is definitely not a simple or reasonable way to do it. Using symbolic integer constants to look them up instead of using strings is slightly better, but you still have the problem of having to find the vtable first and invoke it second, two steps for such a basic common operation seems lousy to me. The alternative is to use one L1 op per vtable:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;vtable_add result, src1, src2&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;But again, we would end up with a huge number of such ops to call a huge number of VTABLES. This might provide impetus for us to decrease the total number of them in existence, or it might just lead to unhelpful explanations to &quot;do it all in PIR instead&quot; when L1 becomes so ugly and unmanagable that people sweep it under the rug and choose to ignore it completely.&lt;br /&gt;&lt;br /&gt;In the example above I used the same argument placeholders &lt;code&gt;$1&lt;/code&gt;, &lt;code&gt;$2&lt;/code&gt;, etc that are currently used in .ops files, and I think that's fitting. These op definitions are little more then macros and the values for these arguments can be substituted in very simply when a program is converted from PBC to L1BC. If we're using that notation for arguments (which represent the register set that is available for use from PIR), then we would have to use a different notation for representing the set of temporary registers which are reserved for use internally by L1. I'll kick out a few ideas, but I don't have any strong preference how these register sets are delimited. Consider for instance the case of the swap opcode:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;op swap(inout PMC, inout PMC) {&lt;br /&gt;move [P0], $1&lt;br /&gt;move $1, $2,&lt;br /&gt;move $2, [P0]&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Here, the [] brackets denote a temporary L1-only register. Again, just one out of a hundred equally good (or bad) ideas for this. We do need a way to specify whether the register is a P, S, I or N still, and to address them from each family, so in some respects we're stuck with the &quot;P0&quot; base string. I won't really discuss this any further because it's so open and completely fruitless.&lt;br /&gt;&lt;br /&gt;Implementing PIR in terms of L1 ops is only part of the problem, the rest is trying to implement PMCs in it too. For PMCs, we need these kinds of operations, in addition to the list I mentioned above:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;allocate, access, and free memory buffers and custom storage&lt;/li&gt;&lt;li&gt;Access and manipulate attributes&lt;br /&gt;&lt;/li&gt;&lt;li&gt;freeze and thaw, including attributes and children&lt;/li&gt;&lt;li&gt;mark attributes and children for GC&lt;/li&gt;&lt;li&gt;access and manipulate PMC flags, pmc_ext, pmc_sync, and other fields&lt;/li&gt;&lt;/ol&gt;Again, I'm sure this list isn't complete, but it should give a good idea for the kinds of things we need L1 to be capable of.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-3646532211850591693?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Fri, 19 Jun 2009 14:58:46 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>Patrick Michaud: Rakudo Perl 6 development release #18 (&quot;Pittsburgh&quot;)</title>
	<guid>http://use.perl.org/~pmichaud/journal/39149?from=rss</guid>
	<link>http://use.perl.org/~pmichaud/journal/39149?from=rss</link>
	<description>&lt;p&gt;On behalf of the Rakudo development team, I'm pleased to announce
the June 2009 development release of Rakudo Perl #18 &quot;Pittsburgh&quot;.
Rakudo is an implementation of Perl 6 on the &lt;a href=&quot;http://parrot.org/&quot;&gt;Parrot Virtual Machine&lt;/a&gt;.
The tarball for the June 2009 release is available from
&lt;a href=&quot;http://github.com/rakudo/rakudo/downloads&quot;&gt;http://github.com/rakudo/rakudo/downloads&lt;/a&gt; .
&lt;/p&gt;&lt;p&gt;Due to the continued rapid pace of Rakudo development and the
frequent addition of new Perl 6 features and bugfixes, we continue
to recommend that people wanting to use or work with Rakudo obtain
the latest source directly from the main repository at github.
More details are available at &lt;a href=&quot;http://rakudo.org/how-to-get-rakudo&quot;&gt;http://rakudo.org/how-to-get-rakudo&lt;/a&gt; .
&lt;/p&gt;&lt;p&gt;Rakudo Perl follows a monthly release cycle, with each release code named
after a Perl Mongers group.  This release is named &quot;Pittsburgh&quot;, which
is the host for &lt;a href=&quot;http://yapc10.org/&quot;&gt;YAPC|10&lt;/a&gt; (YAPC::NA 2009) and the
&lt;a href=&quot;http://yapc10.org/yn2009/talk/2045&quot;&gt;Parrot Virtual Machine
Workshop&lt;/a&gt;.  Pittsburgh.pm has also sponsored hackathons for Rakudo
Perl as part of the &lt;a href=&quot;http://pghpw.org/ppw2008/&quot;&gt;2008 Pittsburgh Perl Workshop&lt;/a&gt;.
&lt;/p&gt;&lt;p&gt;In this release of Rakudo Perl, we've focused our efforts on refactoring
many of Rakudo's internals; these refactors improve performance,
bring us closer to the Perl 6 specification, operate more cleanly
with Parrot, and provide a stronger foundation for features to be
implemented in the near future.  Some of the specific major changes
and improvements in this release include:
&lt;/p&gt;&lt;ul&gt; &lt;li&gt;Rakudo is now passing 11,536 spectests, an increase of 194
passing tests since the May 2009 release.  With this release
Rakudo is now passing 68% of the available spectest suite.
&lt;/li&gt;&lt;li&gt;Method dispatch has been substantially refactored; the new dispatcher
is significantly faster and follows the Perl 6 specification more
closely.
&lt;/li&gt;&lt;li&gt;Object initialization via the BUILD and CREATE (sub)methods is
substantially improved.
&lt;/li&gt;&lt;li&gt;All return values are now type checked (previously only explicit
'return' statements would perform type checking).
&lt;/li&gt;&lt;li&gt;String handling is significantly improved: fewer Unicode-related
bugs exist, and parsing speed is greatly improved for some programs
containing characters in the Latin-1 set.
&lt;/li&gt;&lt;li&gt;The IO .lines and .get methods now follow the specification more closely.
&lt;/li&gt;&lt;li&gt;User-defined operators now also receive some of their associated
meta variants.
&lt;/li&gt;&lt;li&gt;The 'is export' trait has been improved; more builtin functions
and methods can be written in Perl 6 instead of PIR.
&lt;/li&gt;&lt;li&gt;Many Parrot changes have improved performance and reduced overall
memory leaks (although there's still much more improvement needed).
&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;The development team thanks all of our contributors and sponsors for
making Rakudo Perl possible.  If you would like to contribute,
see &lt;a href=&quot;http://rakudo.org/how-to-help&quot;&gt;http://rakudo.org/how-to-help&lt;/a&gt; , ask on the perl6-compiler@perl.org
mailing list, or ask on IRC #perl6 on freenode.
&lt;/p&gt;&lt;p&gt;The next release of Rakudo (#19) is scheduled for July 23, 2009.
A list of the other planned release dates and codenames for 2009 is
available in the &quot;docs/release_guide.pod&quot; file.  In general, Rakudo
development releases are scheduled to occur two days after each
Parrot monthly release.  Parrot releases the third Tuesday of each month.
&lt;/p&gt;&lt;p&gt;Have fun!
&lt;/p&gt;&lt;p&gt;References:
&lt;br /&gt;[1]  Parrot, &lt;a href=&quot;http://parrot.org/&quot;&gt;http://parrot.org/&lt;/a&gt;
&lt;br /&gt;[2]  YAPC|10 &lt;a href=&quot;http://yapc10.org/yn2009/&quot;&gt;http://yapc10.org/yn2009/&lt;/a&gt;
&lt;br /&gt;[3]  Parrot Virtual Machine Workshop, &lt;a href=&quot;http://yapc10.org/yn2009/talk/2045&quot;&gt;http://yapc10.org/yn2009/talk/2045&lt;/a&gt;
&lt;br /&gt;[4]  Pittsburgh Perl Workshop, &lt;a href=&quot;http://pghpw.org/ppw2008/&quot;&gt;http://pghpw.org/ppw2008/&lt;/a&gt;
&lt;/p&gt;</description>
	<pubDate>Fri, 19 Jun 2009 05:17:59 +0000</pubDate>
</item>
<item>
	<title>chromatic: Perl 6 Design Minutes for 20 May 2009</title>
	<guid>http://use.perl.org/~chromatic/journal/39144?from=rss</guid>
	<link>http://use.perl.org/~chromatic/journal/39144?from=rss</link>
	<description>&lt;p&gt;The Perl 6 design team met by phone on 20 May 2009.  Larry, Allison, Patrick, Jerry, Nicholas, and chromatic attended.

&lt;/p&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;trying to delegate some of my spec writing&lt;/li&gt;&lt;li&gt;if someone has something that needs to change and that person understands the design principles, someone can go ahead&lt;/li&gt;&lt;li&gt;Moritz respecced &lt;code&gt;each&lt;/code&gt; to make it a conjectural junction&lt;/li&gt;&lt;li&gt;other people are working on the NFG specification&lt;/li&gt;&lt;li&gt;I haven't seen any changes committed on that yet&lt;/li&gt;&lt;li&gt;thinking about how importation works&lt;/li&gt;&lt;li&gt;particularly with inlined modules&lt;/li&gt;&lt;li&gt;expect that there will be an &lt;code&gt;import&lt;/code&gt; declarator implied by &lt;code&gt;use&lt;/code&gt; but usable explicitly&lt;/li&gt;&lt;li&gt;if you say &lt;code&gt;import&lt;/code&gt; with an inline module or role declaration, it'll perform the export&lt;/li&gt;&lt;li&gt;which won't happen by default&lt;/li&gt;&lt;li&gt;thinking about how that declaration works at the moment&lt;/li&gt;&lt;li&gt;instead of &lt;code&gt;trait_auxiliary&lt;/code&gt; and &lt;code&gt;trait_verb&lt;/code&gt;, which fill the same syntactic category, we have &lt;code&gt;trait_mod&lt;/code&gt; &lt;/li&gt;&lt;li&gt;they all occur in the same spot&lt;/li&gt;&lt;li&gt;you're always looking for them both simultaneously&lt;/li&gt;&lt;li&gt;the hander routines are now all upperclass autocalled, like other handlers&lt;/li&gt;&lt;li&gt; &lt;code&gt;IS&lt;/code&gt; or &lt;code&gt;TRAIT_IS&lt;/code&gt; or &lt;code&gt;APPLY_IS&lt;/code&gt;, or some such&lt;/li&gt;&lt;li&gt;still thinking about namespaces for typeless traits not based on classes&lt;/li&gt;&lt;li&gt;perhaps &lt;code&gt;rw&lt;/code&gt; or &lt;code&gt;readonly&lt;/code&gt; traits aren't types&lt;/li&gt;&lt;li&gt;they need to be in a namespace somewhere&lt;/li&gt;&lt;li&gt;maybe just a syntactic category&lt;/li&gt;&lt;li&gt;added the use of ampersand variables on method calls to STD, &lt;code&gt;.&amp;amp;foo&lt;/code&gt; &lt;/li&gt;&lt;li&gt;you can already say &lt;code&gt;$.foo&lt;/code&gt;, call a code reference as if it were a method&lt;/li&gt;&lt;li&gt; &lt;code&gt;&amp;amp;&lt;/code&gt; is also a code reference; ought to be allowed there too&lt;/li&gt;&lt;li&gt;Jonathan was playing with ampersand attributes, &lt;code&gt;.&amp;amp;!foo&lt;/code&gt; &lt;/li&gt;&lt;li&gt;the rudimentary POD parser now complains if you don't have a matching &lt;code&gt;=end&lt;/code&gt; for your &lt;code&gt;=begin&lt;/code&gt;, except in the case of &lt;code&gt;=begin END&lt;/code&gt; &lt;/li&gt;&lt;li&gt;if you put a default onto a named parameter, parser assumed it to be a positional parameter&lt;/li&gt;&lt;li&gt;gave a bogus error message&lt;/li&gt;&lt;li&gt;I fixed that&lt;/li&gt;&lt;li&gt;another interesting grammar tweak&lt;/li&gt;&lt;li&gt;defining an &lt;code&gt; infix:&amp;lt;&amp;lt; &amp;gt;&amp;gt;&lt;/code&gt; and then a signature&lt;/li&gt;&lt;li&gt;if you leave a space out between the name and the signature parentheses, it would misparse&lt;/li&gt;&lt;li&gt;French angles ambiguously hyper parentheses there&lt;/li&gt;&lt;li&gt;I didn't want to require the space there&lt;/li&gt;&lt;li&gt;it's nice that you can write the declaration as if it a were call with the parens&lt;/li&gt;&lt;li&gt;if you're going to hyperoperate on parentheses, you have to use the dot form&lt;/li&gt;&lt;li&gt; &lt;code&gt;&amp;gt;&amp;gt;(&lt;/code&gt; is now specifically not a hyperoperator within interpolation&lt;/li&gt;&lt;li&gt; &lt;code&gt;&amp;gt;&amp;gt;.(&lt;/code&gt; is&lt;/li&gt;&lt;li&gt;that seems to be pretty DWIMmy&lt;/li&gt;&lt;li&gt;everything else is cage cleaning and hanging out&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;did not write any posts&lt;/li&gt;&lt;li&gt;will fix that first&lt;/li&gt;&lt;li&gt;mostly worked with others to make these happen&lt;/li&gt;&lt;li&gt;Tene and I ported Rakudo to run in its own HLL namespace instead of Parrot's&lt;/li&gt;&lt;li&gt;caused a 40-50% slowdown in execution time&lt;/li&gt;&lt;li&gt;we know the cause and have a fix before tomorrow's Rakudo release&lt;/li&gt;&lt;li&gt;I'll compare Rakudo's speed to before the switch&lt;/li&gt;&lt;li&gt;want to credit chromatic for any performance optimizations&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;c:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;I have a 6.5% improvement for all function calls&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;we have better error reporting now&lt;/li&gt;&lt;li&gt;can point to the point in your code with the error, rather than some point in generated PIR code&lt;/li&gt;&lt;li&gt;added the ability to define custom operators in Rakudo&lt;/li&gt;&lt;li&gt;infix, prefix, postfix&lt;/li&gt;&lt;li&gt;in select cases also circumfix&lt;/li&gt;&lt;li&gt;we can move even more parts of the builtins to Perl 6 as a Setting&lt;/li&gt;&lt;li&gt;exposed a few other places we need cleanup&lt;/li&gt;&lt;li&gt;Jonathan is working on those&lt;/li&gt;&lt;li&gt;added a variable to PCT which gives the compiler the names of the files it's compiling&lt;/li&gt;&lt;li&gt;improved error reporting there&lt;/li&gt;&lt;li&gt;added an inline PIR construct to NQP to match Rakudo's&lt;/li&gt;&lt;li&gt;added the &lt;code&gt;qx//&lt;/code&gt; quoting term&lt;/li&gt;&lt;li&gt;can now run shell commands and capture the output into a variable&lt;/li&gt;&lt;li&gt;answering questions online and taking care of other little things&lt;/li&gt;&lt;li&gt;preparing for tomorrow's release&lt;/li&gt;&lt;li&gt;though it may occur very late tonight&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Allison:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;mainly release prep this week&lt;/li&gt;&lt;li&gt;lots of ticket review and patch application&lt;/li&gt;&lt;li&gt;submitted an article to Linux Magazine, &quot;Why Parrot is Important&quot;&lt;/li&gt;&lt;li&gt;more high-level than a tutorial&lt;/li&gt;&lt;li&gt;continuing to work on the book&lt;/li&gt;&lt;li&gt;a good week for high-level design discussions&lt;/li&gt;&lt;li&gt;seems like that happens when I have more time to be on IRC&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Nicholas:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;an update on smart-match&lt;/li&gt;&lt;li&gt;Paul Fenwick gave the position of a Perl trainer&lt;/li&gt;&lt;li&gt;the design decision of not being able to overload the left side of the smart match bothered him&lt;/li&gt;&lt;li&gt;there's more discussion there&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;c:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;optimizing Parrot and Rakudo&lt;/li&gt;&lt;li&gt;finding bottlenecks&lt;/li&gt;&lt;li&gt;fixing many of them&lt;/li&gt;&lt;li&gt;editing the Parrot book&lt;/li&gt;&lt;li&gt;doing a little more design work on nanoparrot&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Nicholas:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;how far off are you from letting other people release Rakudo?&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;the instructions are in the repository&lt;/li&gt;&lt;li&gt;they're straightforward&lt;/li&gt;&lt;li&gt;I could turn it over to Jonathan or Jerry or any number of people with ease&lt;/li&gt;&lt;li&gt;they could just do it&lt;/li&gt;&lt;li&gt;it's basically a &lt;em&gt;Makefile&lt;/em&gt; target&lt;/li&gt;&lt;li&gt;you do some prep work, run the target, then upload the tarball to the right places&lt;/li&gt;&lt;li&gt;I stole liberally from how Parrot does things&lt;/li&gt;&lt;li&gt;I can hand it off any time I get tired of making them&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Nicholas:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;so the bus number is low&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Jerry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;any plans to turn it over soon?&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;if other folks think it's important, I can do that&lt;/li&gt;&lt;li&gt;I could pick someone at YAPC::NA to do it&lt;/li&gt;&lt;li&gt;the release day is the Hackathon day there&lt;/li&gt;&lt;li&gt;we could just walk a few people through it that day&lt;/li&gt;&lt;li&gt;even if they don't upload the tarball and push the tag&lt;/li&gt;&lt;li&gt;we'll target that for the June release, even if no one else releases an official release&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Jerry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;I've been trying to get the Parrot release bus number above 10&lt;/li&gt;&lt;li&gt;we're close, which is a great place to be&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;that was evident, as yesterday's release manager couldn't make it, and Mark Glines picked it up&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Jerry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;and it was his first release&lt;/li&gt;&lt;/ul&gt;</description>
	<pubDate>Thu, 18 Jun 2009 02:08:58 +0000</pubDate>
</item>
<item>
	<title>chromatic: Perl 6 Design Minutes for 13 May 2009</title>
	<guid>http://use.perl.org/~chromatic/journal/39131?from=rss</guid>
	<link>http://use.perl.org/~chromatic/journal/39131?from=rss</link>
	<description>&lt;p&gt;The Perl 6 design team met by phone on 13 May 2009.  Larry, Allison, Patrick, Jerry, Will, Nicholas, and chromatic attended.&lt;/p&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;continuing to think about how braided languages work&lt;/li&gt;&lt;li&gt;implementing the notion in the STD parser&lt;/li&gt;&lt;li&gt;the notion of how you switch between these languages&lt;/li&gt;&lt;li&gt;now called &lt;em&gt;slangs&lt;/em&gt; &lt;/li&gt;&lt;li&gt;thinking about how macros work in embedded lexical scopes&lt;/li&gt;&lt;li&gt;if you define a role which contains a trait auxiliary definition&lt;/li&gt;&lt;li&gt;label it &lt;code&gt;is export&lt;/code&gt; &lt;/li&gt;&lt;li&gt;how does it export?&lt;/li&gt;&lt;li&gt;to which lexical scope?&lt;/li&gt;&lt;li&gt;when you do the role or what?&lt;/li&gt;&lt;li&gt;no defined way of exporting to outer&lt;/li&gt;&lt;li&gt;that's a problem in some tests&lt;/li&gt;&lt;li&gt;with &lt;code&gt;augment slang&lt;/code&gt;, we have a way of embedding grammar modifications inline&lt;/li&gt;&lt;li&gt;when do ordinary macros embedded in subscopes desugar to that sort of thing?&lt;/li&gt;&lt;li&gt; &lt;code&gt;%*LANG&lt;/code&gt; now holds the whole language braid&lt;/li&gt;&lt;li&gt;the &lt;code&gt;$*PARSER&lt;/code&gt; variable is just the &lt;code&gt;MAIN&lt;/code&gt; element of that&lt;/li&gt;&lt;li&gt;I backed off some of the errors in the STD parser to just warnings&lt;/li&gt;&lt;li&gt;don't really handle module and role long names yet&lt;/li&gt;&lt;li&gt;you get bogus &quot;can't augment&quot; warnings now&lt;/li&gt;&lt;li&gt;it thinks something isn't there that should be there and vice versa&lt;/li&gt;&lt;li&gt;fixed a test where STD needs to parse &lt;code&gt;=for&lt;/code&gt;; now it does&lt;/li&gt;&lt;li&gt;added the slang declarator so that we could augment them&lt;/li&gt;&lt;li&gt;a twigil indicates a current slang subset of the current braid&lt;/li&gt;&lt;li&gt;fixed a bug to recognize the invocant marker after an unspace&lt;/li&gt;&lt;li&gt;that was a longest-token match problem&lt;/li&gt;&lt;li&gt;the message I added about a missing block gobbled by a function is now two separate messages&lt;/li&gt;&lt;li&gt;one talks about the function which needs parens&lt;/li&gt;&lt;li&gt;the other talks about the missing block&lt;/li&gt;&lt;li&gt;they point to two different areas as a matter of clarity&lt;/li&gt;&lt;li&gt;I'm really enjoying adding clever error messages&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;Rakudo now passes 11,200+ tests&lt;/li&gt;&lt;li&gt;up by 70 tests since yesterday&lt;/li&gt;&lt;li&gt;a couple of hundred in the past week&lt;/li&gt;&lt;li&gt;mostly doing little bug fixes and refactors&lt;/li&gt;&lt;li&gt;typically, I'll start to add a feature and find some code which doesn't look right&lt;/li&gt;&lt;li&gt;then I add the feature&lt;/li&gt;&lt;li&gt;slurpy arrays and hashes weren't added properly to subs&lt;/li&gt;&lt;li&gt;always added automatically regardless of the type of &lt;code&gt;Block&lt;/code&gt; &lt;/li&gt;&lt;li&gt;I cleaned that up&lt;/li&gt;&lt;li&gt;also cleaned up lots of parameter handling in the code&lt;/li&gt;&lt;li&gt;that made &lt;em&gt;actions.pm&lt;/em&gt; 100 lines shorter, and I removed three duplicate subroutines&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;c:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;that also speeds up startup&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;every time we do that it helps&lt;/li&gt;&lt;li&gt;found a bug dealing with Unicode characters in grammars&lt;/li&gt;&lt;li&gt;prevented us from properly parsing French quotes as an angle delimiter&lt;/li&gt;&lt;li&gt;working on adding operator parsing to Rakudo today&lt;/li&gt;&lt;li&gt;define your own custom operators&lt;/li&gt;&lt;li&gt;refer to them using canonical names&lt;/li&gt;&lt;li&gt;expect to have that done today&lt;/li&gt;&lt;li&gt;they won't be lexically scoped&lt;/li&gt;&lt;li&gt;I'll work on fixing that, when we get more to lexical scopes and language braids&lt;/li&gt;&lt;li&gt;continuing to consider protoregexes and LTM in PGE&lt;/li&gt;&lt;li&gt;probably will implement contextual variables in NQP and Rakudo&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Allison:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;we'll have packages in Ubuntu soon&lt;/li&gt;&lt;li&gt;just a straight sync of the Debian packages&lt;/li&gt;&lt;li&gt;no reason to make Ubuntu-specific packages, if that works&lt;/li&gt;&lt;li&gt;working on editing the book&lt;/li&gt;&lt;li&gt;working on the calling conventions branch&lt;/li&gt;&lt;li&gt;writing a Parrot article&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Jerry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;GSoC mentors and students seem to be bonding in their bonding period&lt;/li&gt;&lt;li&gt;set up &lt;a href=&quot;http://www.parrot.org/donate/&quot;&gt;parrot.org to accept donations from individuals&lt;/a&gt; &lt;/li&gt;&lt;li&gt;there's a sidebar link under the Foundation heading&lt;/li&gt;&lt;li&gt;and we received our first donation!&lt;/li&gt;&lt;li&gt;thank you, Bradley Kuhn&lt;/li&gt;&lt;li&gt;we'll work on placement and prominence&lt;/li&gt;&lt;li&gt;think I'll give a keynote at YAPC::NA, following Larry&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;if you pay me enough, I'll run over&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;if you don't pay him, I suspect he'll run over&lt;/li&gt;&lt;li&gt;you are what stands between everybody and lunch&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Will:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;added some regression tests&lt;/li&gt;&lt;li&gt;made some stuff work in Perl 5.8.8, so we don't have to upgrade our dependency&lt;/li&gt;&lt;li&gt;wrote a script to summarize our old branches&lt;/li&gt;&lt;li&gt;convinced people to delete a bunch of old branches&lt;/li&gt;&lt;li&gt;hopefully we can weed them out&lt;/li&gt;&lt;li&gt;TPF's grant committee votes this week on the current crop of proposals&lt;/li&gt;&lt;li&gt;one of them is for Perl 6&lt;/li&gt;&lt;li&gt;if you have any comments, please post on that&lt;/li&gt;&lt;li&gt;Partcl is still dead&lt;/li&gt;&lt;li&gt;blocking on the ability to build a language from an installed Parrot&lt;/li&gt;&lt;li&gt;we've made some progress on that&lt;/li&gt;&lt;li&gt;there are still things that do not work&lt;/li&gt;&lt;li&gt;most of them have tickets&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;Rakudo's blocking on the same thing&lt;/li&gt;&lt;li&gt;Tene is working on getting Rakudo to run in its own HLL&lt;/li&gt;&lt;li&gt;he's blocking on the HLL &lt;code&gt;load_library&lt;/code&gt; problem&lt;/li&gt;&lt;li&gt;I'll have him post to the list and give an update on the ticket&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Nicholas:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;Rafael has merged his smart-match branch back into blead&lt;/li&gt;&lt;li&gt;he tried to make smart-matches match ranges&lt;/li&gt;&lt;li&gt;it won't work for various reasons&lt;/li&gt;&lt;li&gt;precedence is the wrong way around for one&lt;/li&gt;&lt;li&gt; &lt;code&gt;$foo ~~ [ 1, 2, [ 3 .. 5 ] ]&lt;/code&gt; won't work either&lt;/li&gt;&lt;li&gt;Perl 5 ranges aren't lazy&lt;/li&gt;&lt;li&gt;smart-match can't interrogate &lt;code&gt;Range&lt;/code&gt; objects lazily&lt;/li&gt;&lt;li&gt;that's why we can't emulate everything from Perl 6&lt;/li&gt;&lt;li&gt;we don't have the low-level infrastructure to do it all&lt;/li&gt;&lt;li&gt;even if we had that infrastructure, there are parsing issues&lt;/li&gt;&lt;li&gt;I don't see that coming in a hurry&lt;/li&gt;&lt;li&gt;if someone implements lazy ranges, maybe someone can add them to smart-match&lt;/li&gt;&lt;li&gt;giving the enjoyment people derive from implementing such things, I'll be surprised if anyone does that&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;c:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;added some optimizations&lt;/li&gt;&lt;li&gt;heading toward the &quot;not really worth doing&quot; kind&lt;/li&gt;&lt;li&gt;fixed some bugs&lt;/li&gt;&lt;li&gt;including a Unicode parsing bug with named parameters and arguments in IMCC&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Nicholas:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;did you write about the abolition of unary equals, Patrick?&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;not yet&lt;/li&gt;&lt;li&gt;I feel badly about that&lt;/li&gt;&lt;li&gt;I need to catch up&lt;/li&gt;&lt;li&gt;there are so many interesting problems to work on&lt;/li&gt;&lt;li&gt;writing is not as interesting as working on code&lt;/li&gt;&lt;/ul&gt;</description>
	<pubDate>Tue, 16 Jun 2009 20:14:44 +0000</pubDate>
</item>
<item>
	<title>Andrew Whitworth: Parrot 1.3.0 &quot;Andean Swift&quot;</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-4045657546822076573</guid>
	<link>http://wknight8111.blogspot.com/2009/06/on-behalf-of-parrot-team-im-proud-to.html</link>
	<description>&lt;p&gt;I put out the 1.3.0 release earlier this afternoon, here's the release announcement:&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;On behalf of the Parrot team, I'm proud to announce Parrot 1.3.0 &quot;Andean Swift.&quot; &lt;a href=&quot;http://parrot.org/&quot;&gt;Parrot&lt;/a&gt; is a virtual machine aimed at running all dynamic languages.&lt;/p&gt;&lt;p&gt;Parrot 1.3.0 is available on &lt;a href=&quot;ftp://ftp.parrot.org/pub/parrot/releases/devel/1.3.0/&quot;&gt;Parrot's FTP site&lt;/a&gt;, or &lt;a href=&quot;http://parrot.org/download&quot;&gt;follow the download instructions&lt;/a&gt;.  For those who would like to develop on Parrot, or help develop Parrot itself, we recommend using &lt;a href=&quot;http://subversion.tigris.org/&quot;&gt;Subversion&lt;/a&gt;  on &lt;a href=&quot;https://svn.parrot.org/parrot/trunk/&quot;&gt;our source code repository&lt;/a&gt; to get the latest and best Parrot code.&lt;/p&gt;&lt;p&gt;Parrot 1.3.0 News:&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;- Core&lt;br /&gt;+ Optimized parts of the IO system&lt;br /&gt;+ Fixed inheritance hierarchy of FileHandle and Socket PMC types&lt;br /&gt;+ Fixed leaks involving subroutines and Parrot_Context&lt;br /&gt;+ Cleaned up and refactored GC internals, including fixes and optimizations&lt;br /&gt;+ Optimized PMC class manipulations to use type numbers instead of string names&lt;br /&gt;+ Fixed problems involving hashval calculations in strings&lt;br /&gt;+ Removed unnecessary MULTI dispatches in built-in PMCs&lt;br /&gt;+ Fixed memory leaks involving PMCs that were not properly destroyed&lt;br /&gt;+ Fixed creation of PMCProxy PMCs in correct namespaces&lt;br /&gt;+ Added preliminary Pipe support&lt;br /&gt;+ Fixed cloning of Object PMCs&lt;br /&gt;+ Added root_new opcode&lt;br /&gt;+ Added initial versions of Packfile PMCs with read/write capabilities&lt;br /&gt;- Compilers&lt;br /&gt;+ Fixed several memory leaks in IMCC&lt;br /&gt;+ Updated PCT to use root_new opcode&lt;br /&gt;+ Added support for keyword &quot;self&quot; in NQP&lt;br /&gt;- Documentation&lt;br /&gt;+ Improved and expanded /docs/book&lt;br /&gt;+ Updated project documentation&lt;br /&gt;+ Defined 'experimental' status and procedures in DEPRECATED.pod&lt;br /&gt;- Miscellaneous&lt;br /&gt;+ Cleaned code and improved code-level documentation&lt;br /&gt;+ Various bugfixes, code cleanups, and coding standard fixes&lt;br /&gt;+ Added an experimental compiler library to help use PIR libraries from HLLs&lt;br /&gt;+ Updated OpenGL library and examples to support experimental HLL import&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;Thanks to all our contributors for making this possible, and our sponsors for supporting this project.  Our next release is 21 July 2009.&lt;br /&gt;&lt;br /&gt;Enjoy!&lt;/blockquote&gt;&lt;br /&gt;I picked the name &quot;Andean Swift&quot; to pay homage to the serious optimization work we've done this month. I wanted a fast bird, and naturally I thought of using &quot;Peregrine Falcon&quot; first. However, considering chromatic's awesome work in plugging memory leaks, I thought it would be more fitting to pick a bird that was both fast &lt;i&gt;and&lt;/i&gt; small. We can reserve &quot;peregrine falcon&quot; for a future optimized Parrot &lt;i&gt;par excellence&lt;/i&gt;. Maybe that will be the one where we introduce the &lt;a href=&quot;http://wknight8111.blogspot.com/2009/06/l1-language-of-parrot-internals.html&quot;&gt;super-fast L1 operations&lt;/a&gt;, or a &lt;a href=&quot;https://trac.parrot.org/parrot/wiki/GCTasklist&quot;&gt;faster concurrent GC&lt;/a&gt;, or something else extraordinary.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-4045657546822076573?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Tue, 16 Jun 2009 20:13:02 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>chromatic: Perl 6 Design Minutes for 06 May 2009</title>
	<guid>http://use.perl.org/~chromatic/journal/39125?from=rss</guid>
	<link>http://use.perl.org/~chromatic/journal/39125?from=rss</link>
	<description>&lt;p&gt;The Perl 6 design team met by phone on 06 May 2009.  Larry, Allison,
Patrick, Nicholas, and chromatic attended.&lt;/p&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;refactored my phone&lt;/li&gt;&lt;li&gt;refactored various functions&lt;/li&gt;&lt;li&gt; &lt;code&gt;comb&lt;/code&gt; now defaults to matching single characters&lt;/li&gt;&lt;li&gt;a &lt;code&gt;words&lt;/code&gt; method now does what &lt;code&gt;comb&lt;/code&gt; used to do&lt;/li&gt;&lt;li&gt;did some work on &lt;code&gt;pick&lt;/code&gt; &lt;/li&gt;&lt;li&gt;looked at most of the functions in containers to see whether they out to return a &lt;code&gt;List&lt;/code&gt; or a &lt;code&gt;Capture&lt;/code&gt; which returns an &lt;code&gt;Item&lt;/code&gt; &lt;/li&gt;&lt;li&gt;depends on whether the function would ever be used to pull a single thing out&lt;/li&gt;&lt;li&gt;whether people expected it to do the right thing as an &lt;code&gt;Item&lt;/code&gt; &lt;/li&gt;&lt;li&gt; &lt;code&gt;pick&lt;/code&gt; is one of those functions&lt;/li&gt;&lt;li&gt;worked on the semantics of &lt;code&gt;has&lt;/code&gt; &lt;/li&gt;&lt;li&gt;the initializer semantics; the syntax hasn't changed&lt;/li&gt;&lt;li&gt;worked on the relationship between multiple &lt;code&gt;has&lt;/code&gt; if you have multiple attributes&lt;/li&gt;&lt;li&gt;straightened out a mismatch between prefix parsing specification and implementation&lt;/li&gt;&lt;li&gt;turned the term &quot;protoobject&quot; into &quot;type object&quot;&lt;/li&gt;&lt;li&gt;thinking about the notion of braided languages&lt;/li&gt;&lt;li&gt;Perl isn't a single language&lt;/li&gt;&lt;li&gt;also a regexp language, a quoting language, a quasi-quoting language&lt;/li&gt;&lt;li&gt;they hand off to each other&lt;/li&gt;&lt;li&gt;they have to keep track of each other; I call that a &quot;braid&quot;&lt;/li&gt;&lt;li&gt;how you override one language in another&lt;/li&gt;&lt;li&gt;how do you handle regexp language changes from regular Perl, when you're not in the regexp language at the time?&lt;/li&gt;&lt;li&gt;thinking about how to get the derivations to work correctly&lt;/li&gt;&lt;li&gt;when you parse a regexp or a quote&lt;/li&gt;&lt;li&gt;now instead of starting at a language like &lt;code&gt;q&lt;/code&gt;, it starts at the current &lt;code&gt;q&lt;/code&gt;-ish language in your braid&lt;/li&gt;&lt;li&gt;in support of that, I implemented temporization of context variables in &lt;code&gt;gimme5&lt;/code&gt; &lt;/li&gt;&lt;li&gt;used to temporize current braids to a lexical scope&lt;/li&gt;&lt;li&gt;added a block after &lt;code&gt;try&lt;/code&gt; in parsing&lt;/li&gt;&lt;li&gt;it uses that rather than parsing the block as the first argument of a list operator&lt;/li&gt;&lt;li&gt;likewise the other statement prefix operators&lt;/li&gt;&lt;li&gt;added the auxiliary &lt;code&gt;hides&lt;/code&gt; trait&lt;/li&gt;&lt;li&gt;the &lt;code&gt;\c&lt;/code&gt; notation for characters allows any radix of integer inside the list&lt;/li&gt;&lt;li&gt;the &lt;code&gt;\c&lt;/code&gt;, &lt;code&gt;\o&lt;/code&gt;, and &lt;code&gt;\x&lt;/code&gt; notations all parse consistently now&lt;/li&gt;&lt;li&gt;enums are parsed more correctly&lt;/li&gt;&lt;li&gt;they don't give bogus duplicate warnings&lt;/li&gt;&lt;li&gt;if you declare a lexical symbol with &lt;code&gt;::&lt;/code&gt; in it, assumes you're referring to a subpackage of the current lexical scope&lt;/li&gt;&lt;li&gt;means something different from a symbol intended to scan outward&lt;/li&gt;&lt;li&gt;along with the notion of braided languages and derivability, derived languages can add more parser variables (&lt;code&gt;$?foo&lt;/code&gt;) with a virtual function for lookup&lt;/li&gt;&lt;li&gt;avoids clobbering the core definitions&lt;/li&gt;&lt;li&gt;worked on role parameters&lt;/li&gt;&lt;li&gt;they're now in the role's pad, like normal signature parameters&lt;/li&gt;&lt;li&gt;started playing with the &lt;code&gt;YOU_ARE_HERE&lt;/code&gt; stub used to define the effective insertion location of your code into a &lt;code&gt;Setting&lt;/code&gt; &lt;/li&gt;&lt;li&gt;determining which lexical pad to dump as the &lt;code&gt;Setting&lt;/code&gt;'s context for use by other compilation units&lt;/li&gt;&lt;li&gt;did a lot of work on error messsages&lt;/li&gt;&lt;li&gt;some of my &lt;code&gt;||&lt;/code&gt;s suppressed panic messages&lt;/li&gt;&lt;li&gt;more useful error message on the null pattern (&lt;code&gt;//&lt;/code&gt;)&lt;/li&gt;&lt;li&gt;gives a better message if you slurp your control block in the preceding expression&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;had a lot of discussions online&lt;/li&gt;&lt;li&gt;not as much coding as I like&lt;/li&gt;&lt;li&gt;seem to be answering questions for others&lt;/li&gt;&lt;li&gt;quite a bit of work on Rakudo internals refactoring&lt;/li&gt;&lt;li&gt;that'll make it easier to switch it over to be its own HLL in Parrot&lt;/li&gt;&lt;li&gt;moved things around&lt;/li&gt;&lt;li&gt;made a single constant definition we can change when we move it over to its own HLL&lt;/li&gt;&lt;li&gt;also moved all of the Parrot HLL mangling into its own source code files&lt;/li&gt;&lt;li&gt;easy for us to manage there&lt;/li&gt;&lt;li&gt;fixed some bugs&lt;/li&gt;&lt;li&gt;talked with Jonathan about refactoring the P6object implementation&lt;/li&gt;&lt;li&gt;used in Rakudo and PCT for Perl 6 object-like behaviors&lt;/li&gt;&lt;li&gt;he's working on that refactoring now&lt;/li&gt;&lt;li&gt;found and fixed a couple of bugs handling implicit slurpy positionals&lt;/li&gt;&lt;li&gt;made Rakudo's standard IO handles default to UTF-8 encoding&lt;/li&gt;&lt;li&gt;gives people behavior more like they expect&lt;/li&gt;&lt;li&gt;working on changes to the &lt;code&gt;Array&lt;/code&gt; and &lt;code&gt;List&lt;/code&gt; implementation&lt;/li&gt;&lt;li&gt;currently &lt;code&gt;List&lt;/code&gt; inherits from &lt;code&gt;ResizablePMCArray&lt;/code&gt; &lt;/li&gt;&lt;li&gt;we'll change that to contain it&lt;/li&gt;&lt;li&gt;that should clean up a lot of behavior&lt;/li&gt;&lt;li&gt;Rakudo passed the 11,000 spectest mark as of two days ago&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Allison:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;spent some time on ticket, milestone, and roadmap maintenance&lt;/li&gt;&lt;li&gt;helping other people start or continue their tasks&lt;/li&gt;&lt;li&gt;launched the install PDD out of draft&lt;/li&gt;&lt;li&gt;it doesn't address every question, but I cleaned out all of the inaccuracies&lt;/li&gt;&lt;li&gt;fits our current plan&lt;/li&gt;&lt;li&gt;probably needs more expansion when we figure out the source of some of our problems building Rakudo and Partcl&lt;/li&gt;&lt;li&gt;the general problem is that we've built all of our languages from the build tree, never and installed Parrot&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;c:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;I've been explaning Perl 6 roles on my new weblog&lt;/li&gt;&lt;li&gt;lots of feedback&lt;/li&gt;&lt;li&gt;still lots of explaining to do&lt;/li&gt;&lt;li&gt;also been profiling Parrot and Rakudo startup&lt;/li&gt;&lt;li&gt;Parrot's a lot faster now (cotto and bacek's work on vtable init helped immensely)&lt;/li&gt;&lt;li&gt;Rakudo's getting faster, but it has a ways to go&lt;/li&gt;&lt;li&gt;will keep working on that, but the progress has been decent with little investment&lt;/li&gt;&lt;li&gt;discussed exception handling with Allison&lt;/li&gt;&lt;li&gt;came up with a preliminary design to handle the interior runloop exit there&lt;/li&gt;&lt;li&gt;just syntax to hide tricky semantics&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;when dealing with exceptions, handlers, and returns for subroutines&lt;/li&gt;&lt;li&gt;it'd be nice to force a return from a subroutine higher up in the caller chain&lt;/li&gt;&lt;li&gt;akin to Perl 6's &lt;code&gt;leave&lt;/code&gt; semantics&lt;/li&gt;&lt;li&gt;trying to do that without throwing an exception....&lt;/li&gt;&lt;li&gt;if we do it with exceptions requires every block to have a handler&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Allison:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;invoke the return continuation several levels back?&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;is that easily doable at this point&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Allison:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;we have all of the ability for that, but no syntax for it&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;I don't necessarily need syntax for it&lt;/li&gt;&lt;li&gt;the natural approach is to find the appropriate caller&lt;/li&gt;&lt;li&gt;I need to do that anyway&lt;/li&gt;&lt;li&gt;then ask for its &lt;code&gt;ReturnContinuation&lt;/code&gt; &lt;/li&gt;&lt;li&gt;then invoke that with the values I want to return to its caller&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;c:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;makes sense to me&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;that may exist in PIR syntax like that anyway&lt;/li&gt;&lt;li&gt;if the easy invoke doesn't work, use some combination of &lt;code&gt;set_returns&lt;/code&gt; &lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Allison:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;not sure if we have in PIR right now the way to ask the caller for its return continuation&lt;/li&gt;&lt;li&gt;you can do it from C&lt;/li&gt;&lt;li&gt;we can add something which does that&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;if I ask for a &lt;code&gt;Sub&lt;/code&gt;'s current context&lt;/li&gt;&lt;li&gt;I could write a method on a sub to do that&lt;/li&gt;&lt;li&gt;it'll be easier and nicer when our contexts are PMCs&lt;/li&gt;&lt;li&gt;as an intermediate case, that would be it&lt;/li&gt;&lt;li&gt;related to that, this might be there too&lt;/li&gt;&lt;li&gt;is there a way for a &lt;code&gt;Sub&lt;/code&gt; to register behavior to execute just before it exits&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Allison:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;are those like the &lt;code&gt;LEAVE&lt;/code&gt; hooks in Perl 6?&lt;/li&gt;&lt;li&gt;we have a place to store them now&lt;/li&gt;&lt;li&gt;we don't right now have a way of flagging a particular handler to execute at block scope exit&lt;/li&gt;&lt;li&gt;would it make sense to call that an event?&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;it might&lt;/li&gt;&lt;li&gt;before saying what we do and don't have&lt;/li&gt;&lt;li&gt;one piece of this is that there's still a &lt;code&gt;push_action&lt;/code&gt; opcode&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Allison:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;it never worked&lt;/li&gt;&lt;li&gt;we're removing it&lt;/li&gt;&lt;li&gt;the global stack never synchronized with continuations&lt;/li&gt;&lt;li&gt;it dummied up to work, but it doesn't have the automatic stack cleanup behavior&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;the other possibility is the presence of &lt;code&gt;ONEXIT&lt;/code&gt; or &lt;code&gt;LEAVE&lt;/code&gt; hooks on &lt;code&gt;Sub&lt;/code&gt;s in Parrot&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Allison:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;do you want all &lt;code&gt;Sub&lt;/code&gt;s to have that&lt;/li&gt;&lt;li&gt;or at runtime would you want to attach a handler to that sub?&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;it might be nice to have that at compile time&lt;/li&gt;&lt;li&gt;I suspect it'll end up being an attached block&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Allison:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;can we tie that cleanly with other execution pieces?&lt;/li&gt;&lt;li&gt; &lt;code&gt;NEXT&lt;/code&gt; and &lt;code&gt;LAST&lt;/code&gt; etc&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;the biggest difference with &lt;code&gt;LEAVE&lt;/code&gt; is that it's not exception-based&lt;/li&gt;&lt;li&gt;Larry thinks of it as natural to a block&lt;/li&gt;&lt;li&gt;PCT models the rest as exceptional&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Allison:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;it sounds like a handler to store in the local handler list&lt;/li&gt;&lt;li&gt;mark it so that it's clearly not an exception&lt;/li&gt;&lt;li&gt;we have handler flags -- exception, event, etc&lt;/li&gt;&lt;li&gt;we add to the execution code for &lt;code&gt;Sub&lt;/code&gt;s&lt;/li&gt;&lt;li&gt;as it returns or ends, it checks to see if there was a handler&lt;/li&gt;&lt;li&gt;invokes it if so&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;sounds good to me&lt;/li&gt;&lt;li&gt;it's come up if you're thinking about these issues anyway&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Nicholas:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;how useful is MAD that's in Perl 5 blead still?&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;I don't know&lt;/li&gt;&lt;li&gt;it may turn out to be very important&lt;/li&gt;&lt;li&gt;depends on how possible it is to write a decent Perl 5 parser in Perl 6&lt;/li&gt;&lt;li&gt;where &lt;em&gt;decent&lt;/em&gt; is a very peculiar definition meaning &quot;indecent&quot;&lt;/li&gt;&lt;li&gt;this is unknown&lt;/li&gt;&lt;li&gt;for interleaving Perl 5 and Perl 6 on various VMs, some VMs will use a Perl 5 compiler written in Perl 6&lt;/li&gt;&lt;li&gt;that may not be a solution as nice as using the real Perl 5 parser which knows its own idiosyncracies&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;c:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt; &lt;em&gt;sometimes&lt;/em&gt; it does&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;that's the point&lt;/li&gt;&lt;li&gt;I'd hate to have to have to hack it up again&lt;/li&gt;&lt;li&gt;that was a lot of work&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Nicholas:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;it seems to suffer slow bitrot&lt;/li&gt;&lt;li&gt;no one seems to try to keep it up to date&lt;/li&gt;&lt;li&gt;when people change the parser, they don't change it&lt;/li&gt;&lt;li&gt;the question is if people still use it&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;the vision is still to have a Perl 5 to Perl 6 translator&lt;/li&gt;&lt;li&gt;that's been on hold until we have a viable target to translate to&lt;/li&gt;&lt;li&gt;the demand for that will re-arise at some point&lt;/li&gt;&lt;li&gt;if it bitrots, it bitrots&lt;/li&gt;&lt;li&gt;that doesn't bother me as much as if people felt like ripping it out&lt;/li&gt;&lt;li&gt;the way to unbitrot it was roundtripping the test suite and fixing any problems&lt;/li&gt;&lt;li&gt;we'd just go back to doing that again until everything was reannotated the way it needs to be&lt;/li&gt;&lt;li&gt;the standard for when you know you're storing enough information is being able to reproduce it&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;c:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;is there a test target to handle that?&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;I used special scripts to do that&lt;/li&gt;&lt;li&gt;didn't expect other people to maintain that&lt;/li&gt;&lt;li&gt;it's MAD for a reason&lt;/li&gt;&lt;li&gt;nobody's tried to write a Perl 5 parser in Perl 6 yet&lt;/li&gt;&lt;li&gt;it's theoretically possible&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;depending how much fidelity you need for the actual Perl 5, you can get a pretty good way&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;considering how much effort has gone into PPI, you can get a PPI-like result&lt;/li&gt;&lt;li&gt;that only takes you so far though&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Patrick:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;maybe a GSoC project next year would be for someone to start hacking something together with PPI&lt;/li&gt;&lt;li&gt;it'd be a worthwhile project&lt;/li&gt;&lt;/ul&gt;&lt;p&gt; &lt;strong&gt;Larry:&lt;/strong&gt; &lt;/p&gt;&lt;ul&gt;
&lt;li&gt;we already have a Perl 5 to Perl 6 translator based on the state of MAD&lt;/li&gt;&lt;/ul&gt;</description>
	<pubDate>Tue, 16 Jun 2009 01:38:38 +0000</pubDate>
</item>
<item>
	<title>Andrew Whitworth: Pair Programming</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-4620557888219052167</guid>
	<link>http://wknight8111.blogspot.com/2009/06/pair-programming.html</link>
	<description>I was &lt;a href=&quot;http://irclog.perlgeek.de/parrot/2009-06-15#i_1241981&quot;&gt;talking with chromatic tonight&lt;/a&gt; about Parrot development. One thing that we both want to talk about at YAPC is development priorities, although admittedly we want to talk about them from different angles. chromatic suggests that group work, even pairing up would be a great way to get high-quality code written for important tasks, and I agree. Some of the best work in Parrot-land has been written by pairs of people who are highly synchronized. Just this month &lt;a href=&quot;http://wknight8111.blogspot.com/2009/06/io-speedup-more-dramatic-still.html&quot;&gt;Infinoid and I did some amazing work&lt;/a&gt; on the IO system together and squeezed a lot of performance out of the bird.&lt;br /&gt;&lt;br /&gt;I've said before and I'll say again, that getting people to focus in a volunteer-driven community is like herding cats. You just can't force volunteers to work on any one particular task, although I am a firm believer that you can do a lot to motivate them so the &lt;span&gt;choose to&lt;/span&gt; do what's needed. Of course, this is more of a sprint technique then a marathon one, you're not going to get people to do the work that they don't personally want to do for too long. Any longer and it leads to serious burnout.&lt;br /&gt;&lt;br /&gt;I am definitly able and willing to work on things that the project needs, although I have plenty of &lt;a href=&quot;http://wknight8111.blogspot.com/2009/05/my-personal-roadmap-for-parrot-20.html&quot;&gt;my own pet projects&lt;/a&gt; that provide me personal satisfaction. I am, for instance, hell-bent on &lt;a href=&quot;http://wknight8111.blogspot.com/2009/05/asynchronous-io-in-parrot.html&quot;&gt;putting AIO together&lt;/a&gt; starting this month. I've also developed a &lt;a href=&quot;http://wknight8111.blogspot.com/2009/05/gc-next-steps.html&quot;&gt;personal vendetta against the GC system&lt;/a&gt; that I plan to tackle in the not-so-distant future. Of course, I'm pretty sure the GC is going to become a community priority eventually, and then I'll just be another part of a (hopefully large) development team.&lt;br /&gt;&lt;br /&gt;When prompted, chromatic listed these few things off the cuff that he thought were current development priorities:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;http://wknight8111.blogspot.com/2009/05/calling-conventions-work.html&quot;&gt;Parrot Calling Conventions&lt;/a&gt; system refactoring and optimizing&lt;/li&gt;&lt;li&gt;Installable Parrot&lt;/li&gt;&lt;li&gt;HLLs running from an Installable Parrot&lt;/li&gt;&lt;li&gt;Fixing Multiple Dispatch semantics (which is really an ancillary part of the PCC work, I think)&lt;/li&gt;&lt;/ol&gt;To this list I would suggest that the following things are also, more or less, pre-2.0 development priorities. In no particular order:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Replace IMCC with PIRC&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://wknight8111.blogspot.com/2009/05/parrot-gc-refactor-work.html&quot;&gt;The Garbage Collector&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://wknight8111.blogspot.com/2009/04/parrot-jit-extravaganza.html&quot;&gt;The JIT system&lt;/a&gt;&lt;/li&gt;&lt;li&gt;The packfile system&lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://wknight8111.blogspot.com/2009/06/l1-language-of-parrot-internals.html&quot;&gt;L1&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;I'm sure there are a few more things that I am just not thinking about right now, but I think this is a pretty good representative list of ongoing development tasks that need some work. There are also plenty of other things which aren't priorities but would definitely be nice to have. Follow that with a long list of &quot;green fields&quot; wishlist features that aren't necessary but would be very cool to have.&lt;br /&gt;&lt;br /&gt;I'm hoping beyond hope that we can talk about all this cool stuff at &lt;a href=&quot;http://wknight8111.blogspot.com/2009/05/yapcna.html&quot;&gt;YAPC&lt;/a&gt; next week. I know the time is really only allocated for a hacking workshop, but maybe some afterhours conversation can address some of these things.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-4620557888219052167?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Mon, 15 Jun 2009 22:49:04 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>partcl: Partcl now passing 2,972 tcl spec tests</title>
	<guid>tag:blogger.com,1999:blog-134339605383818351.post-3931143117930020539</guid>
	<link>http://partcl.blogspot.com/2009/06/partcl-now-passing-2972-tcl-spec-tests.html</link>
	<description>Thanks to prompting from kbk on irc (#tcl at freenode), I finally fixed the parsing of string.test.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It had been complaining about the \udead escape in that file; That isn't really a valid codepoint, and while Tcl accepts it as if it were, parrot (which uses ICU internally) throws an exception when trying to create a string that contains it. So, (at kbk's suggestion), I settled for now to convert any codepoints in the \udead range to \ufffd. That allowed the test to parse...&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;... but it then ran out of memory, as several other tests have been doing since I started running the tests again.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I've been working with chromatic to try to provide test cases to show where the memory leaks have been coming from, but I've only been going after things I could spot with valgrind. Today, someone on irc (#parrot at irc.parrot.org) posted a very small sample program that eventually ran out of memory... because the garbage collector apparently wasn't.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The small PIR example allowed chromatic to identify and fix that issue in parrot, and partcl has now reclaimed several files which had been exhausting a 1/2 gig of memory.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;http://code.google.com/p/partcl/source/browse/trunk/docs/spectest-current.txt&quot;&gt;Current results&lt;/a&gt;, over 67 test files that run to completion:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt; Total   5145     Passed  2972      Skipped 1352       Failed  821&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;That's the highest number of attempted &amp;amp; passing tests since I &lt;a href=&quot;http://code.google.com/p/partcl/source/browse/trunk/docs/spectest-progress.csv&quot;&gt;started keeping track&lt;/a&gt;. It's an additional 1181 passing since the 8th, when I started running the spec tests again.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/134339605383818351-3931143117930020539?l=partcl.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Sat, 13 Jun 2009 00:03:26 +0000</pubDate>
	<author>noreply@blogger.com (Coke)</author>
</item>
<item>
	<title>Andrew Whitworth: L1: The possibilities</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-222306375041254613</guid>
	<link>http://wknight8111.blogspot.com/2009/06/l1-possibilities.html</link>
	<description>I know a little bit about microprocessor design (it is what I focused on in gradschool), and the whole idea of L1 reminds me very much of a type of microcode. A &lt;a href=&quot;http://en.wikipedia.org/wiki/Microcode&quot;&gt;microcode is&lt;/a&gt;, in this context, is a very small set of instructions, very close to the underlying hardware and blindingly fast. A processor like an Intel Pentium 4 doesn't execute the vast expansive x86 instruction set directly. In most cases, it has a translation module that converts x86 opcodes into a stream of RISC-like microcodes which are then executed by a small, super-fast microcore. In some cases the minicore that executes the microcodes even runs at a faster clock speed then the rest of the processor does, since it's operations are so simple and atomic to execute.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://irclog.perlgeek.de/parrot/2009-06-11&quot;&gt;We talked about this issue a lot yesterday&lt;/a&gt;, and I forsee that we will do a lot more talking about it all in the future too.&lt;br /&gt;&lt;br /&gt;chromatic envisions &lt;a href=&quot;http://irclog.perlgeek.de/parrot/2009-06-11#i_1232726&quot;&gt;L1 as being a subset of PIR&lt;/a&gt;. That is, L1 opcodes are just regular PASM opcodes, but the subset of fundamental operations in which all other opcodes are defined.  Only the L1 opcodes are written in C, and the rest, potentially, are written in terms of L1. I envision L1 as being a &lt;a href=&quot;http://irclog.perlgeek.de/parrot/2009-06-11#i_1232784&quot;&gt;completely separate layer&lt;/a&gt;, and not being directly usable by the programmer. Specifically, I don't like mixing together opcodes that are written in C, and opcodes that are written in L1, and expecting Parrot to figure out the difference at runtime. I would like to see L1 that is written strictly in C, and PASM ops which are strictly written in L1. L1 not only is a small set of atomic operations, but they are very simple, easy to parse and decode, and extremely fast. I'm thinking about them being three-argument operations, which opens all sorts of doors for optimization.&lt;br /&gt;&lt;br /&gt;Here's how I think execution would go using this kind of scheme:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;L1 ops are written in C and are all trivially simple: Individual operations or individual calls to internal functions, or something simple like that. They need to be trivially simple to write and trivially simple to JIT.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;PASM opcodes are written in terms of L1 instructions.&lt;/li&gt;&lt;li&gt;At build time, PASM opcodes are &quot;compiled&quot; into a sequence of L1 byte code (L1BC) values in an array, instead of being &quot;compiled&quot; into standards-compliant C code and then compiled again into machine code.&lt;/li&gt;&lt;li&gt;At execution time, user-defined L1 overlays are added so that existing ops and PMCs can be redefined or extended to add specific information if needed.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;At execution time, executing PIR code is converted into PBC, which in turn is used to index the sequences of L1 code that represents the ops. These sequences are strung together to form an execution stream of L1BC which is executed by the core (or JITted, or whatever).&lt;/li&gt;&lt;/ol&gt;If the mapping between PIR-&gt;L1 is simple and direct enough, the conversion process will be very speedy. pmichaud and chromatic suggested that we would have a full-fledged compiler for it, but I think something closer to a table-lookup assembler would be just fine, especially if we were using sequences three-argument ops. Of course, L1 code would only be human-readable at build time, once we compile it into L1BC it is essentially frozen that way forever and never needs to be human-readable (and therefore never compiled) again. So, it doesn't &lt;span&gt;really&lt;/span&gt; matter how complicated the compilation process is, although I always tend towards simplicity.&lt;br /&gt;&lt;br /&gt;Having all ops represented as frozen sequences of L1BC opens up a few options for us, some of which are very enticing indeed:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;A pseudo-JIT, where we convert PBC on the fly to a straight L1BC stream. This saves us from having to look up L1BC segments for each op repeatedly.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;We still store packfiles using PBC, because it's a more compact format (although we might consider a &quot;super fast&quot; frozen L1BC stream format too)&lt;/li&gt;&lt;li&gt;Overridable and dynamically extensible ops. If you use a custom PASM op in your code (written in L1, of course), you can save that custom definition in your packfiles and then execute your custom ops on any Parrot. Currently, custom ops are written in C and form a dynamicly linked library which would need to be included with your program in order to execute properly. With L1, this mechanism all disappears. Also, you could override existing op definisions locally, by supplying a custom L1BC stream to use for it instead.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Overridable and dynamically extendable PMCs. Same as above, but with PMC types instead of ops. PMC types can be defined at compile time and included in the packfile as a custom L1BC stream. No need to compile dynpmc dynamic libraries and shuffle them around, they can be included in the packfile directly.&lt;/li&gt;&lt;li&gt;Serious optimization potential. If you're willing to spend a few cycles optimizing, a unified L1BC stream makes for quite an attractive optimization target. Right now we can't optimize much because execution is flowing between C and PIR and it's just impossible to make any predictions. As chromatic is quick to point out, we suddenly gain the ability to do &lt;a href=&quot;http://irclog.perlgeek.de/parrot/2009-06-11#i_1232905&quot;&gt;escape analysis, code inlining, duplicate and unused code removal&lt;/a&gt;, and other optimizations that we can't do now. Plus, having more information about code execution will allow us to make a smarter garbage collector, register allocator, etc.&lt;/li&gt;&lt;li&gt;Built-in PMCs and user-defined PMCs will have all their VTABLEs written in L1 instead of in C. the VTABLE structure contains pointers to L1 streams instead of C function pointers. Overriding a vtable method becomes transparent, and there is no functional difference at all between built-in and user-defined PMCs. Also, there is the potential that built-in PMC VTABLEs could be locally overridden and then restored later, or copied to another PMC type, or something else entirely. Lots of potential here.&lt;/li&gt;&lt;li&gt;If PMCs and OPS are ultimately compiled into L1, there's no saying that they all have to be hand written in L1. They could be written in PIR, or NQP, or Perl6, or TCL. Imagine using Perl 6 to write parts of Parrot that run the Perl 6 compiler which itself is written in Perl 6? Bootstrapping indeed, and only the start of the potential uses!&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;So these are some of the enticing possibilities that arise from this method, and I think everybody will agree that some of these are very valuable indeed. As I mentioned before, I do have some differences of opinion from chromatic, and I do get the feeling that he's given more deep consideration to some points then I have, but that doesn't stop me from talking about it here. What are blogs for if not the easy dissemination of ill-informed opinions? If chromatic wanted to write a guest-post here to present his vision for what L1 is and how it works, I would be happy to have it. Or, if he posted a discussion of it on his own blog, I would definitely link it. I am definitely a congregant in the church of chromatic.&lt;br /&gt;&lt;br /&gt;So, how do we get from here to there? This is the million dollar question, and without a solid roadmap we may never be able to implement such radical changes to Parrot. On this point, &lt;a href=&quot;http://www.modernperlbooks.com/mt/2009/06/how-to-change-a-running-system.html&quot;&gt;chromatic has already written a partial plan&lt;/a&gt;, although he mostly focuses on rewriting PMCs in something other then C. I'll adapt his basic timeline, but add a few of my specifics (which, as I've mentioned before, may be at odds with what chromatic thinks, and may actually be quite rediculous):&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Create a PCT-based compiler for PMCs and OPs that reads the current mismash of C-like code and emits ordinary C code, which is what our Perl5-based build system does already.&lt;/li&gt;&lt;li&gt;Develop a compiler that converts L1 to equivalent C code.&lt;/li&gt;&lt;li&gt;Replace the current Perl5-based build system with the PCT-based one&lt;/li&gt;&lt;li&gt;Change the PCT-based compiler to emit L1, and use the L1 to create the C code of the PMCs and Ops&lt;/li&gt;&lt;li&gt;Develop a runcore (nanoparrot) which executes L1 directly, including all the necessary control flow to interact ops with PMC vtables, etc.&lt;/li&gt;&lt;li&gt;Remove the L1-&gt;C step, and have the L1 code generated by the PCT-based OP and PMC compiler(s) be executed by Parrot directly.&lt;/li&gt;&lt;/ol&gt;What's remarkable about all this is that we add a new layer to Parrot, but the end result will be &lt;span&gt;less&lt;/span&gt; complexity and &lt;span&gt;better&lt;/span&gt; performance overall. At least, that's the hope. I'm planning at least one more post about L1 to talk about what this beast may look like, although with &lt;a href=&quot;http://wknight8111.blogspot.com/2009/06/wittie-wiki-project.html&quot;&gt;other things on my plate&lt;/a&gt; and &lt;a href=&quot;http://wknight8111.blogspot.com/2009/06/parrot-final-countdown.html&quot;&gt;the release on tuesday&lt;/a&gt;, I don't know when I will be posting it.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-222306375041254613?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Fri, 12 Jun 2009 10:57:56 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>Andrew Whitworth: L1: The Language of Parrot Internals</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-1092988425245035236</guid>
	<link>http://wknight8111.blogspot.com/2009/06/l1-language-of-parrot-internals.html</link>
	<description>&lt;a href=&quot;http://wknight8111.blogspot.com/2009/04/parrot-of-future.html&quot;&gt;A while back I mentioned&lt;/a&gt; using a special-purpose small language to be used for implementing some of the Parrot internals, such as PMC VTABLEs, and OPS. Well, the idea is slowly taking shape and it's going by the name L1. I don't know the exact genesis of the name, so I can't point you to a link containing a &quot;let's call this thing L1!&quot; quote, but that's the name of it, and here's some discussion. By way of disclaimer, this all isn't anywhere on my &lt;a href=&quot;http://wknight8111.blogspot.com/2009/05/my-personal-roadmap-for-parrot-20.html&quot;&gt;personal pre-2.0 roadmap&lt;/a&gt;, but I do intend to offer my moral support where possible, and look very closely at this issue if it hasn't been resolved before 2.0.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://irclog.perlgeek.de/parrot/2009-06-11#i_1230213&quot;&gt;cotto and bacek&lt;/a&gt; have been doing a lot of great work on a PCT-based PMC parser, and ultimately we hope that such a bootstrapping tool would help enable ubiquitous use of L1. I'll talk more about that later.&lt;br /&gt;&lt;br /&gt;To understand why this is needed, and to put into context some of the things I am going to talk about in this post, let's look at a small example that comes directly from the &lt;a href=&quot;http://www.gnu.org/projects/dotgnu/libjit-doc/libjit_3.html&quot;&gt;libJIT documentation&lt;/a&gt;. Let's take a small function to multiply two numbers together and return a result:&lt;br /&gt;&lt;pre&gt;int mul_add(int x, int y, int z)&lt;br /&gt;{&lt;br /&gt;return x * y + z;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;If we want to compile this operation at runtime with &lt;a href=&quot;http://freshmeat.net/projects/libjit/&quot;&gt;libJIT&lt;/a&gt;, we would have to do this:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;jit_context_t context;&lt;br /&gt;context = jit_context_create();&lt;br /&gt;jit_context_build_start(context);&lt;br /&gt;jit_function_t function;&lt;br /&gt;function = jit_function_create(context, signature);&lt;br /&gt;jit_type_t params[3];&lt;br /&gt;jit_type_t signature;&lt;br /&gt;params[0] = jit_type_int;&lt;br /&gt;params[1] = jit_type_int;&lt;br /&gt;params[2] = jit_type_int;&lt;br /&gt;signature = jit_type_create_signature&lt;br /&gt; (jit_abi_cdecl, jit_type_int, params, 3, 1);&lt;br /&gt;jit_value_t x, y, z;&lt;br /&gt;x = jit_value_get_param(function, 0);&lt;br /&gt;y = jit_value_get_param(function, 1);&lt;br /&gt;z = jit_value_get_param(function, 2);&lt;br /&gt;jit_value_t temp1, temp2;&lt;br /&gt;temp1 = jit_insn_mul(function, x, y);&lt;br /&gt;temp2 = jit_insn_add(function, temp1, z);&lt;br /&gt;jit_insn_return(function, temp2);&lt;br /&gt;jit_function_compile(function);&lt;br /&gt;jit_context_build_end(context);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;What this listing shows is not the function itself, but how to tell the computer to write the function itself at runtime. The computer will build and compile the function into executable code at runtime and then will be able to execute it. The benefit to JIT is that the compiled code pieces are reusable, so all the overhead of describing the function only needs to occur once and the resulting machine code can be executed over and over again. The mechanics of JIT aren't really important for this discussion, but what is important is to see that the two versions of the code are very different from each other, and if we're generating C code at runtime we potentially need to generate several different versions of each code snippet.&lt;br /&gt;&lt;br /&gt;Currently, we do JIT by writing the opcode definitions in a C-like script in one place, and writing JIT versions of them in another place. And when one doesnt match the other, there's a problem. One thing that we absolutely need in Parrot, for our own sanity if nothing else, is the ability to specify operations using a common, simplified, non-C small language that can be converted into multiple forms and executed in multiple ways, as necessary. This, I think, is a good use for L1: An abstraction layer that enables us to write an almost behavioral description of a piece of code and have that used at build time to produce all the various pieces of C code and other code that we need.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.modernperlbooks.com/mt/index.html&quot;&gt;chromatic&lt;/a&gt; has a slightly different conception of what L1 could be, although I don't think it's entirely incompatible from what I was talking about above. Instead of simply being a common front-end language that gets converted into other stuff for compilation and execution, chromatic suggests that it could be used in the virtual machine in the same way that &lt;a href=&quot;http://en.wikipedia.org/wiki/Microcode&quot;&gt;microcodes&lt;/a&gt; are used in a hardware processor. A small, fast Parrot core (called &quot;nanoparrot&quot;) would execute the L1 microcodes directly. There are some different ideas here about what the relationship will be between PIR/PASM and L1, but I will talk about those differences later. chromatic also hopes that a pure L1 execution environment would be self-contained and save us from the frequent switching between C and PIR calling conventions. Let's explore that idea a little bit more.&lt;br /&gt;&lt;br /&gt;PIR code is executing and reaches a particular operation which internally calls PCCINVOKE on a PIR subroutine. This creates a new runloop to execute the new PIR function, which returns a value to PCCINVOKE, which in turn returns results back to PIR. All the while, marshaling data back and forth between two very different environments (C and PIR). Likewise, consider the case of PIR code executing and throwing an exception. Parrot searches for a handler (which itself may be PIR or C, which in turn calls a function in PIR or C again, &lt;span&gt;ad infinitem&lt;/span&gt;), executes it, and possibly returns execution to where it was. We're jumping back and forth between C and PIR for control flow, creating runloops and shuffling data all too frequently. The situation, in short, is complex and unsustainable in the long run. Plus, there are &lt;a href=&quot;http://wknight8111.blogspot.com/2009/06/io-pudding-contains-proof.html&quot;&gt;serious performance problems&lt;/a&gt; associated with all this jumping between PIR and C.&lt;br /&gt;&lt;br /&gt;Now consider the alternative of a pure L1 execution environment, where PASM opcodes are little more than named sequences of L1 opcodes. L1 code is executing, and throws an exception. A return continuation is created and passed to an L1-based hander, which returns control through the return continuation. No C code involved. Almost too good to be true. Almost. The case of calling into L1 code from C is a little bit more tricky but not impossible. Instead of passing a return continuation we pass a C-based return continuation which will probably consist of a cached image of the interpreter structure and a jump point or something. In any case we still save on performance because the arguments get passed in PIR registers and that's where they stay.&lt;br /&gt;&lt;br /&gt;What I personally would like from L1 is a unified solution, something that meets these requirements:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Has to be easy, trivially easy, to JIT.&lt;/li&gt;&lt;li&gt;Has to be a small set of operations capable of implementing all other ops&lt;/li&gt;&lt;li&gt;Should be suitable, at least in the long term, for implementing VTABLEs and METHODs in PMCs.&lt;/li&gt;&lt;/ol&gt;chromatic suggests that L1 should be a subset of PIR, but I'm not sure I agree with that. I am thinking right now (and I may change my mind as I think about this more) that it should be a separate assembly-level language entirely. There are a number of reasons for that, and I will discuss them later. I have plenty more to say about L1, and I'll do that in later posts.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-1092988425245035236?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Thu, 11 Jun 2009 22:16:09 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>Andrew Whitworth: Parrot: The Final Countdown</title>
	<guid>tag:blogger.com,1999:blog-4146794174400139442.post-1286647642353751900</guid>
	<link>http://wknight8111.blogspot.com/2009/06/parrot-final-countdown.html</link>
	<description>Okay, so it's not quite final, but we are one week away from the next release, and I'm the release manager. I'm already &lt;a href=&quot;http://lists.parrot.org/pipermail/parrot-dev/2009-June/002345.html&quot;&gt;starting my preparation for it&lt;/a&gt;. We only have a week left, and I requested that major changes not land into trunk after Saturday, but I have high hopes that a lot of cool new things will happen soon.&lt;br /&gt;&lt;br /&gt;I asked on the list that people try to focus on a few major tasks for the release:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Update the NEWS and PLATFORMS files. Specifically, there are several platforms that haven't been updated since 2008, and it would be awesome to get them updated.&lt;/li&gt;&lt;li&gt;Priorities: HLL interop is on the roadmap for this release as being a high-priority item. Also, several developers have asked for better profiling tools. I have offered a bounty of &lt;span&gt;one batch of brownies&lt;/span&gt; (chocolate or blonde, by request) for the first person to deliver good PIR-level profiling tools, before Saturday (when I requested big changes not be made any more). Write a good code profiler, &lt;span&gt;get free brownies&lt;/span&gt;. Can't beat that.&lt;/li&gt;&lt;li&gt;There are some items in Deprecated that were eligible in 1.1. If some of those could disappear, awesome.&lt;/li&gt;&lt;li&gt;Documentation.&lt;/li&gt;&lt;li&gt;Close tickets.&lt;/li&gt;&lt;li&gt;Blog!&lt;a href=&quot;http://irclog.perlgeek.de/parrotsketch/2009-06-09#i_1225803&quot;&gt; Coke requested at #ps today that people blog about their progress &lt;/a&gt;on Parrot to help spread the message and build some interest in the progress.&lt;/li&gt;&lt;/ol&gt;The io_rewiring branch landed in trunk today and appears to have exposed a transient heisenbug. &lt;a href=&quot;http://modernperlbooks.com/mt/index.html&quot;&gt;chromatic&lt;/a&gt; found a reliable way to reproduce it, so now it's just a matter of time before one of the great Parrot minds finds the cause and resolves it. Next on the IO agenda is another branch to do some &lt;a href=&quot;http://wknight8111.blogspot.com/2009/05/lots-of-io-work-to-do.html&quot;&gt;more cleanup and optimizations&lt;/a&gt;, and to do more integrating of Socket and Pipe PMC types into the IO API. Following that, I want to kick off the &lt;a href=&quot;http://wknight8111.blogspot.com/2009/05/blocked-tasks-and-starting-aio.html&quot;&gt;AIO work&lt;/a&gt; I've been planning.&lt;br /&gt;&lt;br /&gt;Allison committed her remaining local changes to the pcc_rewiring branch, and I'm hoping that a few eyes looking over it will help resolve the remaining problems. I doubt we'll get the branch merged into trunk before the Tuesday release, but I do hope we can get it committed not long thereafter. Once that branch finally lands, I'll be ready to start on &lt;a href=&quot;http://wknight8111.blogspot.com/2009/05/turning-contexts-into-pmcs.html&quot;&gt;Garbage Collectable Contexts&lt;/a&gt;, which I've been planning for a long time too.&lt;br /&gt;&lt;br /&gt;Cotto sent me a &lt;a href=&quot;http://doc.cat-v.org/inferno/concurrent_gc/&quot;&gt;link today to a cool GC-related research&lt;/a&gt; paper that I have already gotten some fun ideas from. I don't know when I'll have time to do any GC work, but I can't wait too long: It's on &lt;a href=&quot;http://wknight8111.blogspot.com/2009/05/my-personal-roadmap-for-parrot-20.html&quot;&gt;my task list for 2.0&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;So thats the pre-1.3 release recap, plus a little extra information too. Here's hoping things go smoothly from here on out.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/4146794174400139442-1286647642353751900?l=wknight8111.blogspot.com&quot; /&gt;&lt;/div&gt;</description>
	<pubDate>Tue, 09 Jun 2009 22:45:42 +0000</pubDate>
	<author>noreply@blogger.com (Whiteknight)</author>
</item>
<item>
	<title>Jeff Horwitz: Yet Another History Lesson</title>
	<guid>http://www.smashing.org/53 at http://www.smashing.org/jeff</guid>
	<link>http://www.smashing.org/jeff/node/53</link>
	<description>&lt;p&gt;Ceiling cat demands a larger audience for &quot;A LOLCAT's History of Perl 6&quot;.  YAPC it is.  :)&lt;/p&gt;</description>
	<pubDate>Tue, 09 Jun 2009 14:01:07 +0000</pubDate>
</item>

</channel>
</rss>
