[EMAIL PROTECTED]:
# > Well, on thinking a bit about this, there's no reason that 
# we have to 
# > worry--it's perfectly OK for us to declare, unconditionally, that 
# > segment 0 is always bytecode, 1 line number info, and so on, with 
# > everything after position X (for some value of X) left up 
# in the air. 
# > A bit dodgy, true, as it means that any new known segment 
# types we add 
# > in will be floating, but I don't think we're going to end 
# up with too 
# > many performance-critical pieces in the bytecode. (Arguably 
# it's just 
# > the bytecode itself, the symbols, and the constants, as the 
# rest are 
# > looked at under exceptional circumstances or on (rare) demand)
# 
# *No*
# 
# This really kills extendability, or makes it at least very 
# ugly. It needs to prealloc a certain number of segments. Each 
# of this has a fixed semantic. Extending means consuming on of 
# the preallocated fields, or using some segment beyond the 
# preallocated area but then it needs a type field. In fact the 
# preallocated segments also have a
# type-field: the position in the packfile.

How about this structure:

        HEADER
        SEGMENT 0
                CHUNK 0 (DIRECTORY)
                        SIZE:
                        DATA:
                                CHUNK 0 ENTRY
                                        TYPE: DIRECTORY (type 0)
                                        OFFSET:
                                CHUNK 1 ENTRY
                                        TYPE: e.g. BYTECODE (type 3)
                                        OFFSET:
                                CHUNK 2 ENTRY
                                        TYPE: e.g. CONSTTABLE (type 1)
                                        OFFSET:
                                CHUNK 3 ENTRY
                                        TYPE: e.g. FIXUP (type 2)
                                        OFFSET:
                                CHUNK 4 ENTRY
                                        TYPE: e.g. LINETABLE (type 4)
                                        OFFSET:
                CHUNK 1
                        SIZE: 
                        DATA:
                CHUNK 2
                        SIZE:
                        DATA:
                CHUNK 3
                        SIZE:
                        DATA:
                CHUNK 4
                        SIZE:
                        DATA:
        SEGMENT 1
        SEGMENT 2
        SEGMENT 3
        SEGMENT 4

Each chunk just holds its size and its data--the type is stored in the
directory.  Chunk 0 is the only chunk with fixed meaning--it's always
the directory.  There should only be one chunk per segment of the given
type.  We'll reserve some of the types--say, up to 127 to be safe--and
let any outside tools use chunk numbers above that.

--Brent Dax <[EMAIL PROTECTED]>
@roles=map {"Parrot $_"} qw(embedding regexen Configure)

Wire telegraph is a kind of a very, very long cat. You pull his tail in
New York and his head is meowing in Los Angeles. And radio operates
exactly the same way. The only difference is that there is no cat.
    --Albert Einstein (explaining radio)

Reply via email to