From: Bob Rogers <[EMAIL PROTECTED]>
   Date: Tue, 26 Dec 2006 23:14:06 -0500

      From: chromatic <[EMAIL PROTECTED]>
      Date: Tue, 26 Dec 2006 16:26:03 -0800

      . . .

      I don't understand why; would you consider writing up some rough
      documentation on how contexts and interpreters and code segments
      currently work?  Having to dig in the implementation and guess by
      reading the code isn't getting me very far.

   I can try, but I don't know much about code segments; I'm just digging
   in the code myself.  But I'll certainly post anything I learn.

This is not quite to the point, but I did find that Parrot_pop_cs is
unused, which makes the "prev" member of PackFile_ByteCode effectively
unused.  Parrot_pop_cs looks like a pre-Continuation legacy, but was
actually added (in r2969) five months after continuation.pmc.  Does
anybody object to deleting this code?

                                        -- Bob

* include/parrot/packfile.h:
   + (struct PackFile_ByteCode):  Delete prev slot.
* src/packfile.c:
   + (Parrot_pop_cs):  Remove dead code.
   + (PackFile_find_fixup_entry, Parrot_switch_to_cs, byte_code_new):
     No more prev slot.

Diffs between last version checked in and current workfile(s):

Index: include/parrot/packfile.h
===================================================================
--- include/parrot/packfile.h   (revision 16270)
+++ include/parrot/packfile.h   (working copy)
@@ -174,7 +174,6 @@
     void *jit_info;             /* JITs data */
     Parrot_PIC_store * pic_store;      /* PIC storage */
     struct PackFile_Segment   * pic_index; /* segment of indices into store */
-    struct PackFile_ByteCode  * prev;   /* was executed previous */
     struct PackFile_Debug     * debugs;
     struct PackFile_ConstTable *const_table;
     struct PackFile_FixupTable *fixups;
@@ -334,8 +333,6 @@
 PARROT_API struct PackFile_ByteCode * Parrot_switch_to_cs(Interp *,
     struct PackFile_ByteCode *, int really);
 PARROT_API void Parrot_switch_to_cs_by_nr(Interp *, opcode_t seg);
-PARROT_API void Parrot_pop_cs(Interp *);
-
 PARROT_API void Parrot_destroy_constants(Interp *);
 
 /*
Index: src/packfile.c
===================================================================
--- src/packfile.c      (revision 16270)
+++ src/packfile.c      (working copy)
@@ -1936,7 +1936,6 @@
     byte_code->prederef.branches = NULL;
     byte_code->prederef.n_allocated = 0;
     byte_code->jit_info = NULL;
-    byte_code->prev = NULL;
     byte_code->debugs = NULL;
     byte_code->const_table = NULL;
     byte_code->fixups = NULL;
@@ -2479,7 +2478,6 @@
             /* new_cs->const_table->constants; */
     CONTEXT(interp->ctx)->pred_offset =
         new_cs->base.data - (opcode_t*) new_cs->prederef.code;
-    new_cs->prev = cur_cs;
     if (really)
         prepare_for_run(interp);
     return cur_cs;
@@ -2487,28 +2485,6 @@
 
 /*
 
-=item C<void
-Parrot_pop_cs(Interp *interp)>
-
-Remove current byte code segment from directory and switch to previous.
-
-=cut
-
-*/
-
-void
-Parrot_pop_cs(Interp *interp)
-{
-    struct PackFile_ByteCode * const cur_cs = interp->code;
-
-    interp->code = cur_cs->prev;
-    PackFile_remove_segment_by_name (interp,
-            cur_cs->base.dir, cur_cs->base.name);
-    /* FIXME delete returned segment */
-}
-
-/*
-
 =item C<static PackFile_Constant **
 find_constants(Interp *interp, struct PackFile_ConstTable *ct)>
 
@@ -2983,12 +2959,6 @@
     struct PackFile_FixupEntry *ep, e;
     int found;
 
-    /*
-     * XXX when in eval, the dir is in cur_cs->prev
-     */
-    if (interp->code->prev)
-        dir = interp->code->prev->base.dir;
-
     e.type = type;
     e.name = name;
     ep = &e;

End of diffs.

Reply via email to