On Thursday 22 February 2007 08:41, Patrick R.Michaud wrote:

> While running 'make fulltest' for the 0.4.9 release, I'm getting
> two failing tests under the -C (CGP) runcore (r17148):
>
> Failed Test     Stat Wstat Total Fail  List of Failed
> ---------------------------------------------------------------------------
>---- t/pmc/ref.t        2   512    16    2  13-14

Here's a fix for that.  I'm not sure it's completely correct with regard to 
the Ref PMC, but it does fix the delegation problem nicely.

-- c

=== src/ops/pic.ops
==================================================================
--- src/ops/pic.ops	(revision 2241)
+++ src/ops/pic.ops	(local)
@@ -50,7 +50,7 @@
     left = $2;
     right = $3;
     lru = &mic->lru;
-    lr_types = (left->vtable->base_type << 16) | right->vtable->base_type;
+    lr_types = (VTABLE_type(interp, left) << 16) | VTABLE_type(interp, right);
     if (lru->u.type == lr_types) {
 runit_v_pp:
         ((mmd_f_v_pp)lru->f.real_function)(interp, left, right);
@@ -88,10 +88,10 @@
 
     left = $2;
     mic = (Parrot_MIC *) cur_opcode[1];
-    lt = left->vtable->base_type;
+    lt = VTABLE_type(interp, left);
     right = $3;
     lru = &mic->lru;
-    rt = right->vtable->base_type;
+    rt = VTABLE_type(interp, right);
     lr_types = (lt << 16) | rt;
     if (lru->u.type == lr_types) {
         INTVAL a = lt == enum_class_Integer ? PMC_int_val(left) :
=== src/pic.c
==================================================================
--- src/pic.c	(revision 2241)
+++ src/pic.c	(local)
@@ -660,8 +660,8 @@
     /*
      * get real dispatch function
      */
-    left_type = left->vtable->base_type;
-    right_type = right->vtable->base_type;
+    left_type = VTABLE_type(interp, left);
+    right_type = VTABLE_type(interp, right);
     func = get_mmd_dispatch_type(interp,
             mic->m.func_nr, left_type, right_type, &is_pmc);
     if (is_pmc) {
=== src/pmc/ref.pmc
==================================================================
--- src/pmc/ref.pmc	(revision 2241)
+++ src/pmc/ref.pmc	(local)
@@ -96,6 +96,20 @@
 
 /*
 
+=item C<INTVAL type()>
+
+Returns the PMC's type.
+
+=cut
+
+*/
+
+    INTVAL type() {
+        return VTABLE_type(interp, PMC_pmc_val(SELF));
+    }
+
+/*
+
 =item C<void mark()>
 
 Marks the referenced PMC as live.

Reply via email to