public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Do not inline buffered_vfprintf
@ 2003-11-30 19:15 Andreas Jaeger
  2003-11-30 19:33 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Jaeger @ 2003-11-30 19:15 UTC (permalink / raw)
  To: GNU libc hacker

[-- Attachment #1: Type: text/plain, Size: 1646 bytes --]


With the new inliner in GCC (tested with the hammer-branch), GCC
inlines buffered_vfprintf into vfprintf and the stack size of that
function increases since buffered_vfprintf puts CHAR_T buf[_IO_BUFSIZ]
on the stack which is 8192 bytes.


This leads - on at least i686 and x86_64 - to test failures in those
tests where we have a user-supplied stack: stdlib/tst-setcontext.c
(user stack is exactly 8192 bytes), linuxthreads/tst-context.c (user
stack is exactly 8192 bytes) and nptl/tst-context1.c.

I think the best solution is to not inline the function at all.  The
appended patch does this and now all tests pass with the new inliner.

Ok to commit?

Andreas

2003-11-30  Andreas Jaeger  <aj@suse.de>

	* stdio-common/vfprintf.c: Do not inline buffered_vfprintf to
	decrease stack usage.

============================================================
Index: stdio-common/vfprintf.c
--- stdio-common/vfprintf.c	6 Sep 2003 07:50:03 -0000	1.123
+++ stdio-common/vfprintf.c	30 Nov 2003 17:51:26 -0000
@@ -209,7 +209,7 @@ static const CHAR_T null[] = L_("(null)"
 
 /* Helper function to provide temporary buffering for unbuffered streams.  */
 static int buffered_vfprintf __P ((FILE *stream, const CHAR_T *fmt, va_list))
-     internal_function;
+     __attribute__ ((noinline)) internal_function;
 
 /* Handle unknown format specifier.  */
 static int printf_unknown __P ((FILE *, const struct printf_info *,

-- 
 Andreas Jaeger, aj@suse.de, http://www.suse.de/~aj
  SuSE Linux AG, Deutschherrnstr. 15-19, 90429 Nürnberg, Germany
   GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126

[-- Attachment #2: Type: application/pgp-signature, Size: 188 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Do not inline buffered_vfprintf
  2003-11-30 19:15 Do not inline buffered_vfprintf Andreas Jaeger
@ 2003-11-30 19:33 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2003-11-30 19:33 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: GNU libc hacker

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andreas Jaeger wrote:

> I think the best solution is to not inline the function at all.  The
> appended patch does this and now all tests pass with the new inliner.

The function certainly is meant to not be inlined.  OK.

- -- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/ykGI2ijCOnn/RHQRAjVMAJ9vfe+Rz6iqfYgvjWJzjyPjKZ3+jQCeMmsy
YB9GFMfxod4MxnzN/nel0WA=
=DEQt
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-11-30 19:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-30 19:15 Do not inline buffered_vfprintf Andreas Jaeger
2003-11-30 19:33 ` Ulrich Drepper

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).