[svn:parrot] r48332 - in branches/gsoc_threads: . compilers/pct/src/PAST compilers/pct/src/PCT include/parrot src src/call src/gc src/interp src/packfile src/pmc src/runcore t/native_pbc t/pmc t/src tools/dev

Chandon at svn.parrot.org Chandon at svn.parrot.org
Thu Aug 5 22:26:46 UTC 2010


Author: Chandon
Date: Thu Aug  5 22:26:46 2010
New Revision: 48332
URL: https://trac.parrot.org/parrot/changeset/48332

Log:
[gsoc_threads] Merge from trunk.

Modified:
   branches/gsoc_threads/   (props changed)
   branches/gsoc_threads/compilers/pct/src/PAST/Compiler.pir
   branches/gsoc_threads/compilers/pct/src/PCT/HLLCompiler.pir
   branches/gsoc_threads/include/parrot/packfile.h
   branches/gsoc_threads/include/parrot/runcore_trace.h   (props changed)
   branches/gsoc_threads/src/alarm.c
   branches/gsoc_threads/src/call/args.c
   branches/gsoc_threads/src/gc/system.c
   branches/gsoc_threads/src/hash.c
   branches/gsoc_threads/src/interp/inter_create.c   (props changed)
   branches/gsoc_threads/src/packfile.c
   branches/gsoc_threads/src/packfile/pf_items.c
   branches/gsoc_threads/src/packout.c
   branches/gsoc_threads/src/pmc.c
   branches/gsoc_threads/src/pmc/default.pmc
   branches/gsoc_threads/src/pmc/env.pmc
   branches/gsoc_threads/src/pmc/imageio.pmc
   branches/gsoc_threads/src/runcore/cores.c   (props changed)
   branches/gsoc_threads/src/runcore/trace.c   (props changed)
   branches/gsoc_threads/src/scheduler.c
   branches/gsoc_threads/t/native_pbc/annotations.pbc
   branches/gsoc_threads/t/native_pbc/integer.pbc
   branches/gsoc_threads/t/native_pbc/integer_1.pbc
   branches/gsoc_threads/t/native_pbc/number.pbc
   branches/gsoc_threads/t/native_pbc/number_1.pbc
   branches/gsoc_threads/t/native_pbc/string.pbc
   branches/gsoc_threads/t/native_pbc/string_1.pbc
   branches/gsoc_threads/t/pmc/oplib.t
   branches/gsoc_threads/t/src/embed.t   (props changed)
   branches/gsoc_threads/tools/dev/mk_gitignore.pl   (props changed)

Modified: branches/gsoc_threads/compilers/pct/src/PAST/Compiler.pir
==============================================================================
--- branches/gsoc_threads/compilers/pct/src/PAST/Compiler.pir	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/compilers/pct/src/PAST/Compiler.pir	Thu Aug  5 22:26:46 2010	(r48332)
@@ -81,7 +81,11 @@
     piropsig['find_codepoint']   = 'Is'
     piropsig['find_dynamic_lex'] = 'Ps'
     piropsig['find_name']  = 'Ps'
+    piropsig['getinterp']  = 'P'
     piropsig['getprop']    = 'P~P'
+    piropsig['getstderr']  = 'P'
+    piropsig['getstdin']   = 'P'
+    piropsig['getstdout']  = 'P'
     piropsig['index']      = 'Issi'
     piropsig['isa']        = 'IP~'
     piropsig['isfalse']    = 'IP'
@@ -92,9 +96,11 @@
     piropsig['length']     = 'Is'
     piropsig['load_bytecode'] = 'vs'
     piropsig['load_language'] = 'vs'
+    piropsig['loadlib']    = 'P~'
     piropsig['mod']        = 'PP+'
     piropsig['mul']        = 'PP+'
     piropsig['neg']        = 'PP'
+    piropsig['new']        = 'P~'
     piropsig['newclosure'] = 'PP'
     piropsig['not']        = 'PP'
     piropsig['ord']        = 'Isi'
@@ -117,7 +123,9 @@
     piropsig['split']      = 'Pss'
     piropsig['sub']        = 'PP+'
     piropsig['substr']     = 'Ssii'
+    piropsig['titlecase']  = 'Ss'
     piropsig['trace']      = 'vi'
