public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dibyendu Majumdar <mobile@majumdar.org.uk>
To: jit@gcc.gnu.org, David Malcolm <dmalcolm@redhat.com>
Subject: First bytecode compiled in Ravi/Lua
Date: Thu, 01 Jan 2015 00:00:00 -0000	[thread overview]
Message-ID: <CACXZuxeDajmtKfkSToqsSfua+wSJhDvkACUVFW99oxODT7XY_A@mail.gmail.com> (raw)

I am pleased to report that I can JIT compile the following minimal
Lua function:

x=function() return; end

I faced following problems that I had to work around:

1. libgccjit fails when there are unreachable blocks - I had to patch
libgccjit to disable this validation. As explained in my previous post
this is a show stopper issue.

2. I had to make the compiled function exported - I didn't think this
should be necessary given that the function is JIT compiled, but I
suspect it is the result of the JITed function being part of a
temporary shared library?

------------

The compiled output looks like this:

extern int
ravif1 (struct ravi_lua_State * L)
{
  struct ravi_TValue * base;
  struct ravi_LClosure * cl;

entry:
  cl = (struct ravi_LClosure *)L->ci->func->value_.gc;
  base = L->ci->u.l.base;
  base = L->ci->u.l.base;
  L->top = &base[(int)0];
  if (cl->p->sizep > (int)0) goto <UNNAMED BLOCK 0x10109f0>; else goto
<UNNAMED BLOCK 0x100bee0>;

<UNNAMED BLOCK 0x10109f0>:
  (void)luaF_close (L, base);
  goto <UNNAMED BLOCK 0x100bee0>;

<UNNAMED BLOCK 0x100bee0>:
  (void)luaD_poscall (L, &base[(int)0]);
  return (int)1;

<UNNAMED BLOCK 0x100bb20>:
  base = L->ci->u.l.base;
  L->top = &base[(int)0];
  if (cl->p->sizep > (int)0) goto <UNNAMED BLOCK 0x100edc0>; else goto
<UNNAMED BLOCK 0x100ef20>;

<UNNAMED BLOCK 0x100edc0>:
  (void)luaF_close (L, base);
  goto <UNNAMED BLOCK 0x100ef20>;

<UNNAMED BLOCK 0x100ef20>:
  (void)luaD_poscall (L, &base[(int)0]);
  return (int)1;
}

             reply	other threads:[~2015-06-14 22:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-01  0:00 Dibyendu Majumdar [this message]
2015-01-01  0:00 ` David Malcolm
  -- strict thread matches above, loose matches on Subject: below --
2015-01-01  0:00 Dibyendu Majumdar
2015-01-01  0:00 ` Dibyendu Majumdar

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=CACXZuxeDajmtKfkSToqsSfua+wSJhDvkACUVFW99oxODT7XY_A@mail.gmail.com \
    --to=mobile@majumdar.org.uk \
    --cc=dmalcolm@redhat.com \
    --cc=jit@gcc.gnu.org \
    /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).