Attached patches change how dragonegg lowers trampolines (for
compatibility with Go).
0001-Fix-the-trampolines-for-Go.patch (4.99 KB)
Attached patches change how dragonegg lowers trampolines (for
compatibility with Go).
0001-Fix-the-trampolines-for-Go.patch (4.99 KB)
Hi Sanjoy,
Attached patches change how dragonegg lowers trampolines (for
compatibility with Go).
I think the right approach is to add an llvm.adjust.trampoline intrinsic
to LLVM (and change llvm.init.trampoline to not return a result). Then the
dragonegg trampoline code will become trivial, and the Go problem will just
Go away In fact this was how I first did it: two intrinsics, just like in
GCC (probably the commits are still in the repository history). Chris asked me
to combine them into one if possible, and I did but I now think that that was a
mistake because they don't go naturally together: the call to adjust_trampoline
can occur far away from the call to init.trampoline (eg: in a different
function). As you can see in the dragonegg code, by doing evil tricks you can
overcome this difference between the intrinsics, but as you also discovered it
is fragile and broke the moment Go generalized the use of trampolines.
Ciao, Duncan.
Hi!
I think the right approach is to add an llvm.adjust.trampoline intrinsic
to LLVM (and change llvm.init.trampoline to not return a result). Then the
Won't that break previous code that relies on the current
llvm.init.trampoline? I can start work on this if that is not a problem.
Hi Sanjoy,
I think the right approach is to add an llvm.adjust.trampoline intrinsic
to LLVM (and change llvm.init.trampoline to not return a result). Then theWon't that break previous code that relies on the current
llvm.init.trampoline? I can start work on this if that is not a problem.
the usual way of handling this kind of thing is using auto-upgrade
(see llvm/AutoUpgrade.h). When the old llvm.init.trampoline intrinsic is
seen, it can be replaced by a call to the new llvm.init.trampoline intrinsic
followed by a call to llvm.adjust.trampoline. So while, yes, this is an
issue that needs to be dealt with, it should be easily taken care of thanks
to the auto-upgrade infrastructure.
Thanks for working on this!
Ciao, Duncan.