[svn:parrot] r40760 - in trunk/src: dynpmc pmc
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Mon Aug 24 11:31:30 UTC 2009
Author: NotFound
Date: Mon Aug 24 11:31:30 2009
New Revision: 40760
URL: https://trac.parrot.org/parrot/changeset/40760
Log:
[pmc] set auto_attrs on Sub and derived PMCs - second attempt
Modified:
trunk/src/dynpmc/subproxy.pmc
trunk/src/pmc/coroutine.pmc
trunk/src/pmc/eval.pmc
trunk/src/pmc/eventhandler.pmc
trunk/src/pmc/sub.pmc
Modified: trunk/src/dynpmc/subproxy.pmc
==============================================================================
--- trunk/src/dynpmc/subproxy.pmc Mon Aug 24 11:16:16 2009 (r40759)
+++ trunk/src/dynpmc/subproxy.pmc Mon Aug 24 11:31:30 2009 (r40760)
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2003-2008, Parrot Foundation.
+ * Copyright (C) 2003-2009, Parrot Foundation.
*/
/*
@@ -14,7 +14,7 @@
*/
#define enum_class_SubProxy -1
-pmclass SubProxy dynpmc extends Sub {
+pmclass SubProxy dynpmc extends Sub auto_attrs {
VTABLE void init() {
SUPER();
Modified: trunk/src/pmc/coroutine.pmc
==============================================================================
--- trunk/src/pmc/coroutine.pmc Mon Aug 24 11:16:16 2009 (r40759)
+++ trunk/src/pmc/coroutine.pmc Mon Aug 24 11:31:30 2009 (r40760)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2008, Parrot Foundation.
+Copyright (C) 2001-2009, Parrot Foundation.
$Id$
=head1 NAME
@@ -56,7 +56,7 @@
print_pbc_location(interp);
}
-pmclass Coroutine extends Sub {
+pmclass Coroutine extends Sub auto_attrs {
ATTR PackFile_ByteCode *caller_seg; /* bytecode segment */
ATTR opcode_t *address; /* next address to run - toggled each time */
@@ -76,11 +76,10 @@
VTABLE void init() {
Parrot_Coroutine_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_Coroutine_attributes);
+ (Parrot_Coroutine_attributes *) PMC_data(SELF);
attrs->seg = INTERP->code;
attrs->ctx = NULL;
- PMC_data(SELF) = attrs;
PObj_custom_mark_destroy_SETALL(SELF);
}
Modified: trunk/src/pmc/eval.pmc
==============================================================================
--- trunk/src/pmc/eval.pmc Mon Aug 24 11:16:16 2009 (r40759)
+++ trunk/src/pmc/eval.pmc Mon Aug 24 11:31:30 2009 (r40760)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2008, Parrot Foundation.
+Copyright (C) 2001-2009, Parrot Foundation.
$Id$
=head1 NAME
@@ -125,7 +125,7 @@
}
}
-pmclass Eval extends Sub {
+pmclass Eval extends Sub auto_attrs {
VTABLE void init() {
Parrot_Sub_attributes *sub_data;
Modified: trunk/src/pmc/eventhandler.pmc
==============================================================================
--- trunk/src/pmc/eventhandler.pmc Mon Aug 24 11:16:16 2009 (r40759)
+++ trunk/src/pmc/eventhandler.pmc Mon Aug 24 11:31:30 2009 (r40760)
@@ -19,7 +19,7 @@
*/
-pmclass EventHandler extends Sub {
+pmclass EventHandler extends Sub auto_attrs {
ATTR STRING *type; /* the type of the event to handle */
ATTR PMC *code; /* the code object to execute */
@@ -38,13 +38,8 @@
*/
VTABLE void init() {
- Parrot_EventHandler_attributes *e =
- mem_allocate_zeroed_typed(Parrot_EventHandler_attributes);
-
PObj_custom_mark_SET(SELF);
PObj_active_destroy_SET(SELF);
-
- PMC_data(SELF) = e;
}
/*
@@ -84,7 +79,8 @@
PMC *interpreter = PMCNULL;
STRING *type = NULL;
INTVAL priority = 0;
- Parrot_EventHandler_attributes *e = NULL;
+ Parrot_EventHandler_attributes *e =
+ (Parrot_EventHandler_attributes *) PMC_data(SELF);
if (VTABLE_isa(INTERP, data, CONST_STRING(INTERP, "Sub"))) {
code = data;
@@ -104,12 +100,9 @@
interpreter = VTABLE_get_pmc_keyed_int(INTERP,
INTERP->iglobals, IGLOBALS_INTERPRETER);
- e = mem_allocate_zeroed_typed(Parrot_EventHandler_attributes);
-
PObj_custom_mark_SET(SELF);
PObj_active_destroy_SET(SELF);
- PMC_data(SELF) = e;
e->type = type;
e->code = code;
e->interp = interpreter;
Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc Mon Aug 24 11:16:16 2009 (r40759)
+++ trunk/src/pmc/sub.pmc Mon Aug 24 11:31:30 2009 (r40760)
@@ -35,7 +35,7 @@
print_pbc_location(interp);
}
-pmclass Sub {
+pmclass Sub auto_attrs {
ATTR PackFile_ByteCode *seg; /* bytecode segment */
ATTR size_t start_offs; /* sub entry in ops from seg->base.data */
ATTR size_t end_offs;
@@ -90,11 +90,10 @@
*/
VTABLE void init() {
Parrot_Sub_attributes * const attrs =
- mem_allocate_zeroed_typed(Parrot_Sub_attributes);
+ (Parrot_Sub_attributes *) PMC_data(SELF);
attrs->seg = INTERP->code;
- PMC_data(SELF) = attrs;
PObj_custom_mark_destroy_SETALL(SELF);
}
@@ -118,11 +117,7 @@
Parrot_free_context(INTERP, sub->ctx, 1);
if (sub->outer_ctx)
Parrot_free_context(INTERP, sub->outer_ctx, 1);
-
- mem_sys_free(sub);
}
-
- PMC_data(SELF) = NULL;
}
/*
More information about the parrot-commits
mailing list