[svn:parrot] r44537 - in trunk: lib/Parrot/Pmc2c src/pmc
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Sat Feb 27 22:13:25 UTC 2010
Author: NotFound
Date: Sat Feb 27 22:13:23 2010
New Revision: 44537
URL: https://trac.parrot.org/parrot/changeset/44537
Log:
manual_attrs attribute, set it in ParrotInterpreter and Handle
Modified:
trunk/lib/Parrot/Pmc2c/PMCEmitter.pm
trunk/src/pmc/handle.pmc
trunk/src/pmc/parrotinterpreter.pmc
Modified: trunk/lib/Parrot/Pmc2c/PMCEmitter.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/PMCEmitter.pm Sat Feb 27 21:22:05 2010 (r44536)
+++ trunk/lib/Parrot/Pmc2c/PMCEmitter.pm Sat Feb 27 22:13:23 2010 (r44537)
@@ -730,16 +730,25 @@
my $export = $self->is_dynamic ? 'PARROT_DYNEXT_EXPORT ' : 'PARROT_EXPORT';
# Sets the attr_size field:
- # If the auto_attrs flag is set, use the current data,
- # else check if this PMC has init or init_pmc vtable functions,
+ # - If the auto_attrs flag is set, use the current data.
+ # - If manual_attrs is set, set to 0.
+ # - If none is set, check if this PMC has init or init_pmc vtable functions,
# setting it to 0 in that case, and keeping the value from the
# parent otherwise.
my $set_attr_size = '';
- if ( @{$self->attributes} && $self->{flags}{auto_attrs} ) {
+ my $flag_auto_attrs = $self->{flags}{auto_attrs};
+ my $flag_manual_attrs = $self->{flags}{manual_attrs};
+ die 'manual_attrs and auto_attrs can not be used together'
+ if ($flag_auto_attrs && $flag_manual_attrs);
+ warn 'PMC has attributes but no auto_attrs or manual_attrs'
+ if (@{$self->attributes} && ! ($flag_auto_attrs || $flag_manual_attrs));
+
+ if ( @{$self->attributes} && $flag_auto_attrs) {
$set_attr_size .= "sizeof(Parrot_${classname}_attributes)";
}
else {
- $set_attr_size .= "0" if exists($self->{has_method}{init}) ||
+ $set_attr_size .= "0" if $flag_manual_attrs ||
+ exists($self->{has_method}{init}) ||
exists($self->{has_method}{init_pmc});
}
$set_attr_size = " vt->attr_size = " . $set_attr_size . ";\n"
Modified: trunk/src/pmc/handle.pmc
==============================================================================
--- trunk/src/pmc/handle.pmc Sat Feb 27 21:22:05 2010 (r44536)
+++ trunk/src/pmc/handle.pmc Sat Feb 27 22:13:23 2010 (r44537)
@@ -25,7 +25,7 @@
#include "parrot/parrot.h"
#include "../src/io/io_private.h"
-pmclass Handle provides Handle {
+pmclass Handle provides Handle manual_attrs {
/* TODO: Consider encapsulating PIOHANDLE as a PMC type, for subclassing */
ATTR PIOHANDLE os_handle; /* Low level OS descriptor */
Modified: trunk/src/pmc/parrotinterpreter.pmc
==============================================================================
--- trunk/src/pmc/parrotinterpreter.pmc Sat Feb 27 21:22:05 2010 (r44536)
+++ trunk/src/pmc/parrotinterpreter.pmc Sat Feb 27 22:13:23 2010 (r44537)
@@ -176,7 +176,7 @@
new_interp->current_cont = NEED_CONTINUATION;
}
-pmclass ParrotInterpreter no_ro {
+pmclass ParrotInterpreter no_ro manual_attrs {
ATTR struct parrot_interp_t *interp; /* this PMC's interpreter */
ATTR INTVAL tid; /* thread id */
ATTR PMC *args; /* args passed to this thread */
More information about the parrot-commits
mailing list