Author: chromatic Date: Thu Dec 18 13:52:05 2008 New Revision: 34084 Modified: trunk/DEPRECATED.pod trunk/include/parrot/multidispatch.h trunk/src/multidispatch.c
Log: [MMD] Removed deprecated mmd_expand_x(), mmd_expand_y(), Parrot_mmd_register(), and Parrot_mmd_register_sub() functions. Modified: trunk/DEPRECATED.pod ============================================================================== --- trunk/DEPRECATED.pod (original) +++ trunk/DEPRECATED.pod Thu Dec 18 13:52:05 2008 @@ -126,8 +126,7 @@ =item Old-style MMD functions [post 0.7.1] -mmd_expand_x, mmd_expand_y, Parrot_mmd_register, -Parrot_mmd_register_sub, Parrot_mmd_destroy, Parrot_MMD_search_default_infix, +Parrot_mmd_destroy, Parrot_MMD_search_default_infix, Parrot_mmd_search_default, mmd_cvt_to_types. See RT #60626. Modified: trunk/include/parrot/multidispatch.h ============================================================================== --- trunk/include/parrot/multidispatch.h (original) +++ trunk/include/parrot/multidispatch.h Thu Dec 18 13:52:05 2008 @@ -216,23 +216,6 @@ __attribute__nonnull__(3); PARROT_EXPORT -void Parrot_mmd_register(PARROT_INTERP, - INTVAL func_nr, - INTVAL left_type, - INTVAL right_type, - NULLOK(funcptr_t funcptr)) - __attribute__nonnull__(1); - -PARROT_EXPORT -void Parrot_mmd_register_sub(PARROT_INTERP, - INTVAL func_nr, - INTVAL left_type, - INTVAL right_type, - ARGIN(const PMC *sub)) - __attribute__nonnull__(1) - __attribute__nonnull__(5); - -PARROT_EXPORT PARROT_CANNOT_RETURN_NULL PARROT_WARN_UNUSED_RESULT PMC * Parrot_MMD_search_default_infix(PARROT_INTERP, Modified: trunk/src/multidispatch.c ============================================================================== --- trunk/src/multidispatch.c (original) +++ trunk/src/multidispatch.c Thu Dec 18 13:52:05 2008 @@ -201,90 +201,6 @@ #define MMD_DEBUG 0 -/* - -=item C<funcptr_t get_mmd_dispatch_type> - -RT #48260: Not yet documented!!! - -=cut - -*/ - -PARROT_EXPORT -PARROT_WARN_UNUSED_RESULT -PARROT_CANNOT_RETURN_NULL -funcptr_t -get_mmd_dispatch_type(PARROT_INTERP, INTVAL func_nr, INTVAL left_type, - INTVAL right_type, ARGOUT(int *is_pmc)) -{ - funcptr_t func = NULL; - MMD_table * const table = interp->binop_mmd_funcs + func_nr; - const UINTVAL x_funcs = table->x; - const UINTVAL y_funcs = table->y; - INTVAL r = right_type; - funcptr_t func_; - -#if MMD_DEBUG - fprintf(stderr, "running function %d with left type=%u, right type=%u\n", - (int) func_nr, (unsigned) left_type, (unsigned) right_type); -#endif - - PARROT_ASSERT(left_type >= 0); - PARROT_ASSERT(right_type >=0 || - (right_type >= enum_type_INTVAL && right_type <= enum_type_PMC)); - - if (right_type < 0) - right_type -= enum_type_INTVAL; - else - right_type += 4; - - if ((UINTVAL)left_type < x_funcs && (UINTVAL)right_type < y_funcs) { - const UINTVAL offset = x_funcs * right_type + left_type; - func = table->mmd_funcs[offset]; - } - - if (!func) { - const char * const meth_c = Parrot_MMD_method_name(interp, func_nr); - STRING * const meth_s = const_string(interp, meth_c); - PMC * const method = Parrot_MMD_search_default_infix(interp, - meth_s, left_type, r); - if (!method) - Parrot_ex_throw_from_c_args(interp, 0, 1, "MMD function %s not found " - "for types (%d, %d)", meth_c, left_type, r); - - - if (method->vtable->base_type == enum_class_NCI) { - /* C function is at struct_val */ - func = D2FPTR(PMC_struct_val(method)); - *is_pmc = 0; - Parrot_mmd_register(interp, func_nr, left_type, r, - (funcptr_t)PMC_struct_val(method)); - } - else { - *is_pmc = 1; - func = D2FPTR(method); - Parrot_mmd_register_sub(interp, func_nr, left_type, r, method); - } - - return func; - } - - *is_pmc = (UINTVAL)func & 3; - func_ = (funcptr_t)((UINTVAL)func & ~3); - -#ifndef PARROT_HAS_ALIGNED_FUNCPTR - if (!*is_pmc) { - return func; - } - else if (!is_pmc_ptr(interp, F2DPTR(func_))) { - *is_pmc = 0; - return func; - } -#endif - return func_; -} - /* @@ -601,96 +517,6 @@ /* -=item C<void Parrot_mmd_register> - -Register a function C<funcptr> for MMD function table C<func_num> for classes -C<left_type> and C<right_type>. The left and right types are C<INTVAL>s that -represent the class ID numbers. - -The function table must exist, but if it is too small, it will -automatically be expanded. - -Adding a new function to the table can be interestingly non-trivial, so -we get to be tricky. - -If the left or right types are larger than anything we've seen so far, -it means that we have to expand the table. Making Y larger is simple -- -just realloc with some more rows. Making X larger is less simple. In -either case, we punt to other functions. - -RT #45943 - Currently the MMD system doesn't handle inheritance and best match -searching, as it assumes that all PMC types have no parent type. This -can be considered a bug, and will be resolved at some point in the -future. - -{{**DEPRECATE**}} - -=cut - -*/ - -PARROT_EXPORT -void -Parrot_mmd_register(PARROT_INTERP, INTVAL func_nr, INTVAL left_type, INTVAL right_type, - NULLOK(funcptr_t funcptr)) -{ - - INTVAL offset; - MMD_table *table; - - PARROT_ASSERT(func_nr < (INTVAL)interp->n_binop_mmd_funcs); - PARROT_ASSERT(left_type >= 0); - PARROT_ASSERT(right_type >=0 || - (right_type >= enum_type_INTVAL && right_type <= enum_type_PMC)); - - if (right_type < 0) - right_type -= enum_type_INTVAL; - else - right_type += 4; - - table = interp->binop_mmd_funcs + func_nr; - - if ((INTVAL)table->x <= left_type) - mmd_expand_x(interp, func_nr, left_type + 1); - - if ((INTVAL)table->y <= right_type) - mmd_expand_y(interp, func_nr, right_type + 1); - - offset = table->x * right_type + left_type; - table->mmd_funcs[offset] = funcptr; -} - - -/* - -=item C<void Parrot_mmd_register_sub> - -RT #48260: Not yet documented!!! - -{{**DEPRECATE**}} - -=cut - -*/ - -PARROT_EXPORT -void -Parrot_mmd_register_sub(PARROT_INTERP, INTVAL func_nr, - INTVAL left_type, INTVAL right_type, ARGIN(const PMC *sub)) -{ - if (sub->vtable->base_type == enum_class_NCI) { - Parrot_mmd_register(interp, func_nr, left_type, right_type, - D2FPTR(PMC_struct_val(sub))); - } - else { - PMC * const fake = (PMC *)((UINTVAL) sub | 1); - Parrot_mmd_register(interp, func_nr, left_type, right_type, D2FPTR(fake)); - } -} - - -/* - =item C<void mmd_destroy> Frees all the memory allocated used the MMD subsystem.