Spaghetti stack?
David Malcolm
dmalcolm@redhat.com
Sat Oct 31 17:33:45 GMT 2020
On Sat, 2020-10-31 at 05:58 +0000, Qiantan Hong wrote:
> Hi,
>
> I’m trying to find a way to implement/hack
> a runtime using spaghetti stack with libgccjit,
I have to confess that I wasn't familiar with the term "spaghetti
stack".
> I think I need to tell libgccjit to use a different
> calling convention, either implemented by
> myself, or somehow let it use the “bare”
> calling convention and generate prologue/
> epilogue myself. However, I didn’t find
> any API about calling convention — neither
> do I have any idea how to express the
> prologue/epilogue with libgccjit because they’re
> at register level.
>
> Any idea?
That sounds lower level that the approach libgccjit takes; libgccjit's
API tends to mimic what's expressible by the C frontend.
I don't think libgccjit currently exposes a way to set the calling
convention, but IIRC the C frontend does.
Does an existing GCC frontend exposes a way of implementing any of
this? If so, it can probably be exposed by libgccjit, otherwise we'd
have to add support to GCC for it, which makes it much harder.
Another approach would be to do it "by hand", by implementing the
calling convention by injecting calls to dynamically allocate the
frame, populate it, and then make a call with the parameters suitably
modified - if that makes sense.
Hope this is helpful
Dave
More information about the Jit
mailing list