This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: empty-string refcount contention
- From: Ulrich Drepper <drepper at redhat dot com>
- To: Nathan Myers <ncm-nospam at cantrip dot org>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Wed, 02 Apr 2003 13:41:36 -0800
- Subject: Re: empty-string refcount contention
- Organization: Red Hat, Inc.
- References: <20030328223847.GD16816@tofu.dreamhost.com> <200303290021.h2T0Ld05089665@latour.rsch.comm.mot.com> <20030331110628.71962cbf.bkoz@redhat.com> <20030331195256.GF16816@tofu.dreamhost.com> <20030331163135.411029b0.bkoz@redhat.com> <20030402182808.GM16816@tofu.dreamhost.com> <3E8B30E9.7090708@redhat.com> <20030402192648.GN16816@tofu.dreamhost.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Nathan Myers wrote:
> If it's not exported, then (since this is a static member of a class
> template) would there be a separate copy instantiated in each shared
> library that mentions it?
Yep.
> Inlined comparisons in other DSOs (and in
> the main program) would refer to the local copy, then, and fail, since
> strings are always constructed in libstdc++.so.
Yes.
> I believe that in the current implementation, the refcount _is_
> exported (and is always touched). What really happens when its address
> is computed?
Read the DSO paper. The whole name lookup process is used when the
empty string object is used in a DSO (i.e., it's done once per DSO).
And then determining the address requires an actual memory access. The
address value, determined by the name lookup, has to be loaded from the GOT.
> Might the cost of getting that global address far exceed
> any advantage from inlining operations on it, regardless of whether we
> try to optimize away touching it?
I cannot answer this. The cost for any non-local access is
non-neglectable. And one more: if on platforms like x86 you end up with
copy relocations you will never again be able to change the size of the
object (well, maybe the size can be decreased but this is also a grey area).
- --
- --------------. ,-. 444 Castro Street
Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA
Red Hat `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+i1kQ2ijCOnn/RHQRAmr4AJ44ghRPcu8fX7n8y4KZoif7hnJEBACgkd7R
XeaVelt2JgPQVNEEhv01r0k=
=/5Yk
-----END PGP SIGNATURE-----