[svn:parrot] r45427 - in branches/immutable_strings_part1: include/parrot src/string

chromatic at svn.parrot.org chromatic at svn.parrot.org
Wed Apr 7 21:15:40 UTC 2010


Author: chromatic
Date: Wed Apr  7 21:15:39 2010
New Revision: 45427
URL: https://trac.parrot.org/parrot/changeset/45427

Log:
Broke the build; removed COW functions.

Modified:
   branches/immutable_strings_part1/include/parrot/string_funcs.h
   branches/immutable_strings_part1/src/string/api.c

Modified: branches/immutable_strings_part1/include/parrot/string_funcs.h
==============================================================================
--- branches/immutable_strings_part1/include/parrot/string_funcs.h	Wed Apr  7 13:49:41 2010	(r45426)
+++ branches/immutable_strings_part1/include/parrot/string_funcs.h	Wed Apr  7 21:15:39 2010	(r45427)
@@ -287,14 +287,6 @@
         __attribute__nonnull__(2);
 
 PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-STRING * Parrot_str_new_COW(PARROT_INTERP, ARGMOD(STRING *s))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*s);
-
-PARROT_EXPORT
 PARROT_WARN_UNUSED_RESULT
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
@@ -368,16 +360,6 @@
 
 PARROT_EXPORT
 PARROT_CANNOT_RETURN_NULL
-STRING * Parrot_str_reuse_COW(SHIM_INTERP,
-    ARGMOD(STRING *s),
-    ARGOUT(STRING *d))
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*s)
-        FUNC_MODIFIES(*d);
-
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
 STRING * Parrot_str_set(PARROT_INTERP,
     ARGIN_NULLOK(STRING *dest),
     ARGMOD(STRING *src))
@@ -466,12 +448,6 @@
         FUNC_MODIFIES(*s);
 
 PARROT_EXPORT
-void Parrot_str_write_COW(PARROT_INTERP, ARGMOD(STRING *s))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*s);
-
-PARROT_EXPORT
 PARROT_PURE_FUNCTION
 PARROT_CANNOT_RETURN_NULL
 const char * Parrot_string_cstring(SHIM_INTERP, ARGIN(const STRING *str))
@@ -646,9 +622,6 @@
 #define ASSERT_ARGS_Parrot_str_new_constant __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(buffer))
-#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))
@@ -673,9 +646,6 @@
 #define ASSERT_ARGS_Parrot_str_resize __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(s))
-#define ASSERT_ARGS_Parrot_str_reuse_COW __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(s) \
-    , PARROT_ASSERT_ARG(d))
 #define ASSERT_ARGS_Parrot_str_set __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(src))
@@ -706,9 +676,6 @@
        PARROT_ASSERT_ARG(interp))
 #define ASSERT_ARGS_Parrot_str_upcase_inplace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_Parrot_str_write_COW __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(s))
 #define ASSERT_ARGS_Parrot_string_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(str))
 #define ASSERT_ARGS_string_capacity __attribute__unused__ int _ASSERT_ARGS_CHECK = (\

Modified: branches/immutable_strings_part1/src/string/api.c
==============================================================================
--- branches/immutable_strings_part1/src/string/api.c	Wed Apr  7 13:49:41 2010	(r45426)
+++ branches/immutable_strings_part1/src/string/api.c	Wed Apr  7 21:15:39 2010	(r45427)
@@ -41,14 +41,6 @@
 /* HEADERIZER BEGIN: static */
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 
-static void make_writable(PARROT_INTERP,
-    ARGMOD(STRING **s),
-    const size_t len,
-    parrot_string_representation_t representation)
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*s);
-
 PARROT_INLINE
 PARROT_WARN_UNUSED_RESULT
 PARROT_CAN_RETURN_NULL
@@ -61,9 +53,6 @@
         __attribute__nonnull__(4)
         FUNC_MODIFIES(*e);
 
-#define ASSERT_ARGS_make_writable __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(s))
 #define ASSERT_ARGS_string_rep_compatible __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(a) \
     , PARROT_ASSERT_ARG(b) \
@@ -112,133 +101,6 @@
     return !s || s == STRINGNULL;
 }
 
