[svn:parrot] r40350 - in trunk: lib/Parrot lib/Parrot/Pmc2c/PMC src/pmc
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Fri Jul 31 00:12:15 UTC 2009
Author: NotFound
Date: Fri Jul 31 00:12:14 2009
New Revision: 40350
URL: https://trac.parrot.org/parrot/changeset/40350
Log:
[cage] use vtable slot numbers instead of names in null pmc access and defaults
Modified:
trunk/lib/Parrot/Pmc2c/PMC/Null.pm
trunk/lib/Parrot/Pmc2c/PMC/default.pm
trunk/lib/Parrot/Vtable.pm
trunk/src/pmc/default.pmc
trunk/src/pmc/null.pmc
Modified: trunk/lib/Parrot/Pmc2c/PMC/Null.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/PMC/Null.pm Thu Jul 30 20:46:35 2009 (r40349)
+++ trunk/lib/Parrot/Pmc2c/PMC/Null.pm Fri Jul 31 00:12:14 2009 (r40350)
@@ -47,10 +47,10 @@
$param =~ s/.*\b(\w+)/$1/;
$body .= " UNUSED($param)\n";
}
+ my $vtname = uc $vt_method_name;
$body .= <<"EOC";
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_NULL_REG_ACCESS,
- "Null PMC access in $vt_method_name()");
+ null_pmc_access(interp, PARROT_VTABLE_SLOT_$vtname);
EOC
$new_default_method->body( Parrot::Pmc2c::Emitter->text($body) );
Modified: trunk/lib/Parrot/Pmc2c/PMC/default.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/PMC/default.pm Thu Jul 30 20:46:35 2009 (r40349)
+++ trunk/lib/Parrot/Pmc2c/PMC/default.pm Fri Jul 31 00:12:14 2009 (r40350)
@@ -79,8 +79,8 @@
$param =~ s/.*\b(\w+)/$1/;
$body .= " UNUSED($param)\n";
}
- my $vt_method_name = $method->name;
- $body .= qq{ $stub_func(interp, pmc, "$vt_method_name");\n};
+ my $vt_method_name = uc $method->name;
+ $body .= qq{ $stub_func(interp, pmc, PARROT_VTABLE_SLOT_$vt_method_name);\n};
$clone->body( Parrot::Pmc2c::Emitter->text($body));
Modified: trunk/lib/Parrot/Vtable.pm
==============================================================================
--- trunk/lib/Parrot/Vtable.pm Thu Jul 30 20:46:35 2009 (r40349)
+++ trunk/lib/Parrot/Vtable.pm Fri Jul 31 00:12:14 2009 (r40350)
@@ -238,6 +238,16 @@
EOM
+ # Slot numbers
+ my $vtable_slot_num = 9;
+ for my $entry ( @{$vtable} ) {
+ my $uc_meth = uc $entry->[1];
+ $macros .= <<"EOM";
+#define PARROT_VTABLE_SLOT_${uc_meth} ${vtable_slot_num}
+EOM
+ ++$vtable_slot_num;
+ }
+
# finally the name mapping
$macros .= <<'EOM';
/*
Modified: trunk/src/pmc/default.pmc
==============================================================================
--- trunk/src/pmc/default.pmc Thu Jul 30 20:46:35 2009 (r40349)
+++ trunk/src/pmc/default.pmc Fri Jul 31 00:12:14 2009 (r40350)
@@ -48,7 +48,7 @@
/*
=item C<static void cant_do_method(PARROT_INTERP, PMC *pmc,
- const char *methname)>
+ int index)>
Throws an exception "$methname() not implemented in class '$class'", used by
all unimplemented messages.
@@ -59,10 +59,11 @@
PARROT_DOES_NOT_RETURN
static void
-cant_do_method(PARROT_INTERP, PMC *pmc /*NULLOK*/, const char *methname)
+cant_do_method(PARROT_INTERP, PMC *pmc /*NULLOK*/, int index)
{
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ILL_INHERIT,
- "%s() not implemented in class '%Ss'", methname,
+ "%s() not implemented in class '%Ss'",
+ Parrot_get_vtable_name(interp, index),
caller(interp, pmc));
}
@@ -70,7 +71,7 @@
/*
=item C<static void cant_do_write_method(PARROT_INTERP, PMC *pmc,
- const char *methname)>
+ int index)>
Throws an exception "$methname() on read-only instance of '$class'", used by
all updating messages on read-only instances.
@@ -81,10 +82,11 @@
PARROT_DOES_NOT_RETURN
static void
-cant_do_write_method(PARROT_INTERP, PMC *pmc /*NULLOK*/, const char *methname)
+cant_do_write_method(PARROT_INTERP, PMC *pmc /*NULLOK*/, int index)
{
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_WRITE_TO_CONSTCLASS,
- "%s() in read-only instance of '%Ss'", methname,
+ "%s() in read-only instance of '%Ss'",
+ Parrot_get_vtable_name(interp, index),
caller(interp, pmc));
}
Modified: trunk/src/pmc/null.pmc
==============================================================================
--- trunk/src/pmc/null.pmc Thu Jul 30 20:46:35 2009 (r40349)
+++ trunk/src/pmc/null.pmc Fri Jul 31 00:12:14 2009 (r40350)
@@ -19,6 +19,15 @@
*/
+PARROT_DOES_NOT_RETURN
+static void
+null_pmc_access(PARROT_INTERP, int index)
+{
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_NULL_REG_ACCESS,
+ "Null PMC access in %s()",
+ Parrot_get_vtable_name(interp, index));
+}
+
pmclass Null singleton {
/*
More information about the parrot-commits
mailing list