+    piropsig['typeof']     = 'SP'
     piropsig['unshift']    = '0P*'
     piropsig['upcase']     = 'Ss'
     set_global '%piropsig', piropsig

Modified: branches/gsoc_threads/compilers/pct/src/PCT/HLLCompiler.pir
==============================================================================
--- branches/gsoc_threads/compilers/pct/src/PCT/HLLCompiler.pir	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/compilers/pct/src/PCT/HLLCompiler.pir	Thu Aug  5 22:26:46 2010	(r48332)
@@ -335,7 +335,10 @@
     $P1.'print'("Stage '")
     $P1.'print'(stagename)
     $P1.'print'("': ")
-    $P1.'print'($N2)
+    $P2 = new ['ResizablePMCArray']
+    push $P2, $N2
+    $S0 = sprintf "%.3f", $P2
+    $P1.'print'($S0)
     $P1.'print'(" sec\n")
     if target == stagename goto have_result
     goto stagestats_loop

Modified: branches/gsoc_threads/include/parrot/packfile.h
==============================================================================
--- branches/gsoc_threads/include/parrot/packfile.h	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/include/parrot/packfile.h	Thu Aug  5 22:26:46 2010	(r48332)
@@ -1038,6 +1038,14 @@
         __attribute__nonnull__(1)
         FUNC_MODIFIES(*pf);
 
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
+STRING * PF_fetch_buf(PARROT_INTERP,
+    ARGIN_NULLOK(PackFile *pf),
+    ARGIN(const opcode_t **cursor))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(3);
+
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
 char * PF_fetch_cstring(PARROT_INTERP,
@@ -1075,6 +1083,10 @@
         __attribute__nonnull__(3);
 
 PARROT_PURE_FUNCTION
+size_t PF_size_buf(ARGIN(const STRING *s))
+        __attribute__nonnull__(1);
+
+PARROT_PURE_FUNCTION
 size_t PF_size_cstring(ARGIN(const char *s))
         __attribute__nonnull__(1);
 
@@ -1097,6 +1109,13 @@
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
+opcode_t* PF_store_buf(ARGOUT(opcode_t *cursor), ARGIN(const STRING *s))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        FUNC_MODIFIES(*cursor);
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
 opcode_t* PF_store_cstring(ARGOUT(opcode_t *cursor), ARGIN(const char *s))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
@@ -1132,6 +1151,9 @@
 
 #define ASSERT_ARGS_PackFile_assign_transforms __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(pf))
+#define ASSERT_ARGS_PF_fetch_buf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(cursor))
 #define ASSERT_ARGS_PF_fetch_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(pf) \
@@ -1146,6 +1168,8 @@
 #define ASSERT_ARGS_PF_fetch_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(cursor))
+#define ASSERT_ARGS_PF_size_buf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(s))
 #define ASSERT_ARGS_PF_size_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(s))
 #define ASSERT_ARGS_PF_size_integer __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
@@ -1154,6 +1178,9 @@
 #define ASSERT_ARGS_PF_size_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(s))
 #define ASSERT_ARGS_PF_size_strlen __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_PF_store_buf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(cursor) \
+    , PARROT_ASSERT_ARG(s))
 #define ASSERT_ARGS_PF_store_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(cursor) \
     , PARROT_ASSERT_ARG(s))

