[svn:parrot] r40659 - in trunk/src: dynpmc pmc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Wed Aug 19 16:16:55 UTC 2009


Author: NotFound
Date: Wed Aug 19 16:16:54 2009
New Revision: 40659
URL: https://trac.parrot.org/parrot/changeset/40659

Log:
[pmc] revert r40656 until fixing some platform problems

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	Wed Aug 19 16:03:57 2009	(r40658)
+++ trunk/src/dynpmc/subproxy.pmc	Wed Aug 19 16:16:54 2009	(r40659)
@@ -1,6 +1,6 @@
 /*
  * $Id$
- * Copyright (C) 2003-2009, Parrot Foundation.
+ * Copyright (C) 2003-2008, Parrot Foundation.
  */
 
 /*
@@ -14,7 +14,7 @@
  */
 #define enum_class_SubProxy -1
 
-pmclass SubProxy dynpmc need_ext auto_attrs extends Sub {
+pmclass SubProxy dynpmc need_ext extends Sub {
 
     VTABLE void init() {
         SUPER();

Modified: trunk/src/pmc/coroutine.pmc
==============================================================================
--- trunk/src/pmc/coroutine.pmc	Wed Aug 19 16:03:57 2009	(r40658)
+++ trunk/src/pmc/coroutine.pmc	Wed Aug 19 16:16:54 2009	(r40659)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2001-2009, Parrot Foundation.
+Copyright (C) 2001-2008, Parrot Foundation.
 $Id$
 
 =head1 NAME
@@ -56,7 +56,7 @@
     print_pbc_location(interp);
 }
 
-pmclass Coroutine extends Sub need_ext auto_attrs {
+pmclass Coroutine extends Sub need_ext {
     ATTR PackFile_ByteCode *caller_seg;  /* bytecode segment */
     ATTR opcode_t *address;           /* next address to run - toggled each time */
 
@@ -76,10 +76,11 @@
 
     VTABLE void init() {
         Parrot_Coroutine_attributes *attrs =
-            (Parrot_Coroutine_attributes *) PMC_data(SELF);
+            mem_allocate_zeroed_typed(Parrot_Coroutine_attributes);
 
         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	Wed Aug 19 16:03:57 2009	(r40658)
+++ trunk/src/pmc/eval.pmc	Wed Aug 19 16:16:54 2009	(r40659)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2001-2009, Parrot Foundation.
+Copyright (C) 2001-2008, Parrot Foundation.
 $Id$
 
 =head1 NAME
@@ -125,7 +125,7 @@
     }
 }
 
-pmclass Eval extends Sub need_ext auto_attrs {
+pmclass Eval extends Sub need_ext {
 
     VTABLE void init() {
         Parrot_Sub_attributes *sub_data;

Modified: trunk/src/pmc/eventhandler.pmc
==============================================================================
--- trunk/src/pmc/eventhandler.pmc	Wed Aug 19 16:03:57 2009	(r40658)
+++ trunk/src/pmc/eventhandler.pmc	Wed Aug 19 16:16:54 2009	(r40659)
@@ -19,7 +19,7 @@
 
 */
 
-pmclass EventHandler extends Sub need_ext auto_attrs {
+pmclass EventHandler extends Sub need_ext {
 
     ATTR STRING *type;          /* the type of the event to handle */
     ATTR PMC    *code;          /* the code object to execute */
@@ -28,6 +28,27 @@
 
 /*
 
+=item C<void init()>
+
+Initializes an empty C<EventHandler>.  Add attributes to it if you want it to
+do anything.
+
+=cut
+
+*/
+
+    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;
+    }
+
+/*
+
 =item C<void init_pmc(PMC *data)>
 
 Initializes a new EventHandler with either a C<Sub> PMC (or descendant) or a
@@ -63,8 +84,7 @@
         PMC                 *interpreter = PMCNULL;
         STRING              *type        = NULL;
         INTVAL               priority    = 0;
-        Parrot_EventHandler_attributes *e =
-                (Parrot_EventHandler_attributes *) PMC_data(SELF);
+        Parrot_EventHandler_attributes *e           = NULL;
 
         if (VTABLE_isa(INTERP, data, CONST_STRING(INTERP, "Sub"))) {
             code = data;
@@ -84,10 +104,12 @@
             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	Wed Aug 19 16:03:57 2009	(r40658)
+++ trunk/src/pmc/sub.pmc	Wed Aug 19 16:16:54 2009	(r40659)
@@ -39,7 +39,7 @@
  * A sub now contains more data like namespace, which makes it
  * effectively a container. Therefore need_ext has to be set
  */
-pmclass Sub need_ext auto_attrs {
+pmclass Sub need_ext {
     ATTR PackFile_ByteCode *seg;     /* bytecode segment */
     ATTR size_t   start_offs;        /* sub entry in ops from seg->base.data */
     ATTR size_t   end_offs;
@@ -94,10 +94,11 @@
      */
     VTABLE void init() {
         Parrot_Sub_attributes * const attrs =
-            (Parrot_Sub_attributes *) PMC_data(SELF);
+            mem_allocate_zeroed_typed(Parrot_Sub_attributes);
 
         attrs->seg = INTERP->code;
 
+        PMC_data(SELF) = attrs;
         PObj_custom_mark_destroy_SETALL(SELF);
     }
 
@@ -121,7 +122,11 @@
                 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