On Mon, Mar 14, 2011 at 12:33 PM, Stefan Hajnoczi <stefa...@gmail.com> wrote: > On Mon, Mar 14, 2011 at 10:23 AM, Peter Maydell > <peter.mayd...@linaro.org> wrote: >> On 21 February 2011 08:10, Paolo Bonzini <pbonz...@redhat.com> wrote: >>> On 02/20/2011 06:32 PM, Peter Maydell wrote: >>>> Some of qemu's code does seem to trigger rather excessive memory >>>> use by gcc; for instance we've had problems with memory usage >>>> building for ARM with gcc of target-sparc/translate.c wanting >>>> gigabytes of RAM with some compiler flags: >>>> https://bugs.launchpad.net/gcc-linaro/+bug/714921 >>>> >>>> I suspect it's all those large switch statements... >>> >>> It's on my todo list to report it to GCC, since this memory-hog behavior is >>> a GCC regression. >> >> We've been working on this in Linaro, and the following two patches >> have been posted upstream: >> >> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00193.html >> http://gcc.gnu.org/ml/gcc-patches/2011-03/msg00255.html >> >> so you can probably cross that item off your todo list :-) > > Interesting. Alexander Graf and I recently hit an out of memory when > building translate.o on ppc64 host. It was solved by adding more RAM > to the box but this patch looks nice too ;).
Maybe the switch blocks should be rearranged, or inline attribute removed from the functions. Are the nested switch and if statements optimal from performance point of view or could there be a faster and less memory hungry version?