Leopold Toetsch wrote:

I'm currently simplifying the whole packfile routines. It still does read the old format, but the compat code is centralized now in one place.

Registered types are consecutively numbered, unknown types still get unpacked or dumped:

typedef enum {
PF_DIR_SEG,
PF_UNKNOWN_SEG,
PF_FIXUP_SEG,
PF_CONST_SEG,
PF_BYTEC_SEG,
PF_DEBUG_SEG,

PF_MAX_SEG
} pack_file_flags;

Here is a sample dump of a packfile with file/line info generated by
$ imcc -d -o eval.pbc eval.pasm
$ pdump eval.pbc
DIRECTORY => { # 3 segments
type 3 name CONSTANT offs 0x1c length 35
type 4 name BYTECODE offs 0x40 length 14
type 5 name BYTECODE_DB offs 0x4f length 17
}
CONST => [
### snipped (as old) ###
],

BYTECODE => [ # 14 ops at ofs 0x40
0041: 00000349 00000001 00000003 00000057 00000001 00000002 00000347
0048: 00000000 00000001 00000000 00000345 0000001a 00000001 00000000
]
BYTECODE_DB => [ # 17 ops at ofs 0x4f
0050: 6c617665 7361702e 0000006d 00000001 00000002 00000003 00000004 00000005
0058: 00000006 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0060: 00000000
]

(the line array is currently too big (per opcode not per ins ;-))


Anyway, packing/unpacking and dumping above packfile data is working now.

Does anybody want to have a look at the patch?
Should I check in - or send it to the list?

$ diffstat packf.diff
TODO | 5
debug.c | 2
include/parrot/packfile.h | 129 +++---
languages/imcc/TestCompiler.pm | 6
languages/imcc/imclexer.c | 2
languages/imcc/main.c | 2
languages/imcc/pbc.c | 6
languages/imcc/t/harness | 15
languages/imcc/t/syn/eval.t | 61 ++
packdump.c | 4
packfile.c | 848 ++++++++++++++++++++++-------------------
packout.c | 156 +++----
pdump.c | 23 -
13 files changed, 715 insertions(+), 544 deletions(-)

leo


Reply via email to