[svn:parrot] r49313 - in trunk: compilers/imcc include/parrot src src/pmc t/pmc t/pmc/testlib

plobsing at svn.parrot.org plobsing at svn.parrot.org
Sat Sep 25 01:27:43 UTC 2010


Author: plobsing
Date: Sat Sep 25 01:27:42 2010
New Revision: 49313
URL: https://trac.parrot.org/parrot/changeset/49313

Log:
eliminate pbc fixup table
improves rakudo startup by 0.4%, decreases perl6.pbc size by 0.7%.
eliminates a lot of code that doesn't help much.

Deleted:
   trunk/src/pmc/packfilefixupentry.pmc
   trunk/src/pmc/packfilefixuptable.pmc
   trunk/t/pmc/packfilefixupentry.t
   trunk/t/pmc/packfilefixuptable.t
Modified:
   trunk/compilers/imcc/pbc.c
   trunk/include/parrot/packfile.h
   trunk/src/embed.c
   trunk/src/packdump.c
   trunk/src/packfile.c
   trunk/src/pbc_dump.c
   trunk/src/pbc_merge.c
   trunk/src/pmc/eval.pmc
   trunk/src/pmc/packfiledirectory.pmc
   trunk/t/pmc/packfile.t
   trunk/t/pmc/packfileannotations.t
   trunk/t/pmc/packfiledirectory.t
   trunk/t/pmc/packfilerawsegment.t
   trunk/t/pmc/testlib/packfile_common.pir

Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c	Sat Sep 25 00:59:21 2010	(r49312)
+++ trunk/compilers/imcc/pbc.c	Sat Sep 25 01:27:42 2010	(r49313)
@@ -1562,12 +1562,6 @@
                                    : Parrot_str_new(interp, "*none*", 0));
         }
 
-        /*
-         * create entry in our fixup (=symbol) table
-         * the offset is the index in the constant table of this Sub
-         */
-        PackFile_FixupTable_new_entry(interp, r->name, enum_fixup_sub, k);
-
         return k;
     }
 }

Modified: trunk/include/parrot/packfile.h
==============================================================================
--- trunk/include/parrot/packfile.h	Sat Sep 25 00:59:21 2010	(r49312)
+++ trunk/include/parrot/packfile.h	Sat Sep 25 01:27:42 2010	(r49313)
@@ -101,13 +101,12 @@
 typedef enum {
     PF_DIR_SEG          = 0,
     PF_UNKNOWN_SEG      = 1,
-    PF_FIXUP_SEG        = 2,
-    PF_CONST_SEG        = 3,
-    PF_BYTEC_SEG        = 4,
-    PF_DEBUG_SEG        = 5,
-    PF_ANNOTATIONS_SEG  = 6,
+    PF_CONST_SEG        = 2,
+    PF_BYTEC_SEG        = 3,
+    PF_DEBUG_SEG        = 4,
+    PF_ANNOTATIONS_SEG  = 5,
 
-    PF_MAX_SEG          = 7
+    PF_MAX_SEG          = 6
 } pack_file_types;
 
 /* &end_gen */
@@ -216,24 +215,6 @@
 
 typedef INTVAL (*PackFile_map_segments_func_t)(PARROT_INTERP, PackFile_Segment *seg, void *user_data);
 
-/*
-** PackFile_FixupTable:
-*/
-typedef struct PackFile_FixupEntry {
-    opcode_t                  type;     /* who knows what fixups we need? */
-    char                     *name;     /* name of the label */
-    opcode_t                  offset;   /* location of the item */
-} PackFile_FixupEntry;
-
-typedef struct PackFile_FixupTable {
-    PackFile_Segment             base;
-    opcode_t                     fixup_count;
-    PackFile_FixupEntry         *fixups;
-    PackFile_ByteCode           *code;   /* where this segment belongs to */
-} PackFile_FixupTable;
-
-
-
 /* &gen_from_def(packfile_constants.pasm) */
 
 /* no ascii chars use numbers: for n, s, k, p */
@@ -279,7 +260,6 @@
     PackFile_Segment              base;
     struct PackFile_Debug        *debugs;
     PackFile_ConstTable          *const_table;
-    PackFile_FixupTable          *fixups;
     struct PackFile_Annotations  *annotations;
     PackFile_ByteCode_OpMapping   op_mapping;      /* opcode mapping information */
     size_t                        op_count;        /* number of ops in the func table */
@@ -532,15 +512,6 @@
 PARROT_EXPORT
 PARROT_WARN_UNUSED_RESULT
 PARROT_CAN_RETURN_NULL
