Just kidding!  Here's the patch, for real this time.

On 3/4/07, Alek Storm <[EMAIL PROTECTED]> wrote:
That's because the patch refers to a function that is now outdated because
of #41549.  I've attached an updated version of the patch.

Thanks,
Alek Storm

On 3/2/07, [EMAIL PROTECTED] via RT <[EMAIL PROTECTED]> wrote:
>
> On Sun Feb 25 20:10:00 2007, [EMAIL PROTECTED] wrote:
> > Now that 0.4.9 has been released, can this be committed?
> >
> I just tried, but I get:
>
> /home/default/jnthn.net/dev/parrot/blib/lib/libparrot.so: undefined
> reference to `find_vtable_meth'
> collect2: ld returned 1 exit status
>
> After applying it. Any ideas?
>
> Jonathan
>

diff -ur --exclude=.svn CREDITS CREDITS
--- CREDITS	2007-01-26 22:48:41.000000000 +0000
+++ CREDITS	2007-01-26 23:09:27.000000000 +0000
@@ -553,3 +553,7 @@
 N: Vishal Soni
 E: [EMAIL PROTECTED]
 D: Bug fixes in IMCC, ECMAScript
+
+N: Alek Storm
+E: [EMAIL PROTECTED]
+D: Fixed object vtable method overrides in PIR
diff -ur --exclude=.svn src/ops/object.ops src/ops/object.ops
--- src/ops/object.ops	2007-01-26 22:47:16.000000000 +0000
+++ src/ops/object.ops	2007-01-26 22:56:20.000000000 +0000
@@ -54,14 +54,14 @@
   object = $1;
   meth = $2;
   next = expr NEXT();
-  interp->current_object = object;
-  interp->current_cont = NEED_CONTINUATION;
-  interp->current_method = meth;
   method_pmc = VTABLE_find_method(interp, object, meth);
   if (!method_pmc) {
     real_exception(interp, next, METH_NOT_FOUND,
         "Method '%Ss' not found", meth);
   }
+  interp->current_object = object;
+  interp->current_cont = NEED_CONTINUATION;
+  interp->current_method = meth;
   dest = (opcode_t *)VTABLE_invoke(interp, method_pmc, next);
   goto ADDRESS(dest);
 }
@@ -92,14 +92,14 @@
   object = $1;
   meth = $2;
   next = expr NEXT();
-  interp->current_object = object;
-  interp->current_cont = $3;
-  interp->current_method = meth;
   method_pmc = VTABLE_find_method(interp, object, meth);
   if (!method_pmc) {
     real_exception(interp, next, METH_NOT_FOUND,
         "Method '%Ss' not found", meth);
   }
+  interp->current_object = object;
+  interp->current_cont = $3;
+  interp->current_method = meth;
   dest = (opcode_t *)VTABLE_invoke(interp, method_pmc, next);
   goto ADDRESS(dest);
 }
@@ -128,15 +128,15 @@
 
   object = $1;
   meth = $2;
-  interp->current_cont = CONTEXT(interp->ctx)->current_cont;
-  PObj_get_FLAGS(interp->current_cont) |= SUB_FLAG_TAILCALL;
-  interp->current_object = object;
-  interp->current_method = meth;
   method_pmc = VTABLE_find_method(interp, object, meth);
   if (!method_pmc) {
     real_exception(interp, next, METH_NOT_FOUND,
         "Method '%Ss' not found", meth);
   }
+  interp->current_cont = CONTEXT(interp->ctx)->current_cont;
+  PObj_get_FLAGS(interp->current_cont) |= SUB_FLAG_TAILCALL;
+  interp->current_object = object;
+  interp->current_method = meth;
   dest = (opcode_t *)VTABLE_invoke(interp, method_pmc, next);
   goto ADDRESS(dest);
 }
diff -ur --exclude=.svn src/pmc/parrotobject.pmc src/pmc/parrotobject.pmc
--- src/pmc/parrotobject.pmc	2007-01-26 22:47:23.000000000 +0000
+++ src/pmc/parrotobject.pmc	2007-01-27 11:56:15.000000000 +0000
@@ -202,39 +202,90 @@
 
     PMC* find_method(STRING* name) {
         PMC *class = VTABLE_get_class(INTERP, SELF);
-        return VTABLE_find_method(INTERP, class, name);
+        STRING *meth = CONST_STRING(interp, "__find_method");
+        STRING *meth_v = CONST_STRING(interp, "find_method");
+        PMC *sub = Parrot_find_vtable_meth(interp, SELF, meth_v);
+        if (PMC_IS_NULL(sub))
+            sub = find_meth(interp, SELF, meth);
+        if (PMC_IS_NULL(sub))
+            return VTABLE_find_method(INTERP, class, name);
+        return (PMC*) Parrot_run_meth_fromc_args(interp, sub,
+            SELF, meth, "PS", name);
     }
 
     PMC* get_attr(INTVAL idx) {
-        return Parrot_get_attrib_by_num(INTERP, SELF, idx);
+        STRING *meth = CONST_STRING(interp, "__get_attr");
+        STRING *meth_v = CONST_STRING(interp, "get_attr");
+        PMC *sub = Parrot_find_vtable_meth(interp, SELF, meth_v);
+        if (PMC_IS_NULL(sub))
+            sub = find_meth(interp, SELF, meth);
+        if (PMC_IS_NULL(sub))
+            return Parrot_get_attrib_by_num(INTERP, SELF, idx);
+        return (PMC*) Parrot_run_meth_fromc_args(interp, sub,
+            SELF, meth, "PI", idx);
     }
 
     PMC* get_attr_str(STRING* idx) {
-        return Parrot_get_attrib_by_str(INTERP, SELF, idx);
+        STRING *meth = CONST_STRING(interp, "__get_attr_str");
+        STRING *meth_v = CONST_STRING(interp, "get_attr_str");
+        PMC *sub = Parrot_find_vtable_meth(interp, SELF, meth_v);
+        PMC* r;
+        if (PMC_IS_NULL(sub))
+            sub = find_meth(interp, SELF, meth);
+        if (PMC_IS_NULL(sub))
+            r = Parrot_get_attrib_by_str(INTERP, SELF, idx);
+        else r = (PMC*) Parrot_run_meth_fromc_args(interp, sub,
+            SELF, meth, "PS", idx);
+        return r;
     }
 
     void set_attr(INTVAL idx, PMC* value) {
-        Parrot_set_attrib_by_num(INTERP, SELF, idx, value);
+        STRING *meth = CONST_STRING(interp, "__set_attr");
+        STRING *meth_v = CONST_STRING(interp, "set_attr");
+        PMC *sub = Parrot_find_vtable_meth(interp, SELF, meth_v);
+        if (PMC_IS_NULL(sub))
+            sub = find_meth(interp, SELF, meth);
+        if (PMC_IS_NULL(sub))
+            return Parrot_set_attrib_by_num(INTERP, SELF, idx, value);
+        (PMC*) Parrot_run_meth_fromc_args(interp, sub,
+            SELF, meth, "vIP", idx, value);
     }
 
     void set_attr_str(STRING* idx, PMC* value) {
-        Parrot_set_attrib_by_str(INTERP, SELF, idx, value);
+        STRING *meth = CONST_STRING(interp, "__set_attr_str");
+        STRING *meth_v = CONST_STRING(interp, "set_attr_str");
+        PMC *sub = Parrot_find_vtable_meth(interp, SELF, meth_v);
+        if (PMC_IS_NULL(sub))
+            sub = find_meth(interp, SELF, meth);
+        if (PMC_IS_NULL(sub))
+            return Parrot_set_attrib_by_str(INTERP, SELF, idx, value);
+        (PMC*) Parrot_run_meth_fromc_args(interp, sub,
+            SELF, meth, "vSP", idx, value);
     }
 
     PMC* get_class() {
-        if (!PObj_is_PMC_shared_TEST(SELF)) {
-            return GET_CLASS(PMC_data(SELF), SELF);
-        }
-        else {
-            /* get the class object for this interpreter */
-            /* XXX this is rather a hack, it is, however, necessary:
-             * otherwise we will be accessing the wrong interpreter's
-             * namespace
-             */
-            int type_num = SELF->vtable->base_type;
-
-            return INTERP->vtables[type_num]->class;
-        }
+        STRING *meth = CONST_STRING(interp, "__get_class");
+        STRING *meth_v = CONST_STRING(interp, "get_class");
+        PMC *sub = Parrot_find_vtable_meth(interp, SELF, meth_v);
+        if (PMC_IS_NULL(sub))
+            sub = find_meth(interp, SELF, meth);
+        if (PMC_IS_NULL(sub)) {
+            if (!PObj_is_PMC_shared_TEST(SELF)) {
+                return GET_CLASS(PMC_data(SELF), SELF);
+            }
+            else {
+                /* get the class object for this interpreter */
+                /* XXX this is rather a hack, it is, however, necessary:
+                 * otherwise we will be accessing the wrong interpreter's
+                 * namespace
+                 */
+                int type_num = SELF->vtable->base_type;
+ 
+                return INTERP->vtables[type_num]->class;
+            }
+         }
+        return (PMC*) Parrot_run_meth_fromc_args(interp, sub,
+            SELF, meth, "P");
     }
 
 /*

Reply via email to