The variable layout of interpreter->code (actually the packfile) doesn't
fit very good for multiple code segments. There is only one ->byte_code
pointer, the byte_code_size is in bytes and converted zig times into
opcode_t's and so on.
so:
1) rename interpreter->code to interpreter->pf (the packfile)
The packfile owns all PBC segments: byte_code, const_table and so on.
These segments are all organized in the directory segment. Eval'ing code
generates a new code segment and appends constants to the const_table,
so far so good: But how to load a precompiled PBC module whith its own
const_table (with constants numbered from 0 and spread all over the
code). So:
2) we need multiple constant_tables too.
As one or more code segments may refer to these constants, they
constant_table must be linked to these code segments.
3) one PBC file has exactly one const_table (or none if no constants are
used) and may have multiple code segments
For switching code segments (with the intersegment jump instruction), we
setup this new pointer:
4) interpreter->code ... points to current executing byte_code seg
interpreter->code->const_table ... to current code segs constant
Comments welcome,
leo
- Re: [RFC] multiple code segments and the interpreter Leopold Toetsch
- Re: [RFC] multiple code segments and the interpreter Nicholas Clark
- Re: [RFC] multiple code segments and the interpre... Leopold Toetsch
- Re: [RFC] multiple code segments and the inte... Nicholas Clark
- Re: [RFC] multiple code segments and the ... Leopold Toetsch