Crash when patching hot methods in case of mutual recursion
kpp opened this issue · 2 comments
kpp commented
Assume we have got 2 functions:
A calls B
B calls A
When we patch methods we remove machine code for old functions.
Patching A -> A2 (still calls to old B)
Patching B -> B2 (calls A2, but machine code for B is freed)
Code to reproduce the bug:
Jit do: [ nil benchmark4 ]
Jit patchHotMethods
Jit patchHotMethods
Jit do: [ nil benchmark4 ]
0x7CFE commented
Correct solution would be to traverse the functions in the reverse order of topological sort. This will also help in writing Smalltalk-aware method inliner which would gain a huge performance speedup.
In case of LLVM we should inherit the CallGraphSCCPass.
kpp commented
It seems it was fixed in llvm 3.3+