Dan Sugalski wrote:

At 8:27 PM +0000 1/14/03, Leopold Toetsch (via RT) wrote:

- how should a byte code segment (PMC) look like?

Ah, the big question. I'm not quite sure yet--let's try and work that out while I'm churning over objects.
I have it ready.
It's based on the packfile patch #18056 by Juergen Boemmels. On top of this patch, it was quite easy to implement multiple code segments.

A code segment is this:

struct PackFile_ByteCode {
struct PackFile_Segment base; /* name, byte_count ... */
opcode_t * code;
void **prederef_code; /* The predereferenced code */
void *jit_info; /* JITs data */
struct PackFile_ByteCode * prev; /* was executed previous */
};

And there are some additional functions to deal with code segments:

struct PackFile_ByteCode * Parrot_new_eval_cs(struct Parrot_Interp *);
struct PackFile_ByteCode * Parrot_switch_to_cs(struct Parrot_Interp *,
struct PackFile_ByteCode *);
/* pop and destroy cs */
void Parrot_pop_cs(struct Parrot_Interp *);

The eval code segs are named EVAL_{$n}.

Further changes:
- a PackFile_Constant is now a union, which saves a lot of space in mem.
- eval (invoke) can run with *all* run cores, including trace
- reading packfiles is ready for multiple code segments in bytecode.
- code is ready for debug information, I'll first do it in imcc, which could generate file/line info on the fly. Next would then be to extend the PBC format.


diffstat of patch:

classes/compiler.pmc | 24 -
classes/eval.pmc | 16
debug.c | 35 +-
include/parrot/debug.h | 2
include/parrot/exceptions.h | 1
include/parrot/interpreter.h | 2
include/parrot/packfile.h | 104 ++++++
interpreter.c | 6
jit.c | 2
jit/i386/jit_emit.h | 6
languages/imcc/parser_util.c | 24 -
languages/imcc/pbc.c | 10
lib/Parrot/OpTrans/C.pm | 6
lib/Parrot/OpTrans/CGoto.pm | 6
lib/Parrot/OpTrans/Compiled.pm | 6
ops2c.pl | 3
packdump.c | 12
packfile.c | 688 ++<snip..>+++++++++++++++---
packout.c | 106 ++----
trace.c | 9
20 files changed, 891 insertions(+), 177 deletions(-)

A lot of files are touched because of the PackFile_Constant change.

Does anyone want to have a look at the patch, or should I put it in?

leo



Reply via email to