C extension helpful for JITs #367
Replies: 2 comments
-
Here the code in foo() is essentially "inline" code - but moved to a common location. |
Beta Was this translation helpful? Give feedback.
-
I think it is possible if all variables referenced inside
If there are many such variables, it will constrain the register allocator too much which might result in worse code generation or even impossibility to generate code. If the variable leaves through some call, it should be bound to caller-saved hard register. Also |
Beta Was this translation helpful? Give feedback.
-
Hi @vnmakarov
I see that there is one test that uses the jcall/jret - but it is not clear to me whether it can be used the following way.
When I generate JITed code in C, there are often repeated chunks of code - but this is inserted linearly in the code.
What would be nice is the ability to move these chunks to common chunks - and be able to jump to them and back within the context of the current function.
That is suppose we could define:
Here foo() is just a reusable piece of code, and is not a function in its own right. In particular - it can access vars in the enclosing function.
When we call foo() - all we are doing is ensuring that the common code snippet is in one place, rather than duplicated inline as it would have been.
I don't know if I explained this well, or if this is even possible to do.
Regards
Beta Was this translation helpful? Give feedback.
All reactions