Comments (12)
Thank you for contributing this patch! The ppc code is particularly useful,
since we
don't have a ppc macos box to test on.
I'd like to understand some of the changes you made, to see if they call for a
more
general modification of the code -- that is, some implicit assumptions we had
made,
that are easy to get rid of. In particular:
1) In tcmalloc.cc, why did you have to #ifdef out the __libc_* functions? What
kinds
of errors did you get with this code in there? Maybe __libc_* is only defined
on
some systems? Maybe we should try to define these things only on redhat 9
systems,
since those are the ones we had a bug report about which prompted this code in
the
first place.
2) I don't know anything about the ppc, but it seems to me the
stacktrace_ppc-inl.h
file doesn't actually have any ppc-specific code in it. Is that right? I'm
wondering if it makes sense to put this code -- or something much like it -- in
stacktrace_generic-inl.h, and just run it on any system that supports
__builtin_frame_address.
3) Why did you get rid of the "if (!new_sp) break;" test in
stacktrace_x86-inl.h (and
in stacktrace_ppc-inl.h)?
4) In atomicops.h, you have
#if defined(__MACH__) && defined(__APPLE__) && defined(__ppc__)
Is the test for __APPLE__ necessary? Or is just knowing it's Mach (OS X) on ppc
enough? I just want to make sure I understand what's going on with the defines
you use.
5) Why can't we define ATTRIBUTE_WEAK et al. on Mach (in basictypes.h)?
Thanks again for this contribution! It's nice to see tcmalloc_minimal become
usable
on so many different systems.
Original comment by [email protected]
on 17 May 2007 at 6:56
from gperftools.
Original comment by [email protected]
on 17 May 2007 at 6:56
- Added labels: Type-Patch
- Removed labels: Type-Defect
from gperftools.
(Also, to be clear: this patch is against google-perftools 0.91.)
Original comment by [email protected]
on 17 May 2007 at 6:57
- Added labels: Version-0.91
from gperftools.
I posted the following to the group, I didn't know it wasn't reflected in the
tracker... Here it goes anyway:
On May 17, 8:56 am, [email protected] wrote:
> Issue 15: Patches to build libtcmalloc_minimal on Mac OS
Xhttp://code.google.com/p/google-perftools/issues/detail?id=15
> Comment #1 by csilvers:
> Thank you for contributing this patch! The ppc code is particularly useful,
since we
> don't have a ppc macos box to test on.
Nor do I. I just tested using the cross compiler installed on Mac OS X
boxes and ran it under Rosetta. The ppc code is heavily untested
though. I haven't verified the backtrace is correct.
> I'd like to understand some of the changes you made, to see if they call for
a more
> general modification of the code -- that is, some implicit assumptions we had
made,
> that are easy to get rid of. In particular:
> 1) In tcmalloc.cc, why did you have to #ifdef out the __libc_* functions?
What kinds
> of errors did you get with this code in there? Maybe __libc_* is only
defined on
> some systems? Maybe we should try to define these things only on redhat 9
systems,
> since those are the ones we had a bug report about which prompted this code
in the
> first place.
Those are glibc-specific functions. __libc_* simply doesn't exist on
Darwin (or BSD systems for the matter).
Probably the Right Thing is enclosing that code in:
#if defined(__GLIBC__)
> 2) I don't know anything about the ppc, but it seems to me the
stacktrace_ppc-inl.h
> file doesn't actually have any ppc-specific code in it. Is that right? I'm
> wondering if it makes sense to put this code -- or something much like it --
in
> stacktrace_generic-inl.h, and just run it on any system that supports
> __builtin_frame_address.
Could be an option, but first let me check if the code works
correctly :-) It was dumping something that looked like a backtrace,
but you never know...
> 3) Why did you get rid of the "if (!new_sp) break;" test in
stacktrace_x86-inl.h (and
> in stacktrace_ppc-inl.h)?
Because it was just noise? It made the whole thing look more
complicated than it really is.
> 4) In atomicops.h, you have
> #if defined(__MACH__) && defined(__APPLE__) &&
defined(__ppc__)
> Is the test for __APPLE__ necessary? Or is just knowing it's Mach (OS X) on
ppc
> enough? I just want to make sure I understand what's going on with the
defines you
use.
It is necessary because OSAtomic.h is AFAIK only present in Darwin.
You could try to compile it on another mach-based OS and it would
fail.
> 5) Why can't we define ATTRIBUTE_WEAK et al. on Mach (in basictypes.h)?
Mach uses Mach-O as its object format, and it just won't link using
those constructs.
Greetings,
Jorge Acereda
Original comment by [email protected]
on 17 May 2007 at 2:02
from gperftools.
I looked into this a bit more today. It turns out Mach-O does support weak
references and named sections, but the syntax is a bit different than for ELF.
I've
made the appropriate tweaks, and also incorporated some changes from your patch
like
the #ifdef out of the __libc_foo calls, and have gotten tcmalloc_minimal to
compile
and run on my local Mac OS X box as well.
These changes will make it into the next perftools release, hopefully within a
few weeks.
I'd like to see more testing before adding stacktrace_ppc-inl.h into the
mainline.
If anyone happens to read this and decides to download this patch for their PPC
OS X
boxes, please report your experience here!
Original comment by [email protected]
on 18 May 2007 at 3:58
- Changed state: Started
from gperftools.
> 2) I don't know anything about the ppc, but it seems to me the
stacktrace_ppc-inl.h
> file doesn't actually have any ppc-specific code in it. Is that right? I'm
> wondering if it makes sense to put this code -- or something much like it --
in
> stacktrace_generic-inl.h, and just run it on any system that supports
> __builtin_frame_address.
I've coded a stacktrace_gcc-inl.h that should be more portable (based in
__builtin_get_return_address()).
I don't have my laptop here though, I'll send the patches on monday.
Original comment by [email protected]
on 18 May 2007 at 1:44
from gperftools.
I actually played around quite a bit with __builtin_get_return_address (and
__builtin_get_frame_pointer) last night, and even went so far as to talk with
the
libunwind maintainer. It became clear pretty quickly that these approaches
won't
work. In particular, the code in question *does* have architecture-specific
stuff:
it assumes that sp[0] points to the next frame, and sp[1] points to the return
address. That's true on x86, but unlikely to be true on other architectures.
In
particular, if it works on ppc it's a big coincidence!
So stacktrace_gcc-inl.h won't work. I think our general approach is going to
be to
have the "fallback" option be libunwind, which is designed to provide this
functionality for as many architectures as possible.
Original comment by [email protected]
on 18 May 2007 at 5:56
from gperftools.
This is what I got. This one should be generic.
Original comment by [email protected]
on 20 May 2007 at 7:36
Attachments:
from gperftools.
Yeah, I talked with the author of libunwind about doing something like this,
but alas
it doesn't work either -- __builtin_return_address(x) is not guaranteed to
give a
result for x > 0 on all architecctures. I also talked with a gcc maintainer,
who
said that __builtin_return_address(x>0) on some architectures may give an
answer, but
the wrong one!
I think the only really practical thing to do is to use libunwind for
architectures
we don't choose to support natively, and help libunwind support as many
architectures
as possible.
Original comment by [email protected]
on 20 May 2007 at 7:50
from gperftools.
libunwind seems to be too tied to ELF. If you want to rely on libunwind that's
fine,
but keep in mind that it lacks support for lots of platforms.
I tried that code with the regression test and it seems to work. So an option
would
be to run a configure-time test to determine if the hack works.
Original comment by [email protected]
on 21 May 2007 at 9:52
from gperftools.
teste de comentario
Original comment by [email protected]
on 24 May 2007 at 7:13
from gperftools.
google-perftools 0.92 has improved OS X support, including some preliminary (but
untested) PowerPC support. I think it includes all the functionality in this
patch,
so I'm closing this bug.
Original comment by [email protected]
on 19 Jul 2007 at 2:43
- Changed state: Fixed
from gperftools.
Related Issues (20)
- Cant compile gproftools with mips64 HOT 5
- armv7l compilation fails under -std=c++11 (works under -std=gnu++11) (was: Cant compile gproftools with armv7l) HOT 7
- pprof -disasm / -list fail on OS X due to renamed and incompatible objdump HOT 3
- pprof script bugged when testing out nm HOT 2
- heap-profiler check fails when built with gcc 4.8.0 but works when built with gcc 4.4.7 HOT 6
- Heap profiler consumes a lot of memory HOT 1
- Project Home page 2014->2015 HOT 1
- Callgrind output broken (patch provided) HOT 1
- Callgrind output does not handle inlined functions (patch provided) HOT 1
- Like a teeter totter,run slowly because call ThreadCache::FetchFromCentralCache and ThreadCache::ReleaseToCentralCache frequently HOT 3
- typo in PrintAvailability source code HOT 3
- Any plan to shift to CMake? HOT 1
- VIRT memory continues to grow when using 64k byte buffers HOT 4
- Linking libtorsocks with libtcmalloc results in SIGSEGV HOT 3
- What will be the official home for gperftools?
- On Windows 8.1, system-alloc_unittest fails an assert HOT 1
- recalloc is wrong in windows/override_functions.cc HOT 1
- src/malloc_hook_mmap_linux.h fails to compile with clang in C++11 mode when targeting 32 bit with _FILE_OFFSET_BITS=64 HOT 1
- Should heap profiling with mingw work? HOT 3
- src/gperftools/tcmalloc.h and src/windows/gperftools/tcmalloc.h report v2.3 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gperftools.