develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33687 - in branches/pdd22io_part2: . compilers/imcc compilers/ncigen compilers/ncigen/src compilers/ncigen/src/parser docs/book examples/benchmarks examples/nci ext/SQLite3 languages/WMLScript/runtime languages/WMLScript/src languages/WMLScr

From:
allison
Date:
December 8, 2008 19:37
Subject:
[svn:parrot] r33687 - in branches/pdd22io_part2: . compilers/imcc compilers/ncigen compilers/ncigen/src compilers/ncigen/src/parser docs/book examples/benchmarks examples/nci ext/SQLite3 languages/WMLScript/runtime languages/WMLScript/src languages/WMLScr
Message ID:
20081209033703.A3D23CB9AF@x12.develooper.com
Author: allison
Date: Mon Dec  8 19:37:00 2008
New Revision: 33687

Added:
   branches/pdd22io_part2/ext/SQLite3/gen_sqlite3.pl
      - copied unchanged from r33686, /trunk/ext/SQLite3/gen_sqlite3.pl
Removed:
   branches/pdd22io_part2/compilers/ncigen/gen_sqlite3.pl
   branches/pdd22io_part2/compilers/ncigen/k.h
   branches/pdd22io_part2/compilers/ncigen/kk.h
Modified:
   branches/pdd22io_part2/MANIFEST
   branches/pdd22io_part2/compilers/imcc/pbc.c
   branches/pdd22io_part2/compilers/ncigen/NCIGENP6.pm
   branches/pdd22io_part2/compilers/ncigen/src/NCIGENAST.pir
   branches/pdd22io_part2/compilers/ncigen/src/parser/actions.pm
   branches/pdd22io_part2/docs/book/ch01_overview.pod
   branches/pdd22io_part2/docs/book/ch11_pmcs.pod
   branches/pdd22io_part2/docs/book/ch12_opcodes.pod
   branches/pdd22io_part2/examples/benchmarks/oofib.pir
   branches/pdd22io_part2/examples/nci/QtHelloWorld.pasm
   branches/pdd22io_part2/ext/SQLite3/Makefile.in
   branches/pdd22io_part2/languages/WMLScript/runtime/wmlsconsole.pir
   branches/pdd22io_part2/languages/WMLScript/runtime/wmlsfloat.pir
   branches/pdd22io_part2/languages/WMLScript/runtime/wmlslang.pir
   branches/pdd22io_part2/languages/WMLScript/runtime/wmlsstring.pir
   branches/pdd22io_part2/languages/WMLScript/src/script.pir
   branches/pdd22io_part2/languages/WMLScript/t/harness
   branches/pdd22io_part2/languages/WMLScript/t/pmc/float.t
   branches/pdd22io_part2/languages/WMLScript/t/pmc/integer.t
   branches/pdd22io_part2/languages/WMLScript/t/pmc/string.t
   branches/pdd22io_part2/languages/lua/src/pmc/luanumber.pmc
   branches/pdd22io_part2/languages/lua/t/pmc/number.t
   branches/pdd22io_part2/languages/lua/t/pmc/string.t
   branches/pdd22io_part2/languages/perl6/docs/spectest-progress.csv
   branches/pdd22io_part2/languages/perl6/src/builtins/math.pir
   branches/pdd22io_part2/languages/perl6/src/classes/Object.pir
   branches/pdd22io_part2/languages/perl6/src/pmc/perl6multisub.pmc
   branches/pdd22io_part2/languages/perl6/t/spectest.data
   branches/pdd22io_part2/runtime/parrot/library/File/Spec.pir
   branches/pdd22io_part2/runtime/parrot/library/File/Spec/Win32.pir
   branches/pdd22io_part2/src/packdump.c
   branches/pdd22io_part2/src/pmc/role.pmc
   branches/pdd22io_part2/t/compilers/imcc/syn/subflags.t
   branches/pdd22io_part2/tools/dev/install_files.pl

Log:
[pdd22io] Bringing the pdd22io_part2 branch up-to-date with trunk r33686.


Modified: branches/pdd22io_part2/MANIFEST
==============================================================================
--- branches/pdd22io_part2/MANIFEST	(original)
+++ branches/pdd22io_part2/MANIFEST	Mon Dec  8 19:37:00 2008
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Sun Dec  7 15:38:53 2008 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Mon Dec  8 16:51:06 2008 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -88,9 +88,6 @@
 compilers/ncigen/NCIGENP6.pm                                []
 compilers/ncigen/README                                     []
 compilers/ncigen/config/makefiles/ncigen.in                 []
-compilers/ncigen/gen_sqlite3.pl                             []
-compilers/ncigen/k.h                                        []
-compilers/ncigen/kk.h                                       []
 compilers/ncigen/lib/Parrot/Test/NCIGENAST.pm               []
 compilers/ncigen/ncigen.pir                                 []
 compilers/ncigen/ncigen.pl                                  []
@@ -922,6 +919,7 @@
 ext/SQLite3/Makefile.PL                                     []
 ext/SQLite3/Makefile.in                                     []
 ext/SQLite3/SQLite3.pir                                     []
+ext/SQLite3/gen_sqlite3.pl                                  []
 ext/SQLite3/t/test.p6                                       []
 ext/SQLite3/test.pir                                        []
 include/parrot/atomic.h                                     [main]include

Modified: branches/pdd22io_part2/compilers/imcc/pbc.c
==============================================================================
--- branches/pdd22io_part2/compilers/imcc/pbc.c	(original)
+++ branches/pdd22io_part2/compilers/imcc/pbc.c	Mon Dec  8 19:37:00 2008
@@ -113,12 +113,15 @@
 static subs_t * find_global_label(PARROT_INTERP,
     ARGIN(const char *name),
     ARGIN(const subs_t *sym),
-    ARGOUT(int *pc))
+    ARGOUT(int *pc),
+    ARGOUT(int *sub_id))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
         __attribute__nonnull__(4)