-PackFile_FixupEntry * PackFile_find_fixup_entry(PARROT_INTERP,
-    INTVAL type,
-    ARGIN(char *name))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(3);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
 PackFile_Segment * PackFile_find_segment(PARROT_INTERP,
     ARGIN_NULLOK(PackFile_Directory *dir),
     ARGIN(const STRING *name),
@@ -555,21 +526,6 @@
         __attribute__nonnull__(1);
 
 PARROT_EXPORT
-void PackFile_FixupTable_clear(PARROT_INTERP,
-    ARGMOD(PackFile_FixupTable *self))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*self);
-
-PARROT_EXPORT
-void PackFile_FixupTable_new_entry(PARROT_INTERP,
-    ARGIN(const char *label),
-    INTVAL type,
-    opcode_t offs)
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-PARROT_EXPORT
 void PackFile_funcs_register(SHIM_INTERP,
     ARGOUT(PackFile *pf),
     UINTVAL type,
@@ -823,20 +779,11 @@
 #define ASSERT_ARGS_PackFile_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(pf))
-#define ASSERT_ARGS_PackFile_find_fixup_entry __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(name))
 #define ASSERT_ARGS_PackFile_find_segment __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(name))
 #define ASSERT_ARGS_PackFile_fixup_subs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_PackFile_FixupTable_clear __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_PackFile_FixupTable_new_entry __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(label))
 #define ASSERT_ARGS_PackFile_funcs_register __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(pf))
 #define ASSERT_ARGS_PackFile_map_segments __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -942,18 +889,9 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-PARROT_EXPORT
-void PackFile_Fixup_dump(PARROT_INTERP,
-    ARGIN(const PackFile_FixupTable *ft))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
 #define ASSERT_ARGS_PackFile_ConstTable_dump __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_PackFile_Fixup_dump __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(ft))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 /* HEADERIZER END: src/packdump.c */
 

Modified: trunk/src/embed.c
==============================================================================
--- trunk/src/embed.c	Sat Sep 25 00:59:21 2010	(r49312)
+++ trunk/src/embed.c	Sat Sep 25 01:27:42 2010	(r49313)
@@ -717,8 +717,8 @@
     PMC *new_sub_pmc;
 
     PackFile_ByteCode   * const cur_cs = interp->code;
-    PackFile_FixupTable * const ft     = cur_cs->fixups;
     PackFile_ConstTable * const ct     = cur_cs->const_table;
+    STRING * const SUB = CONST_STRING(interp, "Sub");
 
     opcode_t    i;
 
@@ -727,10 +727,9 @@
      * entry point with the address at our resume_offset.
      */
 
-    for (i = 0; i < ft->fixup_count; ++i) {
-        if (ft->fixups[i].type == enum_fixup_sub) {
-            const opcode_t ci      = ft->fixups[i].offset;
-            PMC    * const sub_pmc = ct->pmc.constants[ci];
+    for (i = 0; i < ct->pmc.const_count; i++) {
+        PMC *sub_pmc = ct->pmc.constants[i];
+        if (VTABLE_isa(interp, sub_pmc, SUB)) {
             Parrot_Sub_attributes *sub;
 
             PMC_get_sub(interp, sub_pmc, sub);

Modified: trunk/src/packdump.c
==============================================================================
--- trunk/src/packdump.c	Sat Sep 25 00:59:21 2010	(r49312)
+++ trunk/src/packdump.c	Sat Sep 25 01:27:42 2010	(r49313)
@@ -400,41 +400,6 @@
 
 /*
 
-=item C<void PackFile_Fixup_dump(PARROT_INTERP, const PackFile_FixupTable *ft)>
-
-Dumps the fix-up table C<ft>.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-PackFile_Fixup_dump(PARROT_INTERP, ARGIN(const PackFile_FixupTable *ft))
-{
-    ASSERT_ARGS(PackFile_Fixup_dump)
-    opcode_t i;
-
-    for (i = 0; i < ft->fixup_count; ++i) {
-        Parrot_io_printf(interp, "\t#%d\n", (int) i);
-        switch (ft->fixups[i].type) {
-          case enum_fixup_sub:
-            Parrot_io_printf(interp,
-                        "\ttype => %d offs => %8d name => '%s',\n",
-                        (int)ft->fixups[i].type,
-                        (int)ft->fixups[i].offset,
-                        ft->fixups[i].name);
-            break;
-          default:
-            Parrot_io_printf(interp, "\ttype => %d ???,\n",
-                        (int) ft->fixups[i].type);
-            break;
-        }
-    }
-}
-
-/*
-
 =back
 
 =head1 SEE ALSO

Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c	Sat Sep 25 00:59:21 2010	(r49312)
+++ trunk/src/packfile.c	Sat Sep 25 01:27:42 2010	(r49313)
@@ -216,61 +216,6 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PackFile_FixupEntry * find_fixup(
-    ARGMOD(PackFile_FixupTable *ft),
-    INTVAL type,
-    ARGIN(const char *name))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*ft);
-
-static INTVAL find_fixup_iter(PARROT_INTERP,
-    ARGIN(PackFile_Segment *seg),
-    ARGIN(void *user_data))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3);
-
-static void fixup_destroy(PARROT_INTERP, ARGMOD(PackFile_Segment *self))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*self);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static PackFile_Segment * fixup_new(PARROT_INTERP,
-    SHIM(PackFile *pf),
-    SHIM(STRING *name),
-    SHIM(int add))
-        __attribute__nonnull__(1);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static opcode_t * fixup_pack(PARROT_INTERP,
-    ARGIN(PackFile_Segment *self),
-    ARGOUT(opcode_t *cursor))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*cursor);
-
-static size_t fixup_packed_size(PARROT_INTERP,
-    ARGMOD(PackFile_Segment *self))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*self);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static const opcode_t * fixup_unpack(PARROT_INTERP,
-    ARGIN(PackFile_Segment *seg),
-    ARGIN(const opcode_t *cursor))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3);
-
 PARROT_CANNOT_RETURN_NULL
 static PMC * make_annotation_value_pmc(PARROT_INTERP,
     ARGIN(PackFile_Annotations *self),
@@ -455,29 +400,6 @@
 #define ASSERT_ARGS_find_constants __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(ct))
-#define ASSERT_ARGS_find_fixup __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(ft) \
-    , PARROT_ASSERT_ARG(name))
-#define ASSERT_ARGS_find_fixup_iter __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(seg) \
-    , PARROT_ASSERT_ARG(user_data))
-#define ASSERT_ARGS_fixup_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_fixup_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_fixup_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(self) \
-    , PARROT_ASSERT_ARG(cursor))
-#define ASSERT_ARGS_fixup_packed_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_fixup_unpack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(seg) \
-    , PARROT_ASSERT_ARG(cursor))
 #define ASSERT_ARGS_make_annotation_value_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(self))
@@ -639,12 +561,6 @@
         if (!pf->cur_cs)
             pf->cur_cs = (PackFile_ByteCode *)seg;
         break;
-      case PF_FIXUP_SEG:
-        if (!pf->cur_cs->fixups) {
-            pf->cur_cs->fixups       = (PackFile_FixupTable *)seg;
-            pf->cur_cs->fixups->code = pf->cur_cs;
-        }
-        break;
       case PF_CONST_SEG:
         if (!pf->cur_cs->const_table) {
             pf->cur_cs->const_table       = (PackFile_ConstTable *)seg;
@@ -960,46 +876,32 @@
                pbc_action_enum_t action, ARGIN_NULLOK(PMC *eval_pmc))
 {
     ASSERT_ARGS(do_sub_pragmas)
-    PackFile_FixupTable * const ft = self->fixups;
     PackFile_ConstTable * const ct = self->const_table;
     opcode_t i;
 
     TRACE_PRINTF(("PackFile: do_sub_pragmas (action=%d)\n", action));
 
-    for (i = 0; i < ft->fixup_count; ++i) {
-        switch (ft->fixups[i].type) {
-            case enum_fixup_sub:
-            {
-                /* offset is an index into const_table holding the Sub PMC */
-                PMC           *sub_pmc;
-                Parrot_Sub_attributes    *sub;
-                const opcode_t ci = ft->fixups[i].offset;
-
-                if (ci < 0 || ci >= ct->pmc.const_count)
-                    Parrot_ex_throw_from_c_args(interp, NULL, 1,
-                        "Illegal fixup offset (%d) in enum_fixup_sub");
-
-                sub_pmc       = ct->pmc.constants[ci];
-                PMC_get_sub(interp, sub_pmc, sub);
-                sub->eval_pmc = eval_pmc;
-
-                if (((PObj_get_FLAGS(sub_pmc) & SUB_FLAG_PF_MASK)
-                ||   (Sub_comp_get_FLAGS(sub) & SUB_COMP_FLAG_MASK))
-                &&    sub_pragma(interp, action, sub_pmc)) {
-                    PMC * const result = do_1_sub_pragma(interp, sub_pmc,
-                                                         action);
-
-                    /* replace Sub PMC with computation results */
-                    if (action == PBC_IMMEDIATE && !PMC_IS_NULL(result)) {
-                        ft->fixups[i].type    = enum_fixup_none;
-                        ct->pmc.constants[ci] = result;
-                    }
+    for (i = 0; i < ct->pmc.const_count; ++i) {
+        STRING * const SUB = CONST_STRING(interp, "Sub");
+        PMC *sub_pmc = ct->pmc.constants[i];
+
+        if (VTABLE_isa(interp, sub_pmc, SUB)) {
+            Parrot_Sub_attributes *sub;
+
+            PMC_get_sub(interp, sub_pmc, sub);
+            sub->eval_pmc = eval_pmc;
+
+            if (((PObj_get_FLAGS(sub_pmc) & SUB_FLAG_PF_MASK)
+            ||   (Sub_comp_get_FLAGS(sub) & SUB_COMP_FLAG_MASK))
+            &&    sub_pragma(interp, action, sub_pmc)) {
+                PMC * const result = do_1_sub_pragma(interp, sub_pmc,
+                        action);
+
+                /* replace Sub PMC with computation results */
+                if (action == PBC_IMMEDIATE && !PMC_IS_NULL(result)) {
+                    ct->pmc.constants[i] = result;
                 }
-
-                break;
             }
-            default:
-                break;
         }
     }
 }
@@ -1675,15 +1577,6 @@
         default_dump
     };
 
-    static const PackFile_funcs fixupf = {
-        fixup_new,
-        fixup_destroy,
-        fixup_packed_size,
-        fixup_pack,
-        fixup_unpack,
-        default_dump
-    };
-
     static const PackFile_funcs constf = {
         const_new,
         const_destroy,
@@ -1722,7 +1615,6 @@
 
     PackFile_funcs_register(interp, pf, PF_DIR_SEG,         dirf);
     PackFile_funcs_register(interp, pf, PF_UNKNOWN_SEG,     defaultf);
-    PackFile_funcs_register(interp, pf, PF_FIXUP_SEG,       fixupf);
     PackFile_funcs_register(interp, pf, PF_CONST_SEG,       constf);
     PackFile_funcs_register(interp, pf, PF_BYTEC_SEG,       bytef);
     PackFile_funcs_register(interp, pf, PF_DEBUG_SEG,       debugf);
@@ -1799,7 +1691,7 @@
 =item C<PackFile_ByteCode * PF_create_default_segs(PARROT_INTERP, STRING
 *file_name, int add)>
 
-Creates the bytecode, constant, and fixup segments for C<file_name>. If C<add>
+Creates the bytecode and constant segments for C<file_name>. If C<add>
 is true, the current packfile becomes the owner of these segments by adding the
 segments to the directory.
 
@@ -1819,12 +1711,6 @@
         (PackFile_ByteCode *)create_seg(interp, &pf->directory,
             PF_BYTEC_SEG, BYTE_CODE_SEGMENT_NAME, file_name, add);
 
-    cur_cs->fixups       =
-        (PackFile_FixupTable *)create_seg(interp, &pf->directory,
-            PF_FIXUP_SEG, FIXUP_TABLE_SEGMENT_NAME, file_name, add);
-
-    cur_cs->fixups->code = cur_cs;
-
     cur_cs->const_table  =
         (PackFile_ConstTable *)create_seg(interp, &pf->directory,
             PF_CONST_SEG, CONSTANT_SEGMENT_NAME, file_name, add);
@@ -2308,27 +2194,13 @@
         }
     }
 
-    seg = dir->segments[1];
-
-    if (seg->type != PF_FIXUP_SEG) {
-        size_t i;
-
-        for (i = 2; i < num_segs; ++i) {
-            PackFile_Segment * const s2 = dir->segments[i];
-            if (s2->type == PF_FIXUP_SEG) {
-                dir->segments[1] = s2;
-                dir->segments[i] = seg;
-                break;
-            }
-        }
-    }
 
     /* XXX
      * Temporary? hack to put ConstantTable in front of other segments.
      * This is useful for Annotations because we ensure that constants used
      * for keys already available during unpack.
      */
-    seg = dir->segments[2];
+    seg = dir->segments[1];
 
     if (seg->type != PF_CONST_SEG) {
         size_t i;
@@ -2642,7 +2514,6 @@
     byte_code->annotations     = NULL;
     byte_code->const_table     = NULL;
     byte_code->debugs          = NULL;
-    byte_code->fixups          = NULL;
     byte_code->op_func_table   = NULL;
     byte_code->op_info_table   = NULL;
     byte_code->op_mapping.libs = NULL;
@@ -3492,395 +3363,6 @@
     parrot_hash_destroy(interp, hash);
 }
 
-
-/*
-
-=back
-
-=head2 PackFile FixupTable Structure Functions
-
-=over 4
-
-=item C<void PackFile_FixupTable_clear(PARROT_INTERP, PackFile_FixupTable
-*self)>
-
-Clears a PackFile FixupTable.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-PackFile_FixupTable_clear(PARROT_INTERP, ARGMOD(PackFile_FixupTable *self))
-{
-    ASSERT_ARGS(PackFile_FixupTable_clear)
-
-    if (!self) {
-        Parrot_io_eprintf(interp, "PackFile_FixupTable_clear: self == NULL!\n");
-        return;
-    }
-
-    if (self->fixup_count) {
-        opcode_t i;
-        for (i = 0; i < self->fixup_count; ++i) {
-            mem_gc_free(interp, self->fixups[i].name);
-            self->fixups[i].name = NULL;
-        }
-        mem_gc_free(interp, self->fixups);
-    }
-    self->fixups      = NULL;
-    self->fixup_count = 0;
-
-    return;
-}
-
-
-/*
-
-=item C<static void fixup_destroy(PARROT_INTERP, PackFile_Segment *self)>
-
-Calls C<PackFile_FixupTable_clear()> with C<self>.
-
-=cut
-
-*/
-
-static void
-fixup_destroy(PARROT_INTERP, ARGMOD(PackFile_Segment *self))
-{
-    ASSERT_ARGS(fixup_destroy)
-    PackFile_FixupTable * const ft = (PackFile_FixupTable *)self;
-    PackFile_FixupTable_clear(interp, ft);
-}
-
-
-/*
-
-=item C<static size_t fixup_packed_size(PARROT_INTERP, PackFile_Segment *self)>
-
-Calculates the size, in multiples of C<opcode_t>, required to store the
-passed C<PackFile_FixupTable> in bytecode.
-
-=cut
-
-*/
-
-static size_t
-fixup_packed_size(PARROT_INTERP, ARGMOD(PackFile_Segment *self))
-{
-    ASSERT_ARGS(fixup_packed_size)
-    PackFile_FixupTable * const ft   = (PackFile_FixupTable *)self;
-    size_t                      size = 1;
-    opcode_t i;
-
-    for (i = 0; i < ft->fixup_count; ++i) {
-        /* fixup_entry type */
-        ++size;
-        switch (ft->fixups[i].type) {
-          case enum_fixup_sub:
-            size += PF_size_cstring(ft->fixups[i].name);
-            ++size; /* offset */
-            break;
-          case enum_fixup_none:
-            break;
-          default:
-            Parrot_ex_throw_from_c_args(interp, NULL, 1,
-                    "Unknown fixup type\n");
-        }
-    }
-
-    return size;
-}
-
-
-/*
-
-=item C<static opcode_t * fixup_pack(PARROT_INTERP, PackFile_Segment *self,
-opcode_t *cursor)>
-
-Packs the fixup table for a given packfile.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static opcode_t *
-fixup_pack(PARROT_INTERP, ARGIN(PackFile_Segment *self), ARGOUT(opcode_t *cursor))
-{
-    ASSERT_ARGS(fixup_pack)
-    PackFile_FixupTable * const ft = (PackFile_FixupTable *)self;
-    opcode_t i;
-
-    *cursor++ = ft->fixup_count;
-
-    for (i = 0; i < ft->fixup_count; ++i) {
-        *cursor++ = (opcode_t) ft->fixups[i].type;
-        switch (ft->fixups[i].type) {
-          case enum_fixup_sub:
-            cursor    = PF_store_cstring(cursor, ft->fixups[i].name);
-            *cursor++ = ft->fixups[i].offset;
-            break;
-          case enum_fixup_none:
-            break;
-          default:
-            Parrot_ex_throw_from_c_args(interp, NULL, 1,
-                    "Unknown fixup type\n");
-        }
-    }
-
-    return cursor;
-}
-
-
-/*
-
-=item C<static PackFile_Segment * fixup_new(PARROT_INTERP, PackFile *pf, STRING
-*name, int add)>
-
-Returns a new C<PackFile_FixupTable> segment.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static PackFile_Segment *
-fixup_new(PARROT_INTERP, SHIM(PackFile *pf), SHIM(STRING *name), SHIM(int add))
-{
-    ASSERT_ARGS(fixup_new)
-    PackFile_FixupTable * const fixup = mem_gc_allocate_zeroed_typed(interp,
-            PackFile_FixupTable);
-
-    return (PackFile_Segment *) fixup;
-}
-
-
-/*
-
-=item C<static const opcode_t * fixup_unpack(PARROT_INTERP, PackFile_Segment
-*seg, const opcode_t *cursor)>
-
-Unpacks a PackFile FixupTable from a block of memory, given a cursor.
-
-Returns one (1) if everything is okay, else zero (0).
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static const opcode_t *
-fixup_unpack(PARROT_INTERP, ARGIN(PackFile_Segment *seg), ARGIN(const opcode_t *cursor))
-{
-    ASSERT_ARGS(fixup_unpack)
-    PackFile_FixupTable * const self = (PackFile_FixupTable *)seg;
-    PackFile                   *pf;
-    opcode_t                    i;
-
-    if (!self) {
-        Parrot_io_eprintf(interp,
-            "PackFile_FixupTable_unpack: self == NULL!\n");
-        return NULL;
-    }
-
-    PackFile_FixupTable_clear(interp, self);
-
-    pf                = self->base.pf;
-    self->fixup_count = PF_fetch_opcode(pf, &cursor);
-
-    TRACE_PRINTF(("PackFile_FixupTable_unpack(): %ld entries\n",
-        self->fixup_count));
-
-    if (self->fixup_count) {
-        self->fixups = mem_gc_allocate_n_zeroed_typed(interp,
-            self->fixup_count, PackFile_FixupEntry);
-
-        if (!self->fixups) {
-            Parrot_io_eprintf(interp,
-                    "PackFile_FixupTable_unpack: Could not allocate "
-                    "memory for array!\n");
-            self->fixup_count = 0;
-            return NULL;
-        }
-    }
-
-    for (i = 0; i < self->fixup_count; ++i) {
-        PackFile_FixupEntry * const entry = self->fixups + i;
-
-        entry->type = PF_fetch_opcode(pf, &cursor);
-
-        switch (entry->type) {
-          case enum_fixup_sub:
-            entry->name   = PF_fetch_cstring(interp, pf, &cursor);
-            entry->offset = PF_fetch_opcode(pf, &cursor);
-            TRACE_PRINTF_VAL(("PackFile_FixupTable_unpack(): type %d, "
-                    "name %s, offset %ld\n",
-                    entry->type, entry->name, entry->offset));
-            break;
-          case enum_fixup_none:
-            break;
-          default:
-            Parrot_io_eprintf(interp,
-                    "PackFile_FixupTable_unpack: Unknown fixup type %d!\n",
-                    entry->type);
-            return NULL;
-        }
-    }
-
-    return cursor;
-}
-
-
-/*
-
-=item C<void PackFile_FixupTable_new_entry(PARROT_INTERP, const char *label,
-INTVAL type, opcode_t offs)>
-
-Adds a new fix-up entry with label and type.  Creates a new PackFile FixupTable
-if none is present.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-PackFile_FixupTable_new_entry(PARROT_INTERP,
-        ARGIN(const char *label), INTVAL type, opcode_t offs)
-{
-    ASSERT_ARGS(PackFile_FixupTable_new_entry)
-    PackFile_FixupTable *self = interp->code->fixups;
-    opcode_t             i;
-
-    if (!self) {
-        self = (PackFile_FixupTable *) PackFile_Segment_new_seg(
-                interp, interp->code->base.dir, PF_FIXUP_SEG,
-                FIXUP_TABLE_SEGMENT_NAME, 1);
-
-        interp->code->fixups = self;
-        self->code           = interp->code;
-    }
-
-    i = self->fixup_count++;
-    self->fixups = mem_gc_realloc_n_typed_zeroed(interp,
-            self->fixups, self->fixup_count, i, PackFile_FixupEntry);
-
-    self->fixups[i].type   = type;
-    self->fixups[i].name   = mem_sys_strdup(label);
-    self->fixups[i].offset = offs;
-}
-
-
-/*
-
-=item C<static PackFile_FixupEntry * find_fixup(PackFile_FixupTable *ft, INTVAL
-type, const char *name)>
-
-Finds the fix-up entry in a given FixupTable C<ft> for C<type> and C<name> and
-returns it.
-
-This ignores directories. For a recursive version see
-C<PackFile_find_fixup_entry()>.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PackFile_FixupEntry *
-find_fixup(ARGMOD(PackFile_FixupTable *ft), INTVAL type, ARGIN(const char *name))
-{
-    ASSERT_ARGS(find_fixup)
-    opcode_t i;
-    for (i = 0; i < ft->fixup_count; ++i) {
-        if ((INTVAL)((enum_fixup_t)ft->fixups[i].type) == type
-        &&  STREQ(ft->fixups[i].name, name)) {
-            return ft->fixups + i;
-        }
-    }
-
-    return NULL;
-}
-
-
-/*
-
-=item C<static INTVAL find_fixup_iter(PARROT_INTERP, PackFile_Segment *seg, void
-*user_data)>
-
-Internal iterator for C<PackFile_find_fixup_entry>; recurses into directories.
-
-=cut
-
-*/
-
-static INTVAL
-find_fixup_iter(PARROT_INTERP, ARGIN(PackFile_Segment *seg), ARGIN(void *user_data))
-{
-    ASSERT_ARGS(find_fixup_iter)
-    if (seg->type == PF_DIR_SEG) {
-        if (PackFile_map_segments(interp, (PackFile_Directory *)seg,
-                    find_fixup_iter, user_data))
-            return 1;
-    }
-    else if (seg->type == PF_FIXUP_SEG) {
-        PackFile_FixupEntry ** const e  = (PackFile_FixupEntry **)user_data;
-        PackFile_FixupEntry *  const fe = (PackFile_FixupEntry *)find_fixup(
-                (PackFile_FixupTable *) seg, (*e)->type, (*e)->name);
-
-        if (fe) {
-            *e = fe;
-            return 1;
-        }
-    }
-
-    return 0;
-}
-
-
-/*
-
-=item C<PackFile_FixupEntry * PackFile_find_fixup_entry(PARROT_INTERP, INTVAL
-type, char *name)>
-
-Searches the whole PackFile recursively for a fix-up entry with the given
-C<type> and C<name>, and returns the found entry or NULL.
-
-This also recurses into directories, compared to the simplier C<find_fixup>
-which just searches one PackFile_FixupTable.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PackFile_FixupEntry *
-PackFile_find_fixup_entry(PARROT_INTERP, INTVAL type, ARGIN(char *name))
-{
-    ASSERT_ARGS(PackFile_find_fixup_entry)
-
-    /* TODO make a hash of all fixups */
-    PackFile_Directory  * const dir = interp->code->base.dir;
-    PackFile_FixupEntry * const ep  = mem_gc_allocate_zeroed_typed(interp, PackFile_FixupEntry);
-
-    ep->type = type;
-    ep->name = name;
-
-    if (PackFile_map_segments(interp, dir, find_fixup_iter, (void *) ep))
-        return ep;
-
-    return NULL;
-}
-
-
 /*
 
 =back

Modified: trunk/src/pbc_dump.c
==============================================================================
--- trunk/src/pbc_dump.c	Sat Sep 25 00:59:21 2010	(r49312)
+++ trunk/src/pbc_dump.c	Sat Sep 25 01:27:42 2010	(r49313)
@@ -82,25 +82,6 @@
 
 /*
 
-=item C<static void fixup_dump(PARROT_INTERP, const PackFile_Segment *segp)>
-
-Dump the fixup table.
-
-=cut
-
-*/
-
-static void
-fixup_dump(PARROT_INTERP, const PackFile_Segment *segp)
-{
-    Parrot_io_printf(interp, "%Ss => [\n", segp->name);
-    PackFile_Fixup_dump(interp, (const PackFile_FixupTable *)segp);
-    Parrot_io_printf(interp, "],\n");
-}
-
-
-/*
-
 =item C<static void disas_dump(PARROT_INTERP, const PackFile_Segment *self)>
 
 Disassemble and dump.
@@ -432,7 +413,6 @@
     /* install a dumper function */
     if (!terse) {
         pf->PackFuncs[PF_CONST_SEG].dump = const_dump;
-        pf->PackFuncs[PF_FIXUP_SEG].dump = fixup_dump;
     }
 
     if (disas)

Modified: trunk/src/pbc_merge.c
==============================================================================
--- trunk/src/pbc_merge.c	Sat Sep 25 00:59:21 2010	(r49312)
+++ trunk/src/pbc_merge.c	Sat Sep 25 01:27:42 2010	(r49313)
@@ -126,15 +126,6 @@
         FUNC_MODIFIES(*pf)
         FUNC_MODIFIES(*bc);
 
-static void pbc_merge_fixups(PARROT_INTERP,
-    ARGIN(pbc_merge_input **inputs),
-    int num_inputs,
-    ARGMOD(PackFile *pf))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(4)
-        FUNC_MODIFIES(*pf);
-
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 static PackFile* pbc_merge_loadpbc(PARROT_INTERP,
@@ -173,10 +164,6 @@
     , PARROT_ASSERT_ARG(inputs) \
     , PARROT_ASSERT_ARG(pf) \
     , PARROT_ASSERT_ARG(bc))
-#define ASSERT_ARGS_pbc_merge_fixups __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(inputs) \
-    , PARROT_ASSERT_ARG(pf))
 #define ASSERT_ARGS_pbc_merge_loadpbc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(fullname))
@@ -477,92 +464,6 @@
 
 /*
 
-=item C<static void pbc_merge_fixups(PARROT_INTERP, pbc_merge_input **inputs,
-int num_inputs, PackFile *pf)>
-
-This function merges the fixups tables from the input PBC files.
-
-=cut
-
-*/
-
-static void
-pbc_merge_fixups(PARROT_INTERP, ARGIN(pbc_merge_input **inputs),
-                 int num_inputs, ARGMOD(PackFile *pf))
-{
-    ASSERT_ARGS(pbc_merge_fixups)
-    PackFile_FixupTable  *fixup_seg;
-    PackFile_FixupEntry  *fixups = NULL;
-    opcode_t              cursor = 0;
-    int                   i;
-
-    /* Add a fixup table segment. */
-    fixup_seg = (PackFile_FixupTable*)PackFile_Segment_new_seg(
-        interp, &pf->directory, PF_FIXUP_SEG, FIXUP_TABLE_SEGMENT_NAME, 1);
-    if (fixup_seg == NULL) {
-        Parrot_io_eprintf(interp,
-            "PBC Merge: Error creating fixup table segment.");
-        Parrot_exit(interp, 1);
-    }
-
-    /* Loop over input files. */
-    for (i = 0; i < num_inputs; ++i) {
-        /* Get the fixup segment from the input file. */
-        PackFile_FixupTable * const in_seg = inputs[i]->pf->cur_cs->fixups;
-        int j;
-
-        if (in_seg == NULL) {
-            Parrot_io_eprintf(interp,
-                "PBC Merge: Cannot locate fixup segment in %s",
-                inputs[i]->filename);
-            Parrot_exit(interp, 1);
-        }
-
-        /* Allocate space for these fixups, provided we have some. */
-        if (in_seg->fixup_count > 0) {
-            fixups = mem_gc_realloc_n_typed(interp, fixups,
-                    cursor + in_seg->fixup_count, PackFile_FixupEntry);
-        }
-
-        /* Loop over the fixups and copy them to the output PBC, correcting
-           the offsets into the bytecode. */
-        for (j = 0; j < in_seg->fixup_count; ++j) {
-            /* Get the entry and allocate space for copies. */
-            const PackFile_FixupEntry * const cur_entry = in_seg->fixups + j;
-            PackFile_FixupEntry * const copy =
-                mem_gc_allocate_typed(interp, PackFile_FixupEntry);
-            char * const name_copy = mem_gc_allocate_n_typed(interp,
-                    strlen(cur_entry->name) + 1, char);
-
-            /* Copy type and name. */
-            copy->type = cur_entry->type;
-            strcpy(name_copy, cur_entry->name);
-            copy->name = name_copy;
-
-            /* Set new offset and bytecode pointer. */
-            switch (copy->type) {
-                case enum_fixup_sub:
-                    copy->offset = cur_entry->offset + inputs[i]->pmc.const_start;
-                    break;
-                default:
-                    Parrot_io_eprintf(interp, "PBC Merge: Unknown fixup type");
-                    Parrot_exit(interp, 1);
-            }
-
-            /* Slot it into the list. */
-            fixups[cursor] = *copy;
-            ++cursor;
-        }
-    }
-
-    /* Stash merged fixup table and count. */
-    fixup_seg->fixups      = fixups;
-    fixup_seg->fixup_count = cursor;
-}
-
-
-/*
-
 =item C<static void pbc_merge_debugs(PARROT_INTERP, pbc_merge_input **inputs,
 int num_inputs, PackFile *pf, PackFile_ByteCode *bc)>
 
@@ -851,7 +752,6 @@
     ct = pbc_merge_constants(interp, inputs, num_inputs, merged, bc);
     UNUSED(ct);
 
-    pbc_merge_fixups(interp, inputs, num_inputs, merged);
     pbc_merge_debugs(interp, inputs, num_inputs, merged, bc);
 
     /* Walk bytecode and fix ops that reference the constants table. */

Modified: trunk/src/pmc/eval.pmc
==============================================================================
--- trunk/src/pmc/eval.pmc	Sat Sep 25 00:59:21 2010	(r49312)
+++ trunk/src/pmc/eval.pmc	Sat Sep 25 01:27:42 2010	(r49313)
@@ -25,28 +25,20 @@
 /* HEADERIZER BEGIN: static */
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
 
-static void clear_fixups(PARROT_INTERP,
-    ARGIN(const Parrot_Sub_attributes *sub_data))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
 PARROT_WARN_UNUSED_RESULT
 PARROT_CAN_RETURN_NULL
 static PMC* get_sub(PARROT_INTERP, ARGIN(PMC *self), int idx)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-static void mark_subs(PARROT_INTERP, ARGIN(PMC *self))
+static void mark_ct(PARROT_INTERP, ARGIN(PMC *self))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-#define ASSERT_ARGS_clear_fixups __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
-       PARROT_ASSERT_ARG(interp) \
-    , PARROT_ASSERT_ARG(sub_data))
 #define ASSERT_ARGS_get_sub __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_mark_subs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+#define ASSERT_ARGS_mark_ct __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
        PARROT_ASSERT_ARG(interp) \
     , PARROT_ASSERT_ARG(self))
 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
