Andreas Färber wrote:
Corresponding code is:
#ifndef FCOMPILER /* instead of pointing to an explicit 0 variable we
- point behind the pointer.
*/ static ucell t[] = { DOCOL, 0, (ucell)(t+3), 0 }; static ucell *trampoline = t; #endif
The warning goes away if I cast to (unsigned long) first, but the initialization error remains. In powerpc-elf-gcc 4.4+ this didn't surface. Suggestions how to fix?
Andreas
Right. So this code is to ensure that any arbitrarily executed Forth is always executed as part of a word (i.e. execution will always return to the previous point).
In order to do this, the trampoline is a synthetic word used to setup a Forth word like this:
DOCOL <xt of code/word> <xt of ;>
which is roughly equivalent to:
: trampoline <name of word> ;
Now the xt of ; is unknown until runtime due to dictionary relocation, but in fact ; is just a CFA of 0. Since an xt is a pointer to a Forth word, then <xt of ;> is done sneakily by pointing to an address containing 0 which is the CFA of semis().
Note there is a less sneaky version of this in the code already - see init_trampoline() in bootstrap.c.
HTH,
Mark.