[svn:parrot] r41163 - trunk/src/pmc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Tue Sep 8 21:05:33 UTC 2009
Author: chromatic
Date: Tue Sep 8 21:05:32 2009
New Revision: 41163
URL: https://trac.parrot.org/parrot/changeset/41163
Log:
[PMC] Replaced some VTABLE calls with macrod attribute access in
ResizableStringArray PMC.
Modified:
trunk/src/pmc/resizablestringarray.pmc
Modified: trunk/src/pmc/resizablestringarray.pmc
==============================================================================
--- trunk/src/pmc/resizablestringarray.pmc Tue Sep 8 20:56:07 2009 (r41162)
+++ trunk/src/pmc/resizablestringarray.pmc Tue Sep 8 21:05:32 2009 (r41163)
@@ -38,7 +38,8 @@
VTABLE STRING *get_string_keyed_int(INTVAL key) {
STRING **str_array;
- INTVAL size = SELF.elements();
+ INTVAL size;
+ GET_ATTR_size(interp, SELF, size);
if (key < 0) {
if (key < -size)
@@ -72,7 +73,8 @@
VTABLE void set_string_keyed_int(INTVAL key, STRING *value) {
STRING **str_array;
- INTVAL size = SELF.elements();
+ INTVAL size;
+ GET_ATTR_size(interp, SELF, size);
if (key < 0) {
if (key < -size)
@@ -102,7 +104,8 @@
*/
VTABLE void push_string(STRING *value) {
- INTVAL next_idx = SELF.elements();
+ INTVAL next_idx;
+ GET_ATTR_size(interp, SELF, next_idx);
SELF.set_string_keyed_int(next_idx, value);
}
@@ -117,8 +120,9 @@
*/
VTABLE STRING *pop_string() {
- INTVAL size = SELF.elements();
STRING *value;
+ INTVAL size;
+ GET_ATTR_size(interp, SELF, size);
if (size == 0)
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
@@ -214,7 +218,8 @@
else if (new_size <= resize_threshold) {
/* zero out anything that was previously allocated
* if we're growing the array */
- INTVAL old_size = SELF.elements();
+ INTVAL old_size;
+ GET_ATTR_size(interp, SELF, old_size);
if (new_size > old_size) {
INTVAL i;
for (i = old_size; i < new_size; i++)
@@ -261,8 +266,10 @@
VTABLE PMC *clone() {
PMC *copy = SUPER();
+ INTVAL size;
+ GET_ATTR_size(interp, SELF, size);
/* copy trimmed extra space */
- SET_ATTR_resize_threshold(INTERP, copy, SELF.elements());
+ SET_ATTR_resize_threshold(INTERP, copy, size);
return copy;
}
@@ -277,8 +284,9 @@
*/
VTABLE STRING *shift_string() {
- INTVAL size = SELF.elements();
STRING *value;
+ INTVAL size;
+ GET_ATTR_size(interp, SELF, size);
if (size == 0)
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
More information about the parrot-commits
mailing list