Jürgen Bömmels (via RT) wrote:

# 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 >

Applied with some modifications and extension.
Thanks again,
leo

PS orig description again:


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.

Reply via email to