qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Profiling Qemu for speed?


From: Nathaniel G H
Subject: Re: [Qemu-devel] Profiling Qemu for speed?
Date: Sun, 17 Apr 2005 18:36:15 -0700 (PDT)

On 17 Apr 2005, at 12:27, Paul Brook wrote:
> Unfortunately it's not that simple. The push instruction may
> cause an exception. Whatever optimizations you apply you've
> got to make sure that the guest state is still consistent when
> the exception occurs.

I brought this up because I want to speed up the case of x86 code on
the PPC. The biggest trouble with optimizing the code generated by Qemu
is that the two architectures are as different as they are complex.

I was up until 3:00am studying Qemu, and I came to the conclusion that
it doesn't make sense to try speeding up the output code, at least not
yet. A peephole optimizer or hand-coded sequences made to handle common
combinations of instructions would lead to the problems discussed here:
exceptions happening at the right time, self-modifying code, etc.
Worse, the translator might have to spend so much time doing this that
the result would actually be slower execution.

I have another idea: The next-best thing to making faster output is to
make the same output, faster. In other words, speeding up the
translator. Given that the bulk of the translator is in disas_insn()
and all the gen_* functions it calls, this seems like a good place to
begin.

Does anybody know how GCC generates a "switch" statement? disas_insn()
and friends contain dozens of switch statements containing hundreds and
hundreds of cases. I'm not familiar with GCC internals, but I do know
that compilers I've used in the past actually produce the equivalent of
"if.. else if.. else if" code for switch statements. Some compilers
produce table-lookups, but only under certain circumstances, like when
there aren't too many cases and the numbers being tested fit in one
byte. I couldn't find this information on GCC, and unfortunately the
code is so complicated that my initial look through it hasn't told me
much.

Unless someone can show me that GCC produces table-lookups for the
switches in disas_insn(), there's a good opportunity for increased
speed by doing this manually. Do you agree with this assessment?

Please let me know if I'm on the right track. :-)

Kind regards,
Nathaniel G H


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]