[svn:parrot] r37634 - in trunk: . src/pmc t/pmc

cotto at svn.parrot.org cotto at svn.parrot.org
Sun Mar 22 04:02:36 UTC 2009


Author: cotto
Date: Sun Mar 22 04:02:29 2009
New Revision: 37634
URL: https://trac.parrot.org/parrot/changeset/37634

Log:
[PMC] remove the Bound_NCI PMC and the code that used it, bump PBC_COMPAT

Deleted:
   trunk/src/pmc/bound_nci.pmc
   trunk/t/pmc/bound_nci.t
Modified:
   trunk/MANIFEST
   trunk/PBC_COMPAT
   trunk/src/pmc/default.pmc
   trunk/src/pmc/object.pmc

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	Sun Mar 22 03:16:19 2009	(r37633)
+++ trunk/MANIFEST	Sun Mar 22 04:02:29 2009	(r37634)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Thu Mar 19 20:27:45 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sun Mar 22 03:34:37 2009 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -1374,7 +1374,6 @@
 src/pmc/bigint.pmc                                          [devel]src
 src/pmc/bignum.pmc                                          [devel]src
 src/pmc/boolean.pmc                                         [devel]src
-src/pmc/bound_nci.pmc                                       [devel]src
 src/pmc/callsignature.pmc                                   [devel]src
 src/pmc/capture.pmc                                         [devel]src
 src/pmc/class.pmc                                           [devel]src

Modified: trunk/PBC_COMPAT
==============================================================================
--- trunk/PBC_COMPAT	Sun Mar 22 03:16:19 2009	(r37633)
+++ trunk/PBC_COMPAT	Sun Mar 22 04:02:29 2009	(r37634)
@@ -27,6 +27,7 @@
 
 # please insert tab separated entries at the top of the list
 
+4.2	2009.03.21	cotto	removed Bound_NCI PMC
 4.1	2009.03.17	cotto	removed Slice PMC
 4.0	2009.03.17	allison	released 1.0.0
 3.0	2007.07.23	jonathan	implementing new PBC header format

Deleted: trunk/src/pmc/bound_nci.pmc
==============================================================================
--- trunk/src/pmc/bound_nci.pmc	Sun Mar 22 04:02:29 2009	(r37633)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,132 +0,0 @@
-/*
-Copyright (C) 2001-2008, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/bound_nci.pmc - Bound internal method
-
-=head1 DESCRIPTION
-
-A bound internal method is a NCI method call, where the object is
-bound to this call instance.
-
-=head2 Methods
-
-=over 4
-
-=cut
-
-*/
-
-#include "parrot/parrot.h"
-
-pmclass Bound_NCI extends NCI need_ext {
-
-/*
-
-=item C<void set_pmc(PMC *obj)>
-
-Bind the object C<obj> to this call instance.
-
-=item C<PMC *get_pmc(void)>
-
-Return the bound object.
-
-=item C<opcode_t *invoke(void *next)>
-
-Calls the associated C method, returning C<*next>.
-
-=item C<void mark()>
-
-Set the bound object live.
-
-=cut
-
-*/
-
-    VTABLE void set_pmc(PMC *obj) {
-        PMC_pmc_val(SELF) = obj;
-        if (!PMC_IS_NULL(obj))
-            PObj_custom_mark_SET(SELF);
-    }
-
-    VTABLE PMC *get_pmc() {
-        return PMC_pmc_val(SELF);
-    }
-
-    VTABLE opcode_t *invoke(void *next) {
-        if (PObj_get_FLAGS(SELF) & PObj_private0_FLAG) {
-            /* bound multi sub
-             * XXX maybe create separate PMC class
-             * see also src/pmc/default.pmc:get_attr_str()
-             * */
-            PMC *multi = (PMC *)PMC_struct_val(SELF);
-            next       = VTABLE_invoke(INTERP, multi, next);
-        }
-        else {
-            /* Locate register holding invocant. */
-            int  sig_const = interp->current_args[1];
-            PMC *sig       = CONTEXT(interp)->constants[sig_const]->u.key;
-
-            if (PMC_IS_NULL(sig))
-                Parrot_ex_throw_from_c_args(interp, NULL,
-                    EXCEPTION_INVALID_OPERATION,
-                    "Bound NCI call made, but no current signature found.");
-
-            ASSERT_SIG_PMC(sig);
-
-            /* Get invocant register. */
-            if (VTABLE_elements(INTERP, sig) > 0 &&
-                    VTABLE_get_integer_keyed_int(INTERP, sig, 0) &
-                    PARROT_ARG_PMC) {
-                int  invocant_reg      = interp->current_args[2];
-                PMC *p2                = REG_PMC(interp, invocant_reg);
-                INTERP->current_object = REG_PMC(interp, invocant_reg)
-                                           = PMC_pmc_val(SELF);
-                SUPER(next);
-                REG_PMC(interp, invocant_reg)  = p2;
-            }
-            else {
-                Parrot_ex_throw_from_c_args(interp, NULL,
-                    EXCEPTION_INVALID_OPERATION, "Bound NCI call made, "
-                        "but the current call has no invocant.");
-            }
-        }
-
-        return (opcode_t *)next;
-    }
-
-    VTABLE void mark() {
-        if (PMC_pmc_val(SELF))
-            pobject_lives(INTERP, (PObj *)PMC_pmc_val(SELF));
-        if (PObj_get_FLAGS(SELF) & PObj_private0_FLAG) {
-            if (PMC_struct_val(SELF))
-                pobject_lives(INTERP, (PObj *)PMC_struct_val(SELF));
-        }
-    }
-
-}
-
-/*
-
-=back
-
-=head1 SEE ALSO
-
-F<src/pmc/nci.pmc>
-
-=head1 HISTORY
-
-Initial revision by leo 2005.01.31.
-
-=cut
-
-*/
-
-/*
- * Local variables:
- *   c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */

