I've been thinking alot about the bytecode file format lately.  Its
going to get really gross really fast when we start adding other
(optional) sections to the code.

So, with that in mind, here's what I propose:

* All data sizes are in longwords (4 bytes) because that's just the way
things are :)

* The file is composed of a header (which is really just a magic 
cookie) , a series of data chunks, and a directory (of sorts)


Offset  Length  Description
0       1       Magic Cookie (0x013155a1)
1       n       Data
n+1     m       Directory Table
m+n+1   1       Offset of beginning of directory table (i.e. n+1)

The directory is after the data so offsets can be determined as the data
is written.  The directory offset is at the very end, so it can be
determined before the directory is written, and easily found by loaders.


Each Directory Entry consists of 3 longs:

Offset  Length  Description
0       1       ID/Type of chunk
1       1       Size of chunk
2       1       Offset from beginning of file


Chunk types we've seen so far are: Bytecode, Fixup, String Table. Just
guessing, but we'll probably need things likes symbol tables, source
chunks, notes, etc.

What do you guys think? 

Brian

Reply via email to