cvsuser 05/03/13 04:16:14
Modified: lib/Parrot Pmc2c.pm
src dynext.c mmd.c
Log:
work around dynclasses failure
* disable DOD during dynamic library loading
* use const_string for vtable->whoami
* more asserts in mmd.c
Revision Changes Path
1.64 +2 -2 parrot/lib/Parrot/Pmc2c.pm
Index: Pmc2c.pm
===================================================================
RCS file: /cvs/public/parrot/lib/Parrot/Pmc2c.pm,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- Pmc2c.pm 9 Mar 2005 20:31:26 -0000 1.63
+++ Pmc2c.pm 13 Mar 2005 12:16:11 -0000 1.64
@@ -1,5 +1,5 @@
# Copyright: 2004 The Perl Foundation. All Rights Reserved.
-# $Id: Pmc2c.pm,v 1.63 2005/03/09 20:31:26 leo Exp $
+# $Id: Pmc2c.pm,v 1.64 2005/03/13 12:16:11 leo Exp $
=head1 NAME
@@ -183,7 +183,7 @@
while (my ($class, $info) = each %classes) {
my $lhs = $info->{flags}->{noinit} ? "" : "type$class = ";
$cout .= <<"EOC";
- whoami = string_from_cstring(interpreter, "$class", 0);
+ whoami = const_string(interpreter, "$class");
${lhs}pmc_register(interpreter, whoami);
EOC
}
1.38 +8 -2 parrot/src/dynext.c
Index: dynext.c
===================================================================
RCS file: /cvs/public/parrot/src/dynext.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- dynext.c 7 Jan 2005 00:16:37 -0000 1.37
+++ dynext.c 13 Mar 2005 12:16:14 -0000 1.38
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: dynext.c,v 1.37 2005/01/07 00:16:37 scog Exp $
+$Id: dynext.c,v 1.38 2005/03/13 12:16:14 leo Exp $
=head1 NAME
@@ -87,7 +87,7 @@
=item C<static PMC*
is_loaded(Parrot_Interp interpreter, STRING *path)>
-Check if a C<ParrotLibrary> PMC with the filename path exists.
+Check if a C<ParrotLibrary> PMC with the filename path exists.
If it does, return it. Otherwise, return NULL.
=cut
@@ -306,6 +306,11 @@
/* UNLOCK */
return lib_pmc;
}
+ /*
+ * work around gcc 3.3.3 and other problem with dynclasses
+ * something during library loading doesn't stand a DOD run
+ */
+ Parrot_block_DOD(interpreter);
/* get load_func */
load_func_name = Parrot_sprintf_c(interpreter, "Parrot_lib_%Ss_load",
lib);
cload_func_name = string_to_cstring(interpreter, load_func_name);
@@ -336,6 +341,7 @@
*/
store_lib_pmc(interpreter, lib_pmc, path, type);
/* UNLOCK */
+ Parrot_unblock_DOD(interpreter);
return lib_pmc;
}
1.49 +15 -8 parrot/src/mmd.c
Index: mmd.c
===================================================================
RCS file: /cvs/public/parrot/src/mmd.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- mmd.c 14 Feb 2005 10:57:42 -0000 1.48
+++ mmd.c 13 Mar 2005 12:16:14 -0000 1.49
@@ -1,6 +1,6 @@
/*
Copyright: 2003 The Perl Foundation. All Rights Reserved.
-$Id: mmd.c,v 1.48 2005/02/14 10:57:42 leo Exp $
+$Id: mmd.c,v 1.49 2005/03/13 12:16:14 leo Exp $
=head1 NAME
@@ -398,6 +398,8 @@
funcptr_t default_func;
UINTVAL i;
MMD_table *table = interpreter->binop_mmd_funcs + function;
+ char *src_ptr, *dest_ptr;
+ size_t old_dp, new_dp;
/* Is the Y 0? If so, nothing to expand, so just set the X for
later use */
@@ -423,13 +425,14 @@
/* Then copy the old table over. We have to do this row by row,
because the rows in the old and new tables are different
lengths */
+ src_ptr = (char*) table->mmd_funcs;
+ dest_ptr = (char*) new_table;
+ old_dp = sizeof(funcptr_t) * x;
+ new_dp = sizeof(funcptr_t) * new_x;
for (i = 0; i < y; i++) {
- INTVAL newoffset, oldoffset;
- newoffset = i * new_x;
- oldoffset = i * x;
- memcpy(new_table + newoffset,
- table->mmd_funcs + oldoffset,
- sizeof(funcptr_t) * x);
+ memcpy(dest_ptr, src_ptr, sizeof(funcptr_t) * x);
+ src_ptr += old_dp;
+ dest_ptr += new_dp;
}
if (table->mmd_funcs)
mem_sys_free(table->mmd_funcs);
@@ -460,6 +463,7 @@
MMD_table *table = interpreter->binop_mmd_funcs + function;
x = table->x;
+ assert(x);
y = table->y;
default_func = table->default_func;
@@ -573,7 +577,10 @@
{
INTVAL offset;
- MMD_table *table = interpreter->binop_mmd_funcs + function;
+ MMD_table *table;
+
+ assert(function < (INTVAL)interpreter->n_binop_mmd_funcs);
+ table = interpreter->binop_mmd_funcs + function;
if ((INTVAL)table->x <= left_type) {
mmd_expand_x(interpreter, function, left_type + 1);
}