2 ms·
If it's writing code into memory, and you're going to compile it and rewrite the jump when it's done, isn't the part where the current code is writing in W mode
by microcolonel 10y ago
If it's writing code into memory, and you're going to compile it and rewrite the jump when it's done, isn't the part where the current code is writing in W mode already?
The process would be:
1. compile the code when you fault on the basic block exit.
2. mark that basic block executable.
3. Optionally only after return or other jump: mark the jumping basic block as writable, patch the jump, then mark it as executable.
In this case, there would be three changes, JS JITs are doing this a lot more often than Dolphin is. They often have more than one level of JIT in addition to an interpreter; so they will end up doing this dance more than once per basic block.
Until I see at least some microbenchmarks and concrete estimates, I don't think I'll worry too much about this. Though it is unfortunate to have to modify all of this code.