develooper Front page | perl.perl6.internals | Postings from October 2002

[perl #18056] [PATCH] Extending the Packfile (Part 1.)

Thread Next
From:
Jürgen" "Bömmels
Date:
October 22, 2002 12:01
Subject:
[perl #18056] [PATCH] Extending the Packfile (Part 1.)
Message ID:
rt-18056-40325.18.6738506097295@bugs6.perl.org
# New Ticket Created by  Jürgen Bömmels 
# Please include the string:  [perl #18056]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=18056 >


This patch is the beginning of an effort to make PackFile format
extendible. At the moment its combatible with the old bytecode
format.

Ok, to the details:
It appends a 4th segment behind the 3 already defined segments (FIXUP,
CONSTANT and BYTECODE) name DIRECTORY. After this directory one ore
more uniquely named segments may follow. 

The directory segments start with the number of segments in the
PackFile, followed by a list of directory items. Each item constists
of a '\0' terminated c-string (padded to opcode_t-alignment), a
flag-word, the size of the corresponding segment and the position of
the segment in the packfile. The 4 first segments are nothing special,
expect that their name and order is fixed.

The implementation uses a glib style inheritance aproach. The
base-"class" of all Segments is struct PackFile_Segment which consists
of data-members for name, packfile, fileoffset, size and flags and
furter the member-functions destroy, packed_size, and pack. The
derived "classes" struct PackFile_Directory, PackFile_ConstTable
PackFile_FixupTable and PackFile_ByteCode (the later two are ATM just
dummy implementations) embed a PackFile_Segment as first elment so the
base-class can be get by a pointer cast.

Next steps might be:
- seperate the packfile.c in diffrent files (maybe move them to a
  directory/subsystem on its own as suggest by PDD07) one for each
  segment-type.
- document the extension in parrotbyte.pod
- lower the restriction on the ordering of the first 4 segments
- write an objdump-like tool for manipulating packfiles. (I tried to
  extend pdump for that, but it segfaults in unmake_COW, a
  NULL-interpreter from PIO_eprintf)
- Teach the assembler to output the new format. (imcc uses AFAIK
  packout.c and should already work)

bye
b.


-- attachment  1 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/40325/32605/06f52f/packfile.diff


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About