All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jim C. Brown" <jbrown106@phreaker.net>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] get_func() hangs with gcc 3.4.2 on MinGW and WinXP host
Date: Sat, 18 Dec 2004 10:50:37 -0500	[thread overview]
Message-ID: <20041218155037.GA32132@jbrown.mylinuxbox.org> (raw)
In-Reply-To: <20041217195627.A38776@saturn.kn-bremen.de>

On Sat, Dec 18, 2004 at 03:59:38PM +0100, Johannes Schindelin wrote:
> Hi,
> 
> On Fri, 17 Dec 2004, Jim C. Brown wrote:
> 
> > On Sat, Dec 18, 2004 at 01:09:26AM +0100, Johannes Schindelin wrote:
> > > Hi,
> > >
> > > it would be better to fix
> > > the compilation of op.c, so that you really can chain the op_* functions.
> > > What I mean: if you work on it, you could as well do it such that you gain
> > > the most (performance) of it.
> > >
> > > Ciao,
> > > Dscho
> > >
> >
> > >From what I understand, this is outright impossible with later versions of
> > gcc. In order to do what you want, you would have to write the code purely
> > in assembler.
> 
> What do new gcc's do? Why is it impossible to chain the code?

Originally, the op_* functions for qemu were written so that they would have the
machine code and then the rets at the very end of the function. qemu could
then just chain them together by stripping the rets.

gcc now rearranges the generated code around, and reserves the right to stick in
extra rets any place it wants, not just the very end, which makes them very hard
to strip off. I asked another developer about the difficulty of doing this, and
was told that it would be easier to write a C compiler just for op.c from
scratch.

> Do you have
> an example object file, or even better, an assembly snippet?

Afraid not.

> 
> Ciao,
> Dscho
> 

On Fri, Dec 17, 2004 at 07:56:27PM +0100, Juergen Lock wrote:
> On Thu, Dec 16, 2004 at 01:37:53AM +0000, Johannes Schindelin wrote:
> > Hi,
> > 
> > On Wed, 15 Dec 2004, Jim C. Brown wrote:
> > 
> > > This is due to a change in the way gcc compiles code ... 3.4.0 may work,
> > > but later versions will cause functions to return prematurely (due to the way
> > > qemu handles translated blocks). I suggested that a fix for this would be to
> > > use function pointer calls instead of directly chaining machine code, but
> > > apparently this is too slow to make qemu usable.
> > 
> > The Forth way ;-)
> >...
> 
> How about instead post-processing the .s, replacing the rets with jumps
> to the end of the function?  Of course this part would be architecture
> dependant (different assembler syntax), but other parts of qemu
> are that as well, right?

This may be possible. I don't know if the change applies to gcc only, in which
case this is the best solution, or if it applies to gas as well, in which case
this would solve nothing.

Well, even if gas was changed, we could probably get around that by using a
newer gcc with an older gas as the backend ...

> 
>  Just a thought...
> 	Juergen
> 
> 

-- 
Infinite complexity begets infinite beauty.
Infinite precision begets infinite perfection.

  reply	other threads:[~2004-12-18 16:01 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-15 13:47 [Qemu-devel] get_func() hangs with gcc 3.4.2 on MinGW and WinXP host tomba
2004-12-15 14:18 ` Johannes Schindelin
2004-12-15 14:59   ` tomba
2004-12-15 23:45     ` Jim C. Brown
2004-12-15 23:52       ` Johannes Schindelin
2004-12-17 18:56         ` Juergen Lock
2004-12-18  0:09           ` Johannes Schindelin
2004-12-18  4:04             ` Jim C. Brown
2004-12-18 14:59               ` Johannes Schindelin
2004-12-18 15:50                 ` Jim C. Brown [this message]
2004-12-19 14:25                   ` Johannes Schindelin
2004-12-19 22:57                     ` Jim C. Brown
2004-12-18 21:07                 ` John R. Hogerhuis
2004-12-18 21:59                   ` Jim C. Brown
2004-12-19 14:45                   ` Johannes Schindelin
2004-12-20  6:26                     ` John R. Hogerhuis
2004-12-20 15:16                       ` Removing GCC dependency, was " Johannes Schindelin
2004-12-20 18:02                         ` John R. Hogerhuis
2004-12-20 23:30                           ` Fabrice Bellard
2004-12-21 14:36                             ` [Qemu-devel] Testing with Win2k SP3 and Win2kSP4 Elefterios Stamatogiannakis
2004-12-21 15:23                             ` [Qemu-devel] Re: Removing GCC dependency Paul Brook
2004-12-21 15:36                               ` Herbert Poetzl
2004-12-19 22:13           ` [Qemu-devel] get_func() hangs with gcc 3.4.2 on MinGW and WinXP host Fabrice Bellard
2004-12-19 22:29             ` Johannes Schindelin
2004-12-20  3:31               ` Rob Browning
2004-12-20 18:57                 ` John R. Hogerhuis
2005-01-17 14:16                   ` CMinusMins, was " Johannes Schindelin
2005-01-17 15:36                     ` malc
2005-01-17 15:53                       ` Jim C. Brown
2005-01-17 16:13                         ` OCAML, was " Mark A. Williamson

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=20041218155037.GA32132@jbrown.mylinuxbox.org \
    --to=jbrown106@phreaker.net \
    --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 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.