cvsuser 03/12/02 10:34:21
Modified: src objects.c
Log:
Gotta cache the class PMC in the class' vtable so objects can get to it
Revision Changes Path
1.18 +9 -2 parrot/src/objects.c
Index: objects.c
===================================================================
RCS file: /cvs/public/parrot/src/objects.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -w -r1.17 -r1.18
--- objects.c 2 Dec 2003 17:45:16 -0000 1.17
+++ objects.c 2 Dec 2003 18:34:21 -0000 1.18
@@ -1,7 +1,7 @@
/* objects.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: objects.c,v 1.17 2003/12/02 17:45:16 dan Exp $
+ * $Id: objects.c,v 1.18 2003/12/02 18:34:21 dan Exp $
* Overview:
* Handles class and object manipulation
* Data Structure and Algorithms:
@@ -181,6 +181,10 @@
/* Set the vtable's type to the newly allocated type */
Parrot_vtable_set_type(interpreter, new_vtable, new_type);
+ /* And cache our class PMC in the vtable so we can find it later
+ */
+ Parrot_vtable_set_data(interpreter, new_vtable, new_class);
+
/* Reset the init method to our instantiation method */
new_vtable->init = Parrot_instantiate_object;
new_class->vtable = new_vtable;
@@ -201,11 +205,14 @@
*
*/
PMC *
-Parrot_instantiate_object(Parrot_Interp interpreter, PMC *class) {
+Parrot_instantiate_object(Parrot_Interp interpreter, PMC *object) {
PMC *new_object;
PMC *new_object_array;
INTVAL attrib_count;
PMC *class_array;
+ PMC *class;
+
+ class = object->vtable->data;
/* Grab the attribute count from the parent */
attrib_count = class->cache.int_val;