[svn:parrot] r48906 - in branches/hash_inlined_func: compilers/imcc config/auto config/gen/config_h include/parrot lib/Parrot src src/gc src/pmc src/string t/pmc tools/dev

luben at svn.parrot.org luben at svn.parrot.org
Fri Sep 10 08:41:56 UTC 2010


Author: luben
Date: Fri Sep 10 08:41:55 2010
New Revision: 48906
URL: https://trac.parrot.org/parrot/changeset/48906

Log:
Bring up to date with master

Modified:
   branches/hash_inlined_func/compilers/imcc/pbc.c
   branches/hash_inlined_func/config/auto/gcc.pm
   branches/hash_inlined_func/config/auto/msvc.pm
   branches/hash_inlined_func/config/gen/config_h/config_h.in
   branches/hash_inlined_func/include/parrot/packfile.h
   branches/hash_inlined_func/lib/Parrot/Headerizer.pm
   branches/hash_inlined_func/src/exceptions.c
   branches/hash_inlined_func/src/gc/system.c
   branches/hash_inlined_func/src/namespace.c
   branches/hash_inlined_func/src/packfile.c
   branches/hash_inlined_func/src/packout.c
   branches/hash_inlined_func/src/pmc/bytebuffer.pmc
   branches/hash_inlined_func/src/pmc/complex.pmc
   branches/hash_inlined_func/src/pmc/packfileannotations.pmc
   branches/hash_inlined_func/src/pmc/stringbuilder.pmc
   branches/hash_inlined_func/src/string/api.c
   branches/hash_inlined_func/t/pmc/complex.t
   branches/hash_inlined_func/t/pmc/hashiteratorkey.t
   branches/hash_inlined_func/t/pmc/lexinfo.t
   branches/hash_inlined_func/tools/dev/fetch_languages.pl
   branches/hash_inlined_func/tools/dev/headerizer.pl
   branches/hash_inlined_func/tools/dev/nci_thunk_gen.pir

Modified: branches/hash_inlined_func/compilers/imcc/pbc.c
==============================================================================
--- branches/hash_inlined_func/compilers/imcc/pbc.c	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/compilers/imcc/pbc.c	Fri Sep 10 08:41:55 2010	(r48906)
@@ -360,11 +360,11 @@
     }
     else {
         /* initialize rlookup cache */
-        interp->code->const_table->string_hash =
-            Parrot_pmc_new_init_int(interp, enum_class_Hash, enum_type_INTVAL);
-        ((Hash *)VTABLE_get_pointer(interp, interp->code->const_table->string_hash))->key_type =
-            Hash_key_type_STRING_enc;
-
+        interp->code->const_table->string_hash = parrot_create_hash(interp,
+                enum_type_INTVAL,
+                Hash_key_type_STRING,
+                hash_compare_string_distinct_enc,
+                (hash_hash_key_fn)key_hash_STRING);
         interp->code->const_table->constants =
             mem_gc_allocate_n_zeroed_typed(interp, newcount, PackFile_Constant);
     }
@@ -1142,7 +1142,7 @@
         constant->type              = PFC_STRING;
         constant->u.string          = s;
 
-        VTABLE_set_integer_keyed_str(interp, table->string_hash, s, k);
+        parrot_hash_put(interp, table->string_hash, s, (void *)k);
 
         return k;
     }

Modified: branches/hash_inlined_func/config/auto/gcc.pm
==============================================================================
--- branches/hash_inlined_func/config/auto/gcc.pm	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/config/auto/gcc.pm	Fri Sep 10 08:41:55 2010	(r48906)
@@ -86,6 +86,7 @@
 
     $conf->data->set( sym_export => '__attribute__ ((visibility("default")))' )
         if $gccversion >= 4.0 && !$conf->data->get('sym_export');
+    $conf->data->set( noinline => '__attribute__ ((noinline))' );
 
     # sneaky check for g++
     my $gpp = (index($conf->data->get('cc'), '++') > 0) ? 1 : 0;

Modified: branches/hash_inlined_func/config/auto/msvc.pm
==============================================================================
--- branches/hash_inlined_func/config/auto/msvc.pm	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/config/auto/msvc.pm	Fri Sep 10 08:41:55 2010	(r48906)
@@ -89,6 +89,9 @@
         # for details.
         $conf->data->add( " ", "ccflags", "-D_CRT_SECURE_NO_DEPRECATE" );
     }