@@ -54,41 +46,6 @@
 
 /*
 
-=item C<static void clear_fixups(PARROT_INTERP, const Parrot_Sub_attributes
-*sub_data)>
-
-=cut
-
-*/
-
-static void
-clear_fixups(PARROT_INTERP, ARGIN(const Parrot_Sub_attributes *sub_data))
-{
-    ASSERT_ARGS(clear_fixups)
-
-    PackFile_ByteCode * const seg = sub_data->seg;
-
-    if (seg) {
-        PackFile_FixupTable * const ft = seg->fixups;
-        if (ft) {
-            PackFile_ConstTable * const ct = seg->const_table;
-            if (ct) {
-                INTVAL i;
-                for (i = 0; i < ft->fixup_count; ++i) {
-                    PackFile_FixupEntry * const e = ft->fixups + i;
-
-                    if (e->type == enum_fixup_sub) {
-                        opcode_t  ci          = e->offset;
-                        ct->pmc.constants[ci] = NULL;
-                    }
-                }
-            }
-        }
-    }
-}
-
-/*
-
 =item C<static PMC* get_sub(PARROT_INTERP, PMC *self, int idx)>
 
 =cut
@@ -109,21 +66,15 @@
     seg = sub->seg;
 
     if (seg) {
-        PackFile_FixupTable * const ft = seg->fixups;
-        if (ft) {
-            PackFile_ConstTable * const ct = seg->const_table;
-            if (ct) {
-                INTVAL i, n;
-                for (i = n = 0; i < ft->fixup_count; ++i) {
-                    const PackFile_FixupEntry * const e = ft->fixups + i;
-
-                    if (e->type == enum_fixup_sub) {
-                        opcode_t ci = e->offset;
-
-                        if (n++ == idx)
-                            return ct->pmc.constants[ci];
-                    }
-                }
+        PackFile_ConstTable * const ct = seg->const_table;
+        if (ct) {
+            INTVAL i, n;
+            for (i = n = 0; i < ct->pmc.const_count; ++i) {
+                STRING * const SUB = CONST_STRING(interp, "Sub");
+                PMC *x = ct->pmc.constants[i];
+                if (VTABLE_isa(interp, x, SUB))
+                    if (!idx--)
+                        return x;
             }
         }
     }
@@ -133,16 +84,16 @@
 
 /*
 
-=item C<static void mark_subs(PARROT_INTERP, PMC *self)>
+=item C<static void mark_ct(PARROT_INTERP, PMC *self)>
 
 =cut
 
 */
 
 static void
