Closed GoogleCodeExporter closed 9 years ago
The preamble-patcher uses a disassembler to figure out how to patch. This
disassembler is restricted to x86 right now -- it doesn't support other
architectures. So it looks like perftools won't work on 64-bit windows any
time soon.
If someone wants to contribute an IA64 or x86_64 disassembler, we'd be glad to
put it
into use! But unfortunately, supporting non-32-bit windows seems like a
difficult task.
Original comment by csilv...@gmail.com
on 14 Nov 2008 at 2:03
Original comment by csilv...@gmail.com
on 14 Nov 2008 at 2:04
Original comment by csilv...@gmail.com
on 14 Nov 2008 at 2:04
Original comment by csilv...@gmail.com
on 14 Nov 2008 at 2:04
Original comment by csilv...@gmail.com
on 25 Feb 2009 at 11:13
Original comment by csilv...@gmail.com
on 11 Mar 2009 at 9:23
Issue 233 has been merged into this issue.
Original comment by csilv...@gmail.com
on 9 Apr 2010 at 3:05
Do I get it right: Using static linking it might be possible to use tcmalloc in
a 64-bit environment?
Original comment by weidenri...@gmx.de
on 29 Oct 2010 at 7:47
It's not about linking, it's about using static patching rather than runtime
patching. If you follow the patching instructions pointed to by the windows
README, it should be possible to use tcmalloc in 64-bit windows.
Original comment by csilv...@gmail.com
on 29 Oct 2010 at 9:00
And static patching requires static linking of libc. And - if I get it right -
this requires that the program does not use dlls or at least does not allocate
memory in one dll that is freed in the other.
http://stackoverflow.com/questions/787216/should-i-link-to-the-visual-studio-c-r
untime-statically-or-dynamically
Agreed?
Original comment by weidenri...@gmx.de
on 1 Nov 2010 at 3:59
Sorry, I don't know the details of this technique. You'd have to ask the
author of the original groups post.
Original comment by csilv...@gmail.com
on 1 Nov 2010 at 8:28
1. atomicops-internals-x86-msvc.h is used instead of falling back to
atomicops-internals-x86.h
2. atomicops-internals-x86-msvc.h renamed to atomicops-internals-msvc.h since
the file contains both 32bit and 64bit implementations. Having x86 in the name
would be misleading.
3. changed inline asm in cycleclock.h to use intrinsic function since this
works for both x86 and x64
4. Leading underscore removed for symbol names in port.cc since x64 uses
different name decorations. __tls_used becomes _tls_used. Same thing goes for
_p_thread_callback_tcmalloc and _p_process_term_tcmalloc.
I didn't want to add x64 configuration to all .vcproj files because current
files are from the older Visual Studio then the one I'm using. After you add
the x64 configuration you have to change the symbol name in all projects that
depend on tcmalloc. Just change __tcmalloc to _tcmalloc in the project
properties - Linker - Input - Force Symbol References. Without this change all
the projects that depend on it will fail to link.
Original comment by popiz...@gmail.com
on 3 Feb 2011 at 10:24
Attachments:
Thank you for this patch, and I'm sorry I've not responded to it in so long.
I'm swamped on another project and probably will be for at least another two
months. Plus, I don't really know anything about windows, so this is slower
for me. :-} I'll see if I can recruit someone else to help out reviewing this.
Your patch doesn't show the new file (atomicops-internals-msvc.h) being added.
Can I assume it's the same as atomicops-internals-x86-msvc.h? That is, you
just changed the filename, no content?
It looks like all these changes are pretty straightforward, actually. I'll try
to carve out a bit of time to apply them.
Original comment by csilv...@gmail.com
on 7 Apr 2011 at 3:12
OK, I've started making changes on 1, 2, and 3. A note on (3): I saw you
didn't #include <intrin.h> in the cycleclock file, though it seems like it
should need it. Should I be doing that? Do you know why the code is working
anyway?
And a note on (4): rather than have to use different decorations, I'd rather
just add the following lines to src/windows/patch_functions.cc:
// This version is needed for x64, which uses a different symbol-decoration
scheme.
extern "C" PERFTOOLS_DLL_DECL void __tcmalloc();
void __tcmalloc() { }
If you add those lines, do the existing .vcproj files work under x64? Or are
there other .vcproj changes I would need to make for x64?
Original comment by csilv...@gmail.com
on 7 Apr 2011 at 3:28
Original comment by csilv...@gmail.com
on 7 Apr 2011 at 3:32
Yes the changes are very simple.
atomicops-internals-msvc.h is just a renamed atomicops-internals-x86-msvc.h
because having x86 in the file name is kind of misleading.
I have no idea why the code compiles without intin.h, I forgot to include it.
The code might not compile on other platforms without it.
I'll try your decoration change on some other branch since I have problems
compiling trunk, here they are:
1. tcmalloc.h(88) : error C2018: unknown character '0x40'. Same thing with
TC_VERSION_MAJOR and TC_VERSION_MINOR macros, I have ho idea what @ character
means in this context or how to fix this?
2. cycleclock.h(53) : fatal error C1083: Cannot open include file:
'sys/time.h': No such file or directory. Shouldn't this be <time.h>?
Original comment by popiz...@gmail.com
on 7 Apr 2011 at 9:44
I've applied your change against revision 101 and removed my changes from
port.cc but I get three linker errors (that changes from port.cc tried to
address) complaining about __tls_used, _p_thread_callback_tcmalloc and
_p_process_term_tcmalloc. I don't see how is your change related to this
problem? The linker complains about these specific symbols, which have nothing
to do with _tcmalloc, or am I wrong?
Original comment by popiz...@gmail.com
on 7 Apr 2011 at 10:05
Sorry top-of-tree breaks under windows. While I try to be careful, I don't
test on all architectures before committing every revision, so these things
slip through. :-( I'm glad you found a revision that works. (You could also
just use the last official release.)
You're right, the changes from port.cc have to stay. The reason to introduce
the __tcmalloc is to avoid having to change the .vcproj files, like you
mentioned in comment 12 (after the 4 points).
Original comment by csilv...@gmail.com
on 8 Apr 2011 at 12:00
Yes your change does the trick, no need to change .vcproj files. I think it's
best that they stay the way they are (without x64 configuration). Whoever needs
x64 configuration can easily add it. Having x64 configuration might create
problems for users that don't have x64 compiler installed, so it's best that we
leave it out, but I'm not sure about this.
I've also noticed something strange. Runtime library property is set to
Multi-threaded DLL (/MD) for each .cc file in libtcmalloc_minimal separately.
The project itself is set to Multi-Threaded (/MT). File configuration overrides
project configuration and everything works fine until you try to use tcmalloc
statically, like Chrome does. In this case you have to change Runtime library
for every .cc file. I'm not sure if this was intentional, but if it wasn't I
would advise you to change this property for every .cc file in
libtcmalloc_minimal. You can do this by selecting them all and changing Runtime
library to <inherit from parent or project defaults>. This way project property
would be in effect.
Original comment by popiz...@gmail.com
on 8 Apr 2011 at 6:56
Yes, the settings are done this way intentionally, because the vcproj files are
written to support MSVC 7.1, which does not have project-global settings. The
project-global '/MT' is added by the conversion process to whatever version of
MSVC you're using.
Original comment by csilv...@gmail.com
on 9 Apr 2011 at 3:11
I believe all 4 changes are in perftools 1.8, just released. If I missed
something, feel free to reopen the bug.
Original comment by csilv...@gmail.com
on 16 Jul 2011 at 1:18
Reopening for the original runtime issue 4, requiring a 64-bit disassembler.
It looks like such a thing may be coming soon!
Original comment by csilv...@gmail.com
on 21 Sep 2011 at 3:26
Never mind, issue 360 is a better place for this. Re-closing.
Original comment by csilv...@gmail.com
on 21 Sep 2011 at 3:27
Original issue reported on code.google.com by
shiningram@gmail.com
on 13 Nov 2008 at 11:59