[svn:parrot] r38261 - in trunk/src: ops pmc
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Tue Apr 21 23:08:46 UTC 2009
Author: whiteknight
Date: Tue Apr 21 23:08:45 2009
New Revision: 38261
URL: https://trac.parrot.org/parrot/changeset/38261
Log:
a fix for TT #218. Use elements() and get_pointer() VTABLEs in the sort() method, so that it can be properly used by subclasses. Also, modify the semantics of the get_addr opcode to consistently return the memory address of the PMC, instead of returning whatever value get_pointer was returning (which is not consistent for all PMCs)
Modified:
trunk/src/ops/core.ops
trunk/src/pmc/fixedpmcarray.pmc
trunk/src/pmc/resizablepmcarray.pmc
Modified: trunk/src/ops/core.ops
==============================================================================
--- trunk/src/ops/core.ops Tue Apr 21 22:56:14 2009 (r38260)
+++ trunk/src/ops/core.ops Tue Apr 21 23:08:45 2009 (r38261)
@@ -745,8 +745,7 @@
}
inline op get_addr(out INT, invar PMC) {
- void *ptr = VTABLE_get_pointer(interp, $2);
- $1 = (INTVAL)ptr;
+ $1 = (INTVAL)($2);
}
=back
Modified: trunk/src/pmc/fixedpmcarray.pmc
==============================================================================
--- trunk/src/pmc/fixedpmcarray.pmc Tue Apr 21 22:56:14 2009 (r38260)
+++ trunk/src/pmc/fixedpmcarray.pmc Tue Apr 21 23:08:45 2009 (r38261)
@@ -47,7 +47,7 @@
const INTVAL n = SELF.elements();
if (n > 1)
- Parrot_quicksort(interp, (void **)PMC_array(SELF), n, cmp_func);
+ Parrot_quicksort(interp, (void **)SELF.get_pointer(), n, cmp_func);
}
/*
@@ -212,6 +212,18 @@
/*
+=item C<void* get_pointer()>
+
+=cut
+
+*/
+
+ VTABLE void* get_pointer() {
+ return PMC_array(SELF);
+ }
+
+/*
+
=item C<INTVAL get_integer_keyed_int(INTVAL key)>
Returns the integer value of the element at index C<key>.
Modified: trunk/src/pmc/resizablepmcarray.pmc
==============================================================================
--- trunk/src/pmc/resizablepmcarray.pmc Tue Apr 21 22:56:14 2009 (r38260)
+++ trunk/src/pmc/resizablepmcarray.pmc Tue Apr 21 23:08:45 2009 (r38261)
@@ -348,6 +348,18 @@
/*
+=item C<void* get_pointer()>
+
+=cut
+
+*/
+
+ VTABLE void* get_pointer() {
+ return PMC_array(SELF);
+ }
+
+/*
+
=item C<void push_float(FLOATVAL value)>
=item C<void push_integer(INTVAL value)>
More information about the parrot-commits
mailing list