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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Wed Nov 11 19:43:21 UTC 2009


Author: NotFound
Date: Wed Nov 11 19:43:14 2009
New Revision: 42424
URL: https://trac.parrot.org/parrot/changeset/42424

Log:
[pcc] experimental object vtable invoke, TT #103, TT #1262

Modified:
   trunk/DEPRECATED.pod
   trunk/src/pmc/object.pmc

Modified: trunk/DEPRECATED.pod
==============================================================================
--- trunk/DEPRECATED.pod	Wed Nov 11 18:07:49 2009	(r42423)
+++ trunk/DEPRECATED.pod	Wed Nov 11 19:43:14 2009	(r42424)
@@ -75,6 +75,14 @@
 
 L<https://trac.parrot.org/parrot/ticket/918>
 
+=item Overriding vtable invoke in PIR objects [experimental]
+
+The VTABLE invoke in object.pmc puts SELF at the start of the
+signature call arguments when there is no current object and is
+not already here. This allows the usage of $P0() instead of $P0($P0).
+
+L<https://trac.parrot.org/parrot/ticket/103>
+
 =item All bitwise VTABLE functions [eligible in 2.1]
 
 All bitwise VTABLE functions (all VTABLE functions containing C<bitwise> in

Modified: trunk/src/pmc/object.pmc
==============================================================================
--- trunk/src/pmc/object.pmc	Wed Nov 11 18:07:49 2009	(r42423)
+++ trunk/src/pmc/object.pmc	Wed Nov 11 19:43:14 2009	(r42424)
@@ -616,8 +616,14 @@
             PMC * const meth =
                 Parrot_oo_find_vtable_override_for_class(interp, cur_class,
                                                          meth_name);
-            if (!PMC_IS_NULL(meth))
+            if (!PMC_IS_NULL(meth)) {
+                /* Experimental code. See DEPRECATED.pod */
+                PMC *call_sig = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
+                if (PMC_IS_NULL(interp->current_object) && VTABLE_get_pmc_keyed_int(interp, call_sig, 0) != SELF)
+                    VTABLE_unshift_pmc(interp, call_sig, SELF);
+
                 return VTABLE_invoke(interp, meth, next);
+            }
 
             if (cur_class->vtable->base_type == enum_class_PMCProxy) {
                 /* Get the PMC instance and call the vtable method on that. */


More information about the parrot-commits mailing list