public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: Qiantan Hong <qhong@mit.edu>, "jit@gcc.gnu.org" <jit@gcc.gnu.org>
Subject: Re: Spaghetti stack?
Date: Sat, 31 Oct 2020 13:33:45 -0400	[thread overview]
Message-ID: <b9d5526ac4eb0c4e4509e2c7ef93ef1177533019.camel@redhat.com> (raw)
In-Reply-To: <4C3839D5-645F-49FD-9A3B-27754F8F938A@mit.edu>

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


  reply	other threads:[~2020-10-31 17:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-31  5:58 Qiantan Hong
2020-10-31 17:33 ` David Malcolm [this message]
2020-10-31 17:45   ` Basile Starynkevitch
2020-10-31 19:52     ` Qiantan Hong
2020-11-01 12:52       ` David Malcolm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b9d5526ac4eb0c4e4509e2c7ef93ef1177533019.camel@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=jit@gcc.gnu.org \
    --cc=qhong@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).