Skip to content

Instantly share code, notes, and snippets.

@rurban
Created July 29, 2014 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rurban/f6fde77a6c38735d8ab8 to your computer and use it in GitHub Desktop.
Save rurban/f6fde77a6c38735d8ab8 to your computer and use it in GitHub Desktop.
diff --git lib/Parrot/Pmc2c/Method.pm lib/Parrot/Pmc2c/Method.pm
index edd5f75..a99a5da 100644
--- lib/Parrot/Pmc2c/Method.pm
+++ lib/Parrot/Pmc2c/Method.pm
@@ -337,9 +337,10 @@ sub decl {
}
my $interp = $self->interp_unused ? 'SHIM_INTERP' : 'PARROT_INTERP';
my $pmcarg = $self->pmc_unused ? 'SHIM(PMC *_self)' : 'ARGMOD(PMC *_self)';
+ my $static = $pmcname eq 'CallContext' ? "" : "static";
return <<"EOC";
-static $decs $ret${newl}Parrot_${pmcname}_$meth($interp, $pmcarg$args)$semi
+$static $decs $ret${newl}Parrot_${pmcname}_$meth($interp, $pmcarg$args)$semi
EOC
}
diff --git lib/Parrot/Pmc2c/PMC.pm lib/Parrot/Pmc2c/PMC.pm
index 7ebf43c..7e7b93c 100644
--- lib/Parrot/Pmc2c/PMC.pm
+++ lib/Parrot/Pmc2c/PMC.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2004-2013, Parrot Foundation.
+# Copyright (C) 2004-2014, Parrot Foundation.
=head1 NAME
@@ -521,7 +521,7 @@ sub generate_c_file {
$c->emit( $self->preamble );
- $c->emit( $self->hdecls );
+ $c->emit( $self->hdecls ) unless $self->name eq 'CallContext';
$c->emit( $self->{ro}->hdecls ) if ( $self->{ro} );
$self->gen_methods;
@@ -589,6 +589,10 @@ EOH
$self->gen_attributes;
+ if ($name eq 'CallContext') {
+ $h->emit( $self->hdecls );
+ }
+
if ($self->is_dynamic) {
$h->emit(<<"EOH");
@@ -1744,7 +1748,9 @@ sub generate_accessor {
/* Generated macro accessors for '$attrname' attribute of $pmcname PMC. */
#define GETATTR_${pmcname}_${attrname}(interp, pmc, dest) \\
EOA
- if (${pmcname} eq "CallContext") {
+
+ # Nobody derives from CallContext, the arg is always proper, and we need the speed
+ if ($pmcname eq "CallContext") {
$decl .= <<"EOA";
(dest) = PARROT_CALLCONTEXT(pmc)->${attrname};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment