Tail-Call style for interp.c#1999
Conversation
|
I'm not entirely happy with how the signature of the op functions is Here's a compiler explorer snippet where I tried to just YOLO it and just take the address of these variables on the stack inside the first frame that tail-calls, and asan immediately complains about accessing the data after the stack frame it's from has disappeared (I was hoping tail-call here means the arguments live on the stack and the frames are "compatible" in that way). |
|
For me on MacOS on Apple silicon, this is not an improvement YET: Building rakudo before: after: |
5d28616 to
48aebe7
Compare
|
It feels a little better than before, but still doesn't beat the old way just yet: And the spectest feels a lot slower as well: which is in the old way: |
|
These are in Kubuntu Asahi on my MacBook Air M2, while plugged in. With GCC 15.2.0. branch (gcc): With Clang 20.1.8. branch (clang): |
|
But wow, it's cool seeing the interpreter functions in perf! |
so that we can have interp.c as musttail and program.c as Computed Goto
6e1c5a6 to
0c56bf5
Compare
90fc7e2 to
0c56bf5
Compare
The suggestion to give moarvm an interpreter in tail-call style with the
musttailattribute (going to be calledreturn gotoin a future standard of C) which was a very nice performance boost for some interpreters out there. @MasterDuke17 pointed it out already in april of 2021 (see refs below)This is the first stab at allowing interp.c to be compiled into that kind of interpreter, without changing a huge amount of the code inside it.
Refs: