[svn:parrot] r44968 - branches/pcc_hackathon_6Mar10/src/call

bacek at svn.parrot.org bacek at svn.parrot.org
Tue Mar 16 20:14:25 UTC 2010


Author: bacek
Date: Tue Mar 16 20:14:24 2010
New Revision: 44968
URL: https://trac.parrot.org/parrot/changeset/44968

Log:
Remove csr_foo functions.

Modified:
   branches/pcc_hackathon_6Mar10/src/call/args.c

Modified: branches/pcc_hackathon_6Mar10/src/call/args.c
==============================================================================
--- branches/pcc_hackathon_6Mar10/src/call/args.c	Tue Mar 16 20:14:01 2010	(r44967)
+++ branches/pcc_hackathon_6Mar10/src/call/args.c	Tue Mar 16 20:14:24 2010	(r44968)
@@ -81,66 +81,6 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-static void csr_fill_integer(PARROT_INTERP,
-    ARGIN(PMC *self),
-    INTVAL key,
-    INTVAL value)
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-static void csr_fill_number(PARROT_INTERP,
-    ARGIN(PMC *self),
-    INTVAL key,
-    FLOATVAL value)
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-static void csr_fill_pmc(PARROT_INTERP,
-    ARGIN(PMC *self),
-    INTVAL key,
-    ARGIN_NULLOK(PMC *value))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-static void csr_fill_string(PARROT_INTERP,
-    ARGIN(PMC *self),
-    INTVAL key,
-    ARGIN_NULLOK(STRING *value))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-PARROT_CANNOT_RETURN_NULL
-static void* csr_get_pointer_keyed_int(PARROT_INTERP,
-    ARGIN(PMC *self),
-    INTVAL key)
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-PARROT_CANNOT_RETURN_NULL
-static STRING* csr_get_string_keyed_int(PARROT_INTERP,
-    ARGIN(PMC *self),
-    INTVAL key)
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-static void csr_push_pointer(PARROT_INTERP,
-    ARGIN(PMC *self),
-    ARGIN_NULLOK(void *value),
-    INTVAL type)
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-PARROT_CANNOT_RETURN_NULL
-static void** csr_reallocate_return_values(PARROT_INTERP,
-    ARGIN(PMC *self),
-    INTVAL size)
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-static INTVAL csr_returns_count(PARROT_INTERP, ARGIN(PMC *self))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
 PARROT_CANNOT_RETURN_NULL
 static void dissect_aggregate_arg(PARROT_INTERP,
     ARGMOD(PMC *call_object),
@@ -355,33 +295,6 @@
 #define ASSERT_ARGS_clone_key_arg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(key))
-#define ASSERT_ARGS_csr_fill_integer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_csr_fill_number __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_csr_fill_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_csr_fill_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_csr_get_pointer_keyed_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_csr_get_string_keyed_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_csr_push_pointer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_csr_reallocate_return_values __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_csr_returns_count __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(self))
 #define ASSERT_ARGS_dissect_aggregate_arg __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(call_object) \
@@ -2052,309 +1965,6 @@
 
 /*
 
-VTABLE functions from CallContextReturns. TODO Rename them appropriately.
-
-*/
-
-/* mask off lower two bits (1 + 2 = 3) for pointer tags */
-#define TAG_BITS 3
-#define UNTAG_CELL(c) INTVAL2PTR(void *, (PTR2INTVAL(c)) & ~TAG_BITS)
-#define CELL_TYPE_MASK(c) (PTR2INTVAL(c)) & TAG_BITS
-
-/*
-
-=item C<static void** csr_reallocate_return_values(PARROT_INTERP, PMC *self,
-INTVAL size)>
-
-Resizes the array to C<size> elements.
-
-=cut
-
-*/
-
-PARROT_CANNOT_RETURN_NULL
-static void**
-csr_reallocate_return_values(PARROT_INTERP, ARGIN(PMC *self), INTVAL size)
-{
-    ASSERT_ARGS(csr_reallocate_return_values)
-    void    **values = NULL;
-    INTVAL    resize_threshold;
-
-    GETATTR_CallContext_returns_values(interp, self, values);
-    GETATTR_CallContext_returns_resize_threshold(interp, self, resize_threshold);
-
-    /* Empty. Allocate 8 elements (arbitary number) */
-    if (!values) {
-        /* It's slightly wrong. We have to allocate directly from system allocator
-         * when initial size is greater than 8. But it's never happen. So, put
-         * assert here to be sure */
-        PARROT_ASSERT(size < 8);
-        values = (void **)Parrot_gc_allocate_fixed_size_storage(interp,
-                                 8 * sizeof (void *));
-
-        SETATTR_CallContext_returns_values(interp, self, values);
-        SETATTR_CallContext_returns_size(interp, self, size);
-        SETATTR_CallContext_returns_resize_threshold(interp, self, 8);
-    }
-    else if (size <= resize_threshold) {
-        SETATTR_CallContext_returns_size(interp, self, size);
-    }
-    else {
-        INTVAL  cur = resize_threshold;
-
-        /* Switch to system allocator */
-        if (cur == 8) {
-            void * const old_values = values;
-
-            values     = mem_gc_allocate_n_typed(interp, 8, void *);
-            memcpy(values, old_values, 8 * sizeof (void *));
-            Parrot_gc_free_fixed_size_storage(interp,
-                8 * sizeof (void *), old_values);
-        }
-
-        if (cur < 8192)
-            cur = size < 2 * cur ? 2 * cur : size;
-        else {
-            const INTVAL needed = size - cur;
-            cur          += needed + 4096;
-            cur          &= ~0xfff;
-        }
-
-        values = mem_gc_realloc_n_typed_zeroed(interp, values,
-                cur, resize_threshold, void *);
-
-        SETATTR_CallContext_returns_values(interp, self, values);
-        SETATTR_CallContext_returns_size(interp, self, size);
-        SETATTR_CallContext_returns_resize_threshold(interp, self, cur);
-    }
-
-    return values;
-}
-
-/*
-
-=item C<static INTVAL csr_returns_count(PARROT_INTERP, PMC *self)>
-
-Returns the number of returns values.
-
-=cut
-
-*/
-
-static INTVAL
-csr_returns_count(PARROT_INTERP, ARGIN(PMC *self))
-{
-    ASSERT_ARGS(csr_returns_count)
-    INTVAL size;
-    GETATTR_CallContext_returns_size(interp, self, size);
-    return size;
-}
-
-/*
-
-=item C<static void csr_push_pointer(PARROT_INTERP, PMC *self, void *value,
-INTVAL type)>
-
-Push pointer to results.  The pointer should point to a storage
-location for a return value -- it must be a pointer to an INTVAL, FLOATVAL,
-PMC, or STRING storage location. C<type> is type of pointer.
-
-TODO Rephrase doc. It's weird.
-
-=cut
-
-*/
-
-static void
-csr_push_pointer(PARROT_INTERP, ARGIN(PMC *self), ARGIN_NULLOK(void *value), INTVAL type)
-{
-    ASSERT_ARGS(csr_push_pointer)
-    void   **values;
-    INTVAL   size;
-
-    PARROT_ASSERT((type >= 0 && type < 4) || !"Wrong pointer type");
-
-    GETATTR_CallContext_returns_size(interp, self, size);
-    values = csr_reallocate_return_values(interp, self, size + 1);
-
-    /* Tag pointer */
-    values[size] = INTVAL2PTR(void *, PTR2INTVAL(value) | type);
-}
-
-
-/*
-
-=item C<static void csr_fill_integer(PARROT_INTERP, PMC *self, INTVAL key,
-INTVAL value)>
-
-=item C<static void csr_fill_number(PARROT_INTERP, PMC *self, INTVAL key,
-FLOATVAL value)>
-
-=item C<static void csr_fill_string(PARROT_INTERP, PMC *self, INTVAL key, STRING
-*value)>
-
-=item C<static void csr_fill_pmc(PARROT_INTERP, PMC *self, INTVAL key, PMC
-*value)>
-
-Sets the value of the element at index C<key> to C<value>, casting if
-necessary.
-
-=cut
-
-*/
-
-static void
-csr_fill_integer(PARROT_INTERP, ARGIN(PMC *self), INTVAL key, INTVAL value)
-{
-    ASSERT_ARGS(csr_fill_integer)
-    void * const cell = csr_get_pointer_keyed_int(interp, self, key);
-    void * const ptr  = UNTAG_CELL(cell);
-
-    switch ((Call_bits_enum_t)CELL_TYPE_MASK(cell)) {
-      case PARROT_ARG_INTVAL:
-        *(INTVAL *)ptr = value;
-        break;
-      case PARROT_ARG_FLOATVAL:
-        *(FLOATVAL *)ptr = value;
-        break;
-      case PARROT_ARG_STRING:
-        *(STRING **)ptr = Parrot_str_from_int(interp, value);
-        break;
-      case PARROT_ARG_PMC:
-        *(PMC **)ptr = get_integer_pmc(interp, value);
-        break;
-      default:
-        PARROT_ASSERT(!"Impossible type");
-    }
-}
-
-static void
-csr_fill_number(PARROT_INTERP, ARGIN(PMC *self), INTVAL key, FLOATVAL value)
-{
-    ASSERT_ARGS(csr_fill_number)
-    void * const cell = csr_get_pointer_keyed_int(interp, self, key);
-    void * const ptr  = UNTAG_CELL(cell);
-
-    switch ((Call_bits_enum_t)CELL_TYPE_MASK(cell)) {
-      case PARROT_ARG_INTVAL:
-        *(INTVAL *)ptr = value;
-        break;
-      case PARROT_ARG_FLOATVAL:
-        *(FLOATVAL *)ptr = value;
-        break;
-      case PARROT_ARG_STRING:
-        *(STRING **)ptr = Parrot_str_from_num(interp, value);
-        break;
-      case PARROT_ARG_PMC:
-        *(PMC **)ptr = get_number_pmc(interp, value);
-        break;
-      default:
-        PARROT_ASSERT(!"Impossible type");
-    }
-}
-
-static void
-csr_fill_string(PARROT_INTERP, ARGIN(PMC *self), INTVAL key, ARGIN_NULLOK(STRING *value))
-{
-    ASSERT_ARGS(csr_fill_string)
-    void * const cell = csr_get_pointer_keyed_int(interp, self, key);
-    void * const ptr  = UNTAG_CELL(cell);
-
-    switch ((Call_bits_enum_t)CELL_TYPE_MASK(cell)) {
-      case PARROT_ARG_INTVAL:
-        *(INTVAL *)ptr = Parrot_str_to_int(interp, value);
-        break;
-      case PARROT_ARG_FLOATVAL:
-        *(FLOATVAL *)ptr = Parrot_str_to_num(interp, value);
-        break;
-      case PARROT_ARG_STRING:
-        *(STRING **)ptr = value;
-        break;
-      case PARROT_ARG_PMC:
-        *(PMC **)ptr = STRING_IS_NULL(value) ?
-                PMCNULL :
-                get_string_pmc(interp, value);
-        break;
-      default:
-        PARROT_ASSERT(!"Impossible type");
-    }
-}
-
-static void
-csr_fill_pmc(PARROT_INTERP, ARGIN(PMC *self), INTVAL key, ARGIN_NULLOK(PMC *value))
-{
-    ASSERT_ARGS(csr_fill_pmc)
-    void * const cell = csr_get_pointer_keyed_int(interp, self, key);
-    void * const ptr  = UNTAG_CELL(cell);
-
-    switch ((Call_bits_enum_t)CELL_TYPE_MASK(cell)) {
-      case PARROT_ARG_INTVAL:
-        *(INTVAL *)ptr = VTABLE_get_integer(interp, value);
-        break;
-      case PARROT_ARG_FLOATVAL:
-        *(FLOATVAL *)ptr = VTABLE_get_number(interp, value);
-        break;
-      case PARROT_ARG_STRING:
-        *(STRING **)ptr = VTABLE_get_string(interp, value);
-        break;
-      case PARROT_ARG_PMC:
-        *(PMC **)ptr = value;
-        break;
-      default:
-        PARROT_ASSERT(!"Impossible type");
-    }
-}
-
-/*
-
-=item C<static STRING* csr_get_string_keyed_int(PARROT_INTERP, PMC *self, INTVAL
-key)>
-
-Gets raw pointer for result.
-
-=cut
-
-*/
-
-PARROT_CANNOT_RETURN_NULL
-static STRING*
-csr_get_string_keyed_int(PARROT_INTERP, ARGIN(PMC *self), INTVAL key)
-{
-    ASSERT_ARGS(csr_get_string_keyed_int)
-    void * const cell  = csr_get_pointer_keyed_int(interp, self, key);
-    void * const ptr   = UNTAG_CELL(cell);
-    return (STRING *)ptr;
-}
-
-
-/*
-
-=item C<static void* csr_get_pointer_keyed_int(PARROT_INTERP, PMC *self, INTVAL
-key)>
-
-Gets raw pointer for result.
-
-=cut
-
-*/
-
-PARROT_CANNOT_RETURN_NULL
-static void*
-csr_get_pointer_keyed_int(PARROT_INTERP, ARGIN(PMC *self), INTVAL key)
-{
-    ASSERT_ARGS(csr_get_pointer_keyed_int)
-    void   **values;
-    INTVAL   size;
-
-    GETATTR_CallContext_returns_size(interp, self, size);
-    PARROT_ASSERT((key < size) || !"Wrong index");
-
-    GETATTR_CallContext_returns_values(interp, self, values);
-    return values[key];
-}
-
-/*
-
 =back
 
 =head1 SEE ALSO


More information about the parrot-commits mailing list