-        FUNC_MODIFIES(*pc);
+        __attribute__nonnull__(5)
+        FUNC_MODIFIES(*pc)
+        FUNC_MODIFIES(*sub_id);
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CAN_RETURN_NULL
@@ -656,7 +659,7 @@
 PARROT_CAN_RETURN_NULL
 static subs_t *
 find_global_label(PARROT_INTERP, ARGIN(const char *name),
-    ARGIN(const subs_t *sym), ARGOUT(int *pc))
+    ARGIN(const subs_t *sym), ARGOUT(int *pc), ARGOUT(int *subid_matched))
 {
     subs_t *s;
 
@@ -665,10 +668,12 @@
     for (s = IMCC_INFO(interp)->globals->cs->first; s; s = s->next) {
         SymReg * const r = s->unit->instructions->symregs[0];
 
+        *subid_matched = r && (r->subid && (strcmp(r->subid, name) == 0));
+
         /* if names and namespaces are matching - ok */
-        if (r && ((r->subid && (strcmp(r->subid, name) == 0))
+        if (r && (*subid_matched
                     || (r->name && (strcmp(r->name, name) == 0)))
-              && ((sym->unit->_namespace && s->unit->_namespace
+                && ((sym->unit->_namespace && s->unit->_namespace
                         && (strcmp(sym->unit->_namespace->name, s->unit->_namespace->name) == 0))
                     || (!sym->unit->_namespace && !s->unit->_namespace)))
             return s;
@@ -706,9 +711,10 @@
             for (fixup = hsh->data[i]; fixup; fixup = fixup->next) {
                 int pc, pmc_const;
                 int addr = jumppc + fixup->color;
+                int subid_matched = 0;
 
                 /* check in matching namespace */
-                subs_t *s1 = find_global_label(interp, fixup->name, s, &pc);
+                subs_t *s1 = find_global_label(interp, fixup->name, s, &pc, &subid_matched);
 
                 /*
                  * if failed change opcode:
@@ -732,7 +738,7 @@
                         PARROT_ASSERT(pcc_sub);
 
                         /* if the sub is multi, don't insert constant */
-                        if (pcc_sub->nmulti)
+                        if (pcc_sub->nmulti && !subid_matched)
                             s1 = NULL;
                     }
                 }

Modified: branches/pdd22io_part2/compilers/ncigen/NCIGENP6.pm
==============================================================================
--- branches/pdd22io_part2/compilers/ncigen/NCIGENP6.pm	(original)
+++ branches/pdd22io_part2/compilers/ncigen/NCIGENP6.pm	Mon Dec  8 19:37:00 2008
@@ -77,7 +77,7 @@
     for ($node.list()) -> $x {
         $type ~= param_to_code($x);
     }
-    return ($node.name, $type);
+    return ($node.name, $type, $node.source());
 }
 
 sub format_func_decl($pirname, $cname, $type) {
@@ -99,6 +99,8 @@
           when 'long'   { return "V"; }
           when 'char'   { return "t"; }
           when 'short'  { return "V"; }
+          when 'double' { return "V"; }
+          when 'floag'  { return "V"; }
           default {
 =begin
             say "ERROR";
@@ -119,6 +121,8 @@
             when 'long'     { return "l"; }
             when 'char'     { return "c"; }
             when 'short'    { return "s"; }
+            when 'double'   { return "d"; }
+            when 'floag'    { return "f"; }
             default         { return "p"; }
         }
     }

Modified: branches/pdd22io_part2/compilers/ncigen/src/NCIGENAST.pir
==============================================================================
--- branches/pdd22io_part2/compilers/ncigen/src/NCIGENAST.pir	(original)
+++ branches/pdd22io_part2/compilers/ncigen/src/NCIGENAST.pir	Mon Dec  8 19:37:00 2008
@@ -149,6 +149,12 @@
 
 .namespace [ 'NCIGENAST';'VarDecl' ]
 
+.sub 'source' :method
+    .param pmc value           :optional
+    .param int has_value       :opt_flag
+    .tailcall self.'attr'('source', value, has_value)
+.end
+
 .sub 'type' :method
     .param pmc value           :optional
     .param int has_value       :opt_flag

Modified: branches/pdd22io_part2/compilers/ncigen/src/parser/actions.pm
==============================================================================
--- branches/pdd22io_part2/compilers/ncigen/src/parser/actions.pm	(original)
+++ branches/pdd22io_part2/compilers/ncigen/src/parser/actions.pm	Mon Dec  8 19:37:00 2008
@@ -128,10 +128,14 @@
 
 sub ispointer($/, $ast) {
     if $/ {
-        if $<declarator><pointer> {
+        if ($<declarator><pointer>)  {
             $ast.pointer(1);
             $ast.pointer_cnt(countpointer($<declarator><pointer>));
         }
+        if ($<abstract_declarator><pointer>)  {
+            $ast.pointer(1);
+            $ast.pointer_cnt(countpointer($<abstract_declarator><pointer>));
+        }
     }
 
     my $lookup_ast := $ast;

Modified: branches/pdd22io_part2/docs/book/ch01_overview.pod
==============================================================================
--- branches/pdd22io_part2/docs/book/ch01_overview.pod	(original)
+++ branches/pdd22io_part2/docs/book/ch01_overview.pod	Mon Dec  8 19:37:00 2008
@@ -253,7 +253,7 @@
 Last, but not least, is the glue that holds the project together.
 BjE<oslash>rn Hansen and Robert Spier manage the email, revision
 control, and bug-tracking systems, as well as the web sites for Parrot,
-U<http://www.parrot.org> and now U<http://www.parrot.org>. Without
+U<http://www.parrotcode.org> and now U<http://www.parrot.org>. Without
 these systems, the project would grind to a screeching halt.
 
 In the end, it is the developers themselves who hold the project
@@ -285,7 +285,7 @@
 
 =over 4
 
-=item * U<http://www.parrotcode.org>
+=item * U<http://www.parrot.org>
 
 =item * U<http://dev.perl.org/perl6>
 

Modified: branches/pdd22io_part2/docs/book/ch11_pmcs.pod
==============================================================================
--- branches/pdd22io_part2/docs/book/ch11_pmcs.pod	(original)
+++ branches/pdd22io_part2/docs/book/ch11_pmcs.pod	Mon Dec  8 19:37:00 2008
@@ -115,9 +115,9 @@
 
   pmclass Foo {
     ATTR INTVAL bar;
-	ATTR PMC baz;
+    ATTR PMC baz;
 
-	...
+    ...
   }
 
 The attributes are stored in a custom data structure that can be accessed
@@ -218,9 +218,6 @@
 of arbitrary functionality to a PMC that the VTABLE functions themselves
 cannot define.
 
-
-
-
 =head2 Dynpmcs
 
 =head3 Loading dynpmcs

Modified: branches/pdd22io_part2/docs/book/ch12_opcodes.pod
==============================================================================
--- branches/pdd22io_part2/docs/book/ch12_opcodes.pod	(original)
+++ branches/pdd22io_part2/docs/book/ch12_opcodes.pod	Mon Dec  8 19:37:00 2008
@@ -4,107 +4,224 @@
 
 Z<CHP-11>
 
-The smallest executable component is not the compilation unit or even the subroutine,
-but is in fact the opcode. Opcodes in PASM, like opcodes in other assembly languages,
-are individual instructions that implement low-level operations in Parrot N<In the
-world of microprocessors, the word "opcode" typically refers to the numeric identifier
-for each instructions. The human-readable word used in the associated assembly language
-is called the "mnemonic". An assembler, among other tasks, is responsible for converting
-mnemonics into opcodes for execution. In Parrot, instead of referring to an instruction
-by different names depending on what form it's in, we just call them all "opcodes">. Of
-course the list of things that qualify as "low-level" in Parrot can be pretty advanced
-compared to the functionality supplied by regular assembly language opcodes.
+The smallest executable component is not the compilation unit or even
+the subroutine, but is in fact the opcode. Opcodes in PASM, like opcodes
+in other assembly languages, are individual instructions that implement
+low-level operations in Parrot N<In the world of microprocessors, the
+word "opcode" typically refers to the numeric identifier for each
+instructions. The human-readable word used in the associated assembly
+language is called the "mnemonic". An assembler, among other tasks, is
+responsible for converting mnemonics into opcodes for execution. In
+Parrot, instead of referring to an instruction by different names
+depending on what form it's in, we just call them all "opcodes">. Of
+course the list of things that qualify as "low-level" in Parrot can be
+pretty advanced compared to the functionality supplied by regular
+assembly language opcodes.
 
-Before we talk about opcodes, we have to a little bit of talking about the various
-runcores that invoke them.
+Before we talk about opcodes, we have to a little bit of talking about
+the various runcores that invoke them.
 
 =head2 Runcores
 
-During execution, the runcore is like the heart of Parrot. The runcore controls calling
-the various opcodes with the correct data, and making sure that program flow moves
-properly. Some runcores, such as the I<precomputed C goto runcore> are optimized for
-speed and don't perform many tasks beyond finding and dispatching opcodes. Other runcores,
-such as the I<GC-Debug>, I<debug> and I<profiling> runcores help with typical software
-maintenance and analysis tasks. Different runcores, because of the way they are structured,
-require the opcodes to be compiled into different forms. Because of this, understanding
-opcodes first requires an understanding of the Parrot runcores.
+During execution, the runcore is like the heart of Parrot. The runcore
+controls calling the various opcodes with the correct data, and making
+sure that program flow moves properly. Some runcores, such as the
+I<precomputed C goto runcore> are optimized for speed and don't perform
+many tasks beyond finding and dispatching opcodes. Other runcores,
+such as the I<GC-Debug>, I<debug> and I<profiling> runcores help with
+typical software maintenance and analysis tasks. We'll talk about all
+of these throughout the chapter.
+
+Different runcores, because of the way they are structured, require the
+opcodes to be compiled into different forms. Because of this,
+understanding opcodes first requires an understanding of the Parrot
+runcores.
 
 =head3 Types of Runcores
 
-Parrot has multiple runcores. Some are useful for particular maintenance tasks, some are
-only available as optimizations in certain compilers, some are intended for general use,
-and some are just interesing flights of fancy with no practical benefits. One runcore that
-we've already seen is the debugging runcore which prompts the user for commands between
-executing each opcode. Another valuable maintenance runcore is the GC dubug core (which runs a
-full sweep of the garbage collector between each opcode).
+Parrot has multiple runcores. Some are useful for particular maintenance
+tasks, some are only available as optimizations in certain compilers,
+some are intended for general use, and some are just interesing flights
+of fancy with no practical benefits. Here we list the various runcores,
+their uses, and their benefits.
 
 =over 4
 
 =item* Slow Core
 
-The slow core is a basic runcore design that treats each opcode as a separate function
-at the C level. Each function is called, and returns the address of the next opcode
-to be called by the core. The slow core performs bounds checking to ensure that the next
-opcode to be called is properly in bounds. Because of this modular approach where opcodes
-are treated as separate executable entities many other runcores, especially diagnostic and
-maintenance cores are based on this design.
+The slow core is a basic runcore design that treats each opcode as a
+separate function at the C level. Each function is called, and returns
+the address of the next opcode to be called by the core. The slow core
+performs bounds checking to ensure that the next opcode to be called is
+properly in bounds, and not somewhere random in memory. Because of this
+modular approach where opcodes are treated as separate executable
+entities many other runcores, especially diagnostic and maintenance
+cores are based on this design.
 
 =item* Fast Core
 
-The fast core is a bare-bones core that doesn't do any of the bounds-checking or context
-updating that the slow core does.
+The fast core is a bare-bones core that doesn't do any of the
+bounds-checking or context updating that the slow core does. The fast
+core is the way Parrot should run, and is used to find and debug places
+where execution strays outside of it's normal bounds.
 
 =item* Computed Goto Core
 
-I<Computed Goto> is a feature of some C compilers where a label is treated as a piece of
-data that can be stored in an array. Each opcode is simply a label in a very large
-function, and the labels are stored in an array. Calling an opcode is as easy as taking
-that opcode's number as the index of the label array, and calling the associated label.
-Sound complicated? It is a little, especially to C programmers who are not used to these
-kinds of features, and who have been taught that the C<goto> keyword is to be avoided.
+I<Computed Goto> is a feature of some C compilers where a label is
+treated as a piece of data that can be stored in an array. Each opcode
+is simply a label in a very large function, and the labels are stored
+in an array. Calling an opcode is as easy as taking that opcode's number
+as the index of the label array, and calling the associated label.
+Sound complicated? It is a little, especially to C programmers who are
+not used to these kinds of features, and who have been taught that the
+C<goto> keyword is to be avoided.
 
-As was mentioned earlier, not all compilers support computed goto, which means that this
-core will not be built on platforms that don't support it.
+As was mentioned earlier, not all compilers support computed goto, which
+means that this core will not be built on platforms that don't support it.
 
 =item* Precomputed Goto Core
 
-Thought the Computed Goto core was hard enough to understand? Precomputed goto takes the
-concept a little further.
+Thought the Computed Goto core was hard enough to understand? Precomputed
+goto takes the concept a little further.
 
 =item* Tracing Core
 
 =item* Profiling Core
 
+The profiling core analyzes the performance of Parrot, and helps to
+determine where bottlenecks and trouble spots are in the programs that
+run on top of Parrot.
+
 =item* GC Debug Core
 
+Parrot's garbage collector has been known as a weakness in the system
+for several years. In fact, the garbage collector and memory management
+subsystem was one of the last systems to be improved and rewritten before
+the release of version 1.0. It's not that garbage collection isn't
+important, but instead that it was so hard to do earlier in the project.
+
+Early on when the GC was such a weakness, and later when the GC was under
+active development, it was useful to have an operational mode that would
+really exercise the GC and find bugs that otherwise could hide by sheer
+chance. The GC debug runcore was this tool. The core executes a complete
+collection iteration between every single opcode. The throughput
+performance is terrible, but that's not the point: it's almost guaranteed
+to find problems in the memory system if they exist.
+
 =item* Debug Core
 
+The debug core works like a normal software debugger, such as GDB. The
+debug core executes each opcode, and then prompts the user to enter a
+command. These commands can be used to continue execution, step to the
+next opcode, or examine and manipulate data from the executing program.
+
 =back
 
 =head2 Opcodes
 
-Opcodes are the smallest logical execution element in Parrot. An individual opcode
-corresponds, in an abstract kind of way, with a single machine code instruction
-for a particular hardware processor architecture. The difference is that Parrot's
-opcodes can perform some very complex tasks. Also, Parrot's opcodes can be dynamically
-loaded in from a special library file called a I<dynop library>. We'll talk about
-dynops a little bit later
+Opcodes are the smallest logical execution element in Parrot. An
+individual opcode corresponds, in an abstract kind of way, with a single
+machine code instruction for a particular hardware processor
+architecture. The difference is that Parrot's opcodes can perform some
+very complex and high-level tasks. Also, Parrot's opcodes can be
+dynamically loaded in from a special library file called a I<dynop
+library>. We'll talk about dynops a little bit later.
 
 =head3 Opcode naming
 
+To the PIR and PASM programmers, opcodes appear to be polymorphic. That
+is, some opcodes appear to have multiple argument formats. This is just an
+illusion, however. Parrot opcodes are not polymorphic, although certain
+features enable it to appear that way. Different argument list formats
+are detected during parsing and translated into separate, and unique,
+opcode names. 
+
 =head3 Opcode Multiple Dispatch
 
 =head2 Writing Opcodes
 
-Writing Opcodes, like writing PMCs, is done in a C-like language which is later
-compiled into C code by the X<opcode compiler> opcode compiler. The opcode script
-represents a thin overlay on top of ordinary C code: All valid C code is valid
-Opcode script. There are a few neat additions that make writing Opcodes easier.
+Writing Opcodes, like writing PMCs, is done in a C-like language which is
+later compiled into C code by the X<opcode compiler> opcode compiler. The
+opcode script represents a thin overlay on top of ordinary C code: All
+valid C code is valid opcode script. There are a few neat additions that
+make writing opcodes easier. This script is very similar to that used to
+define PMCs. The C<INTERP> constant, for instance, is always available
+in the opcodes like they are in VTABLE and METHOD declarations. Unlike
+VTABLEs and METHODs, opcodes are defined with the C<op> keyword.
+
+Opcodes are written in files with the C<.ops> extension. The core
+operation files are stored in the C<src/ops/> directory.
 
 =head3 Opcode Parameters
 
+Each opcode can take any fixed number of input and output arguments. These
+arguments can be any of the four primary data types--INTVALs, PMCs, NUMBERS
+and STRINGs--but can also be one of several other types of values including
+LABELs, KEYs and INTKEYs.
+
+Each parameter can be an input, an output or both, using the C<in>, C<out>,
+and C<inout> keywords respectively. Here is an example:
+
+  op Foo (out INT, in NUM)
+
+This opcode could be called like this:
+
+  $I0 = Foo $N0     # in PIR syntax
+  Foo $I0, $N0      # in PASM syntax
+
+When Parrot parses through the file and sees the C<Foo> operation, it
+converts it to the real name C<Foo_i_n>. The real name of an opcode
+is it's name followed by an underscore-separated ordered list of
+the parameters to that opcode. This is how Parrot appears to use
+polymorphism: It translates the overloaded opcode common names into
+longer unique names depending on the parameter list of that opcode. Here
+is a list of some of the variants of the C<add> opcode:
+
+  add_i_i      # $I0 += $I1
+  add_n_n      # $N0 += $N1
+  add_p_p      # $P0 += $P1
+  add_i_i_i    # $I0 = $I1 + $I2
+  add_p_p_i    # $P0 = $P1 + $I0
+  add_p_p_n    # $P0 = $P1 + $N0
+
+This isn't a complete list, but you should get the picture. Each different
+combination of parameters translates to a different unique operation, and
+each operation is remarkably simple to implement. In some cases, Parrot
+can even use it's multi-method dispatch system to call opcodes which are
+heavily overloaded, or for which there is no exact fit but the parameters
+could be coerced into different types to complete the operation. For
+instance, attempting to add a STRING to a PMC might coerce the string into
+a numerical type first, and then dispatch to the C<add_p_p_n> opcode. This
+is just an example, and the exact mechanisms may change as more opcodes
+are added or old ones are deleted.
+
 =head3 Opcode Control Flow
 
+Some opcodes have the ability to alter control flow of the program they
+are in. There are a number of control behaviors that can be implemented,
+such as an unconditional jump in the C<goto> opcode, or a subroutine
+call in the C<call> code, or the conditional behavior implemented by C<if>.
+
+At the end of each opcode you can call a C<goto> operation to jump to the
+next opcode to execute. If no C<goto> is performed, control flow will
+continue like normal to the next operation in the program. In this way,
+opcodes can easily manipulate control flow. Opcode script provides a
+number of keywords to alter control flow:
+
+=over 4
+
+=item * NEXT()
+
+If C<NEXT> contains the address of the next opcode in memory. You don't
+need to call C<goto NEXT()>, however, because the default behavior for
+all opcodes is to automatically jump to the next opcode in the program
+N<You can do this if you really want to, but it really wouldn't help you
+any>. The C<NEXT> keyword is frequently used in places like the C<invoke>
+opcode to create a continuation to the next opcode to return to after
+the subroutine returns.
+
+=back
+
 =head2 The Opcode Compiler
 
 =head2 Dynops

Modified: branches/pdd22io_part2/examples/benchmarks/oofib.pir
==============================================================================
--- branches/pdd22io_part2/examples/benchmarks/oofib.pir	(original)
+++ branches/pdd22io_part2/examples/benchmarks/oofib.pir	Mon Dec  8 19:37:00 2008
@@ -44,9 +44,7 @@
 .sub fib :method
     .param pmc n
     if n >= 2 goto rec
-    .begin_return
-    .return n
-    .end_return
+    .return (n)
 rec:
     .local pmc n1
     .local pmc n2
@@ -60,17 +58,13 @@
     r2 = self."fibB"(n2)
     n = new 'Integer'
     n = r1 + r2
-    .begin_return
-    .return n
-    .end_return
+    .return (n)
 .end
 
 .sub fibA :method
     .param pmc n
     if n >= 2 goto rec
-    .begin_return
-    .return n
-    .end_return
+    .return (n)
 rec:
     .local pmc n1
     .local pmc n2
@@ -84,9 +78,7 @@
     r2 = self."fibB"(n2)
     n = new 'Integer'
     n = r1 + r2
-    .begin_return
-    .return n
-    .end_return
+    .return (n)
 .end
 
 .namespace ["B"]
@@ -94,9 +86,7 @@
 .sub fibB :method
     .param pmc n
     if n >= 2 goto rec
-    .begin_return
-    .return n
-    .end_return
+    .return (n)
 rec:
     .local pmc n1
     .local pmc n2
@@ -110,9 +100,7 @@
     r2 = self."fibA"(n2)
     n = new 'Integer'
     n = r1 + r2
-    .begin_return
-    .return n
-    .end_return
+    .return (n)
 .end
 
 # Local Variables:

Modified: branches/pdd22io_part2/examples/nci/QtHelloWorld.pasm
==============================================================================
--- branches/pdd22io_part2/examples/nci/QtHelloWorld.pasm	(original)
+++ branches/pdd22io_part2/examples/nci/QtHelloWorld.pasm	Mon Dec  8 19:37:00 2008
@@ -11,7 +11,7 @@
 
 =head1 DESCRIPTION
 
-Sample "Hello World" with Qt, via Parrot Native Call API (nci). See
+Sample "Hello World" with Qt, via Parrot Native Call Interface (nci). See
 F<docs/pdds/pdd03_calling_conventions.pod>.
 
 Qt is a multiplatform C++ GUI application framework

Modified: branches/pdd22io_part2/ext/SQLite3/Makefile.in
==============================================================================
--- branches/pdd22io_part2/ext/SQLite3/Makefile.in	(original)
+++ branches/pdd22io_part2/ext/SQLite3/Makefile.in	Mon Dec  8 19:37:00 2008
@@ -69,7 +69,7 @@
 
 all :
 	cd ../..; make perl6
-	cd ../../compilers/ncigen/; $(PERL6) gen_sqlite3.pl /usr/include/sqlite3.h > ../../ext/SQLite3/genSQLite3.pir
+	cd ../../compilers/ncigen; $(PERL6) ../../ext/SQLite3/gen_sqlite3.pl /usr/include/sqlite3.h > ../../ext/SQLite3/genSQLite3.pir
 
 test:
 	$(RM_F) test.db t/test.db

Modified: branches/pdd22io_part2/languages/WMLScript/runtime/wmlsconsole.pir
==============================================================================
--- branches/pdd22io_part2/languages/WMLScript/runtime/wmlsconsole.pir	(original)
+++ branches/pdd22io_part2/languages/WMLScript/runtime/wmlsconsole.pir	Mon Dec  8 19:37:00 2008
@@ -53,8 +53,7 @@
     $S0 = str
     print $S0
     $I0 = length $S0
-    new res, 'WmlsInteger'
-    set res, $I0
+    box res, $I0
     goto L2
   L1:
     new res, 'WmlsInvalid'
@@ -87,8 +86,7 @@
     print $S0
     print "\n"
     $I0 = length $S0
-    new res, 'WmlsInteger'
-    set res, $I0
+    box res, $I0
     goto L2
   L1:
     new res, 'WmlsInvalid'

Modified: branches/pdd22io_part2/languages/WMLScript/runtime/wmlsfloat.pir
==============================================================================
--- branches/pdd22io_part2/languages/WMLScript/runtime/wmlsfloat.pir	(original)
+++ branches/pdd22io_part2/languages/WMLScript/runtime/wmlsfloat.pir	Mon Dec  8 19:37:00 2008
@@ -73,8 +73,7 @@
     $I0 = isa $P0, 'WmlsInvalid'
     if $I0 goto L2
     $I0 = $P0
-    new res, 'WmlsInteger'
-    set res, $I0
+    box res, $I0
     goto L3
   L2:
     new res, 'WmlsInvalid'
@@ -112,8 +111,7 @@
     if $I0 goto L2
     $N0 = $P0
     $I0 = floor $N0
-    new res, 'WmlsInteger'
-    set res, $I0
+    box res, $I0
     goto L3
   L2:
     new res, 'WmlsInvalid'
@@ -151,8 +149,7 @@
     if $I0 goto L2
     $N0 = $P0
     $I0 = ceil $N0
-    new res, 'WmlsInteger'
-    set res, $I0
+    box res, $I0
     goto L3
   L2:
     new res, 'WmlsInvalid'
@@ -209,8 +206,7 @@
     $N2 = $P2
     unless $N1 == 0.0 goto L4
     if $N2 < 0.0 goto L2
-    new res, 'WmlsFloat'
-    set res, 0.0
+    box res, 0.0
     goto L5
   L4:
     unless $N1 < 0.0 goto L6
@@ -218,8 +214,7 @@
     if $I0 goto L2
   L6:
     $N0 = pow $N1, $N2
-    new res, 'WmlsFloat'
-    set res, $N0
+    box res, $N0
     goto L5
   L2:
     new res, 'WmlsInvalid'
@@ -260,8 +255,7 @@
     $N0 = $P0
     $N0 += 0.5
     $I0 = floor $N0
-    new res, 'WmlsInteger'
-    set res, $I0
+    box res, $I0
     goto L3
   L2:
     new res, 'WmlsInvalid'
@@ -304,8 +298,7 @@
     $N0 = $P0
     if $N0 < 0.0 goto L2
     $N1 = sqrt $N0
-    new res, 'WmlsFloat'
-    set res, $N1
+    box res, $N1
     goto L3
   L2:
     new res, 'WmlsInvalid'
@@ -329,8 +322,7 @@
 
 .sub '_float_maxFloat' :anon
     .local pmc res
-    new res, 'WmlsFloat'
-    set res, 3.40282347e+38
+    box res, 3.40282347e+38
     .return (res)
 .end
 
@@ -351,8 +343,7 @@
 
 .sub '_float_minFloat' :anon
     .local pmc res
-    new res, 'WmlsFloat'
-    set res, 1.17549435e-38
+    box res, 1.17549435e-38
     .return (res)
 .end
 

Modified: branches/pdd22io_part2/languages/WMLScript/runtime/wmlslang.pir
==============================================================================
--- branches/pdd22io_part2/languages/WMLScript/runtime/wmlslang.pir	(original)
+++ branches/pdd22io_part2/languages/WMLScript/runtime/wmlslang.pir	Mon Dec  8 19:37:00 2008
@@ -427,8 +427,7 @@
 
 .sub '_lang_maxInt' :anon
     .local pmc res
-    new res, 'WmlsInteger'
-    set res, 2147483647
+    box res, 2147483647
     .return (res)
 .end
 
@@ -447,8 +446,7 @@
 
 .sub '_lang_minInt' :anon
     .local pmc res
-    new res, 'WmlsInteger'
-    set res, -2147483648
+    box res, -2147483648
     .return (res)
 .end
 
@@ -577,8 +575,7 @@
     $N0 = $P0
     $N0 = mul $I0
     $I0 = $N0
-    new res, 'WmlsInteger'
-    set res, $I0
+    box res, $I0
     goto L3
   L2:
     new res, 'WmlsInvalid'
@@ -654,8 +651,7 @@
 
 .sub '_lang_characterSet' :anon
     .local pmc res
-    new res, 'WmlsInteger'
-    res = 4     # latin1
+    box res, 4     # latin1
     .return (res)
 .end
 

Modified: branches/pdd22io_part2/languages/WMLScript/runtime/wmlsstring.pir
==============================================================================
--- branches/pdd22io_part2/languages/WMLScript/runtime/wmlsstring.pir	(original)
+++ branches/pdd22io_part2/languages/WMLScript/runtime/wmlsstring.pir	Mon Dec  8 19:37:00 2008
@@ -110,8 +110,7 @@
     if $I0 goto L1
     $S1 = str
     $I1 = length $S1
-    new res, 'WmlsInteger'
-    set res, $I1
+    box res, $I1
     .return (res)
   L1:
     new res, 'WmlsInvalid'
@@ -196,12 +195,13 @@
     $S1 = str
     $I1 = length $S1
     $I2 = index_
-    new res, 'WmlsString'
     if $I2 < 0 goto L3
     if $I2 >= $I1 goto L3
     $S0 = substr $S1, $I2, 1
-    set res, $S0
+    box res, $S0
+    .return (res)
   L3:
+    new res, 'WmlsString'
     .return (res)
   L1:
     new res, 'WmlsInvalid'
@@ -267,13 +267,14 @@
     if $I2 >= 0 goto L4
     $I2 = 0
   L4:
-    new res, 'WmlsString'
     if $I2 >= $I1 goto L5
     $I3 = Length
     if $I3 <= 0 goto L5
     $S0 = substr $S1, $I2, $I3
-    set res, $S0
+    box res, $S0
+    .return (res)
   L5:
+    new res, 'WmlsString'
     .return (res)
   L1:
     new res, 'WmlsInvalid'
@@ -321,8 +322,7 @@
     $I2 = length $S2
     if $I2 == 0 goto L1
     $I0 = index $S1, $S2
-    new res, 'WmlsInteger'
-    set res, $I0
+    box res, $I0
     .return (res)
   L1:
     new res, 'WmlsInvalid'
@@ -377,8 +377,7 @@
     $S3 = newSubString
     $P0 = split $S2, $S1
     $S0 = join $S3, $P0
-    new res, 'WmlsString'
-    set res, $S0
+    box res, $S0
     .return (res)
   L1:
     new res, 'WmlsInvalid'
@@ -423,15 +422,14 @@
     $I2 = length $S2
     if $I2 == 0 goto L1
     $S2 = substr $S2, 0, 1
-    new res, 'WmlsInteger'
     $I1 = length $S1
     if $I1 != 0 goto L2
-    set res, 1
+    box res, 1
     .return (res)
   L2:
     $P0 = split $S2, $S1
     $I0 = elements $P0
-    set res, $I0
+    box res, $I0
     .return (res)
   L1:
     new res, 'WmlsInvalid'
@@ -494,9 +492,9 @@
     $I3 = length $S3
     if $I3 == 0 goto L1
     $S3 = substr $S3, 0, 1
-    new res, 'WmlsString'
     $I1 = length $S1
     if $I1 != 0 goto L4
+    new res, 'WmlsString'
     .return (res)
   L4:
     $P0 = split $S3, $S1
@@ -505,7 +503,7 @@
     $I2 = $I0 - 1
   L5:
     $S0 = $P0[$I2]
-    set res, $S0
+    box res, $S0
     .return (res)
   L1:
     new res, 'WmlsInvalid'
@@ -568,9 +566,9 @@
     $I3 = length $S3
     if $I3 == 0 goto L1
     $S3 = substr $S3, 0, 1
-    new res, 'WmlsString'
     $I1 = length $S1
     if $I1 != 0 goto L4
+    new res, 'WmlsString'
     .return (res)
   L4:
     $P0 = split $S3, $S1
@@ -594,7 +592,7 @@
     goto L6
   L7:
     $S0 = join $S3, $P1
-    set res, $S0
+    box res, $S0
     .return (res)
   L1:
     new res, 'WmlsInvalid'
@@ -663,10 +661,9 @@
     $I4 = length $S4
     if $I4 == 0 goto L1
     $S4 = substr $S4, 0, 1
-    new res, 'WmlsString'
     $I1 = length $S1
     if $I1 != 0 goto L4
-    set res, $S2
+    box res, $S2
     .return (res)
   L4:
     $P0 = split $S4, $S1
@@ -676,7 +673,7 @@
   L5:
     $P0[$I3] = $S2
     $S0 = join $S4, $P0
-    set res, $S0
+    box res, $S0
     .return (res)
   L1:
     new res, 'WmlsInvalid'
@@ -745,10 +742,9 @@
     $I4 = length $S4
     if $I4 == 0 goto L1
     $S4 = substr $S4, 0, 1
-    new res, 'WmlsString'
     $I1 = length $S1
     if $I1 != 0 goto L4
-    set res, $S2
+    box res, $S2
     .return (res)
   L4:
     $P0 = split $S4, $S1
@@ -774,7 +770,7 @@
   L7:
     $P1[$I3] = $S2
     $S0 = join $S4, $P1
-    set res, $S0
+    box res, $S0
     .return (res)
   L1:
     new res, 'WmlsInvalid'
@@ -832,10 +828,9 @@
     .local pmc res
     $I0 = isa str, 'WmlsInvalid'
     if $I0 goto L1
-    new res, 'WmlsString'
     $S1 = str
     $S0 = squeeze($S1)
-    set res, $S0
+    box res, $S0
     .return (res)
   L1:
     new res, 'WmlsInvalid'
@@ -886,10 +881,9 @@
     .local pmc res
     $I0 = isa str, 'WmlsInvalid'
     if $I0 goto L1
-    new res, 'WmlsString'
     $S1 = str
     $S0 = trim($S1)
-    set res, $S0
+    box res, $S0
     .return (res)
   L1:
     new res, 'WmlsInvalid'
@@ -928,16 +922,15 @@
     if $I0 goto L1
     $S1 = string1
     $S2 = string2
-    new res, 'WmlsInteger'
     if $S1 >= $S2 goto L2
-    set res, -1
+    box res, -1
     .return (res)
   L2:
     if $S1 > $S2 goto L3
-    set res, 0
+    box res, 0
     .return (res)
   L3:
-    set res, 1
+    box res, 1
     .return (res)
   L1:
     new res, 'WmlsInvalid'
@@ -968,8 +961,7 @@
     .param pmc value
     $S1 = value
     .local pmc res
-    new res, 'WmlsString'
-    set res, $S1
+    box res, $S1
     .return (res)
 .end
 
@@ -1094,8 +1086,7 @@
     $P0[0] = value
   L2:
     $S1 = sprintf $S0, $P0
-    new res, 'WmlsString'
-    set res, $S1
+    box res, $S1
     .return (res)
   L1:
     new res, 'WmlsInvalid'

Modified: branches/pdd22io_part2/languages/WMLScript/src/script.pir
==============================================================================
--- branches/pdd22io_part2/languages/WMLScript/src/script.pir	(original)
+++ branches/pdd22io_part2/languages/WMLScript/src/script.pir	Mon Dec  8 19:37:00 2008
@@ -183,9 +183,7 @@
     pir = "  .local pmc const"
     $S0 = idx
     pir .= $S0
-    pir .= "\n  new const"
-    pir .= $S0
-    pir .= ", 'WmlsInteger'\n  set const"
+    pir .= "\n  box const"
     pir .= $S0
     pir .= ", "
     $S0 = self
@@ -207,12 +205,15 @@
     pir = "  .local pmc const"
     $S0 = idx
     pir .= $S0
-    pir .= "\n  new const"
-    pir .= $S0
-    pir .= ", 'WmlsFloat'\n  set const"
+    pir .= "\n  box const"
     pir .= $S0
     pir .= ", "
-    $S0 = self
+    # need a representation that always contains a dot,
+    # unless box a WmlsInteger
+    new $P0, 'FixedPMCArray'
+    set $P0, 1
+    $P0[0] = self
+    $S0 = sprintf "%f", $P0 # need a better precision
     pir .= $S0
     pir .= "\n"
     .return (pir)
@@ -235,9 +236,7 @@
     pir = "  .local pmc const"
     $S0 = idx
     pir .= $S0
-    pir .= "\n  new const"
-    pir .= $S0
-    pir .= ", 'WmlsString'\n  set const"
+    pir .= "\n  box const"
     pir .= $S0
     pir .= ", unicode:\""
     $S0 = self
@@ -282,9 +281,7 @@
     pir = "  .local pmc const"
     $S0 = idx
     pir .= $S0
-    pir .= "\n  new const"
-    pir .= $S0
-    pir .= ", 'WmlsString'\n  set const"
+    pir .= "\n  box const"
     pir .= $S0
     pir .= ", \""
     $S0 = self
@@ -545,14 +542,12 @@
     goto L5
   L6:
 
-    unless number_of_local_variables goto L7
-    pir .= "  new $P0, 'WmlsString'\n"
   L7:
     unless idx < number_of_variables goto L8
-    pir .= "  local"
+    pir .= "  new local"
     $S0 = idx
     pir .= $S0
-    pir .= " = $P0\n"
+    pir .= ", 'WmlsString'\n"
     inc idx
     goto L7
   L8:

Modified: branches/pdd22io_part2/languages/WMLScript/t/harness
==============================================================================
--- branches/pdd22io_part2/languages/WMLScript/t/harness	(original)
+++ branches/pdd22io_part2/languages/WMLScript/t/harness	Mon Dec  8 19:37:00 2008
@@ -7,7 +7,7 @@
     # Check that we have the WMLScript compiler.
     my $check = `wmlsc -h`;
     unless ($check =~ /wmlsc/) {
-        die "You need the WMLScript compiler in your path to build the test.\n";
+        die "You need the WMLScript compiler in your path to build the test.\n\tcpan WAP::wmls\n";
     }
 }
 

Modified: branches/pdd22io_part2/languages/WMLScript/t/pmc/float.t
==============================================================================
--- branches/pdd22io_part2/languages/WMLScript/t/pmc/float.t	(original)
+++ branches/pdd22io_part2/languages/WMLScript/t/pmc/float.t	Mon Dec  8 19:37:00 2008
@@ -1,5 +1,5 @@
 #! perl
-# Copyright (C) 2006-2007, The Perl Foundation.
+# Copyright (C) 2006-2008, The Perl Foundation.
 # $Id$
 
 =head1 NAME
@@ -19,7 +19,7 @@
 
 use strict;
 use warnings;
-use Parrot::Test tests => 10;
+use Parrot::Test tests => 11;
 use Test::More;
 
 pir_output_is( << 'CODE', << 'OUTPUT', 'check inheritance' );
@@ -228,6 +228,23 @@
 WmlsBoolean
 OUTPUT
 
+pir_output_is( << 'CODE', << 'OUTPUT', 'check box' );
+.HLL "WMLScript"
+.loadlib "wmls_group"
+.loadlib "wmls_ops"
+.sub _main
+    $P0 = box 3.14
+    print $P0
+    print "\n"
+    $S0 = typeof $P0
+    print $S0
+    print "\n"
+.end
+CODE
+3.14
+WmlsFloat
+OUTPUT
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4

Modified: branches/pdd22io_part2/languages/WMLScript/t/pmc/integer.t
==============================================================================
--- branches/pdd22io_part2/languages/WMLScript/t/pmc/integer.t	(original)
+++ branches/pdd22io_part2/languages/WMLScript/t/pmc/integer.t	Mon Dec  8 19:37:00 2008
@@ -1,5 +1,5 @@
 #! perl
-# Copyright (C) 2006-2007, The Perl Foundation.
+# Copyright (C) 2006-2008, The Perl Foundation.
 # $Id$
 
 =head1 NAME
@@ -19,7 +19,7 @@
 
 use strict;
 use warnings;
-use Parrot::Test tests => 10;
+use Parrot::Test tests => 11;
 use Test::More;
 
 pir_output_is( << 'CODE', << 'OUTPUT', 'check inheritance' );
@@ -228,6 +228,23 @@
 WmlsBoolean
 OUTPUT
 
+pir_output_is( << 'CODE', << 'OUTPUT', 'check box' );
+.HLL "WMLScript"
+.loadlib "wmls_group"
+.loadlib "wmls_ops"
+.sub _main
+    $P0 = box 42
+    print $P0
+    print "\n"
+    $S0 = typeof $P0
+    print $S0
+    print "\n"
+.end
+CODE
+42
+WmlsInteger
+OUTPUT
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4

Modified: branches/pdd22io_part2/languages/WMLScript/t/pmc/string.t
==============================================================================
--- branches/pdd22io_part2/languages/WMLScript/t/pmc/string.t	(original)
+++ branches/pdd22io_part2/languages/WMLScript/t/pmc/string.t	Mon Dec  8 19:37:00 2008
@@ -1,5 +1,5 @@
 #! perl
-# Copyright (C) 2006-2007, The Perl Foundation.
+# Copyright (C) 2006-2008, The Perl Foundation.
 # $Id$
 
 =head1 NAME
@@ -19,7 +19,7 @@
 
 use strict;
 use warnings;
-use Parrot::Test tests => 12;
+use Parrot::Test tests => 13;
 use Test::More;
 
 pir_output_is( << 'CODE', << 'OUTPUT', 'check inheritance' );
@@ -260,6 +260,23 @@
 WmlsBoolean
 OUTPUT
 
+pir_output_is( << 'CODE', << 'OUTPUT', 'check box' );
+.HLL "WMLScript"
+.loadlib "wmls_group"
+.loadlib "wmls_ops"
+.sub _main
+    $P0 = box "simple string"
+    print $P0
+    print "\n"
+    $S0 = typeof $P0
+    print $S0
+    print "\n"
+.end
+CODE
+simple string
+WmlsString
+OUTPUT
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4

Modified: branches/pdd22io_part2/languages/lua/src/pmc/luanumber.pmc
==============================================================================
--- branches/pdd22io_part2/languages/lua/src/pmc/luanumber.pmc	(original)
+++ branches/pdd22io_part2/languages/lua/src/pmc/luanumber.pmc	Mon Dec  8 19:37:00 2008
@@ -32,6 +32,7 @@
     dynpmc
     group    lua_group
     hll      Lua
+    maps     Integer
     maps     Float {
 
 /*

Modified: branches/pdd22io_part2/languages/lua/t/pmc/number.t
==============================================================================
--- branches/pdd22io_part2/languages/lua/t/pmc/number.t	(original)
+++ branches/pdd22io_part2/languages/lua/t/pmc/number.t	Mon Dec  8 19:37:00 2008
@@ -20,7 +20,7 @@
 use strict;
 use warnings;
 
-use Parrot::Test tests => 11;
+use Parrot::Test tests => 13;
 use Test::More;
 
 pir_output_is( << 'CODE', << 'OUTPUT', 'check inheritance' );
@@ -208,6 +208,42 @@
 1
 OUTPUT
 
+pir_output_is( << 'CODE', << 'OUTPUT', 'check box float' );
+.HLL 'Lua'
+.loadlib 'lua_group'
+.sub _main
+    .local pmc pmc1
+    box pmc1, 3.14
+    print pmc1
+    print "\n"
+    .local int bool1
+    bool1 = isa pmc1, 'LuaNumber'
+    print bool1
+    print "\n"
+.end
+CODE
+3.14
+1
+OUTPUT
+
+pir_output_is( << 'CODE', << 'OUTPUT', 'check box integer' );
+.HLL 'Lua'
+.loadlib 'lua_group'
+.sub _main
+    .local pmc pmc1
+    box pmc1, -2
+    print pmc1
+    print "\n"
+    .local int bool1
+    bool1 = isa pmc1, 'LuaNumber'
+    print bool1
+    print "\n"
+.end
+CODE
+-2
+1
+OUTPUT
+
 pir_output_is( << 'CODE', << 'OUTPUT', 'check tostring' );
 .HLL 'Lua'
 .loadlib 'lua_group'

Modified: branches/pdd22io_part2/languages/lua/t/pmc/string.t
==============================================================================
--- branches/pdd22io_part2/languages/lua/t/pmc/string.t	(original)
+++ branches/pdd22io_part2/languages/lua/t/pmc/string.t	Mon Dec  8 19:37:00 2008
@@ -20,7 +20,7 @@
 use strict;
 use warnings;
 
-use Parrot::Test tests => 14;
+use Parrot::Test tests => 15;
 use Test::More;
 
 pir_output_is( << 'CODE', << 'OUTPUT', 'check inheritance' );
@@ -213,6 +213,24 @@
 1
 OUTPUT
 
+pir_output_is( << 'CODE', << 'OUTPUT', 'check box' );
+.HLL 'Lua'
+.loadlib 'lua_group'
+.sub _main
+    .local pmc pmc1
+    box pmc1, "simple string"
+    print pmc1
+    print "\n"
+    .local int bool1
+    bool1 = isa pmc1, 'LuaString'
+    print bool1
+    print "\n"
+.end
+CODE
+simple string
+1
+OUTPUT
+
 pir_output_is( << 'CODE', << 'OUTPUT', 'check is_equal (RT #60292)' );
 .HLL 'Lua'
 .loadlib 'lua_group'

Modified: branches/pdd22io_part2/languages/perl6/docs/spectest-progress.csv
==============================================================================
--- branches/pdd22io_part2/languages/perl6/docs/spectest-progress.csv	(original)
+++ branches/pdd22io_part2/languages/perl6/docs/spectest-progress.csv	Mon Dec  8 19:37:00 2008
@@ -199,3 +199,4 @@
 "2008-12-05 00:00",33499,228,6577,4710,0,384,1483,9121
 "2008-12-06 00:00",33539,228,6579,4708,0,370,1501,9123
 "2008-12-07 00:00",33590,231,6596,4717,0,373,1506,9140
+"2008-12-08 00:00",33645,233,6704,4779,0,385,1540,9330

Modified: branches/pdd22io_part2/languages/perl6/src/builtins/math.pir
==============================================================================
--- branches/pdd22io_part2/languages/perl6/src/builtins/math.pir	(original)
+++ branches/pdd22io_part2/languages/perl6/src/builtins/math.pir	Mon Dec  8 19:37:00 2008
@@ -283,7 +283,7 @@
 acotan, sinh, cosh, tanh, asinh, acosh, atanh, sech, cosech, cotanh,
 asech, acosech, acotanh.
 
-Performs the various trigonmetric functions.
+Performs the various trigonometric functions.
 
 Option C<:$base> is used to declare how you measure your angles.
 Given the value of an arc representing a single full revolution.

Modified: branches/pdd22io_part2/languages/perl6/src/classes/Object.pir
==============================================================================
--- branches/pdd22io_part2/languages/perl6/src/classes/Object.pir	(original)
+++ branches/pdd22io_part2/languages/perl6/src/classes/Object.pir	Mon Dec  8 19:37:00 2008
@@ -494,54 +494,120 @@
 .end
 
 
+=item !.?
+
+Helper method for implementing the .? operator. Calls at most one matching
+method, and returns undef if there are none.
+
+=cut
+
 .sub '!.?' :method
     .param string method_name
     .param pmc pos_args     :slurpy
     .param pmc named_args   :slurpy :named
 
-    # For now we won't worry about signature, just if a method exists.
-    $I0 = can self, method_name
+    # Get all possible methods.
+    .local pmc methods
+    methods = self.'!MANY_DISPATCH_HELPER'(method_name, pos_args, named_args)
+    
+    # Do we have any?
+    $I0 = elements methods
     if $I0 goto invoke
     .tailcall '!FAIL'('Undefined value returned by invocation of undefined method')
 
     # If we do have a method, call it.
   invoke:
-    .tailcall self.method_name(pos_args :flat, named_args :named :flat)
+    $P0 = methods[0]
+    .tailcall self.$P0(pos_args :flat, named_args :named :flat)
 .end
 
 
+=item !.*
+
+Helper method for implementing the .* operator. Calls one or more matching
+methods.
+
+=cut
+
 .sub '!.*' :method
     .param string method_name
     .param pmc pos_args     :slurpy
     .param pmc named_args   :slurpy :named
 
-    # Return an empty list if no methods exist at all.
-    $I0 = can self, method_name
-    if $I0 goto invoke
-    .tailcall 'list'()
+    # Get all possible methods.
+    .local pmc methods
+    methods = self.'!MANY_DISPATCH_HELPER'(method_name, pos_args, named_args)
 
-    # Now find all methods and call them - since we know there are methods,
-    # we just pass on to infix:.+.
-  invoke:
-    .tailcall self.'!.+'(method_name, pos_args :flat, named_args :named :flat)
+    # Build result capture list.
+    .local pmc pos_res, named_res, cap, result_list, it, cur_meth
+    $P0 = get_hll_global 'list'
+    result_list = $P0()
+    it = iter methods
+  it_loop:
+    unless it goto it_loop_end
+    cur_meth = shift it
+    (pos_res :slurpy, named_res :named :slurpy) = cur_meth(self, pos_args :flat, named_args :named :flat)
+    cap = 'prefix:\\'(pos_res :flat, named_res :flat :named)
+    push result_list, cap
+    goto it_loop
+  it_loop_end:
+
+    .return (result_list)
 .end
 
 
+=item !.+
+
+Helper method for implementing the .+ operator. Calls one or more matching
+methods, dies if there are none.
+
+=cut
+
 .sub '!.+' :method
     .param string method_name
     .param pmc pos_args     :slurpy
     .param pmc named_args   :slurpy :named
 
+    # Use !.* to produce a (possibly empty) list of result captures.
+    .local pmc result_list
+    result_list = self.'!.*'(method_name, pos_args :flat, named_args :flat :named)
+
+    # If we got no elements at this point, we must die.
+    $I0 = elements result_list
+    if $I0 == 0 goto failure
+    .return (result_list)
+  failure:
+    $S0 = "Could not invoke method '"
+    concat $S0, method_name
+    concat $S0, "' on invocant of type '"
+    $S1 = self.'WHAT'()
+    concat $S0, $S1
+    concat $S0, "'"
+    'die'($S0)
+.end
+
+
+=item !MANY_DISPATCH_HELPER
+
+This is a helper for implementing .+, .? and .*. In the future, it may well be
+the basis of WALK also. It returns all methods we could possible call.
+
+=cut
+
+.sub '!MANY_DISPATCH_HELPER' :method
+    .param string method_name
+    .param pmc pos_args
+    .param pmc named_args
+
     # We need to find all methods we could call with the right name.
-    .local pmc p6meta, result_list, class, mro, it, cap_class, failure_class
-    result_list = 'list'()
+    .local pmc p6meta, result_list, class, mro, it
+    $P0 = get_hll_global 'list'
+    result_list = $P0()
     p6meta = get_hll_global ['Perl6Object'], '$!P6META'
-    class = self.'HOW'()
+    class = self.'WHAT'()
     class = p6meta.'get_parrotclass'(class)
     mro = inspect class, 'all_parents'
     it = iter mro
-    cap_class = get_hll_global 'Capture'
-    failure_class = get_hll_global 'Failure'
   mro_loop:
     unless it goto mro_loop_end
     .local pmc cur_class, meths, cur_meth
@@ -550,30 +616,38 @@
     cur_meth = meths[method_name]
     if null cur_meth goto mro_loop
 
-    # If we're here, found a method. Invoke it and add capture of the results
-    # to the result list.
-    .local pmc pos_res, named_res, cap
-    (pos_res :slurpy, named_res :named :slurpy) = cur_meth(self, pos_args :flat, named_args :named :flat)
-    cap = 'prefix:\\'(pos_res :flat, named_res :flat :named)
-    push result_list, cap
+    # If we're here, found a method. But is it a multi?
+    $I0 = isa cur_meth, "Perl6MultiSub"
+    if $I0 goto multi_dispatch
+    
+    # Single dispatch - add to the result list.
+    push result_list, cur_meth
+    goto mro_loop
+
+    # Multiple dispatch; get all applicable candidates.
+  multi_dispatch:
+    .local pmc possibles, possibles_it
+    possibles = cur_meth.'find_possible_candidates'(self, pos_args :flat)
+    possibles_it = iter possibles
+  possibles_it_loop:
+    unless possibles_it goto possibles_it_loop_end
+    cur_meth = shift possibles_it
+    push result_list, cur_meth
+    goto possibles_it_loop
+  possibles_it_loop_end:
     goto mro_loop
   mro_loop_end:
 
-    # Make sure we got some elements, or we have to die.
-    $I0 = elements result_list
-    if $I0 == 0 goto failure
     .return (result_list)
-  failure:
-    $S0 = "Could not invoke method '"
-    concat $S0, method_name
-    concat $S0, "' on invocant of type '"
-    $S1 = self.'WHAT'()
-    concat $S0, $S1
-    concat $S0, "'"
-    'die'($S0)
 .end
 
 
+=item !.^
+
+Helper for doing calls on the metaclass.
+
+=cut
+
 .sub '!.^' :method
     .param string method_name
     .param pmc pos_args     :slurpy

Modified: branches/pdd22io_part2/languages/perl6/src/pmc/perl6multisub.pmc
==============================================================================
--- branches/pdd22io_part2/languages/perl6/src/pmc/perl6multisub.pmc	(original)
+++ branches/pdd22io_part2/languages/perl6/src/pmc/perl6multisub.pmc	Mon Dec  8 19:37:00 2008
@@ -77,7 +77,11 @@
 
 /* Some constants for candidate sorter. */
 #define EDGE_REMOVAL_TODO -1
-#define EDGE_REMOVED -2
+#define EDGE_REMOVED      -2
+
+/* Some constants for the dispatcher. */
+#define MMD_ONE_RESULT   0
+#define MMD_MANY_RESULTS 1
 
 /*
 
@@ -495,7 +499,7 @@
      * dispatch. Note that we could also store the current candidate set and
      * re-enter the dispatch algorithm below, making it cheaper to get to that
      * point. */
-    if (possibles_count == 1)
+    if (possibles_count == 1 && cache != NULL)
         Parrot_mmd_cache_store_by_values(interp, cache, NULL, args, possibles[0]->sub);
 
     /* If we have multiple candidates left, tie-break on any constraints. */
@@ -617,8 +621,11 @@
         }
     }
     else {
-        /* XXX TODO: Build PMC array of all possibles. */
-        return PMCNULL;
+        /* Build PMC array of all possibles. */
+        PMC *results = pmc_new(interp, enum_class_ResizablePMCArray);
+        for (i = 0; i < possibles_count; i++)
+            VTABLE_push_pmc(interp, results, possibles[i]->sub);
+        return results;
     }
 }
 
@@ -799,7 +806,7 @@
 
             /* Now do the dispatch on the args we are being invoked with;
              * if it can't find anything, it will throw the required exception. */
-            found = do_dispatch(interp, candidates, proto, args, 0,
+            found = do_dispatch(interp, candidates, proto, args, MMD_ONE_RESULT,
                     VTABLE_elements(interp, unsorted), (opcode_t *)next, cache);
         }
 
@@ -819,6 +826,64 @@
 
 /*
 
+=item METHOD PMC *find_possible_candidates()
+
+Takes an array of arguments and finds all possible matching candidates.
+
+=cut
+
+*/
+    METHOD PMC *find_possible_candidates(PMC *args :slurpy) {
+        candidate_info **candidates = NULL;
+        PMC             *unsorted;
+        PMC             *proto;
+        PMC             *results;
+
+        /* Need to make sure a wobload of globals don't get destroyed. */
+        PMC      *saved_ccont       = interp->current_cont;
+        opcode_t *current_args      = interp->current_args;
+        opcode_t *current_params    = interp->current_params;
+        opcode_t *current_returns   = interp->current_returns;
+        PMC      *args_signature    = interp->args_signature;
+        PMC      *params_signature  = interp->params_signature;
+        PMC      *returns_signature = interp->returns_signature;
+
+        /* Make sure that we have a candidate list built. */
+        GETATTR_Perl6MultiSub_candidates_sorted(interp, SELF, candidates);
+        GETATTR_Perl6MultiSub_candidates(interp, SELF, unsorted);
+        GETATTR_Perl6MultiSub_proto(interp, SELF, proto);
+
+        if (!candidates) {
+            candidates = sort_candidiates(interp, unsorted, &proto);
+            SETATTR_Perl6MultiSub_candidates_sorted(interp, SELF, candidates);
+            SETATTR_Perl6MultiSub_proto(interp, SELF, proto);
+        }
+
+        if (!candidates)
+            Parrot_ex_throw_from_c_args(interp, NULL, 1,
+                "Failed to build candidate list");
+
+        /* Now do the dispatch on the args we have been supplied with, and
+         * get back a PMC array of possibles. */
+        results = do_dispatch(interp, candidates, proto, args, MMD_MANY_RESULTS,
+                VTABLE_elements(interp, unsorted), NULL, NULL);
+
+        /* Restore stuff that might have got overwriten by calls during the
+         * dispatch algorithm. */
+        interp->current_cont      = saved_ccont;
+        interp->current_args      = current_args;
+        interp->current_params    = current_params;
+        interp->current_returns   = current_returns;
+        interp->args_signature    = args_signature;
+        interp->params_signature  = params_signature;
+        interp->returns_signature = returns_signature;
+
+        /* Return the results that were found. */
+        RETURN(PMC *results);
+    }
+
+/*
+
 =item C<VTABLE void mark()>
 
 Marks the candidate list.
@@ -941,6 +1006,24 @@
         GETATTR_Perl6MultiSub_candidates(interp, SELF, candidates);
         return VTABLE_get_pmc_keyed(interp, candidates, p);
     }
+
+/*
+
+=item VTABLE PMC * clone()
+
+Makes a copy of this Perl6MultiSub PMC.
+
+=cut
+
+*/
+    VTABLE PMC * clone() {
+        PMC *copy = pmc_new(interp, SELF->vtable->base_type);
+        PMC *unsorted;
+        GETATTR_Perl6MultiSub_candidates(interp, SELF, unsorted);
+        unsorted = VTABLE_clone(interp, unsorted);
+        SETATTR_Perl6MultiSub_candidates(interp, copy, unsorted);
+        return copy;
+    }
 }
 
 /*

Modified: branches/pdd22io_part2/languages/perl6/t/spectest.data
==============================================================================
--- branches/pdd22io_part2/languages/perl6/t/spectest.data	(original)
+++ branches/pdd22io_part2/languages/perl6/t/spectest.data	Mon Dec  8 19:37:00 2008
@@ -6,6 +6,7 @@
 integration/lexicals-and-attributes.t
 integration/man-or-boy.t
 integration/real-strings.t
+integration/substr-after-match-in-gather-in-for.t
 S02-builtin_data_types/anon_block.t
 S02-builtin_data_types/array_extending.t
 S02-builtin_data_types/array_ref.t
@@ -69,6 +70,7 @@
 S03-operators/numeric-context.t
 S03-operators/precedence.t
 S03-operators/range.t
+S03-operators/reduce-metaop.t
 S03-operators/relational.t
 S03-operators/repeat.t
 S03-operators/short-circuit.t
@@ -161,6 +163,7 @@
 S12-enums/as-role.t
 S12-enums/basic.t
 S12-introspection/can.t
+S12-methods/calling_sets.t
 S12-methods/calling_syntax.t
 S12-methods/default-trait.t
 S12-methods/indirect_notation.t

Modified: branches/pdd22io_part2/runtime/parrot/library/File/Spec.pir
==============================================================================
--- branches/pdd22io_part2/runtime/parrot/library/File/Spec.pir	(original)
+++ branches/pdd22io_part2/runtime/parrot/library/File/Spec.pir	Mon Dec  8 19:37:00 2008
@@ -97,7 +97,7 @@
     ## set modules['dos'], 'OS2'
     ## set modules['cygwin'], 'Cygwin'
 
-    store_global '_modules', modules
+    set_global '_modules', modules
 .end
 
 
@@ -107,7 +107,7 @@
     .local pmc modules
     modules= new 'Hash'
 
-    modules= find_global '_modules'
+    modules= get_global '_modules'
 
     .local string module
     module= modules[ osname ]

Modified: branches/pdd22io_part2/runtime/parrot/library/File/Spec/Win32.pir
==============================================================================
--- branches/pdd22io_part2/runtime/parrot/library/File/Spec/Win32.pir	(original)
+++ branches/pdd22io_part2/runtime/parrot/library/File/Spec/Win32.pir	Mon Dec  8 19:37:00 2008
@@ -14,7 +14,7 @@
     .local pmc tmpdir
     tmpdir= new 'ResizableStringArray'
 
-    store_global '_tmpdir', tmpdir
+    set_global '_tmpdir', tmpdir
 .end
 
 
@@ -73,7 +73,7 @@
     push tmpdir, '/'
 
 store:
-    store_global '_tmpdir', tmpdir
+    set_global '_tmpdir', tmpdir
 return_cached:
     .return( tmpdir )
 .end
@@ -552,7 +552,7 @@
 
 .sub 'VERSION' :method
     .local pmc version
-    version= global 'VERSION'
+    version= get_global 'VERSION'
     .return( version )
 .end
 

Modified: branches/pdd22io_part2/src/packdump.c
==============================================================================
--- branches/pdd22io_part2/src/packdump.c	(original)
+++ branches/pdd22io_part2/src/packdump.c	Mon Dec  8 19:37:00 2008
@@ -308,13 +308,19 @@
                             "\tclass => %Ss,\n"
                             "\tstart_offs => %d,\n"
                             "\tend_offs => %d,\n"
-                            "\tname => '%Ss',\n"
+                            "\tname    => '%Ss',\n"
+                            "\tsubid   => '%Ss',\n"
+                            "\tmethod  => '%Ss',\n"
+                            "\tnsentry => '%Ss',\n"
                             "\tnamespace => %Ss\n"
                             "\tHLL_id => %d,\n",
                             pmc->vtable->whoami,
                             sub->start_offs,
                             sub->end_offs,
                             sub->name,
+                            sub->subid,
+                            sub->method_name,
+                            sub->ns_entry_name,
                             namespace_description,
                             sub->HLL_id);
                     break;

Modified: branches/pdd22io_part2/src/pmc/role.pmc
==============================================================================
--- branches/pdd22io_part2/src/pmc/role.pmc	(original)
+++ branches/pdd22io_part2/src/pmc/role.pmc	Mon Dec  8 19:37:00 2008
@@ -336,6 +336,24 @@
         }
     }
 
+/*
+
+=item C<void remove_method(STRING *name, PMC *sub)>
+
+Removes the method with the given name.
+
+=cut
+
+*/
+    VTABLE void remove_method(STRING *name) {
+        Parrot_Role_attributes * const role = PARROT_ROLE(SELF);
+        if (VTABLE_exists_keyed_str(interp, role->methods, name))
+            VTABLE_delete_keyed_str(interp, role->methods, name);
+        else
+            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
+                "No method named '%S' to remove in role '%S'.",
+                name, VTABLE_get_string(interp, SELF));
+    }
 
 /*
 
@@ -665,6 +683,20 @@
         VTABLE_add_method(interp, SELF, name, sub);
     }
 
+/*
+
+=item C<void remove_method(STRING *name)>
+
+Removes the method with the given name.
+
+=cut
+
+*/
+    METHOD remove_method(STRING *name)
+    {
+        VTABLE_remove_method(interp, SELF, name);
+    }
+
 
 /*
 

Modified: branches/pdd22io_part2/t/compilers/imcc/syn/subflags.t
==============================================================================
--- branches/pdd22io_part2/t/compilers/imcc/syn/subflags.t	(original)
+++ branches/pdd22io_part2/t/compilers/imcc/syn/subflags.t	Mon Dec  8 19:37:00 2008
@@ -26,7 +26,7 @@
     test_namespace.'export_to'(curr_namespace, exports)
 
     ##  set our plan
-    plan(25)
+    plan(27)
 
     .local pmc pmcnull
     null pmcnull
@@ -109,8 +109,23 @@
     pop_eh
     $I0 = isa $P70, 'Sub'
     todo($I0, 'subid4 in another ns found w/.const')
+
+    ## find multis via subid
+    .const 'Sub' $P0 = 'above'
+    $P0(3)
+    ok(1, "multi found via subid 'above'")
+    .const 'Sub' $P1 = 'below'
+    $P1('3')
+    ok(1, "multi found via subid 'below'")
+.end
+
+.sub 'xyz' :multi(Integer) :subid('above')
+    .return('xyz above')
 .end
 
+.sub 'xyz' :multi(String) :subid('below')
+    .return('xyz below')
+.end
 
 .sub 'is_same'
     .param pmc x

Modified: branches/pdd22io_part2/tools/dev/install_files.pl
==============================================================================
--- branches/pdd22io_part2/tools/dev/install_files.pl	(original)
+++ branches/pdd22io_part2/tools/dev/install_files.pl	Mon Dec  8 19:37:00 2008
@@ -202,8 +202,10 @@
         # --pkgconfigdir option.
         $dest = File::Spec->catdir( $options{libdir}, 'pkgconfig', $dest );
     }
+    elsif ( /\[library]/ ) {
+        $dest =~ s/^runtime/$options{libdir}/;
+    }
     else {
-        $dest =~ s/^runtime/lib/ if /\[library]/;
         $dest = File::Spec->catdir( $options{prefix}, $dest );
     }
 



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About