Modified: branches/gsoc_threads/src/alarm.c
==============================================================================
--- branches/gsoc_threads/src/alarm.c	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/src/alarm.c	Thu Aug  5 22:26:46 2010	(r48332)
@@ -58,8 +58,6 @@
 {
     ASSERT_ARGS(posix_alarm_init)
 
-    sigset_t mask;
-
     struct sigaction sa;
     sa.sa_handler = Parrot_alarm_callback;
     sa.sa_flags   = SA_RESTART;

Modified: branches/gsoc_threads/src/call/args.c
==============================================================================
--- branches/gsoc_threads/src/call/args.c	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/src/call/args.c	Thu Aug  5 22:26:46 2010	(r48332)
@@ -758,7 +758,6 @@
 
     GETATTR_FixedIntegerArray_size(interp, raw_sig, param_count);
 
-
     /* A null call object is fine if there are no arguments and no returns. */
     if (PMC_IS_NULL(call_object)) {
         if (param_count > 0 && err_check)
@@ -818,6 +817,7 @@
          * arguments into an array.*/
         if (param_flags & PARROT_ARG_SLURPY_ARRAY) {
             PMC *collect_positional;
+            int  j;
 
             /* Can't handle named slurpy here, go to named argument handling */
             if (param_flags & PARROT_ARG_NAME)
@@ -828,11 +828,12 @@
                     EXCEPTION_INVALID_OPERATION,
                     "named parameters must follow all positional parameters");
 
-            collect_positional = Parrot_pmc_new(interp,
-                Parrot_get_ctx_HLL_type(interp, enum_class_ResizablePMCArray));
+            collect_positional = Parrot_pmc_new_init_int(interp,
+                Parrot_get_ctx_HLL_type(interp, enum_class_ResizablePMCArray),
+                positional_args - arg_index);
 
-            for (; arg_index < positional_args; ++arg_index) {
-                VTABLE_push_pmc(interp, collect_positional,
+            for (j = 0; arg_index < positional_args; ++arg_index) {
+                VTABLE_set_pmc_keyed_int(interp, collect_positional, j++,
                     VTABLE_get_pmc_keyed_int(interp, call_object, arg_index));
             }
 

Modified: branches/gsoc_threads/src/gc/system.c
==============================================================================
--- branches/gsoc_threads/src/gc/system.c	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/src/gc/system.c	Thu Aug  5 22:26:46 2010	(r48332)
@@ -253,7 +253,12 @@
     int i, cur_idx;
 
     /* We need to trace the stack in one running thread (this thread) as
-       well as the stack in each blocked thread. */
+       well as the stack in each blocked thread. 
+
+       If a thread isn't running or in the "blocked" state, then it's waiting 
+       on something outside of any runloop, so it doesn't have any PMCs on its
+       stack.
+    */
     cur_idx = Parrot_threads_current(interp);
 
     for (i = 0; i < tbl->count; ++i) {

Modified: branches/gsoc_threads/src/hash.c
==============================================================================
--- branches/gsoc_threads/src/hash.c	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/src/hash.c	Thu Aug  5 22:26:46 2010	(r48332)
@@ -29,8 +29,7 @@
 
 /* the number of entries above which it's faster to hash the hashval instead of
  * looping over the used HashBuckets directly */
-#define SMALL_HASH_SIZE  4
-#define INITIAL_BUCKETS  4
+#define INITIAL_BUCKETS  8
 
 /* HEADERIZER HFILE: include/parrot/hash.h */
 
@@ -1291,31 +1290,18 @@
     if (hash->entries <= 0)
         return NULL;
 
-    /* a very fast search for very small hashes */
-    if (hash->entries <= SMALL_HASH_SIZE) {
-        const UINTVAL  entries = hash->entries;
-        UINTVAL        i;
-
-        for (i = 0; i < entries; ++i) {
-            HashBucket * const bucket = hash->buckets + i;
-
-            /* the hash->compare cost is too high for this fast path */
-            if (bucket->key == key)
-                return bucket;
-        }
-    }
-
     /* if the fast search didn't work, try the normal hashing search */
     {
         const UINTVAL hashval = get_hash_val(interp, hash, key);
         HashBucket   *bucket  = hash->bucket_indices[hashval & hash->mask];
+        const hash_comp_fn compare = hash->compare;
 
         while (bucket) {
             /* key equality is always a match, so it's worth checking */
             if (bucket->key == key
 
             /* ... but the slower comparison is more accurate */
-            || ((hash->compare)(interp, key, bucket->key) == 0))
+            || ((compare)(interp, key, bucket->key) == 0))
                 return bucket;
             bucket = bucket->next;
         }
@@ -1390,6 +1376,7 @@
     ASSERT_ARGS(parrot_hash_put)
     const UINTVAL hashval = get_hash_val(interp, hash, key);
     HashBucket   *bucket  = hash->bucket_indices[hashval & hash->mask];
+    const hash_comp_fn compare = hash->compare;
 
     /* When the hash is constant, check that the key and value are also
      * constant. */
@@ -1409,7 +1396,7 @@
     /* See if we have an existing value for this key */
     while (bucket) {
         /* store hash_val or not */
-        if ((hash->compare)(interp, key, bucket->key) == 0)
+        if ((compare)(interp, key, bucket->key) == 0)
             break;
         bucket = bucket->next;
     }
@@ -1455,27 +1442,21 @@
 parrot_hash_delete(PARROT_INTERP, ARGMOD(Hash *hash), ARGIN(void *key))
 {
     ASSERT_ARGS(parrot_hash_delete)
-    HashBucket   *bucket;
-    HashBucket   *prev    = NULL;
     const UINTVAL hashval = (hash->hash_val)(interp, key, hash->seed) & hash->mask;
-
-    for (bucket = hash->bucket_indices[hashval]; bucket; bucket = bucket->next) {
-        if ((hash->compare)(interp, key, bucket->key) == 0) {
-
-            if (prev)
-                prev->next = bucket->next;
-            else
-                hash->bucket_indices[hashval] = bucket->next;
-
-            --hash->entries;
-            bucket->next    = hash->free_list;
-            bucket->key     = NULL;
-            hash->free_list = bucket;
-
-            return;
+    HashBucket   **prev   = &hash->bucket_indices[hashval];
+    if (*prev) {
+        const hash_comp_fn compare = hash->compare;
+        for (; *prev; prev = &(*prev)->next) {
+            HashBucket *current = *prev;
+            if ((compare)(interp, key, current->key) == 0) {
+                *prev = current->next;
+                --hash->entries;
+                current->next    = hash->free_list;
+                current->key     = NULL;
+                hash->free_list = current;
+                return;
+            }
         }
-
-        prev = bucket;
     }
 }
 

Modified: branches/gsoc_threads/src/packfile.c
==============================================================================
--- branches/gsoc_threads/src/packfile.c	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/src/packfile.c	Thu Aug  5 22:26:46 2010	(r48332)
@@ -3818,7 +3818,7 @@
 
       case PFC_PMC:
         component = self->u.key; /* the pmc (Sub, ...) */
-        packed_size = PF_size_strlen(Parrot_freeze_pbc_size(interp, component, ct));
+        packed_size = PF_size_strlen(Parrot_freeze_pbc_size(interp, component, ct)) - 1;
         break;
 
       default:
@@ -3919,7 +3919,7 @@
     /* thawing the PMC needs the real packfile in place */
     PackFile_ByteCode * const cs_save = interp->code;
     interp->code                      = pf->cur_cs;
-    image                             = PF_fetch_string(interp, pf, &cursor);
+    image                             = PF_fetch_buf(interp, pf, &cursor);
 
     pmc         = Parrot_thaw_pbc(interp, image, constt);
 

Modified: branches/gsoc_threads/src/packfile/pf_items.c
==============================================================================
--- branches/gsoc_threads/src/packfile/pf_items.c	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/src/packfile/pf_items.c	Thu Aug  5 22:26:46 2010	(r48332)
@@ -1189,6 +1189,107 @@
 
 /*
 
+=item C<STRING * PF_fetch_buf(PARROT_INTERP, PackFile *pf, const opcode_t
+**cursor)>
+
+Fetches a buffer (fixed_8 encoded temporary C<STRING>) from bytecode.
+
+Opcode format is:
+
+    opcode_t size
+    * data
+
+When used for freeze/thaw, the C<pf> argument might be C<NULL>.
+
+The returned buffer points to the underlying packfile. It should be used and
+discarded immediately to avoid things changing underneath you.
+
+=cut
+
+*/
+
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
+STRING *
+PF_fetch_buf(PARROT_INTERP, ARGIN_NULLOK(PackFile *pf), ARGIN(const opcode_t **cursor))
+{
+    ASSERT_ARGS(PF_fetch_buf)
+    const int wordsize = pf ? pf->header->wordsize : sizeof (opcode_t);
+    size_t  size       = PF_fetch_opcode(pf, cursor);
+    STRING *s          = Parrot_str_new_init(interp, (const char *)*cursor, size,
+                            Parrot_fixed_8_encoding_ptr, Parrot_binary_charset_ptr,
+                            PObj_external_FLAG);
+    *((const unsigned char **)(cursor)) += ROUND_UP_B(size, wordsize);
+    return s;
+}
+
+
+/*
+
+=item C<opcode_t* PF_store_buf(opcode_t *cursor, const STRING *s)>
+
+Write a buffer (fixed_8 encoded, binary string) to the opcode stream. These
+are encoded more compactly and read more efficiently than normal strings, but
+have limitations (see C<PF_fetch_buf>).
+
+=cut
+
+*/
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
+opcode_t*
+PF_store_buf(ARGOUT(opcode_t *cursor), ARGIN(const STRING *s))
+{
+    ASSERT_ARGS(PF_store_buf)
+    const int  wordsize = sizeof (opcode_t);
+
+    PARROT_ASSERT(s->encoding == Parrot_fixed_8_encoding_ptr);
+    PARROT_ASSERT(s->charset  == Parrot_binary_charset_ptr);
+
+    *cursor++ = s->bufused;
+
+    if (s->strstart) {
+        char *charcursor = (char *) cursor;
+        mem_sys_memcopy(charcursor, s->strstart, s->bufused);
+        charcursor += s->bufused;
+
+        /* Pad up to wordsize boundary. */
+        while ((charcursor - (char *)cursor) % wordsize)
+            *charcursor++ = 0;
+
+        cursor += (charcursor - (char *)cursor) / wordsize;
+    }
+
+    return cursor;
+}
+
+
+/*
+
+=item C<size_t PF_size_buf(const STRING *s)>
+
+Reports the stored size of a buffer in C<opcode_t> units.
+
+=cut
+
+*/
+
+PARROT_PURE_FUNCTION
+size_t
+PF_size_buf(ARGIN(const STRING *s))
+{
+    ASSERT_ARGS(PF_size_buf)
+    if (STRING_IS_NULL(s))
+        return 1;
+    else
+        return PF_size_strlen(s->bufused) - 1;
+}
+
+
+/*
+
 =item C<STRING * PF_fetch_string(PARROT_INTERP, PackFile *pf, const opcode_t
 **cursor)>
 

Modified: branches/gsoc_threads/src/packout.c
==============================================================================
--- branches/gsoc_threads/src/packout.c	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/src/packout.c	Thu Aug  5 22:26:46 2010	(r48332)
@@ -361,9 +361,9 @@
         break;
 
       case PFC_PMC:
-        key = self->u.key;      /* the (Sub) PMC */
-        image = Parrot_freeze_pbc(interp, key, const_table);
-        cursor = PF_store_string(cursor, image);
+        key    = self->u.key;      /* the (Sub) PMC */
+        image  = Parrot_freeze_pbc(interp, key, const_table);
+        cursor = PF_store_buf(cursor, image);
         break;
 
       case PFC_KEY:

Modified: branches/gsoc_threads/src/pmc.c
==============================================================================
--- branches/gsoc_threads/src/pmc.c	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/src/pmc.c	Thu Aug  5 22:26:46 2010	(r48332)
@@ -573,10 +573,9 @@
     PMC *const classobj = interp->vtables[base_type]->pmc_class;
 
     if (!PMC_IS_NULL(classobj) && PObj_is_class_TEST(classobj)) {
-        PMC * const initial =
-          Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_Integer));
-        VTABLE_set_integer_native(interp, initial, init);
-        return VTABLE_instantiate(interp, classobj, initial);
+        PMC * const obj = VTABLE_instantiate(interp, classobj, PMCNULL);
+        VTABLE_set_integer_native(interp, obj, init);
+        return obj;
     }
     else {
         PMC * const pmc = get_new_pmc_header(interp, base_type, 0);

Modified: branches/gsoc_threads/src/pmc/default.pmc
==============================================================================
--- branches/gsoc_threads/src/pmc/default.pmc	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/src/pmc/default.pmc	Thu Aug  5 22:26:46 2010	(r48332)
@@ -360,6 +360,23 @@
 
 /*
 
+=item C<void init_int(INTVAL initvalue)>
+
+Calls C<init()> and C<set_integer_native(initvalue)>.
+Default implementation to allow more usages of init_int without having to
+implement it everywhere.
+
+=cut
+
+*/
+
+    VTABLE void init_int(INTVAL initvalue) {
+        SELF.init();
+        SELF.set_integer_native(initvalue);
+    }
+
+/*
+
 =item C<void destroy()>
 
 Does nothing.

Modified: branches/gsoc_threads/src/pmc/env.pmc
==============================================================================
--- branches/gsoc_threads/src/pmc/env.pmc	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/src/pmc/env.pmc	Thu Aug  5 22:26:46 2010	(r48332)
@@ -10,9 +10,6 @@
 
 C<Env> is a singleton class which provides access to the system environment.
 
-XXX Think about returning Pair back. Currently there is no way to iterate over
-environment I<keys>.
-
 =head2 Methods
 
 =over 4

Modified: branches/gsoc_threads/src/pmc/imageio.pmc
==============================================================================
--- branches/gsoc_threads/src/pmc/imageio.pmc	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/src/pmc/imageio.pmc	Thu Aug  5 22:26:46 2010	(r48332)
@@ -139,7 +139,7 @@
 {
     ASSERT_ARGS(SET_VISIT_CURSOR)
 
-    const char *bufstart = (char *)Buffer_bufstart(PARROT_IMAGEIO(pmc)->buffer);
+    const char * const bufstart  = (const char *)Buffer_bufstart(PARROT_IMAGEIO(pmc)->buffer);
     PARROT_IMAGEIO(pmc)->pos = (cursor - bufstart);
 }
 
@@ -181,9 +181,8 @@
         Parrot_gc_new_bufferlike_header(interp, sizeof (Buffer));
     Parrot_gc_allocate_buffer_storage_aligned(interp,
         PARROT_IMAGEIO(info)->buffer, len);
-
     SET_VISIT_CURSOR(info,
-        (char *)Buffer_bufstart(PARROT_IMAGEIO(info)->buffer));
+        (const char *)Buffer_bufstart(PARROT_IMAGEIO(info)->buffer));
 }
 
 
@@ -201,7 +200,7 @@
 {
     ASSERT_ARGS(ensure_buffer_size)
 
-    Buffer *buf         = PARROT_IMAGEIO(io)->buffer;
+    Buffer * const buf  = PARROT_IMAGEIO(io)->buffer;
     const size_t used   = PARROT_IMAGEIO(io)->pos;
     const int need_free = Buffer_buflen(buf) - used - len;
 
@@ -523,7 +522,7 @@
         const size_t len = PF_size_integer() * sizeof (opcode_t);
         ensure_buffer_size(INTERP, SELF, len);
         SET_VISIT_CURSOR(SELF,
-            (char *)PF_store_integer(GET_VISIT_CURSOR(SELF), v));
+            (const char *)PF_store_integer(GET_VISIT_CURSOR(SELF), v));
     }
 
 
@@ -541,7 +540,7 @@
         const size_t len = PF_size_number() * sizeof (opcode_t);
         ensure_buffer_size(INTERP, SELF, len);
         SET_VISIT_CURSOR(SELF,
-            (char *)PF_store_number(GET_VISIT_CURSOR(SELF), &v));
+            (const char *)PF_store_number(GET_VISIT_CURSOR(SELF), &v));
     }
 
 
@@ -558,9 +557,9 @@
     VTABLE void push_string(STRING *v) {
         if (PObj_flag_TEST(private1, SELF)) {
             /* store a reference to constant table entry of string */
-            PMC                 *v_pmc = key_new_string(interp, v);
-            PackFile_ConstTable *table = PARROT_IMAGEIO(SELF)->pf_ct;
-            int                  idx   =
+            PMC                 * const v_pmc = key_new_string(interp, v);
+            PackFile_ConstTable * const table = PARROT_IMAGEIO(SELF)->pf_ct;
+            const int idx =
                 PackFile_ConstTable_rlookup(INTERP, table, v_pmc, PFC_STRING);
 
             if (idx >= 0) {
@@ -582,7 +581,7 @@
             const size_t len = PF_size_string(v) * sizeof (opcode_t);
             ensure_buffer_size(INTERP, SELF, len);
             SET_VISIT_CURSOR(SELF,
-                (char *)PF_store_string(GET_VISIT_CURSOR(SELF), v));
+                (const char *)PF_store_string(GET_VISIT_CURSOR(SELF), v));
         }
     }
 
@@ -655,7 +654,7 @@
     VTABLE FLOATVAL shift_float() {
         const opcode_t *pos = GET_VISIT_CURSOR(SELF);
         FLOATVAL        f   = PF_fetch_number(PARROT_IMAGEIO(SELF)->pf, &pos);
-        SET_VISIT_CURSOR(SELF, (char *)pos);
+        SET_VISIT_CURSOR(SELF, (const char *)pos);
         BYTECODE_SHIFT_OK(SELF);
         return f;
     }
@@ -692,10 +691,10 @@
         }
 
         {
-            const opcode_t *pos = GET_VISIT_CURSOR(SELF);
-            STRING         *s   = PF_fetch_string(INTERP,
+            const opcode_t * pos     = GET_VISIT_CURSOR(SELF);
+            STRING         * const s = PF_fetch_string(INTERP,
                                     PARROT_IMAGEIO(SELF)->pf, &pos);
-            SET_VISIT_CURSOR(SELF, (char *)pos);
+            SET_VISIT_CURSOR(SELF, (const char *)pos);
             BYTECODE_SHIFT_OK(SELF);
             return s;
         }
@@ -749,7 +748,7 @@
         PARROT_ASSERT(image->_bufstart == image->strstart);
 
         SET_VISIT_CURSOR(SELF,
-            (char *)Buffer_bufstart(PARROT_IMAGEIO(SELF)->buffer));
+            (const char *)Buffer_bufstart(PARROT_IMAGEIO(SELF)->buffer));
         PARROT_IMAGEIO(SELF)->input_length = image->strlen;
 
         PARROT_IMAGEIO(SELF)->pf->options |= PFOPT_PMC_FREEZE_ONLY;

Modified: branches/gsoc_threads/src/scheduler.c
==============================================================================
--- branches/gsoc_threads/src/scheduler.c	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/src/scheduler.c	Thu Aug  5 22:26:46 2010	(r48332)
@@ -151,7 +151,6 @@
 
 */
 
-PARROT_EXPORT
 void
 Parrot_cx_outer_runloop(PARROT_INTERP, INTVAL tidx)
 {
@@ -303,6 +302,7 @@
 =cut
 */
 
+PARROT_EXPORT
 PARROT_CANNOT_RETURN_NULL
 PMC*
 Parrot_cx_stop_task(PARROT_INTERP, ARGIN(opcode_t *next))
@@ -379,7 +379,6 @@
 
 */
 
-PARROT_EXPORT
 void
 Parrot_cx_runloop_end(PARROT_INTERP)
 {
@@ -633,7 +632,6 @@
 
 */
 
-PARROT_EXPORT
 void
 Parrot_cx_schedule_alarm(PARROT_INTERP, ARGIN(PMC *alarm))
 {

Modified: branches/gsoc_threads/t/native_pbc/annotations.pbc
==============================================================================
Binary file (source and/or target). No diff available.

Modified: branches/gsoc_threads/t/native_pbc/integer.pbc
==============================================================================
Binary file (source and/or target). No diff available.

Modified: branches/gsoc_threads/t/native_pbc/integer_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.

Modified: branches/gsoc_threads/t/native_pbc/number.pbc
==============================================================================
Binary file (source and/or target). No diff available.

Modified: branches/gsoc_threads/t/native_pbc/number_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.

Modified: branches/gsoc_threads/t/native_pbc/string.pbc
==============================================================================
Binary file (source and/or target). No diff available.

Modified: branches/gsoc_threads/t/native_pbc/string_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.

Modified: branches/gsoc_threads/t/pmc/oplib.t
==============================================================================
--- branches/gsoc_threads/t/pmc/oplib.t	Thu Aug  5 22:12:05 2010	(r48331)
+++ branches/gsoc_threads/t/pmc/oplib.t	Thu Aug  5 22:26:46 2010	(r48332)
@@ -26,7 +26,7 @@
 
 .sub main :main
     .include 'test_more.pir'
-    plan(12)
+    plan(13)
     new_oplib()
     check_elements()
     getint_end()
@@ -102,8 +102,11 @@
     ok($I0, "got same result from both ways")
 
     $I1 = op
-    $I0 = oplib['end']
+    $I0 = oplib[TESTED_OP]
     is($I0, $I1, 'opcode number from Opcode and from OpLib is the same')
+
+    $S0 = op
+    is($S0, TESTED_OP, 'name from Opcode matches name searched for')
 .end
 
 .sub family_end


More information about the parrot-commits mailing list