From: Fabrice Bellard <fabrice.bellard@free.fr>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: [PATCH] Updated Sparc support
Date: Wed, 14 May 2003 13:48:32 +0200 [thread overview]
Message-ID: <3EC22D10.5050506@free.fr> (raw)
In-Reply-To: 20030514014546.3FA722C090@lists.samba.org
Rusty Russell wrote:
> In message <3EC0E59A.5070907@free.fr> you write:
>
>>I also plan to add direct block chaining. I will try to make it portable
>>by using the 'goto *' gcc extension, but I don't know yet if it will
>>work on every CPU. The direct block chaining will generate something like:
>>
>> 'goto *addr'
>>
>>at the end of some translated blocks to jump either to the CPU core or
>>directly to the next translated block. 'addr' will be a global 'void *'
>>variable. Since no code will be patched to change block chaining, it
>>will simplify the instruction cache invalidation issues and the
>>threading issues.
>
>
> Hmm, I had a more ambitious idea, and that was to keep simple stats on
> which block last followed each block: if it goes to the same block
> more than N times in a row, coalesce/chain them.
>
> As blocks get longer, you have more opportunities for register
> lifetime analsis, which could eliminate redundant stores to registers
> in particular.
>
> I haven't got actual code, so I haven't mentioned it before...
>
> Thoughts?
It could be interesting to avoid some condition codes computations.
Currently it is not possible to do more because qemu has no generic IR
and I think I won't have the time to add one. Julian Seward (of the
valgrind project) is thinking about adding a more generic IR in valgrind
to allow cross debugging, so it might be interesting for valgrind.
BUT, I have a much simpler approach "a la FX!32" which has the advantage
of being very simple and which needs very little modification in qemu:
You can launch your executable a first time to record statistics. Then
you launch a special tool 'qemuopt' which statically generates a dynamic
library with gcc containing the host cpu code of the most used basic
block chains.
'qemuopt' is very easy to do : I discovered that by noting that gcc
optimizes very well 'static inline' local functions. So you just have to
generate a C source containing approximately:
void genfunc(CPUX86State *env)
{
uint32_t T0, EAX, EBX, ...;
EAX = env->regs[R_EAX];
EBX = env->regs[R_EBX];
#define OPPROTO 'static inline'
#include "op-i386.c"
op_movl_T0_EAX();
op_movl_EBX_T0();
env->regs[R_EAX] = EAX;
env->regs[R_EBX] = EBX;
}
Then gcc does all the hard work for us :-)
Fabrice.
next prev parent reply other threads:[~2003-05-14 11:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-13 4:13 [Qemu-devel] [PATCH] Updated Sparc support David S. Miller
2003-05-13 12:31 ` [Qemu-devel] " Fabrice Bellard
2003-05-13 19:49 ` David S. Miller
2003-05-14 0:13 ` Rusty Russell
2003-05-14 11:48 ` Fabrice Bellard [this message]
2003-05-16 13:54 ` [Qemu-devel] Regression tests - syscall note Fabrice Bellard
2003-05-15 13:03 ` [Qemu-devel] [PATCH] Updated Sparc support Johan Rydberg
2003-05-15 20:05 ` David S. Miller
2003-05-15 20:17 ` Johan Rydberg
2003-05-15 20:24 ` David S. Miller
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=3EC22D10.5050506@free.fr \
--to=fabrice.bellard@free.fr \
--cc=qemu-devel@nongnu.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 NNTP newsgroup(s).