Modified: trunk/src/pmc/default.pmc
==============================================================================
--- trunk/src/pmc/default.pmc	Sun Mar 22 03:16:19 2009	(r37633)
+++ trunk/src/pmc/default.pmc	Sun Mar 22 04:02:29 2009	(r37634)
@@ -984,10 +984,6 @@
 
 Returns SELF. A PMC is its own class.
 
-=item C<PMC *get_attr_str(STRING *attr)>
-
-Look for NCI methods and properties.
-
 =cut
 
 */
@@ -1009,32 +1005,6 @@
 
     }
 
-    VTABLE PMC *get_attr_str(STRING *name) {
-        PMC *p = VTABLE_find_method(INTERP, SELF, name);
-
-        if (PMC_IS_NULL(p))
-            return PMCNULL;
-
-        if (VTABLE_isa(INTERP, p, CONST_STRING(INTERP, "NCI"))) {
-            PMC * const bound_meth = VTABLE_clone(INTERP, p);
-            bound_meth->vtable     = interp->vtables[enum_class_Bound_NCI];
-            VTABLE_set_pmc(INTERP, bound_meth, SELF);
-
-            return bound_meth;
-        }
-        else if (p->vtable->base_type == enum_class_MultiSub) {
-            PMC * const bound_meth      = pmc_new(INTERP, enum_class_Bound_NCI);
-            VTABLE_set_pmc(INTERP, bound_meth, SELF);
-            PMC_struct_val(bound_meth)  = p;
-            PObj_get_FLAGS(bound_meth) |= PObj_private0_FLAG;
-
-            return bound_meth;
-        }
-
-        /* RT #46671 bound user functions */
-        return p;
-    }
-
 /*
 
 =item C<PMC *get_attr_keyed(PMC *key, STRING *name)>

Modified: trunk/src/pmc/object.pmc
==============================================================================
--- trunk/src/pmc/object.pmc	Sun Mar 22 03:16:19 2009	(r37633)
+++ trunk/src/pmc/object.pmc	Sun Mar 22 04:02:29 2009	(r37634)
@@ -340,6 +340,8 @@
             PMC * const cur_class =
                 VTABLE_get_pmc_keyed_int(interp, _class->all_parents, i);
 
+            const Parrot_Class_attributes * const class_info = PARROT_CLASS(cur_class);
+
             /* If there's a vtable override for 'find_method' in the current
              * class, run that first. */
             method = Parrot_oo_find_vtable_override_for_class(interp, cur_class,
@@ -352,7 +354,6 @@
             /* If it's from this universe or the class doesn't inherit from
              * anything outside of it... */
             if (all_in_universe || VTABLE_isa(interp, cur_class, CONST_STRING(interp, "Class"))) {
-                const Parrot_Class_attributes * const class_info = PARROT_CLASS(cur_class);
                 if (VTABLE_exists_keyed_str(interp, class_info->methods, name)) {
                     /* Found it! */
                     method = VTABLE_get_pmc_keyed_str(interp, class_info->methods, name);
@@ -360,27 +361,8 @@
                 }
             }
             else {
-                /* Delegate the lookup to the class. */
-                PMC * const del_class = VTABLE_get_pmc_keyed_int(interp, obj->attrib_store,
-                    alien_parents_pos);
-                method = VTABLE_find_method(interp, del_class, name);
-
-                if (!PMC_IS_NULL(method)) {
-                    /* Found it. However, if we just hand this back and it's
-                     * an NCI and we call it, we will get the wrong invocant
-                     * passed. Therefore, we need to close the NCI and make it
-                     * into a BoundNCI. */
-                    if (method->vtable->base_type == enum_class_NCI) {
-                        method         = VTABLE_clone(interp, method);
-                        method->vtable = interp->vtables[enum_class_Bound_NCI];
-                        VTABLE_set_pmc(interp, method, del_class);
-                    }
-
-                    /* Found a method, so we're done. */
-                    break;
-                }
-
-                alien_parents_pos++;
+                Parrot_ex_throw_from_c_args(INTERP, NULL, -1, 
+                        "Class %Ss inherits from alien parents.", class_info->name);
             }
         }
 

Deleted: trunk/t/pmc/bound_nci.t
==============================================================================
--- trunk/t/pmc/bound_nci.t	Sun Mar 22 04:02:29 2009	(r37633)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,32 +0,0 @@
-#! parrot
-# Copyright (C) 2006-2008, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/bound_nci.t - test Bound_NCI PMC
-
-=head1 SYNOPSIS
-
-    % prove t/pmc/bound_nci.t
-
-=head1 DESCRIPTION
-
-Tests the Bound_NCI PMC.
-
-=cut
-
-.sub main :main
-    .include 'include/test_more.pir'
-
-    plan(1)
-
-    $P0 = new ['Bound_NCI']
-    ok(1, 'Instantiated .Bound_NCI')
-.end
-
-# Local Variables:
-#   mode: pir
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:


More information about the parrot-commits mailing list