0x7CFE / llst

LLVM powered Little Smalltalk.
Other
93 stars 10 forks source link

Crash when patching hot methods in case of mutual recursion #48

Closed kpp closed 9 years ago

kpp commented 10 years ago

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 10 years ago

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 9 years ago

It seems it was fixed in llvm 3.3+