[niemeyer@conectiva.com: Re: [Python-Dev] Python's footprint]
Gustavo Niemeyer
niemeyer@conectiva.com
Fri, 11 Jan 2002 12:21:05 -0200
--E39vaYmALEf/7YXx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Hi Martin!
> > Now that 2.2 is history (well, kind of ;-), would it be the time to
> > think about this again?
>=20
> By "consideration early in 2.3's life cycle", the OP probably meant
> that a patch should be posted to SF. Are you willing to implement the
> complete change (i.e. create a patch that changes each and every
> source file)? If so, please post one to SF. You may want to start this
> slowly, first creating only the infrastructure and touching a single
> file (say, stringobject.c)
Yes, I'm going to implement it. I'd just like to know if there was
interest in the patch. Implementing it slowly looks like a nice idea
as well. I'll post a patch there. Thanks!
> I'd personally like to see opportunities for more magic used. E.g. in
> a compiler that uses sections, putting all doc strings into a single
> section might be desirable. They will be a contiguous fragment of the
> python executable, which helps on demand-paged systems to reduce the
> startup time. Going further, it might be possible to strip off "unused
> sections" from the binary after it has been linked, deferring the
> choice of doc string presence to the installation time.
Interesting.
I know it's possible to discard a session. OTOH, I don't know what happens
if somebody refer to discarded data. I'll have a look at this.
> For that to work, we'd first need to know what compilers offer what
> syntax to implement such magic, then generalize it to the right macro.
> If that is a desirable goal, I'd be willing to investigate how to
> achieve things with gcc, on ELF systems.
This is something pretty easy with gcc. When reading your email, I
remembered that the kernel uses this magic to discard a session with
code used just when initializing. Looking in the kernel code, I found
out this in include/linux/init.h:
/*
* Mark functions and data as being only used at initialization
* or exit time.
*/
#define __init __attribute__ ((__section__ (".text.init")))
#define __exit __attribute__ ((unused, __section__(".text.exit")))
#define __initdata __attribute__ ((__section__ (".data.init")))
#define __exitdata __attribute__ ((unused, __section__ (".data.exit")))
#define __initsetup __attribute__ ((unused,__section__ (".setup.init")))
#define __init_call __attribute__ ((unused,__section__ (".initcall.init")))
#define __exit_call __attribute__ ((unused,__section__ (".exitcall.exit")))
After surrounding doc strings with a macro, this will be easy to achieve.
Thanks!
--=20
Gustavo Niemeyer
[ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ]
--E39vaYmALEf/7YXx
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE8PvTQIlOymmZkOgwRAh/yAJ0c5tWHiOhhr0tk6tmic8Zi1JmsigCePNIZ
7LNVHje7zOlwEfAZ9rYkbw4=
=hI95
-----END PGP SIGNATURE-----
--E39vaYmALEf/7YXx--