[LLVMdev] JIT machine code deletion
ralph at inputplus.co.uk
Sun May 14 02:00:26 PDT 2006
> On Fri, 12 May 2006, Ralph Corderoy wrote:
> > recompileAndRelinkFunction() overwrites the old machine code with a
> > branch to the new. Is it always guaranteed that there's space to
> > write the new branch instructions?
> > A quick look suggests the x86 takes five bytes, PowerPC 16,
> PPC should be 4 bytes in the normal case. It is up to the backend to
> implement this API correctly... if it doesn't, that's a bug: please
> report it!
No, EmitBranchToAt() always emits 16 bytes.
AtI = BUILD_LIS(12, Addr >> 16); // lis r12, hi16(address)
AtI = BUILD_ORI(12, 12, Addr); // ori r12, r12, low16(address)
AtI = BUILD_MTCTR(12); // mtctr r12
AtI = BUILD_BCTR(isCall); // bctr/bctrl
but I understand now how startFunctionStub() is given StubSize and on
PowerPC it's 16 so there's no problem.
More information about the llvm-dev