+
+    $conf->data->set( noinline   => '__declspec(noinline)' );
+
     return 1;
 }
 

Modified: branches/hash_inlined_func/config/gen/config_h/config_h.in
==============================================================================
--- branches/hash_inlined_func/config/gen/config_h/config_h.in	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/config/gen/config_h/config_h.in	Fri Sep 10 08:41:55 2010	(r48906)
@@ -84,6 +84,8 @@
 #endif
 #endif
 
+#define PARROT_NOINLINE @noinline@
+
 #if defined(PARROT_IN_CORE)
 
 /* Put any other symbols here. */

Modified: branches/hash_inlined_func/include/parrot/packfile.h
==============================================================================
--- branches/hash_inlined_func/include/parrot/packfile.h	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/include/parrot/packfile.h	Fri Sep 10 08:41:55 2010	(r48906)
@@ -263,7 +263,7 @@
     opcode_t                   const_count;
     PackFile_Constant         *constants;
     PackFile_ByteCode         *code;  /* where this segment belongs to */
-    PMC                       *string_hash; /* Hash for lookup strings and numbers */
+    Hash                      *string_hash; /* Hash for lookup strings and numbers */
 } PackFile_ConstTable;
 
 typedef struct PackFile_ByteCode_OpMappingEntry {

Modified: branches/hash_inlined_func/lib/Parrot/Headerizer.pm
==============================================================================
--- branches/hash_inlined_func/lib/Parrot/Headerizer.pm	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/lib/Parrot/Headerizer.pm	Fri Sep 10 08:41:55 2010	(r48906)
@@ -45,6 +45,7 @@
     $self->{valid_macros} = { map { ( $_, 1 ) } qw(
         PARROT_EXPORT
         PARROT_INLINE
+        PARROT_NOINLINE
 
         PARROT_CAN_RETURN_NULL
         PARROT_CANNOT_RETURN_NULL

Modified: branches/hash_inlined_func/src/exceptions.c
==============================================================================
--- branches/hash_inlined_func/src/exceptions.c	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/src/exceptions.c	Fri Sep 10 08:41:55 2010	(r48906)
@@ -94,52 +94,68 @@
 die_from_exception(PARROT_INTERP, ARGIN(PMC *exception))
 {
     ASSERT_ARGS(die_from_exception)
-    STRING * const message     = VTABLE_get_string(interp, exception);
+    /* Avoid anyhting that can throw if we are already throwing from
+     * a previous call to this function */
+    static int already_dying = 0;
+
+    STRING * const message     = already_dying ? STRINGNULL :
+            VTABLE_get_string(interp, exception);
     INTVAL         exit_status = 1;
-    const INTVAL   severity    = VTABLE_get_integer_keyed_str(interp, exception, CONST_STRING(interp, "severity"));
+    const INTVAL   severity    = already_dying ? EXCEPT_fatal :
+            VTABLE_get_integer_keyed_str(interp, exception, CONST_STRING(interp, "severity"));
 
-    /* In some cases we have a fatal exception before the IO system
-     * is completely initialized. Do some attempt to output the
-     * message to stderr, to help diagnosing. */
-    int use_perr = !PMC_IS_NULL(Parrot_io_STDERR(interp));
-
-    /* flush interpreter output to get things printed in order */
-    if (!PMC_IS_NULL(Parrot_io_STDOUT(interp)))
-        Parrot_io_flush(interp, Parrot_io_STDOUT(interp));
-    if (use_perr)
-        Parrot_io_flush(interp, Parrot_io_STDERR(interp));
-
-    if (interp->pdb) {
-        Interp * interpdeb = interp->pdb->debugger;
-        if (interpdeb) {
-            Parrot_io_flush(interpdeb, Parrot_io_STDOUT(interpdeb));
-            Parrot_io_flush(interpdeb, Parrot_io_STDERR(interpdeb));
-        }
-    }
 
-    if (Parrot_str_not_equal(interp, message, CONST_STRING(interp, ""))) {
+    if (already_dying) {
+        fflush(stderr);
+        fprintf(stderr, "\n***FATAL ERROR: "
+                "Exception thrown while dying from previous unhandled Exception\n");
+    }
+    else {
+        /* In some cases we have a fatal exception before the IO system
+         * is completely initialized. Do some attempt to output the
+         * message to stderr, to help diagnosing. */
+        int use_perr = !PMC_IS_NULL(Parrot_io_STDERR(interp));
+        already_dying = 1;
+
+        /* flush interpreter output to get things printed in order */
+        if (!PMC_IS_NULL(Parrot_io_STDOUT(interp)))
+            Parrot_io_flush(interp, Parrot_io_STDOUT(interp));
         if (use_perr)
-            Parrot_io_eprintf(interp, "%S\n", message);
+            Parrot_io_flush(interp, Parrot_io_STDERR(interp));
+
+        if (interp->pdb) {
+            Interp * interpdeb = interp->pdb->debugger;
+            if (interpdeb) {
+                Parrot_io_flush(interpdeb, Parrot_io_STDOUT(interpdeb));
+                Parrot_io_flush(interpdeb, Parrot_io_STDERR(interpdeb));
+            }
+        }
+
+        if (Parrot_str_not_equal(interp, message, CONST_STRING(interp, ""))) {
+            if (use_perr)
+                Parrot_io_eprintf(interp, "%S\n", message);
+            else {
+                char * const msg = Parrot_str_to_cstring(interp, message);
+                fflush(stderr);
+                fprintf(stderr, "\n%s\n", msg);
+                Parrot_str_free_cstring(msg);
+            }
+
+            /* caution against output swap (with PDB_backtrace) */
+            fflush(stderr);
+            PDB_backtrace(interp);
+        }
+        else if (severity == EXCEPT_exit) {
+            /* TODO: get exit status based on type */
+            exit_status = VTABLE_get_integer_keyed_str(interp, exception, CONST_STRING(interp, "exit_code"));
+        }
         else {
-            char * const msg = Parrot_str_to_cstring(interp, message);
+            Parrot_io_eprintf(interp, "No exception handler and no message\n");
+            /* caution against output swap (with PDB_backtrace) */
             fflush(stderr);
-            fprintf(stderr, "\n%s\n", msg);
-            Parrot_str_free_cstring(msg);
+            PDB_backtrace(interp);
         }
 
-        /* caution against output swap (with PDB_backtrace) */
-        fflush(stderr);
-        PDB_backtrace(interp);
-    }
-    else if (severity == EXCEPT_exit) {
-        /* TODO: get exit status based on type */
-        exit_status = VTABLE_get_integer_keyed_str(interp, exception, CONST_STRING(interp, "exit_code"));
-    }
-    else {
-        Parrot_io_eprintf(interp, "No exception handler and no message\n");
-        /* caution against output swap (with PDB_backtrace) */
-        fflush(stderr);
-        PDB_backtrace(interp);
     }
 
     /*

Modified: branches/hash_inlined_func/src/gc/system.c
==============================================================================
--- branches/hash_inlined_func/src/gc/system.c	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/src/gc/system.c	Fri Sep 10 08:41:55 2010	(r48906)
@@ -75,6 +75,7 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
+PARROT_NOINLINE
 static void trace_system_stack(PARROT_INTERP,
     ARGIN(const Memory_Pools *mem_pools))
         __attribute__nonnull__(1)
@@ -234,12 +235,14 @@
 Traces the memory block starting at C<< interp->lo_var_ptr >>. This should be
 the address of a local variable which has been created on the stack early in
 the interpreter's lifecycle. We trace until the address of another local stack
-variable in this function, which should be at the "top" of the stack.
+variable in this function, which should be at the "top" of the stack. For this
+reason, this function must never be inlined.
 
 =cut
 
 */
 
+PARROT_NOINLINE
 static void
 trace_system_stack(PARROT_INTERP, ARGIN(const Memory_Pools *mem_pools))
 {

Modified: branches/hash_inlined_func/src/namespace.c
==============================================================================
--- branches/hash_inlined_func/src/namespace.c	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/src/namespace.c	Fri Sep 10 08:41:55 2010	(r48906)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2004-2009, Parrot Foundation.
+Copyright (C) 2004-2010, Parrot Foundation.
 $Id$
 
 =head1 NAME
@@ -131,12 +131,12 @@
     ARGIN(STRING *key), int flags)
 {
     ASSERT_ARGS(internal_ns_keyed_str)
-    PMC    * const ns        = VTABLE_get_pmc_keyed_str(interp, base_ns, key);
-    STRING * const namespace = CONST_STRING(interp, "NameSpace");
+    PMC    * const ns     = VTABLE_get_pmc_keyed_str(interp, base_ns, key);
+    STRING * const namesp = CONST_STRING(interp, "NameSpace");
 
     if (!PMC_IS_NULL(ns)
     && (ns->vtable->base_type == enum_class_NameSpace
-     || VTABLE_isa(interp, ns, namespace)))
+     || VTABLE_isa(interp, ns, namesp)))
         return ns;
 
     return internal_ns_maybe_create(interp, base_ns, key, flags);

Modified: branches/hash_inlined_func/src/packfile.c
==============================================================================
--- branches/hash_inlined_func/src/packfile.c	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/src/packfile.c	Fri Sep 10 08:41:55 2010	(r48906)
@@ -3912,6 +3912,11 @@
 
     self->const_count = 0;
 
+    if (self->string_hash) {
+        parrot_hash_destroy(interp, self->string_hash);
+        self->string_hash = NULL;
+    }
+
     return;
 }
 

Modified: branches/hash_inlined_func/src/packout.c
==============================================================================
--- branches/hash_inlined_func/src/packout.c	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/src/packout.c	Fri Sep 10 08:41:55 2010	(r48906)
@@ -273,9 +273,11 @@
     GETATTR_Key_str_key(interp, key, key_str);
     GETATTR_Key_num_key(interp, key, key_num);
 
-    if (type == PFC_STRING && !PMC_IS_NULL(ct->string_hash)) {
-        if (VTABLE_exists_keyed_str(interp, ct->string_hash, key_str)) {
-            i = VTABLE_get_integer_keyed_str(interp, ct->string_hash, key_str);
+    if (type == PFC_STRING && ct->string_hash) {
+        HashBucket *bucket = parrot_hash_get_bucket(interp, ct->string_hash,
+                key_str);
+        if (bucket) {
+            i = (int)bucket->value;
             if (i < ct->const_count) /* only consider constants that have already occured */
                 return i;
         }

Modified: branches/hash_inlined_func/src/pmc/bytebuffer.pmc
==============================================================================
--- branches/hash_inlined_func/src/pmc/bytebuffer.pmc	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/src/pmc/bytebuffer.pmc	Fri Sep 10 08:41:55 2010	(r48906)
@@ -393,16 +393,10 @@
         ARGIN_NULLOK(const STR_VTABLE *encoding))
 {
     ASSERT_ARGS(build_string)
-    STRING *result;
     if (encoding == NULL)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_ENCODING,
                 "Invalid encoding");
-    result = Parrot_str_new_init(interp, (const char *)content, size, encoding, 0);
-    if (!STRING_validate(interp, result))
-        Parrot_ex_throw_from_c_args(interp, NULL,
-                EXCEPTION_INVALID_STRING_REPRESENTATION,
-                "Invalid buffer content");
-    return result;
+    return Parrot_str_new_init(interp, (const char *)content, size, encoding, 0);
 }
 
 /*

Modified: branches/hash_inlined_func/src/pmc/complex.pmc
==============================================================================
--- branches/hash_inlined_func/src/pmc/complex.pmc	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/src/pmc/complex.pmc	Fri Sep 10 08:41:55 2010	(r48906)
@@ -301,7 +301,7 @@
 }
 
 
-pmclass Complex auto_attrs {
+pmclass Complex provides complex provides scalar auto_attrs {
 
     ATTR FLOATVAL re; /* real part */
     ATTR FLOATVAL im; /* imaginary part */

Modified: branches/hash_inlined_func/src/pmc/packfileannotations.pmc
==============================================================================
--- branches/hash_inlined_func/src/pmc/packfileannotations.pmc	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/src/pmc/packfileannotations.pmc	Fri Sep 10 08:41:55 2010	(r48906)
@@ -80,6 +80,8 @@
                 PARROT_PACKFILEANNOTATIONS(SELF);
 
         Parrot_gc_mark_PMC_alive(INTERP, attrs->const_table);
+        Parrot_gc_mark_PMC_alive(INTERP, attrs->gr_byte);
+        Parrot_gc_mark_PMC_alive(INTERP, attrs->gr_entries);
         Parrot_gc_mark_PMC_alive(INTERP, attrs->annotations);
 
         SUPER();

Modified: branches/hash_inlined_func/src/pmc/stringbuilder.pmc
==============================================================================
--- branches/hash_inlined_func/src/pmc/stringbuilder.pmc	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/src/pmc/stringbuilder.pmc	Fri Sep 10 08:41:55 2010	(r48906)
@@ -61,23 +61,17 @@
 */
 
     VTABLE void init_int(INTVAL initial_size) {
-        STRING * const buffer = mem_gc_allocate_zeroed_typed(INTERP, STRING);
+        STRING * const buffer = Parrot_gc_new_string_header(INTERP, 0);
 
         if (initial_size < INITIAL_STRING_CAPACITY)
             initial_size = INITIAL_STRING_CAPACITY;
 
-        buffer->encoding      = Parrot_default_encoding_ptr;
-        buffer->_buflen       = initial_size;
-        buffer->_bufstart     = buffer->strstart
-                              = mem_gc_allocate_n_typed(INTERP,
-                                        initial_size, char);
-
-        /* We need these string flags to use this buffer in substr_str */
-        buffer->flags         = PObj_is_string_FLAG | PObj_external_FLAG;
+        Parrot_gc_allocate_string_storage(INTERP, buffer, initial_size);
+        buffer->encoding = Parrot_default_encoding_ptr;
 
         SET_ATTR_buffer(INTERP, SELF, buffer);
 
-        PObj_custom_destroy_SET(SELF);
+        PObj_custom_mark_SET(SELF);
     }
 
 
@@ -110,24 +104,21 @@
         }
     }
 
-
 /*
 
-=item C<void destroy()>
+=item C<void mark()>
 
-Free the buffer on destruction.
+Mark the buffer.
 
 =cut
 
 */
 
-    VTABLE void destroy() {
+    VTABLE void mark() {
         if (PMC_data(SELF)) {
             STRING *buffer;
             GET_ATTR_buffer(INTERP, SELF, buffer);
-            if (buffer->_bufstart)
-                mem_gc_free(INTERP, buffer->_bufstart);
-            mem_gc_free(INTERP, buffer);
+            Parrot_gc_mark_STRING_alive(INTERP, buffer);
         }
     }
 
@@ -197,13 +188,9 @@
 
                     if (total_size > buffer->_buflen) {
                         /* Reallocate */
-                        mem_gc_free(INTERP, buffer->_bufstart);
                         total_size = calculate_capacity(INTERP, total_size);
-                        buffer->_bufstart = buffer->strstart
-                                          = mem_gc_allocate_n_typed(INTERP, total_size, char);
-                        buffer->_buflen   = total_size;
+                        Parrot_gc_reallocate_string_storage(INTERP, buffer, total_size);
                     }
-
                     buffer->bufused  = new_buffer->bufused;
                     buffer->encoding = new_buffer->encoding;
 
@@ -220,17 +207,17 @@
             /* Calculate (possibly new) total size */
             total_size = calculate_capacity(INTERP, total_size);
 
-            buffer->_bufstart = buffer->strstart = mem_gc_realloc_n_typed(INTERP,
-                buffer->_bufstart, total_size, char);
-            buffer->_buflen   = total_size;
+            Parrot_gc_reallocate_string_storage(INTERP, buffer, total_size);
+            buffer->_buflen = total_size;
         }
 
         /* Tack s on the end of buffer */
-        mem_sys_memcopy((void *)((ptrcast_t)buffer->strstart + buffer->bufused),
+        mem_sys_memcopy((void *)((ptrcast_t)buffer->_bufstart + buffer->bufused),
                 s->strstart, s->bufused);
 
         /* Update buffer */
         buffer->bufused += s->bufused;
+        buffer->strstart = (char *)buffer->_bufstart;
         buffer->strlen  += Parrot_str_length(INTERP, s);
         buffer->hashval = 0; /* hash is invalid */
 
@@ -282,13 +269,12 @@
 
         /* Reallocate if necessary */
         if (total_size > Buffer_buflen(buffer)) {
-            buffer->_bufstart = buffer->strstart = mem_gc_realloc_n_typed(INTERP,
-                    buffer->_bufstart, total_size, char);
-            buffer->_buflen   = total_size;
+            Parrot_gc_reallocate_string_storage(INTERP, buffer, total_size);
+            buffer->strstart = (char*)buffer->_bufstart;
         }
 
         /* Tack s on the buffer */
-        mem_sys_memcopy((void *)((ptrcast_t)buffer->strstart),
+        mem_sys_memcopy((void *)((char*)buffer->_bufstart),
                 s->strstart, s->bufused);
 
         /* Update buffer */

Modified: branches/hash_inlined_func/src/string/api.c
==============================================================================
--- branches/hash_inlined_func/src/string/api.c	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/src/string/api.c	Fri Sep 10 08:41:55 2010	(r48906)
@@ -261,6 +261,10 @@
         return b->encoding;
     }
 
+    /* Sanity check before dereferencing the encoding pointers */
+    if (a->encoding == NULL || b->encoding == NULL)
+        return NULL;
+
     if (STRING_max_bytes_per_codepoint(a) != 1 ||
         STRING_max_bytes_per_codepoint(b) != 1)
         return NULL;

Modified: branches/hash_inlined_func/t/pmc/complex.t
==============================================================================
--- branches/hash_inlined_func/t/pmc/complex.t	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/t/pmc/complex.t	Fri Sep 10 08:41:55 2010	(r48906)
@@ -21,7 +21,7 @@
     .include 'fp_equality.pasm'
     .include "iglobals.pasm"
 
-    plan(458)
+    plan(460)
 
     string_parsing()
     exception_malformed_string__real_part()
@@ -76,6 +76,7 @@
     sech_of_complex_numbers()
     csch_of_complex_numbers()
     add_using_subclass_of_complex_bug_59630()
+    provides_complex()
 
     # END_OF_TESTS
 
@@ -514,10 +515,10 @@
     .local int bool1
 
     does bool1, pmc1, "scalar"
-    ok( bool1, 'Comples does scalar' )
+    ok( bool1, 'Complex does scalar' )
 
     does bool1, pmc1, "no_interface"
-    nok( bool1, 'Comples !does no_interface' )
+    nok( bool1, 'Complex !does no_interface' )
 .end
 
 .sub instantiate__pasm__i
@@ -1156,6 +1157,17 @@
     todo( $I0, $S0 )
 .end
 
+.sub provides_complex
+    $P0 = new 'Complex'
+    $I0 = does $P0, 'complex'
+    ok($I0)
+
+    # ...And test a subclass, for good measure
+    $P0 = new 'MyComplex'
+    $I0 = does $P0, 'complex'
+    ok($I0)
+.end
+
 .namespace ['MyComplex']
 
 .sub 'init' :vtable

Modified: branches/hash_inlined_func/t/pmc/hashiteratorkey.t
==============================================================================
--- branches/hash_inlined_func/t/pmc/hashiteratorkey.t	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/t/pmc/hashiteratorkey.t	Fri Sep 10 08:41:55 2010	(r48906)
@@ -20,11 +20,22 @@
 .sub 'main'
     .include 'test_more.pir'
 
-    plan(3)
+    plan(6)
 
+    'test_new'()
+    'test_key_value'()
+    'test_empty'()
+
+.end
+
+
+.sub 'test_new'
     $P0 = new ['HashIteratorKey']
     ok(1, "Can create HashIteratorKey directly")
+.end
+
 
+.sub 'test_key_value'
     $P0 = new ['Hash']
     $P0['foo'] = 'bar'
     $P1 = iter $P0
@@ -36,6 +47,27 @@
 .end
 
 
+.sub 'test_empty'
+    .local pmc hik, p
+    .local int i
+    .local string s
+    hik = new ['HashIteratorKey']
+
+    # De facto behavior tested for code coverage
+
+    p = hik.'key'()
+    i = isnull p
+    is(i, 1, 'HIK.key gives null when unitialized')
+
+    s = hik
+    is(s, '', 'HIK gives empty string when unitialized')
+
+    # Magic value?
+    i = hik
+    is(i, -1, 'HIK get_integer gives -1')
+.end
+
+
 # Local Variables:
 #   mode: pir
 #   fill-column: 100

Modified: branches/hash_inlined_func/t/pmc/lexinfo.t
==============================================================================
--- branches/hash_inlined_func/t/pmc/lexinfo.t	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/t/pmc/lexinfo.t	Fri Sep 10 08:41:55 2010	(r48906)
@@ -17,11 +17,15 @@
 
 =cut
 
+.include 'except_types.pasm'
+
 .sub main :main
     .include 'test_more.pir'
-    plan(3)
+    plan(5)
 
     inspect_test()
+    inspect_invalid_test()
+    declare_lex_preg_test()
 .end
 
 .sub inspect_test
@@ -58,6 +62,33 @@
     is(have_b, 1, "$b symbol was in list")
 .end
 
+.sub inspect_invalid_test
+    .local pmc li, in, ex
+    .local int r, type
+    li = new ['LexInfo']
+    r = 0
+    push_eh catch
+    in = inspect li, 'fubar'
+    goto done
+  catch:
+    .get_results(ex)
+    type = ex['type']
+    r = iseq type, .EXCEPTION_INVALID_OPERATION
+  done:
+    ok(r, 'invalid introspection key throws as expected')
+.end
+
+.sub declare_lex_preg_test
+    .const string preg_name = 'foo'
+    .const int preg_value = 42
+    .local pmc li
+    li = new ['LexInfo']
+    li.'declare_lex_preg'(preg_name, preg_value)
+    .local int r
+    r = li[preg_name]
+    is(r, preg_value, 'declare_lex_preg method')
+.end
+
 # Local Variables:
 #   mode: pir
 #   fill-column: 100

Modified: branches/hash_inlined_func/tools/dev/fetch_languages.pl
==============================================================================
--- branches/hash_inlined_func/tools/dev/fetch_languages.pl	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/tools/dev/fetch_languages.pl	Fri Sep 10 08:41:55 2010	(r48906)
@@ -231,7 +231,7 @@
     {
         name       => 'pir',
         scm        => 'GIT',
-        repository => 'http://github.com/bacek/pir.git'
+        repository => 'http://github.com/parrot/pir.git'
     },
 
     {

Modified: branches/hash_inlined_func/tools/dev/headerizer.pl
==============================================================================
--- branches/hash_inlined_func/tools/dev/headerizer.pl	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/tools/dev/headerizer.pl	Fri Sep 10 08:41:55 2010	(r48906)
@@ -329,7 +329,11 @@
 
     # Walk the object files and find corresponding source (either .c or .pmc)
     for my $ofile (@ofiles) {
-        next if $ofile =~ m/^\Qsrc$PConfig{slash}ops\E/;
+
+        # Skip files in the src/ops/ subdirectory.
+
+        next if $ofile =~ m/^\Qsrc$PConfig{slash}ops\E/ || # if run by hand...
+                $ofile =~ m{^src/ops};                     # ... or by makefile
 
         $ofile =~ s/\\/\//g;
 

Modified: branches/hash_inlined_func/tools/dev/nci_thunk_gen.pir
==============================================================================
--- branches/hash_inlined_func/tools/dev/nci_thunk_gen.pir	Fri Sep 10 08:41:26 2010	(r48905)
+++ branches/hash_inlined_func/tools/dev/nci_thunk_gen.pir	Fri Sep 10 08:41:55 2010	(r48906)
@@ -313,7 +313,7 @@
     str_file = concat str_file, '.str'
 
     .local string head
-    head = 'sprintf'(<<'HEAD', c_file, ext_defn, str_file)
+    head = 'sprintf'(<<'HEADSTART', c_file)
 /* ex: set ro ft=c:
  * !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
  *
@@ -326,7 +326,13 @@
 /* %s
  *  Copyright (C) 2010, Parrot Foundation.
  *  SVN Info
- *     $Id$
+HEADSTART
+
+    # Avoid svn mangling here by hex encoding the dollar signs
+    head = concat head, " *     \x{24}Id: \x{24}\n"
+
+    .local string headtail
+    headtail = 'sprintf'(<<'HEAD', ext_defn, str_file)
  *  Overview:
  *     Native Call Interface routines. The code needed to build a
  *     parrot to C call frame is in here
@@ -355,6 +361,7 @@
    hackish, but that is just fine */
 
 HEAD
+    head = concat head, headtail
     .return (head)
 .end
 


More information about the parrot-commits mailing list