[LLVMdev] How will OrcJIT guarantee thread-safety when a function is asked to be re generated?

Sanjoy Das
Thu, 19 Mar 2015 17:55:32 -0000

> That all makes sense. What are your thoughts on the trade-offs of this vs
> the patchpoint approach though? If you can modify previously executable
> memory it seems like the patchpoint approach would have lower overhead,
> unless you have a truly huge number of callsites to update?

You need the hijack-return-pc approach *in addition* to a call-site
patching approach.  Modifying the return PC lets you guarantee that
nothing will *return* into the old generated code. To guarantee that
nothing will *call* into it either you could use a double indirection
(all calls go through a trampoline) or patchpoints.

-- Sanjoy