Inlining native code in Cog

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Inlining native code in Cog

Igor Stasenko
Hello, Eliot.

I just started exploring the Cog, and here's my first idea:
- with NativeBoost, i can actually generate the native code, which can
be inlined into other methods.

So, then, whenever Cog sees, that primitive is NativeBoost primitive
and it going to invoke
a native code, then its possible to inline this method into outer
method by copying a native code into
generated method's code.

I remember you mentioned that primitive invocation in Cog is rather
ineffective , because
you have to do some deoptimizations before entering a primitive.


I wonder if its possible to do such things.
The problem, what i see is that NativeBoost's native code works as a
primitive (its using interpreterProxy
and its functions, and generated code honoring all VM/primitive
conventions), so if primitive fails, it should
enter the method's bytecode.
This maybe a major barrier, which could make a native code inlining
highly problematic.

What you think about it?

--
Best regards,
Igor Stasenko AKA sig.