-mark_subs(PARROT_INTERP, ARGIN(PMC *self))
+mark_ct(PARROT_INTERP, ARGIN(PMC *self))
 {
-    ASSERT_ARGS(mark_subs)
+    ASSERT_ARGS(mark_ct)
 
     Parrot_Sub_attributes *sub;
     PackFile_ByteCode   *seg;
@@ -151,21 +102,12 @@
     seg = sub->seg;
 
     if (seg) {
-        PackFile_FixupTable * const ft = seg->fixups;
-        if (ft) {
-            PackFile_ConstTable * const ct = seg->const_table;
-            if (ct) {
-                INTVAL i;
-                for (i = 0; i < ft->fixup_count; ++i) {
-                    const PackFile_FixupEntry * const e = ft->fixups + i;
-
-                    if (e->type == enum_fixup_sub) {
-                        opcode_t  ci  = e->offset;
-                        PMC      *sub = ct->pmc.constants[ci];
-
-                        Parrot_gc_mark_PMC_alive(interp, sub);
-                    }
-                }
+        PackFile_ConstTable * const ct = seg->const_table;
+        if (ct) {
+            INTVAL i;
+            for (i = 0; i < ct->pmc.const_count; ++i) {
+                PMC *sub = ct->pmc.constants[i];
+                Parrot_gc_mark_PMC_alive(interp, sub);
             }
         }
     }
@@ -223,7 +165,6 @@
             return;
         }
 
-        clear_fixups(INTERP, sub_data);
         cur_cs = sub_data->seg;
 
         if (!cur_cs) {
@@ -250,12 +191,6 @@
             cur_cs->debugs = NULL;
         }
 
-        seg = (PackFile_Segment *)cur_cs->fixups;
-        if (seg) {
-            PackFile_Segment_destroy(INTERP, seg);
-            cur_cs->fixups = NULL;
-        }
-
         seg = (PackFile_Segment *)cur_cs;
         if (seg)
             PackFile_Segment_destroy(INTERP, seg);
@@ -267,7 +202,7 @@
 
     VTABLE void mark() {
         SUPER();
-        mark_subs(INTERP, SELF);
+        mark_ct(INTERP, SELF);
     }
 
 /*
@@ -301,10 +236,6 @@
             PackFile_add_segment(INTERP, &pf->directory,
                     (PackFile_Segment *)seg->debugs);
 
-        if (seg->fixups)
-            PackFile_add_segment(INTERP, &pf->directory,
-                    (PackFile_Segment *)seg->fixups);
-
         size = PackFile_pack_size(INTERP, pf) * sizeof (opcode_t);
 
         /*
@@ -425,13 +356,13 @@
         seg = sub->seg;
 
         if (seg) {
-            PackFile_FixupTable *const ft = seg->fixups;
-            if (ft) {
+            PackFile_ConstTable *const ct = seg->const_table;
+            if (ct) {
                 INTVAL i;
-                for (i = n = 0; i < ft->fixup_count; ++i) {
-                    const PackFile_FixupEntry * const e = ft->fixups + i;
-
-                    if (e->type == enum_fixup_sub)
+                STRING * const SUB = CONST_STRING(interp, "Sub");
+                for (i = n = 0; i < ct->pmc.const_count; ++i) {
+                    PMC *x = ct->pmc.constants[i];
+                    if (VTABLE_isa(interp, x, SUB))
                         ++n;
                 }
             }

Modified: trunk/src/pmc/packfiledirectory.pmc
==============================================================================
--- trunk/src/pmc/packfiledirectory.pmc	Sat Sep 25 00:59:21 2010	(r49312)
+++ trunk/src/pmc/packfiledirectory.pmc	Sat Sep 25 01:27:42 2010	(r49313)
@@ -97,9 +97,6 @@
               case PF_DIR_SEG:
                 pmc_type = enum_class_PackfileDirectory;
                 break;
-              case PF_FIXUP_SEG:
-                pmc_type = enum_class_PackfileFixupTable;
-                break;
               case PF_CONST_SEG:
                 pmc_type = enum_class_PackfileConstantTable;
                 break;

Deleted: trunk/src/pmc/packfilefixupentry.pmc
==============================================================================
--- trunk/src/pmc/packfilefixupentry.pmc	Sat Sep 25 01:27:42 2010	(r49312)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,224 +0,0 @@
-/*
-Copyright (C) 2001-2010, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/packfilefixupentry.pmc - PackfileFixupEntry PMC
-
-=head1 DESCRIPTION
-
-This class implements a PackfileFixupEntry object.  It is an element in the
-PackfileFixupTable segment of the .pbc file.  See PDD13 for a design spec.
-
-=head2 Methods
-
-=over 4
-
-=cut
-
-*/
-
-/* HEADERIZER HFILE: none */
-/* HEADERIZER BEGIN: static */
-/* HEADERIZER END: static */
-
-pmclass PackfileFixupEntry auto_attrs {
-    ATTR INTVAL     type;
-    ATTR STRING     *name;
-    ATTR INTVAL     offset;
-
-
-/*
-
-=item C<void init()>
-
-Initialize PackfileFixupEntry.
-
-=cut
-
-*/
-    VTABLE void init() {
-        Parrot_PackfileFixupEntry_attributes * attrs =
-                PMC_data_typed(SELF, Parrot_PackfileFixupEntry_attributes*);
-
-        attrs->name = CONST_STRING(INTERP, "");
-
-        PObj_custom_mark_SET(SELF);
-    }
-
-    VTABLE void init_pmc(PMC *init) {
-        Parrot_PackfileFixupEntry_attributes * attrs =
-                PMC_data_typed(SELF, Parrot_PackfileFixupEntry_attributes*);
-        STRING *name    = CONST_STRING_GEN(INTERP, "name");
-        STRING *type    = CONST_STRING_GEN(INTERP, "type");
-        STRING *offset  = CONST_STRING_GEN(INTERP, "offset");
-
-        attrs->name = VTABLE_get_string(INTERP,
-                        VTABLE_get_pmc_keyed_str(INTERP, init, name));
-        attrs->type = VTABLE_get_integer(INTERP,
-                        VTABLE_get_pmc_keyed_str(INTERP, init, type));
-        attrs->offset = VTABLE_get_integer(INTERP,
-                        VTABLE_get_pmc_keyed_str(INTERP, init, offset));
-
-        PObj_custom_mark_SET(SELF);
-    }
-
-/*
-
-=item C<void mark()>
-
-Marks the object as live.
-
-=cut
-
-*/
-
-    VTABLE void mark() {
-        Parrot_PackfileFixupEntry_attributes * const attrs =
-                PARROT_PACKFILEFIXUPENTRY(SELF);
-
-        Parrot_gc_mark_STRING_alive(INTERP, attrs->name);
-    }
-
-/*
-
-=item C<void set_pointer(void *pointer)>
-
-Initialize from PackFile_FixupEntry pointer.
-
-=cut
-
-*/
-
-    VTABLE void set_pointer(void * pointer) {
-        Parrot_PackfileFixupEntry_attributes * const attrs =
-                PARROT_PACKFILEFIXUPENTRY(SELF);
-        PackFile_FixupEntry *entry = (PackFile_FixupEntry*)pointer;
-
-        attrs->type     = entry->type;
-        attrs->name     = Parrot_str_new_init(INTERP, entry->name,
-                strlen(entry->name), Parrot_binary_encoding_ptr, 0);
-        attrs->offset   = entry->offset;
-    }
-
-/*
-
-=item C<void *get_pointer()>
-
-Create PackFile_FixupEntry* from self.
-
-=cut
-
-*/
-    VTABLE void *get_pointer() {
-        Parrot_PackfileFixupEntry_attributes * const attrs =
-                PARROT_PACKFILEFIXUPENTRY(SELF);
-        PackFile_FixupEntry                  * const entry =
-                mem_gc_allocate_zeroed_typed(INTERP, PackFile_FixupEntry);
-
-        entry->type     = attrs->type;
-        entry->name     = strdup(Parrot_str_cstring(INTERP, attrs->name));
-        entry->offset   = attrs->offset;
-        return entry;
-    }
-
-
-/*
-
-=item C<STRING *get_string()>
-
-Fetch the label field of the fixup entry.
-
-=cut
-
-*/
-    VTABLE STRING *get_string() {
-        return PARROT_PACKFILEFIXUPENTRY(SELF)->name;
-    }
-
-/*
-
-=item C<void set_string_native(STRING *value)>
-
-Set the label field of the fixup entry.
-
-=cut
-
-*/
-    VTABLE void set_string_native(STRING *value) {
-        SETATTR_PackfileFixupEntry_name(INTERP, SELF, value);
-    }
-
-
-/*
-
-=item C<INTVAL get_integer()>
-
-Fetch the offset field of the fixup entry.
-
-=cut
-
-*/
-    VTABLE INTVAL get_integer() {
-        return PARROT_PACKFILEFIXUPENTRY(SELF)->offset;
-    }
-
-
-/*
-
-=item C<void set_integer_native(INTVAL offset)>
-
-Set the offset field of the fixup entry.
-
-=cut
-
-*/
-    VTABLE void set_integer_native(INTVAL offset) {
-        SETATTR_PackfileFixupEntry_offset(INTERP, SELF, offset);
-    }
-
-
-/*
-
-=item C<INTVAL get_type()>
-
-Fetch the type field of the fixup entry.
-
-=cut
-
-*/
-    METHOD get_type() {
-        const INTVAL rv = PARROT_PACKFILEFIXUPENTRY(SELF)->type;
-        RETURN(INTVAL rv);
-    }
-
-
-/*
-
-=item C<void set_type(INTVAL type)>
-
-Set the type field of the fixup entry.
-
-=cut
-
-*/
-    METHOD set_type(INTVAL type) {
-        SETATTR_PackfileFixupEntry_type(INTERP, SELF, type);
-    }
-
-}
-/*
-
-=back
-
-=cut
-
-*/
-
-/*
- * Local variables:
- *   c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */

Deleted: trunk/src/pmc/packfilefixuptable.pmc
==============================================================================
--- trunk/src/pmc/packfilefixuptable.pmc	Sat Sep 25 01:27:42 2010	(r49312)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,210 +0,0 @@
-/*
-Copyright (C) 2001-2010, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/packfilefixuptable.pmc - PackfileFixupTable PMC
-
-=head1 DESCRIPTION
-
-This class implements a PackfileFixupTable object, a segment of the .pbc
-data file storing an array of PackfileFixupEntry PMCs.
-
-See packfile.pmc for the toplevel Packfile interface, see packfilesegment.pmc
-for the list of common methods every packfile segment pmc must implement; see
-PDD13 for the design spec.
-
-
-=head2 Methods
-
-=over 4
-
-=cut
-
-*/
-
-/* HEADERIZER HFILE: none */
-/* HEADERIZER BEGIN: static */
-/* HEADERIZER END: static */
-
-pmclass PackfileFixupTable auto_attrs extends PackfileSegment {
-    /* RPA of entries */
-    ATTR PMC *entries;
-
-/*
-
-=item C<init>
-
-Create empty PackfileFixupTable.
-
-=cut
-
-*/
-
-    VTABLE void init() {
-        Parrot_PackfileFixupTable_attributes * attrs =
-                PMC_data_typed(SELF, Parrot_PackfileFixupTable_attributes*);
-
-        attrs->entries = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
-
-        PObj_custom_mark_SET(SELF);
-    }
-
-/*
-
-=item C<void mark()>
-
-Marks the object as live.
-
-=cut
-
-*/
-
-    VTABLE void mark() {
-        Parrot_PackfileFixupTable_attributes * attrs =
-                PARROT_PACKFILEFIXUPTABLE(SELF);
-
-        Parrot_gc_mark_PMC_alive(INTERP, attrs->entries);
-
-        SUPER();
-    }
-
-/*
-
-=item C<void set_pointer(void *pointer)>
-
-Initialize from PackFile_FixupTable pointer.
-
-=cut
-
-*/
-
-    VTABLE void set_pointer(void * pointer) {
-        Parrot_PackfileFixupTable_attributes * attrs =
-                PARROT_PACKFILEFIXUPTABLE(SELF);
-        PackFile_FixupTable * table = (PackFile_FixupTable*)pointer;
-
-        PMC                 *entry;
-        PackFile_FixupEntry *val;
-        opcode_t             i;
-
-        VTABLE_set_integer_native(INTERP, attrs->entries, table->fixup_count);
-
-        for (i = 0; i < table->fixup_count; ++i) {
-            val = table->fixups + i;
-            entry = Parrot_pmc_new(INTERP, enum_class_PackfileFixupEntry);
-            VTABLE_set_pointer(INTERP, entry, (void*)val);
-            VTABLE_set_pmc_keyed_int(INTERP, attrs->entries, i, entry);
-        }
-    }
-
-/*
-
-=item C<void *get_pointer()>
-
-Create PackFile_FixupTable* from self.
-
-=cut
-
-*/
-    VTABLE void *get_pointer() {
-        Parrot_PackfileFixupTable_attributes * attrs =
-                PARROT_PACKFILEFIXUPTABLE(SELF);
-        PackFile_FixupTable * pftable =
-                mem_gc_allocate_zeroed_typed(INTERP, PackFile_FixupTable);
-        PMC                 * entry;
-        PackFile_FixupEntry * val;
-        opcode_t              i;
-
-        pftable->base.type   = PF_FIXUP_SEG;
-        pftable->fixup_count = VTABLE_elements(INTERP, attrs->entries);
-        pftable->fixups      = mem_gc_allocate_n_typed(INTERP,
-                pftable->fixup_count, PackFile_FixupEntry);
-
-        /* Copy all entries */
-        for (i = 0; i < pftable->fixup_count; ++i) {
-            entry = VTABLE_get_pmc_keyed_int(INTERP, attrs->entries, i);
-            val   = (PackFile_FixupEntry*)VTABLE_get_pointer(INTERP, entry);
-            pftable->fixups[i] = *val;
-            mem_gc_free(INTERP, val);
-        }
-
-        return pftable;
-    }
-
-
-/*
-
-=item C<INTVAL elements()>
-
-Get the number of elements in the array.
-
-=cut
-
-*/
-    VTABLE INTVAL elements() {
-        return VTABLE_elements(INTERP,
-                PARROT_PACKFILEFIXUPTABLE(SELF)->entries);
-    }
-
-
-/*
-
-=item C<PMC *get_pmc_keyed_int(INTVAL index)>
-
-Fetch the given PackfileFixupEntry PMC.
-
-=cut
-
-*/
-    VTABLE PMC *get_pmc_keyed_int(INTVAL index)  {
-        return VTABLE_get_pmc_keyed_int(INTERP,
-            PARROT_PACKFILEFIXUPTABLE(SELF)->entries, index);
-    }
-
-
-/*
-
-=item C<void set_pmc_keyed_int(INTVAL index, PMC *value)>
-
-Store a PackfileFixupEntry PMC to the given slot.
-
-=cut
-
-*/
-    VTABLE void set_pmc_keyed_int(INTVAL index, PMC *value)  {
-        VTABLE_set_pmc_keyed_int(INTERP,
-                PARROT_PACKFILEFIXUPTABLE(SELF)->entries, index, value);
-    }
-
-
-/*
-
-=item C<METHOD type()>
-
-Set segment type.
-
-=cut
-
-*/
-
-    METHOD type() {
-        RETURN(INTVAL PF_FIXUP_SEG);
-    }
-
-}
-/*
-
-=back
-
-=cut
-
-*/
-
-/*
- * Local variables:
- *   c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */

Modified: trunk/t/pmc/packfile.t
==============================================================================
--- trunk/t/pmc/packfile.t	Sat Sep 25 00:59:21 2010	(r49312)
+++ trunk/t/pmc/packfile.t	Sat Sep 25 01:27:42 2010	(r49313)
@@ -24,7 +24,7 @@
 .sub main :main
 .include 'test_more.pir'
 
-    plan(49)
+    plan(45)
     'test_new'()
     'test_set_string_native'()
     'test_get_string'()
@@ -354,15 +354,6 @@
     .local pmc pf, pfdir
     pf = new 'Packfile'
     pfdir = pf.'get_directory'()
-    #$P0 = new 'PackfileConstantTable'
-    #$P0[0] = 42.0
-    $P0 = new 'PackfileFixupTable'
-    $P1 = new 'PackfileFixupEntry'
-    $P1 = 42
-    $P1.'set_type'(1)
-    $P1 = "The fixup"
-    $P0[0] = $P1
-    pfdir["FIXUP_t/pmc/packfile.t"] = $P0
 
     $P1 = new 'PackfileRawSegment'
     pfdir["BYTECODE_t/pmc/packfile.t"] = $P1
@@ -400,17 +391,6 @@
     $I0 = pf['uuid_type']
     is($I0, 1, "uuid_type preserved")
 
-    # Check that FixupTable contains our Entry.
-    $P0 = _get_fixup_table(pf)
-    $I1 = elements $P0
-    is($I1, 1, "FixupTable contains one element")
-    $P1 = $P0[0]
-    isa_ok($P1, "PackfileFixupEntry")
-    $I0 = $P1
-    is($I0, 42, "FixupEntry offset preserved")
-    $S0 = $P1
-    is($S0, "The fixup", "FixupEntry name preserved")
-
     # Check unpacked ConstTable
     $P0 = _find_segment_by_type(pf, "PackfileConstantTable")
     $I0 = defined $P0

Modified: trunk/t/pmc/packfileannotations.t
==============================================================================
--- trunk/t/pmc/packfileannotations.t	Sat Sep 25 00:59:21 2010	(r49312)
+++ trunk/t/pmc/packfileannotations.t	Sat Sep 25 01:27:42 2010	(r49313)
@@ -66,10 +66,6 @@
     .local pmc pf, pfdir
     pf = new 'Packfile'
     pfdir = pf.'get_directory'()
-    #$P0 = new 'PackfileConstantTable'
-    #$P0[0] = 42.0
-    $P0 = new 'PackfileFixupTable'
-    pfdir["FIXUP_t/pmc/packfileannotations.t"] = $P0
 
     $P1 = new 'PackfileRawSegment'
     pfdir["BYTECODE_t/pmc/packfileannotations.t"] = $P1

Modified: trunk/t/pmc/packfiledirectory.t
==============================================================================
--- trunk/t/pmc/packfiledirectory.t	Sat Sep 25 00:59:21 2010	(r49312)
+++ trunk/t/pmc/packfiledirectory.t	Sat Sep 25 01:27:42 2010	(r49313)
@@ -22,7 +22,7 @@
 
 .sub 'main' :main
 .include 'test_more.pir'
-    plan(20)
+    plan(17)
 
     'test_create'()
     'test_typeof'()
@@ -69,7 +69,7 @@
     pop_eh
     pfdir = pf.'get_directory'()
     $I0   = elements pfdir
-    is($I0, 4, 'PackfileDirectory.elements')
+    is($I0, 3, 'PackfileDirectory.elements')
     .return()
 load_error:
     .get_results($P0)

Deleted: trunk/t/pmc/packfilefixupentry.t
==============================================================================
--- trunk/t/pmc/packfilefixupentry.t	Sat Sep 25 01:27:42 2010	(r49312)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,113 +0,0 @@
-#!./parrot
-# Copyright (C) 2009-2010, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/packfilefixupentry.t - test the PackfileFixupEntry PMC
-
-=head1 SYNOPSIS
-
-    % make test_prep
-    % prove t/pmc/packfilefixupentry.t
-
-=head1 DESCRIPTION
-
-Tests the PackfileFixupEntry PMC.
-
-=cut
-
-# Having some known data would be helpful, here.  For now, just make sure
-# the values returned seem sane.
-
-.include 't/pmc/testlib/packfile_common.pir'
-
-.sub 'main' :main
-.include 'test_more.pir'
-    plan(3)
-    test_sanity()
-    test_sanity_entry()
-    test_methods()
-.end
-
-
-
-# sanity check we start with a PackfileFixupTable
-.sub 'test_sanity'
-    .local pmc pf, pftable
-    .local string name
-    push_eh load_error
-    pf      = _pbc()
-    pop_eh
-    pftable = _get_fixup_table(pf)
-    isa_ok(pftable, 'PackfileFixupTable')
-    .return()
-load_error:
-    .get_results($P0)
-    pop_eh
-    report_load_error($P0, 'PackfileFixupTable')
-    .return()
-.end
-
-
-# sanity check we end up with a PackfileFixupTable
-.sub 'test_sanity_entry'
-    .local pmc pf, pftable, pfentry
-    .local string name
-    push_eh load_error
-    pf      = _pbc()
-    pop_eh
-    pftable = _get_fixup_table(pf)
-    pfentry = pftable[0]
-    isa_ok(pfentry, 'PackfileFixupEntry')
-    .return()
-load_error:
-    .get_results($P0)
-    pop_eh
-    report_load_error($P0, 'PackfileFixupEntry')
-    .return()
-.end
-
-
-# PackfileFixupEntry methods .get_string(), .get_integer(), .get_type()
-.sub 'test_methods'
-    .local pmc pf, pftable, pfentry
-    .local int size, this, data
-    .local string name, label
-    push_eh load_error
-    pf      = _pbc()
-    pop_eh
-    pftable = _get_fixup_table(pf)
-    size    = elements pftable
-    this    = 0
-  loop:
-    pfentry = pftable[this]
-    name    = typeof pfentry
-    eq name, "PackfileFixupEntry", next
-    $S0 = "PackfileFixupTable["
-    $S1 = this
-    $S0 = concat $S1
-    $S0 = concat "] returned an object of type: "
-    $S0 = concat name
-    ok(0, $S0)
-    .return ()
-  next:
-    this = this + 1
-    ge this, size, done
-    goto loop
-    gt size, 0, done
-  done:
-    ok(1, "Got entries")
-    .return()
-load_error:
-    .get_results($P0)
-    pop_eh
-    report_load_error($P0, "Got entries")
-    .return()
-.end
-
-# Local Variables:
-#   mode: pir
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:

Deleted: trunk/t/pmc/packfilefixuptable.t
==============================================================================
--- trunk/t/pmc/packfilefixuptable.t	Sat Sep 25 01:27:42 2010	(r49312)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,91 +0,0 @@
-#!./parrot
-# Copyright (C) 2009-2010, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/packfilefixuptable.t - test the PackfileFixupTable PMC
-
-
-=head1 SYNOPSIS
-
-    % make test_prep
-    % prove t/pmc/packfilefixuptable.t
-
-=head1 DESCRIPTION
-
-Tests the PackfileFixupTable PMC.
-
-=cut
-
-# Having some known data would be helpful, here.  For now, just make sure
-# the values returned have the right types.
-
-.include 't/pmc/testlib/packfile_common.pir'
-.sub 'main' :main
-.include 'test_more.pir'
-    plan(3)
-
-    test_unpack()
-.end
-
-
-# Report no ok for loading packfile failures
-.sub report_load_error
-    .param pmc except
-    .param string desc
-    .local string msg, aux
-    msg = concat desc, ' - error loading packfile: '
-    aux = except['message']
-    msg = concat msg, aux
-    ok(0, msg)
-.end
-
-
-# Check unpackging FixupTable
-.sub 'test_unpack'
-    .local pmc pf, pfdir, pftable, pfentry
-    .local int size, this, data
-    .local string name
-    push_eh load_error
-    pf      = _pbc()
-    pop_eh
-    pftable = _get_fixup_table(pf)
-    isa_ok(pftable, 'PackfileFixupTable')
-
-    size    = elements pftable
-    ok(size, "Got some elements")
-
-    this    = 0
-  loop:
-    pfentry = pftable[this]
-    name    = typeof pfentry
-    eq name, "PackfileFixupEntry", next
-    $S0 = "PackfileFixupTable["
-    $S1 = this
-    $S0 = concat $S1
-    $S0 = concat "] returned an object of type: "
-    $S0 = concat name
-    ok(0, $S0)
-    .return ()
-  next:
-    this = this + 1
-    ge this, size, done
-    goto loop
-    gt size, 0, done
-  done:
-    ok(1, "All elements of Table are Entries")
-    .return()
-load_error:
-    .get_results($P0)
-    pop_eh
-    report_load_error($P0, "All elements of Table are Entries")
-    skip(2, "All elements of Table are Entries")
-    .return()
-.end
-
-# Local Variables:
-#   mode: pir
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:

Modified: trunk/t/pmc/packfilerawsegment.t
==============================================================================
--- trunk/t/pmc/packfilerawsegment.t	Sat Sep 25 00:59:21 2010	(r49312)
+++ trunk/t/pmc/packfilerawsegment.t	Sat Sep 25 01:27:42 2010	(r49313)
@@ -114,7 +114,7 @@
 
   done:
     $I0 = elements hash
-    is($I0, 4, "Got all types of Packfile segments")
+    is($I0, 3, "Got all types of Packfile segments")
 
     # Now create RawSegment and set type.
     $P0 = new ['PackfileRawSegment']

Modified: trunk/t/pmc/testlib/packfile_common.pir
==============================================================================
--- trunk/t/pmc/testlib/packfile_common.pir	Sat Sep 25 00:59:21 2010	(r49312)
+++ trunk/t/pmc/testlib/packfile_common.pir	Sat Sep 25 01:27:42 2010	(r49313)
@@ -64,13 +64,6 @@
     .return ()
 .end
 
-.sub '_get_fixup_table'
-    .param pmc pf
-
-    .tailcall '_find_segment_by_type'(pf, "PackfileFixupTable")
-.end
-
-
 # Report no ok for loading packfile failures
 .sub report_load_error
     .param pmc except


More information about the parrot-commits mailing list