[svn:parrot] r38576 - in trunk/src: . call pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Fri May 8 01:34:08 UTC 2009


Author: chromatic
Date: Fri May  8 01:34:07 2009
New Revision: 38576
URL: https://trac.parrot.org/parrot/changeset/38576

Log:
[PMC] Changed some key_next() calls to VTABLE_shift_pmc calls on Key PMCs where
it's unambiguous that the Key PMC really is a Key PMC.

Modified:
   trunk/src/call/pcc.c
   trunk/src/global.c
   trunk/src/jit.c
   trunk/src/key.c
   trunk/src/pmc/key.pmc
   trunk/src/pmc/namespace.pmc
   trunk/src/pmc/orderedhash.pmc

Modified: trunk/src/call/pcc.c
==============================================================================
--- trunk/src/call/pcc.c	Fri May  8 01:31:27 2009	(r38575)
+++ trunk/src/call/pcc.c	Fri May  8 01:34:07 2009	(r38576)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2001-2008, Parrot Foundation.
+Copyright (C) 2001-2009, Parrot Foundation.
 $Id$
 
 =head1 Parrot Calling Conventions
@@ -1199,7 +1199,7 @@
     if (key->vtable->base_type != enum_class_Key)
         return;
 
-    for (; key; key=key_next(interp, key)) {
+    for (; key; key = VTABLE_shift_pmc(interp, key)) {
         /* register keys have to be cloned */
         if (PObj_get_FLAGS(key) & KEY_register_FLAG) {
             Parrot_Context temp_ctx;

Modified: trunk/src/global.c
==============================================================================
--- trunk/src/global.c	Fri May  8 01:31:27 2009	(r38575)
+++ trunk/src/global.c	Fri May  8 01:34:07 2009	(r38576)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2004-2008, Parrot Foundation.
+Copyright (C) 2004-2009, Parrot Foundation.
 $Id$
 
 =head1 NAME
@@ -222,7 +222,7 @@
         }
 
         ns  = sub_ns;
-        key = key_next(interp, key);
+        key = VTABLE_shift_pmc(interp, key);
     }
 
     return ns;

Modified: trunk/src/jit.c
==============================================================================
--- trunk/src/jit.c	Fri May  8 01:31:27 2009	(r38575)
+++ trunk/src/jit.c	Fri May  8 01:34:07 2009	(r38576)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2001-2008, Parrot Foundation.
+Copyright (C) 2001-2009, Parrot Foundation.
 $Id$
 
 =head1 NAME
@@ -372,7 +372,7 @@
                     if (n < NUM_REGISTERS && !ru[typ].reg_count[n]++)
                         ru[typ].reg_dir[n] |= PARROT_ARGDIR_IN;
                 }
-                key = key_next(interp, key);
+                key = VTABLE_shift_pmc(interp, key);
             }
         }
     }

Modified: trunk/src/key.c
==============================================================================
--- trunk/src/key.c	Fri May  8 01:31:27 2009	(r38575)
+++ trunk/src/key.c	Fri May  8 01:34:07 2009	(r38576)
@@ -548,9 +548,8 @@
         GETATTR_Key_next_key(interp, key, next_key);
         return next_key;
     }
-    else {
-        return NULL;
-    }
+
+    return NULL;
 }
 
 

