|
From: Jeremy F. <je...@go...> - 2002-11-17 07:16:24
|
On Sat, 2002-11-16 at 15:25, Josef Weidendorfer wrote:
> On Saturday 16 November 2002 19:17, Jeremy Fitzhardinge wrote:
> > On Sat, 2002-11-16 at 04:09, Julian Seward wrote:
> > ...
> > > When an unchained translation wants to make a jump to a known
> > > (orig)address, it pushes the orig-address it wants to call, and *calls*
> > > "patch_me" which is a short piece of assembly code. This pops the args
> > > (orig-addr) and also pops the return address -- which points just after
> > > the call insn on the original translation. patch_me can arrange to find
> > > the translation and patch the caller to jump directly to it.
>
> Just an idea: Why not simply use indirect jumps and patching the jump address,
> same as the symbol resolving with calls to shared lib functions is doing?
> The jump address would be initialised to "patch_me" and later to the
> translated code (by patch_me).
> You wouldn't need chained/unchained versions or patching generated code, and
> whenever discarding a translation, set the according jump address back to
> "patch_me".
> Seems way easier for me in a first step.
So you mean have a structure per basic block, which contains as one of
its elements the entrypoint for its generated code, or if there is no
generated code, the entrypoint of "patch_me"? This is OK, but it would
be nice not to have an indirect jump in the generated code, since this
makes branch prediction much harder. A nice absolute unconditional jump
makes things easiest on the CPU.
J
|