[svn:parrot] r41066 - trunk/src/pmc

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Sun Sep 6 13:04:28 UTC 2009


Author: whiteknight
Date: Sun Sep  6 13:04:17 2009
New Revision: 41066
URL: https://trac.parrot.org/parrot/changeset/41066

Log:
[cage] some misc cleanups relating to the recent changes to Context and Continuation pmcs

Modified:
   trunk/src/pmc/continuation.pmc
   trunk/src/pmc/retcontinuation.pmc

Modified: trunk/src/pmc/continuation.pmc
==============================================================================
--- trunk/src/pmc/continuation.pmc	Sun Sep  6 12:43:34 2009	(r41065)
+++ trunk/src/pmc/continuation.pmc	Sun Sep  6 13:04:17 2009	(r41066)
@@ -67,7 +67,7 @@
 */
 
     VTABLE void init() {
-        Parrot_Continuation_attributes *attrs = PARROT_CONTINUATION(SELF);
+        Parrot_Continuation_attributes * const attrs = PARROT_CONTINUATION(SELF);
 
         attrs->to_ctx     = CURRENT_CONTEXT(interp);
         attrs->from_ctx   = CURRENT_CONTEXT(interp);
@@ -91,13 +91,14 @@
 
     /*if they pass in a PMC to initialize with*/
     VTABLE void init_pmc(PMC *values) {
-        Parrot_Continuation_attributes *attrs = PARROT_CONTINUATION(SELF);
+        Parrot_Continuation_attributes * const attrs  = PARROT_CONTINUATION(SELF);
+        Parrot_Continuation_attributes * const theirs = PARROT_CONTINUATION(values);
 
-        attrs->to_ctx     = PARROT_CONTINUATION(values)->to_ctx;
+        attrs->to_ctx     = theirs->to_ctx;
         attrs->from_ctx   = CURRENT_CONTEXT(interp);
         attrs->runloop_id = 0;
-        attrs->seg        = PARROT_CONTINUATION(values)->seg;
-        attrs->address    = PARROT_CONTINUATION(values)->address;
+        attrs->seg        = theirs->seg;
+        attrs->address    = theirs->address;
         attrs->current_results = Parrot_pcc_get_results(interp, attrs->to_ctx);
 
         PObj_active_destroy_SET(SELF);
@@ -130,7 +131,6 @@
 
         if (cc->seg)
             Parrot_gc_mark_PObj_alive(interp, (PObj *)cc->seg);
-
         if (cc->to_ctx)
             Parrot_gc_mark_PObj_alive(INTERP, (PObj *) cc->to_ctx);
         if (cc->from_ctx)
@@ -139,18 +139,6 @@
 
 /*
 
-=item C<void destroy()>
-
-Destroys the continuation.
-
-=cut
-
-*/
-
-    VTABLE void destroy() {
-    }
-/*
-
 =item C<PMC *clone()>
 
 Creates and returns a clone of the continuation.
@@ -160,7 +148,7 @@
 */
 
     VTABLE PMC *clone() {
-        PMC         * ret      = pmc_new_init(interp, enum_class_Continuation, SELF);
+        PMC * ret = pmc_new_init(interp, enum_class_Continuation, SELF);
         return ret;
     }
 
@@ -248,10 +236,10 @@
 */
 
     VTABLE opcode_t *invoke(void *next) {
-        Parrot_cont *cc           = PMC_cont(SELF);
-        PMC         *from_ctx     = CURRENT_CONTEXT(interp);
-        PMC         *to_ctx       = cc->to_ctx;
-        opcode_t    *pc           = cc->address;
+        Parrot_Continuation_attributes * const cc = PARROT_CONTINUATION(SELF);
+        PMC      *from_ctx = CURRENT_CONTEXT(interp);
+        PMC      *to_ctx   = cc->to_ctx;
+        opcode_t *pc       = cc->address;
         UNUSED(next)
 
         Parrot_continuation_check(interp, SELF);
@@ -282,8 +270,8 @@
         /* switch segment */
         INTERP->current_args = NULL;
 
-        if (INTERP->code != PARROT_CONTINUATION(SELF)->seg)
-            Parrot_switch_to_cs(INTERP, PARROT_CONTINUATION(SELF)->seg, 1);
+        if (INTERP->code != cc->seg)
+            Parrot_switch_to_cs(INTERP, cc->seg, 1);
 
         return pc;
     }
@@ -313,8 +301,8 @@
 */
 
     METHOD caller() {
-        Parrot_Continuation_attributes *cc     = PARROT_CONTINUATION(SELF);
-        PMC         *caller = Parrot_pcc_get_sub(interp, cc->to_ctx);
+        Parrot_Continuation_attributes * const cc = PARROT_CONTINUATION(SELF);
+        PMC *caller = Parrot_pcc_get_sub(interp, cc->to_ctx);
         Parrot_Sub_attributes  *sub;
 
         if (!caller)
@@ -339,8 +327,8 @@
 */
 
     METHOD continuation() {
-        Parrot_Continuation_attributes *cc   = PARROT_CONTINUATION(SELF);
-        PMC         *cont = Parrot_pcc_get_continuation(interp, cc->to_ctx);
+        Parrot_Continuation_attributes * const cc = PARROT_CONTINUATION(SELF);
+        PMC * const cont = Parrot_pcc_get_continuation(interp, cc->to_ctx);
 
         if (cont)
             RETURN(PMC *cont);

Modified: trunk/src/pmc/retcontinuation.pmc
==============================================================================
--- trunk/src/pmc/retcontinuation.pmc	Sun Sep  6 12:43:34 2009	(r41065)
+++ trunk/src/pmc/retcontinuation.pmc	Sun Sep  6 13:04:17 2009	(r41066)
@@ -75,9 +75,10 @@
 */
 
     VTABLE opcode_t *invoke(void *in_next) {
-        PMC               *from_ctx   = PARROT_CONTINUATION(SELF)->from_ctx;
-        PackFile_ByteCode * const seg = PARROT_CONTINUATION(SELF)->seg;
-        opcode_t          *next       = PARROT_CONTINUATION(SELF)->address;
+        Parrot_Continuation_attributes *data = PARROT_CONTINUATION(SELF);
+        PMC               *from_ctx   = data->from_ctx;
+        PackFile_ByteCode * const seg = data->seg;
+        opcode_t          *next       = data->address;
         UNUSED(in_next)
 
         Parrot_continuation_check(interp, SELF);
@@ -86,7 +87,7 @@
         /* the continuation is dead - delete and destroy it */
         /* This line causes a failure in t/pmc/packfiledirectory.t. No idea
            what the relationship is between this line of code and that test
-           failure. Will look into it later */
+           failure. */
         /* Parrot_gc_free_pmc_header(interp, SELF); */
 
         if (INTERP->code != seg)


More information about the parrot-commits mailing list