public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Földy Lajos" <foldy@rmki.kfki.hu>
To: remko.troncon@cs.kuleuven.ac.be
Cc: gcc@gcc.gnu.org
Subject: Re: Slowdowns in code generated by GCC>=3.3
Date: Wed, 20 Oct 2004 17:26:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.58.0410201758020.32184@bifur.rmki.kfki.hu> (raw)

> Hi,
> 
> I am a developer of a bytecode emulator for the Prolog language. With 
> the release of GCC-3.3, our emulator was slowed down by a factor of 3 on 
> x86 with -O3 turned on (we didn't measure other platforms; the 
> optimization flag doesn't seem to matter). We were hoping this was a 
> temporary issue, but the situation didn't improve in any of the newer 
> releases :( I don't know whether i should file this as a bug report, so 
> i first ask for advice her.
>
> I'll try to explain on a high level what happens. If this isn't 
> sufficient, i can try to give some code, but this will take me some time
> to isolate the code. This is the situation:
> - Since the program counter in our emulator is very crucial, we use the 
>   'register' and 'asm ("bx")' hints.
> - For each instruction in the bytecode, we store the address of the 
>   label of the code which has to be executed for the instruction. 
>   Therefore, the program counter always contains points to an address of
>   code to be executed, and after each instruction we do a 
>         goto  **(void **)program_counter
> Previous versions of GCC keep the program counter in ebx, and do a 
> jmp *(%ebx) after the instructions (as expected). The newer GCCs seem
> to unnecessarily move the program counter around between registers, and
> don't do the jmp*(%ebx) after each instruction, but seem to jump to a
> 'common' piece of code doing this jump.
>
> Looking at the changelog of gcc-3.3, i can only deduce this has to do 
> with the new DFA scheduler, but of course i can not tell for sure.
>
> I don't know if any of this information is useful, but we could use some 
> pointers in places to look where things are going wrong in the code 
> generation. The factor 3 of slowdown is really a lot.
>
> Does anyone have any ideas ?
>
> thanks a lot,
> Remko


Hi,

not portable, but on i386 you can try using the good old inline assembly: 

	void* pc;
	...
	pc=&&lab;
	__asm__("jmp *%0" : : "a" (pc));
	...
	lab:

best regards,
lajos foldy

             reply	other threads:[~2004-10-20 16:20 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-20 17:26 Földy Lajos [this message]
2004-10-20 18:09 ` Zack Weinberg
2004-10-20 18:41   ` Földy Lajos
2004-10-20 19:00     ` Zack Weinberg
2004-10-20 19:05       ` Daniel Berlin
2004-10-20 20:14       ` Földy Lajos
2004-10-20 20:21         ` Zack Weinberg
2004-10-20 21:22         ` Peter Barada
2004-10-20 22:45           ` Zack Weinberg
2004-10-20 23:21         ` Giovanni Bajo
2004-10-20 23:26           ` Andrew Pinski
2004-10-20 23:27             ` Giovanni Bajo
2004-10-20 23:29               ` Remko Troncon
2004-10-20 23:29                 ` Scott Robert Ladd
2004-10-21  7:34                 ` Joe Buck
2004-10-27 17:29                 ` Giovanni Bajo
2004-10-27 17:49                   ` Steven Bosscher
2004-10-27 18:04                     ` Giovanni Bajo
  -- strict thread matches above, loose matches on Subject: below --
2004-10-20 13:38 Remko Troncon
2004-10-20 13:52 ` Steven Bosscher
2004-10-20 14:03   ` Remko Troncon
2004-10-20 14:21     ` Richard Guenther
2004-10-20 14:52       ` Steven Bosscher
2004-10-20 15:40       ` Remko Troncon
2004-10-20 16:21         ` Richard Guenther
2004-10-20 16:29         ` Steven Bosscher
2004-10-20 14:30 ` Ranjit Mathew
2004-10-21 11:10 ` Mike Stump
2004-10-24  8:03   ` Remko Troncon
2004-10-26 20:26     ` Mike Stump
2004-10-26 22:27       ` Steven Bosscher
2004-10-26 22:44         ` Pablo Mejia
2004-10-26 22:47           ` Steven Bosscher

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=Pine.LNX.4.58.0410201758020.32184@bifur.rmki.kfki.hu \
    --to=foldy@rmki.kfki.hu \
    --cc=gcc@gcc.gnu.org \
    --cc=remko.troncon@cs.kuleuven.ac.be \
    /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).