-
-/*
-
-=item C<void Parrot_str_write_COW(PARROT_INTERP, STRING *s)>
-
-If the specified Parrot string is copy-on-write then the memory is
-copied over and the copy-on-write flag is cleared.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-Parrot_str_write_COW(PARROT_INTERP, ARGMOD(STRING *s))
-{
-    ASSERT_ARGS(Parrot_str_write_COW)
-
-    /* COW_FLAG | constant_FLAG | external_FLAG) */
-    if (PObj_is_cowed_TESTALL(s)) {
-        /* Create new pool data for this header to use,
-         * independent of the original COW data */
-        PObj_constant_CLEAR(s);
-
-        /* constant may have been marked */
-        PObj_live_CLEAR(s);
-
-        if (Buffer_buflen(s)) {
-            STRING for_alloc;
-            size_t alloc_size;
-
-            PObj_flags_CLEARALL(&for_alloc);
-            alloc_size = s->bufused;
-            Parrot_gc_allocate_string_storage(interp, &for_alloc, alloc_size);
-
-            /* now copy memory over */
-            mem_sys_memcopy(for_alloc.strstart, s->strstart, alloc_size);
-
-            /* and finally use that string memory */
-
-            Buffer_bufstart(s) = Buffer_bufstart(&for_alloc);
-            s->strstart      = for_alloc.strstart;
-            Buffer_buflen(s)   = Buffer_buflen(&for_alloc);
-            PARROT_ASSERT(Buffer_buflen(s) >= alloc_size);
-        }
-
-        /* COW_FLAG | external_FLAG */
-        PObj_is_external_CLEARALL(s);
-    }
-
-    s->hashval = 0;
-}
-
-/*
-
-=item C<STRING * Parrot_str_new_COW(PARROT_INTERP, STRING *s)>
-
-Creates a copy-on-write string, cloning a string header without
-allocating a new buffer.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-STRING *
-Parrot_str_new_COW(PARROT_INTERP, ARGMOD(STRING *s))
-{
-    ASSERT_ARGS(Parrot_str_new_COW)
-    STRING *d;
-
-    if (PObj_constant_TEST(s)) {
-        d = Parrot_gc_new_string_header(interp,
-            PObj_get_FLAGS(s) & ~PObj_constant_FLAG);
-        PObj_COW_SET(s);
-        STRUCT_COPY(d, s);
-        /* we can't move the memory, because constants aren't
-         * scanned in compact_pool, therefore the other end
-         * would point to garbage.
-         */
-        PObj_constant_CLEAR(d);
-        PObj_external_SET(d);
-    }
-    else {
-        d = Parrot_gc_new_string_header(interp, PObj_get_FLAGS(s));
-        PObj_COW_SET(s);
-        STRUCT_COPY(d, s);
-        PObj_sysmem_CLEAR(d);
-    }
-    return d;
-}
-
-/*
-
-=item C<STRING * Parrot_str_reuse_COW(PARROT_INTERP, STRING *s, STRING *d)>
-
-Creates a copy-on-write string by cloning a string header without
-allocating a new buffer. Doesn't allocate a new string header, instead
-using the one passed in and returns it.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-STRING *
-Parrot_str_reuse_COW(SHIM_INTERP, ARGMOD(STRING *s), ARGOUT(STRING *d))
-{
-    ASSERT_ARGS(Parrot_str_reuse_COW)
-
-    if (PObj_constant_TEST(s)) {
-        PObj_COW_SET(s);
-        STRUCT_COPY(d, s);
-        PObj_constant_CLEAR(d);
-        PObj_external_SET(d);
-    }
-    else {
-        PObj_COW_SET(s);
-        STRUCT_COPY(d, s);
-        PObj_sysmem_CLEAR(d);
-    }
-    return d;
-}
-
 /*
 
 =item C<STRING * Parrot_str_set(PARROT_INTERP, STRING *dest, STRING *src)>
@@ -1643,33 +1505,6 @@
 
 /*
 
-=item C<static void make_writable(PARROT_INTERP, STRING **s, const size_t len,
-parrot_string_representation_t representation)>
-
-Makes the specified Parrot string writable with minimum length C<len>.  The
-C<representation> argument is required in case a new Parrot string has to be
-created.
-
-=cut
-
-*/
-
-static void
-make_writable(PARROT_INTERP, ARGMOD(STRING **s),
-    const size_t len, parrot_string_representation_t representation)
-{
-    ASSERT_ARGS(make_writable)
-    if (!*s)
-        *s = Parrot_str_new_noinit(interp, representation, len);
-    else if ((*s)->strlen < len)
-        Parrot_str_resize(interp, *s, (UINTVAL)(len - (*s)->strlen));
-    else if (PObj_is_cowed_TESTALL(*s))
-        Parrot_str_write_COW(interp, *s);
-}
-
-
-/*
-
 =item C<STRING * Parrot_str_bitwise_and(PARROT_INTERP, const STRING *s1, const
 STRING *s2, STRING **dest)>
 


More information about the parrot-commits mailing list