cvsuser 04/03/05 02:05:26
Modified: . MANIFEST
examples/benchmarks oo1.pasm
src objects.c
Added: examples/benchmarks oo1-prop.pasm
Log:
oo1 update
* optimize find_global
* add pie-thonic oo1-prop.pasm benchmark
* remove single line comments
Revision Changes Path
1.579 +1 -0 parrot/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.578
retrieving revision 1.579
diff -u -w -r1.578 -r1.579
--- MANIFEST 5 Mar 2004 07:44:12 -0000 1.578
+++ MANIFEST 5 Mar 2004 10:05:16 -0000 1.579
@@ -337,6 +337,7 @@
examples/benchmarks/gc_waves_sizeable_headers.pasm [main]doc
examples/benchmarks/hash-utf8.pasm [main]doc
examples/benchmarks/oo1.pasm [main]doc
+examples/benchmarks/oo1-prop.pasm [main]doc
examples/benchmarks/oo1.pl [main]doc
examples/benchmarks/oo1.py [main]doc
examples/benchmarks/primes.c [main]doc
1.3 +15 -3 parrot/examples/benchmarks/oo1.pasm
Index: oo1.pasm
===================================================================
RCS file: /cvs/public/parrot/examples/benchmarks/oo1.pasm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- oo1.pasm 5 Mar 2004 08:39:22 -0000 1.2
+++ oo1.pasm 5 Mar 2004 10:05:21 -0000 1.3
@@ -4,14 +4,26 @@
# python 2.3.3
# perl oo1.pl 0.8
-# python pp1.py 1.2 (first time)
-# python pp1.py 0.5
+# python oo1.py 1.2 (first time)
+# python oo1.py 0.51
# parrot -C oo1.pasm
# original list fixed 4.9 leaks mem ~ 110 M used
# don't clone vtable 4.4
# Dan's vtable cache 4.3
# Dan's vtable cache -O3 3.8
+# list MIN_ITEMS 4->16 2.25
+# find_global hack 2.16
+# find_global hack -O3 1.60
+
+# parrot -j oo1.pasm
+# find_global hack -O3 1.51
+
+
+# parrot -C oo1-prop.pasm
+# invokecc -O3 0.75
+# RetCont out of loop -O3 0.57
+# parrot -j oo1-prop.pasm 0.54
newclass P1, "Foo"
find_global P2, "init"
1.1 parrot/examples/benchmarks/oo1-prop.pasm
Index: oo1-prop.pasm
===================================================================
# pie-thonic object with properties
find_global P0, "__init"
set I10, 0
set I11, 100000
newsub P1, .RetContinuation, retl
loop:
new P5, .PerlUndef
invoke # invokecc
retl:
inc I10
lt I10, I11, loop
new P5, .PerlUndef
invokecc
getprop P2, "i", P5
print P2
print "\n"
end
.pcc_sub __init:
new P10, .PerlInt
set P10, 10
setprop P5, "i", P10
new P10, .PerlInt
set P10, 20
setprop P5, "j", P10
invoke P1
1.51 +36 -15 parrot/src/objects.c
Index: objects.c
===================================================================
RCS file: /cvs/public/parrot/src/objects.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -w -r1.50 -r1.51
--- objects.c 4 Mar 2004 19:41:46 -0000 1.50
+++ objects.c 5 Mar 2004 10:05:25 -0000 1.51
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: objects.c,v 1.50 2004/03/04 19:41:46 dan Exp $
+$Id: objects.c,v 1.51 2004/03/05 10:05:25 leo Exp $
=head1 NAME
@@ -48,9 +48,37 @@
*/
static PMC *
-find_global(Parrot_Interp interpreter, STRING *class, STRING *globalname) {
+find_global(Parrot_Interp interpreter, STRING *class, STRING *globalname)
+{
PMC *stash;
- if (NULL != class) {
+#if 1
+ /*
+ * we are cheating a bit and use PerlHash internals to avoid
+ * hash lookup duplication
+ */
+ HashBucket *b;
+ stash = interpreter->globals->stash_hash;
+ if (class) {
+ b = hash_get_bucket(interpreter,
+ (Hash*) PMC_struct_val(stash), class);
+ if (!b)
+ return NULL;
+ stash = b->value;
+ b = hash_get_bucket(interpreter,
+ (Hash*) PMC_struct_val(stash), globalname);
+ if (!b)
+ return NULL;
+ return VTABLE_get_pmc_keyed_int(interpreter, stash,
+ PMC_int_val((PMC*)b->value));
+ }
+ b = hash_get_bucket(interpreter,
+ (Hash*) PMC_struct_val(stash), globalname);
+ if (!b)
+ return NULL;
+ return b->value;
+
+#else
+ if (class) {
if (!VTABLE_exists_keyed_str(interpreter,
interpreter->globals->stash_hash,
class)) {
@@ -68,6 +96,7 @@
}
return VTABLE_get_pmc_keyed_str(interpreter,
stash, globalname);
+#endif
}
/* Take the class and completely rebuild the atttribute stuff for
@@ -444,25 +473,17 @@
INTVAL attrib_count;
PMC *class_array;
PMC *class;
- INTVAL class_enum;
PMC *class_name;
PMC *vtable_pmc;
class = object->vtable->data;
- /* * remember PMC type */
- class_enum = object->vtable->base_type;
- /* put in the real vtable
- * XXX we are leaking ths vtable
+ /*
+ * put in the real vtable
*/
- vtable_pmc = VTABLE_get_pmc_keyed_int(interpreter, (PMC *)PMC_data(class),
PCD_OBJECT_VTABLE);
+ vtable_pmc = VTABLE_get_pmc_keyed_int(interpreter, (PMC *)PMC_data(class),
+ PCD_OBJECT_VTABLE);
object->vtable = PMC_struct_val(vtable_pmc);
-
- /* object->vtable = Parrot_base_vtables[class_enum];*/
- // object->vtable = Parrot_clone_vtable(interpreter,
- // Parrot_base_vtables[enum_class_ParrotObject]);
- /* and set type of class */
- //object->vtable->base_type = class_enum;
/* Grab the attribute count from the parent */
attrib_count = class->cache.int_val;