cvsuser 03/12/03 05:27:09
Modified: ops object.ops
src objects.c
Log:
use keyed_str for object stuff
Revision Changes Path
1.18 +9 -9 parrot/ops/object.ops
Index: object.ops
===================================================================
RCS file: /cvs/public/parrot/ops/object.ops,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -w -r1.17 -r1.18
--- object.ops 23 Oct 2003 17:41:55 -0000 1.17
+++ object.ops 3 Dec 2003 13:27:05 -0000 1.18
@@ -144,7 +144,8 @@
}
op subclass(out PMC, in STR, in STR) {
- PMC *class = VTABLE_get_pmc_keyed(interpreter, interpreter->class_hash,
key_new_string(interpreter, $2));
+ PMC *class = VTABLE_get_pmc_keyed_str(interpreter,
+ interpreter->class_hash, $2);
if (!class) {
internal_exception(NO_CLASS, "Class doesn't exist");
}
@@ -153,7 +154,8 @@
}
op subclass(out PMC, in STR) {
- PMC *class = VTABLE_get_pmc_keyed(interpreter, interpreter->class_hash,
key_new_string(interpreter, $2));
+ PMC *class = VTABLE_get_pmc_keyed_str(interpreter,
+ interpreter->class_hash, $2);
if (!class) {
internal_exception(NO_CLASS, "Class doesn't exist");
}
@@ -168,11 +170,7 @@
=cut
inline op findclass(out INT, in STR) {
- if (VTABLE_exists_keyed(interpreter, interpreter->class_hash,
key_new_string(interpreter, $2))) {
- $1 = 1;
- } else {
- $1 = 0;
- }
+ $1 = VTABLE_exists_keyed_str(interpreter, interpreter->class_hash, $2);
goto NEXT();
}
@@ -187,8 +185,8 @@
=cut
inline op getclass(out PMC, in STR) {
- if (VTABLE_exists_keyed(interpreter, interpreter->class_hash,
key_new_string(interpreter, $2))) {
- $1 = VTABLE_get_pmc_keyed(interpreter, interpreter->class_hash,
key_new_string(interpreter, $2));
+ if (VTABLE_exists_keyed_str(interpreter, interpreter->class_hash, $2)) {
+ $1 = VTABLE_get_pmc_keyed_str(interpreter, interpreter->class_hash, $2);
} else {
internal_exception(NO_CLASS, "Class doesn't exist");
}
@@ -213,6 +211,8 @@
=cut
inline op class(out PMC, in PMC) {
+ $1 = VTABLE_get_pmc_keyed_int(interpreter,
+ (PMC *)PMC_data($2), 0);
goto NEXT();
}
1.20 +15 -18 parrot/src/objects.c
Index: objects.c
===================================================================
RCS file: /cvs/public/parrot/src/objects.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -w -r1.19 -r1.20
--- objects.c 3 Dec 2003 11:17:47 -0000 1.19
+++ objects.c 3 Dec 2003 13:27:09 -0000 1.20
@@ -1,7 +1,7 @@
/* objects.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: objects.c,v 1.19 2003/12/03 11:17:47 leo Exp $
+ * $Id: objects.c,v 1.20 2003/12/03 13:27:09 leo Exp $
* Overview:
* Handles class and object manipulation
* Data Structure and Algorithms:
@@ -15,14 +15,13 @@
/* This should be public, but for right now it's internal */
static PMC *
find_global(Parrot_Interp interpreter, STRING *globalname) {
- PMC* key = key_new_string(interpreter, globalname);
- if (!VTABLE_exists_keyed(interpreter,
- interpreter->globals->stash_hash, key)) {
+ if (!VTABLE_exists_keyed_str(interpreter,
+ interpreter->globals->stash_hash, globalname)) {
return NULL;
}
- return VTABLE_get_pmc_keyed(interpreter,
- interpreter->globals->stash_hash, key);
+ return VTABLE_get_pmc_keyed_str(interpreter,
+ interpreter->globals->stash_hash, globalname);
}
/* Subclass a class. Single parent class, nice and
@@ -47,7 +46,7 @@
child_class_array = PMC_data(child_class);
/* We have the same number of attributes as our parent */
- child_class->obj.u.int_val = base_class->obj.u.int_val;
+ child_class->cache.int_val = base_class->cache.int_val;
/* Our parent class array has a single member in it */
temp_pmc = pmc_new(interpreter, enum_class_Array);
@@ -61,9 +60,8 @@
VTABLE_set_string_native(interpreter, classname_pmc, child_class_name);
/* Add ourselves to the interpreter's class hash */
- VTABLE_set_pmc_keyed(interpreter, interpreter->class_hash,
- key_new_string(interpreter, child_class_name),
- child_class);
+ VTABLE_set_pmc_keyed_str(interpreter, interpreter->class_hash,
+ child_class_name, child_class);
}
else {
VTABLE_set_string_native(interpreter, classname_pmc,
@@ -120,7 +118,7 @@
new_class = pmc_new(interpreter, enum_class_ParrotClass);
new_class_array = PMC_data(new_class);
/* We have the same number of attributes as our parent */
- new_class->obj.u.int_val = 0;
+ new_class->cache.int_val = 0;
/* Our parent class array has nothing in it */
VTABLE_set_pmc_keyed_int(interpreter, new_class_array, 0,
pmc_new(interpreter, enum_class_Array));
@@ -151,10 +149,10 @@
PMC *
Parrot_class_lookup(Parrot_Interp interpreter, STRING *class_name)
{
- if (VTABLE_exists_keyed(interpreter, interpreter->class_hash,
- key_new_string(interpreter, class_name)))
- return VTABLE_get_pmc_keyed(interpreter, interpreter->class_hash,
- key_new_string(interpreter, class_name));
+ if (VTABLE_exists_keyed_str(interpreter, interpreter->class_hash,
+ class_name))
+ return VTABLE_get_pmc_keyed_str(interpreter, interpreter->class_hash,
+ class_name);
return PMCNULL;
}
@@ -167,8 +165,8 @@
void
Parrot_class_register(Parrot_Interp interpreter, STRING *class_name, PMC *new_class)
{
- VTABLE_set_pmc_keyed(interpreter, interpreter->class_hash,
- key_new_string(interpreter,class_name), new_class);
+ VTABLE_set_pmc_keyed_str(interpreter, interpreter->class_hash,
+ class_name, new_class);
/* Now build a new vtable for this class and register it in the
global registry */
@@ -292,7 +290,6 @@
PMC *
Parrot_find_method_with_cache(Parrot_Interp interpreter, PMC *class,
STRING *method_name) {
- PMC* key = key_new_string(interpreter, method_name);
PMC* method = NULL; /* The method we ultimately return */
PMC* classname; /* The classname PMC for the currently
searched class */