On Thursday, May 10, 2012 at 3:25 PM, Mike Pall wrote: > Joshua Ballanco wrote: > > > > would a workaround like the one used by > > imp_implementationWithBlock work? More details here: > > http://landonf.bikemonkey.org/code/objc/imp_implementationWithBlock.20110413.html > > > > > This only works for trampolines with fixed code, where you can > remap the trampoline code pages and attach it to different data. > But you can't generated arbitrary code, which is what a JIT > compiler really needs to do. > > Thanks for the great explanation! So, curiosity has gotten the better of me… I realize this is completely impractical for LuaJIT, but would it be possible (in theory) to combine something like the trampolines from imp_implementationWithBlock with Return-oriented Programming (possibly with the benefit of a pre-built page containing common code sequences) to achieve something like a JIT compiler? More importantly, if the answer is yes: why on earth would anyone think that locking down memory pages is a good idea?