Jason Gloudon wrote:

On Sun, Feb 02, 2003 at 12:46:50AM +0100, Leopold Toetsch wrote:


#define IREG(i) interpreter->ctx.int_reg.registers[code_start[offs+i]]

Where does the value of code_start coming from ?

As stated in my first mail in this thread, code_start could be a auto variable in the function doing the run loop, e.g. for the CGoto case.


code_start in an opcode function is not a constant, so the above is really:

interpreter->ctx.int_reg.registers[interpreter->code->base.data[offs+i]]
Yes, this would be the term for runops_{slow,fast}_core.

Intersegment jumps may not work readily for all runloops, but I don't believe
that requires as big a change as you're suggesting.
When looking at above longish IREG(i), then it seems, that my suggestion is really suboptimal for runops_{slow,fast}_core. I still think, it's the right thing for all other run loops.

I wrote this proposal, after reading the c source for the native compiled eval.pasm:

switch_label:
switch(cur_opcode - start_code) {
case 0: PC_0: {
[...]
dest = (opcode_t *)p->vtable->invoke(interpreter, p, &&PC_11);
cur_opcode = dest;
goto switch_label;
}
}
case 11: PC_11: {

The address passed to the invoke funtion is a local label in the run loop. This can't work for coroutines, evals and so on.

leo

Reply via email to