public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tfrancuz at mp dot pl" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/43745] [avr] g++ puts VTABLES in SRAM
Date: Wed, 14 Apr 2010 20:40:00 -0000	[thread overview]
Message-ID: <20100414203955.16135.qmail@sourceware.org> (raw)
In-Reply-To: <bug-43745-19028@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from tfrancuz at mp dot pl  2010-04-14 20:39 -------
(In reply to comment #1)
> What is your suggestion?

Because VTABLES are generated during compile time and they are const data there
is no need to copy them into SRAM. Appropriate addresses of virtual methods can
be read directly from FLASH and used to make indirect call as usual. As far as
I know the problem is that AVR port of gcc doesn&#8217;t have appropriate isns
to do that. The problem is extremely important because for example my program
uses 964 bytes of SRAM, from which 860 bytes are used for VTABLES (wasted).
This is a typical situation for any C++ program on AVR.
The only problem is speed penalty, LD instruction on AVR takes 1 cycle, whereas
LPM instruction needed for FLASH access 3 cycles, which gives total 2 or 6
cycles to read virtual method address respectively. So probably the best
solution is to add another gcc option (or pragma) to choose between storing
VTABLES only in FLASH (slower code execution) or moving it to SRAM (faster
execution for the cost of higher SRAM memory occupation).


-- 

tfrancuz at mp dot pl changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tfrancuz at mp dot pl


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43745


  parent reply	other threads:[~2010-04-14 20:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-13  8:15 [Bug c++/43745] New: " tfrancuz at mp dot pl
2010-04-14 19:53 ` [Bug target/43745] [avr] " eric dot weddington at atmel dot com
2010-04-14 20:40 ` tfrancuz at mp dot pl [this message]
     [not found] <bug-43745-4@http.gcc.gnu.org/bugzilla/>
2011-02-06 19:38 ` Kicer86 at gmail dot com
2011-11-21 16:18 ` gjl at gcc dot gnu.org
2011-11-24 22:14 ` tfrancuz at mp dot pl
2012-01-07 12:21 ` gjl at gcc dot gnu.org
2012-11-29 11:58 ` RiccardoManfrin at email dot it
2013-04-26 11:54 ` d.come at isae dot fr

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=20100414203955.16135.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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 read-only IMAP folder(s) and NNTP newsgroup(s).