Modified: trunk/src/pmc/key.pmc
==============================================================================
--- trunk/src/pmc/key.pmc	Fri May  8 01:31:27 2009	(r38575)
+++ trunk/src/pmc/key.pmc	Fri May  8 01:34:07 2009	(r38576)
@@ -277,7 +277,13 @@
 */
 
     VTABLE PMC *shift_pmc() {
-        return key_next(INTERP, SELF);
+        PMC *next_key;
+
+        if (!SELF->pmc_ext)
+            return NULL;
+
+        GET_ATTR_next_key(INTERP, SELF, next_key);
+        return next_key;
     }
 
 /*

Modified: trunk/src/pmc/namespace.pmc
==============================================================================
--- trunk/src/pmc/namespace.pmc	Fri May  8 01:31:27 2009	(r38575)
+++ trunk/src/pmc/namespace.pmc	Fri May  8 01:34:07 2009	(r38576)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2005-2008, Parrot Foundation.
+Copyright (C) 2005-2009, Parrot Foundation.
 $Id$
 
 =head1 NAME
@@ -354,7 +354,7 @@
         if (key->vtable->base_type == enum_class_Key) {
             while (1) {
                 STRING * const part = VTABLE_get_string(INTERP, key);
-                key  = key_next(INTERP, key);
+                key                 = VTABLE_shift_pmc(INTERP, key);
 
                 if (!key) {
                     Parrot_set_global(INTERP, ns, part, value);
@@ -407,7 +407,7 @@
 
         if (key->vtable->base_type == enum_class_Key) {
             STRING * const part = VTABLE_get_string(INTERP, key);
-            key  = key_next(INTERP, key);
+            key                 = VTABLE_shift_pmc(INTERP, key);
 
             if (!key)
                 return VTABLE_get_pmc_keyed_str(INTERP, ns, part);
@@ -476,7 +476,7 @@
                 /* this loop (and function) could use a rewrite for clarity */
                 while (1) {
                     STRING * const part = VTABLE_get_string(INTERP, key);
-                    key  = key_next(INTERP, key);
+                    key                 = VTABLE_shift_pmc(INTERP, key);
 
                     if (!key)
                         return VTABLE_get_pointer_keyed_str(INTERP, ns, part);

Modified: trunk/src/pmc/orderedhash.pmc
==============================================================================
--- trunk/src/pmc/orderedhash.pmc	Fri May  8 01:31:27 2009	(r38575)
+++ trunk/src/pmc/orderedhash.pmc	Fri May  8 01:34:07 2009	(r38576)
@@ -113,7 +113,7 @@
     VTABLE PMC *get_pmc_keyed(PMC *key) {
         if ((PObj_get_FLAGS(key) & KEY_type_FLAGS) == KEY_integer_FLAG) {
             PMC * const item = SELF.get_pmc_keyed_int(VTABLE_get_integer(INTERP, key));
-            PMC * const next = key_next(INTERP, key);
+            PMC * const next = VTABLE_shift_pmc(INTERP, key);
 
             if (!next)
                 return item;
@@ -161,7 +161,7 @@
     VTABLE STRING *get_string_keyed(PMC *key) {
         if ((PObj_get_FLAGS(key) & KEY_type_FLAGS) == KEY_integer_FLAG) {
             PMC * const item = SELF.get_pmc_keyed_int(VTABLE_get_integer(INTERP, key));
-            PMC * const next = key_next(INTERP, key);
+            PMC * const next = VTABLE_shift_pmc(INTERP, key);
 
             if (!next)
                 return VTABLE_get_string(INTERP, item);
@@ -210,7 +210,7 @@
 
         if ((PObj_get_FLAGS(key) & KEY_type_FLAGS) == KEY_integer_FLAG) {
             PMC * const item = SELF.get_pmc_keyed_int(VTABLE_get_integer(INTERP, key));
-            PMC * const next = key_next(INTERP, key);
+            PMC * const next = VTABLE_shift_pmc(INTERP, key);
 
             if (!next)
                 return VTABLE_get_integer(INTERP, item);
@@ -259,7 +259,7 @@
     VTABLE FLOATVAL get_number_keyed(PMC *key) {
         if ((PObj_get_FLAGS(key) & KEY_type_FLAGS) == KEY_integer_FLAG) {
             PMC * const item = SELF.get_pmc_keyed_int(VTABLE_get_integer(INTERP, key));
-            PMC * const next = key_next(INTERP, key);
+            PMC * const next = VTABLE_shift_pmc(INTERP, key);
 
             if (!next)
                 return VTABLE_get_number(INTERP, item);
@@ -417,7 +417,7 @@
                 return 0;
 
             item = (PMC *)b->value;
-            next = key_next(INTERP, key);
+            next = VTABLE_shift_pmc(INTERP, key);
 
             if (!next)
                 return 1;
@@ -469,7 +469,7 @@
                 return 0;
 
             item = (PMC *)b->value;
-            next = key_next(INTERP, key);
+            next = VTABLE_shift_pmc(INTERP, key);
 
             if (!next)
                 return VTABLE_defined(INTERP, item);


More information about the parrot-commits mailing list