[svn:parrot] r43242 - in branches/pmc_freeze_cleanup: include/parrot src src/string

plobsing at svn.parrot.org plobsing at svn.parrot.org
Fri Dec 25 02:23:01 UTC 2009


Author: plobsing
Date: Fri Dec 25 02:22:59 2009
New Revision: 43242
URL: https://trac.parrot.org/parrot/changeset/43242

Log:
new macro VISIT_PMC + no more direct visit_info access in src/list.c (using VISIT_PMC) + headerizer + fix headerizer induced warnings

Modified:
   branches/pmc_freeze_cleanup/include/parrot/list.h
   branches/pmc_freeze_cleanup/include/parrot/parrot.h
   branches/pmc_freeze_cleanup/include/parrot/pmc_freeze.h
   branches/pmc_freeze_cleanup/include/parrot/string_funcs.h
   branches/pmc_freeze_cleanup/src/hash.c
   branches/pmc_freeze_cleanup/src/list.c
   branches/pmc_freeze_cleanup/src/pmc_freeze.c
   branches/pmc_freeze_cleanup/src/string/api.c

Modified: branches/pmc_freeze_cleanup/include/parrot/list.h
==============================================================================
--- branches/pmc_freeze_cleanup/include/parrot/list.h	Thu Dec 24 21:01:15 2009	(r43241)
+++ branches/pmc_freeze_cleanup/include/parrot/list.h	Fri Dec 25 02:22:59 2009	(r43242)
@@ -220,11 +220,11 @@
 PARROT_EXPORT
 void Parrot_pmc_array_visit(PARROT_INTERP,
     ARGIN(List *list),
-    ARGMOD(void *pinfo))
+    ARGMOD(visit_info *info))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3)
-        FUNC_MODIFIES(*pinfo);
+        FUNC_MODIFIES(*info);
 
 PARROT_WARN_UNUSED_RESULT
 PARROT_PURE_FUNCTION
@@ -284,7 +284,7 @@
 #define ASSERT_ARGS_Parrot_pmc_array_visit __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(list) \
-    , PARROT_ASSERT_ARG(pinfo))
+    , PARROT_ASSERT_ARG(info))
 #define ASSERT_ARGS_Parrot_pmc_array_length __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(list))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */

Modified: branches/pmc_freeze_cleanup/include/parrot/parrot.h
==============================================================================
--- branches/pmc_freeze_cleanup/include/parrot/parrot.h	Thu Dec 24 21:01:15 2009	(r43241)
+++ branches/pmc_freeze_cleanup/include/parrot/parrot.h	Fri Dec 25 02:22:59 2009	(r43242)
@@ -264,8 +264,8 @@
 #include "parrot/string.h"
 #include "parrot/string_primitives.h"
 #include "parrot/hash.h"
-#include "parrot/list.h"
 #include "parrot/pmc_freeze.h"
+#include "parrot/list.h"
 #include "parrot/vtable.h"
 #include "parrot/context.h"
 #include "parrot/exceptions.h"

Modified: branches/pmc_freeze_cleanup/include/parrot/pmc_freeze.h
==============================================================================
--- branches/pmc_freeze_cleanup/include/parrot/pmc_freeze.h	Thu Dec 24 21:01:15 2009	(r43241)
+++ branches/pmc_freeze_cleanup/include/parrot/pmc_freeze.h	Fri Dec 25 02:22:59 2009	(r43242)
@@ -73,6 +73,18 @@
 
 #define IMAGE_IO visit_info
 
