All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stuart Brady <sdb@zubnet.me.uk>
To: Stefan Weil <sw@weilnetz.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 5/8] tcg: Add interpreter for bytecode
Date: Sun, 16 Oct 2011 22:54:04 +0100	[thread overview]
Message-ID: <20111016215403.GA18648@zubnet.me.uk> (raw)
In-Reply-To: <20110919202446.GA19005@zubnet.me.uk>

On Mon, Sep 19, 2011 at 09:24:47PM +0100, Stuart Brady wrote:
> On Sat, Sep 17, 2011 at 10:00:31PM +0200, Stefan Weil wrote:
> 
[...]
> > +            u64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0),
> > +                                        tci_read_reg(TCG_REG_R1),
> > +                                        tci_read_reg(TCG_REG_R2),
> > +                                        tci_read_reg(TCG_REG_R3));
> > +            tci_write_reg(TCG_REG_R0, u64);
> > +#endif
> > +            break;
[...]

> Unfortunately, this won't work on all architectures.

[...]

Stefan, have you had a chance to consider this, yet?

I think it would be nice to do this in a way that:

 * allows enabling TCI at runtime.

 * doesn't rely on a huge switch table or wrapper for every conceivable
   type of function.

   For example, if helpers have three argument types, i32, i64 and ptr
   and up to four arguments, together with return types of void, i32,
   i64 and ptr, we might have something like:
  
        4 * (3^4 + 3^2 + 3^1 + 3^0)
     == 376 wrapper functions (or cases).

   Most of these wouldn't be used for any given target.  This gets worse
   if we add a few extra arguments and types.  With up to six arguments,
   and an extra type, there'd be 26985 cases / wrappers. :-(

So, I wonder if it would be best to place this in the target and generate
a wrapper for each helper function.  When using TCI, we'd generate a call
to this wrapper function instead of the helper function.  No extra space
in the ops buffer would be required, since the wrapper function would
call the helper function directly, rather than taking it as a parameter.

This could be compiled out on those architectures for which the current
approach is okay.

If we wanted to allow enabling TCI at runtime, then we'd need to choose
between the wrapper functions and helper functions at translation time,
either in gen_helper_* or when generating the TCI bytecode by way of a
somewhat vile switch() statement...

Should I try to put something together?

Cheers,
-- 
Stuart

  reply	other threads:[~2011-10-16 21:54 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-17 19:59 [Qemu-devel] [PATCH 0/8] tcg/interpreter: Add TCG + interpreter for bytecode (virtual machine) Stefan Weil
2011-09-17 20:00 ` [Qemu-devel] [PATCH 1/8] tcg: Declare TCG_TARGET_REG_BITS in tcg.h Stefan Weil
2011-09-17 20:00 ` [Qemu-devel] [PATCH 2/8] tcg: Don't declare TCG_TARGET_REG_BITS in tcg-target.h Stefan Weil
2011-09-17 20:00 ` [Qemu-devel] [PATCH 3/8] tcg: Add forward declarations for local functions Stefan Weil
2011-09-17 21:40   ` Peter Maydell
2011-09-17 20:00 ` [Qemu-devel] [PATCH 4/8] tcg: Add some assertions Stefan Weil
2011-09-17 20:00 ` [Qemu-devel] [PATCH 5/8] tcg: Add interpreter for bytecode Stefan Weil
2011-09-18  4:03   ` Andi Kleen
2011-09-18  5:49     ` Stefan Weil
2011-09-18  7:22       ` Paolo Bonzini
2011-09-18 17:54         ` Avi Kivity
2011-09-19  6:52           ` Andi Kleen
2011-09-19 11:56             ` Avi Kivity
2011-09-19 14:48               ` Andi Kleen
2011-09-18 10:18   ` Blue Swirl
2011-09-19 16:43   ` Richard Henderson
2011-09-19 20:24   ` Stuart Brady
2011-10-16 21:54     ` Stuart Brady [this message]
2011-09-17 20:00 ` [Qemu-devel] [PATCH 6/8] tcg: Add bytecode generator for tcg interpreter Stefan Weil
2011-09-18 10:03   ` Blue Swirl
2011-09-19 22:28     ` Stuart Brady
2011-10-01 16:54   ` Andreas Färber
2011-10-01 21:25     ` Stefan Weil
2011-10-09 16:19       ` Andreas Färber
2011-09-17 20:00 ` [Qemu-devel] [PATCH 7/8] tcg: Add tcg interpreter to configure / make Stefan Weil
2011-09-18  9:37   ` Blue Swirl
2011-09-18 10:14     ` Stefan Weil
2011-09-17 20:00 ` [Qemu-devel] [PATCH 8/8] ppc: Support tcg interpreter on ppc hosts Stefan Weil
2011-09-17 21:31   ` Peter Maydell
2011-09-17 21:33     ` Stefan Weil
2011-09-18 10:26 ` [Qemu-devel] [PATCH 0/8] tcg/interpreter: Add TCG + interpreter for bytecode (virtual machine) Blue Swirl
2011-09-18 10:49   ` malc
2011-09-18 12:12     ` Blue Swirl
2011-09-18 12:46       ` malc
2011-09-18 13:00         ` Blue Swirl
2011-09-18 13:13           ` malc
2011-09-18 13:26             ` Blue Swirl
2011-09-25 20:37           ` Stefan Weil
2011-10-01 12:02             ` Blue Swirl
2011-09-18 15:02 ` Mulyadi Santosa
2011-09-18 15:13   ` Stefan Weil
2011-09-18 16:39     ` Mulyadi Santosa
2011-09-18 20:15       ` Stefan Weil
2011-09-19 15:14         ` Mulyadi Santosa
2011-09-19  8:40     ` David Gilbert
2011-09-19 10:20       ` Stefan Hajnoczi
2011-09-19 10:27         ` David Gilbert
2011-09-18 18:02 ` Avi Kivity

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=20111016215403.GA18648@zubnet.me.uk \
    --to=sdb@zubnet.me.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.