+#define VISIT_PMC(interp, visit, pmc) do {\
+    switch (VTABLE_get_integer((interp), (visit))) { \
+      case VISIT_FREEZE_NORMAL: \
+        VTABLE_push_pmc((interp), (visit), (pmc)); \
+        break; \
+      case VISIT_THAW_NORMAL: \
+      case VISIT_THAW_CONSTANTS: \
+        (pmc) = VTABLE_shift_pmc((interp), (visit)); \
+        break; \
+    } \
+} while (0)
+
 #define VISIT_PMC_ATTR(interp, visit, self, pmclass, attr_name) do {\
     PMC *_visit_pmc_attr; \
     switch (VTABLE_get_integer((interp), (visit))) { \

Modified: branches/pmc_freeze_cleanup/include/parrot/string_funcs.h
==============================================================================
--- branches/pmc_freeze_cleanup/include/parrot/string_funcs.h	Thu Dec 24 21:01:15 2009	(r43241)
+++ branches/pmc_freeze_cleanup/include/parrot/string_funcs.h	Fri Dec 25 02:22:59 2009	(r43242)
@@ -276,15 +276,6 @@
 
 PARROT_EXPORT
 PARROT_WARN_UNUSED_RESULT
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
-STRING * Parrot_str_new_from_buffer(PARROT_INTERP,
-    ARGIN_NULLOK(const Buffer * buffer),
-    const UINTVAL len)
-        __attribute__nonnull__(1);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 STRING * Parrot_str_new_constant(PARROT_INTERP, ARGIN(const char *buffer))
         __attribute__nonnull__(1)
@@ -300,6 +291,16 @@
 
 PARROT_EXPORT
 PARROT_WARN_UNUSED_RESULT
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+STRING * Parrot_str_new_from_buffer(PARROT_INTERP,
+    ARGIN(const Buffer *buffer),
+    const UINTVAL len)
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+PARROT_EXPORT
+PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 STRING * Parrot_str_new_init(PARROT_INTERP,
     ARGIN_NULLOK(const char *buffer),
@@ -638,6 +639,9 @@
 #define ASSERT_ARGS_Parrot_str_new_COW __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(s))
+#define ASSERT_ARGS_Parrot_str_new_from_buffer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(buffer))
 #define ASSERT_ARGS_Parrot_str_new_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(encoding) \

Modified: branches/pmc_freeze_cleanup/src/hash.c
==============================================================================
--- branches/pmc_freeze_cleanup/src/hash.c	Thu Dec 24 21:01:15 2009	(r43241)
+++ branches/pmc_freeze_cleanup/src/hash.c	Fri Dec 25 02:22:59 2009	(r43242)
@@ -587,8 +587,8 @@
         switch (hash->entry_type) {
           case enum_hash_pmc:
             {
-                const PMC *p = VTABLE_shift_pmc(interp, info);
-                b->value     = (void *)p;
+                PMC *p   = VTABLE_shift_pmc(interp, info);
+                b->value = (void *)p;
                 break;
             }
           case enum_hash_int:

Modified: branches/pmc_freeze_cleanup/src/list.c
==============================================================================
--- branches/pmc_freeze_cleanup/src/list.c	Thu Dec 24 21:01:15 2009	(r43241)
+++ branches/pmc_freeze_cleanup/src/list.c	Fri Dec 25 02:22:59 2009	(r43242)
@@ -1635,7 +1635,8 @@
 
 /*
 
-=item C<void Parrot_pmc_array_visit(PARROT_INTERP, List *list, void *pinfo)>
+=item C<void Parrot_pmc_array_visit(PARROT_INTERP, List *list, visit_info
+*info)>
 
 This is used by freeze/thaw to visit the contents of the list.
 
@@ -1647,11 +1648,10 @@
 
 PARROT_EXPORT
 void
-Parrot_pmc_array_visit(PARROT_INTERP, ARGIN(List *list), ARGMOD(void *pinfo))
+Parrot_pmc_array_visit(PARROT_INTERP, ARGIN(List *list), ARGMOD(visit_info *info))
 {
     ASSERT_ARGS(Parrot_pmc_array_visit)
     List_chunk        *chunk;
-    visit_info * const info = (visit_info*) pinfo;
     UINTVAL            idx;
 
     const UINTVAL n = Parrot_pmc_array_length(interp, list);
@@ -1662,9 +1662,7 @@
         if (!(chunk->flags & sparse)) {
             UINTVAL i;
             for (i = 0; i < chunk->items && idx < n; i++, idx++) {
-                PMC ** const pos = ((PMC **) Buffer_bufstart(&chunk->data)) + i;
-                info->thaw_ptr   = pos;
-                (info->visit_pmc_now)(interp, *pos, info);
+                VISIT_PMC(interp, info, ((PMC **)Buffer_bufstart(&chunk->data))[i]);
             }
         }
         /*

Modified: branches/pmc_freeze_cleanup/src/pmc_freeze.c
==============================================================================
--- branches/pmc_freeze_cleanup/src/pmc_freeze.c	Thu Dec 24 21:01:15 2009	(r43241)
+++ branches/pmc_freeze_cleanup/src/pmc_freeze.c	Fri Dec 25 02:22:59 2009	(r43242)
@@ -128,23 +128,6 @@
         FUNC_MODIFIES(*id)
         FUNC_MODIFIES(*type);
 
-static void visit_info_init(PARROT_INTERP,
-    ARGOUT(visit_info *info),
-    ARGIN(visit_enum_type what),
-    ARGIN(STRING *input),
-    ARGIN(PMC *pmc))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*info);
-
-static void todo_list_init(PARROT_INTERP,
-    ARGOUT(visit_info *info),
-    ARGIN(STRING *input))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*info);
-
 PARROT_INLINE
 static int todo_list_seen(PARROT_INTERP,
     ARGIN(PMC *pmc),
@@ -157,6 +140,17 @@
         FUNC_MODIFIES(*info)
         FUNC_MODIFIES(*id);
 
+static void visit_info_init(PARROT_INTERP,
+    ARGOUT(visit_info *info),
+    visit_enum_type what,
+    ARGIN(STRING *input),
+    ARGIN(PMC *pmc))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(4)
+        __attribute__nonnull__(5)
+        FUNC_MODIFIES(*info);
+
 static void visit_loop_todo_list(PARROT_INTERP,
     ARGIN_NULLOK(PMC *current),
     ARGIN(visit_info *info))
@@ -219,15 +213,16 @@
     , PARROT_ASSERT_ARG(info) \
     , PARROT_ASSERT_ARG(id) \
     , PARROT_ASSERT_ARG(type))
-#define ASSERT_ARGS_visit_info_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(info) \
-    , PARROT_ASSERT_ARG(input))
 #define ASSERT_ARGS_todo_list_seen __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(pmc) \
     , PARROT_ASSERT_ARG(info) \
     , PARROT_ASSERT_ARG(id))
+#define ASSERT_ARGS_visit_info_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+       PARROT_ASSERT_ARG(interp) \
+    , PARROT_ASSERT_ARG(info) \
+    , PARROT_ASSERT_ARG(input) \
+    , PARROT_ASSERT_ARG(pmc))
 #define ASSERT_ARGS_visit_loop_todo_list __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(info))
@@ -580,7 +575,7 @@
 
 static void
 visit_info_init(PARROT_INTERP, ARGOUT(visit_info *info),
-  ARGIN(visit_enum_type what), ARGIN(STRING *input), ARGIN(PMC *pmc))
+  visit_enum_type what, ARGIN(STRING *input), ARGIN(PMC *pmc))
 {
     ASSERT_ARGS(visit_info_init)
     /* We want to store a 16-byte aligned header, but the actual * header may be shorter. */
@@ -1086,7 +1081,7 @@
         gc_block = 1;
     }
 
-    visit_info_init(interp, &info, what, input, NULL);
+    visit_info_init(interp, &info, what, input, PMCNULL);
     BYTECODE_SHIFT_OK(&info);
 
     if (gc_block) {

Modified: branches/pmc_freeze_cleanup/src/string/api.c
==============================================================================
--- branches/pmc_freeze_cleanup/src/string/api.c	Thu Dec 24 21:01:15 2009	(r43241)
+++ branches/pmc_freeze_cleanup/src/string/api.c	Fri Dec 25 02:22:59 2009	(r43242)
@@ -669,7 +669,7 @@
 STRING *
 Parrot_str_new_from_buffer(PARROT_INTERP, ARGIN(const Buffer *buffer), const UINTVAL len)
 {
-    ASSERT_ARGS(Parrot_str_new)
+    ASSERT_ARGS(Parrot_str_new_from_buffer)
     STRING *result;
 
     result = Parrot_gc_new_string_header(interp, 0);


More information about the parrot-commits mailing list