Mercurial > hg > truffle
diff src/os/posix/vm/os_posix.cpp @ 6197:d2a62e0f25eb
6995781: Native Memory Tracking (Phase 1)
7151532: DCmd for hotspot native memory tracking
Summary: Implementation of native memory tracking phase 1, which tracks VM native memory usage, and related DCmd
Reviewed-by: acorn, coleenp, fparain
author | zgu |
---|---|
date | Thu, 28 Jun 2012 17:03:16 -0400 |
parents | 7432b9db36ff |
children | 65906dc96aa1 |
line wrap: on
line diff
--- a/src/os/posix/vm/os_posix.cpp Wed Jun 27 15:23:36 2012 +0200 +++ b/src/os/posix/vm/os_posix.cpp Thu Jun 28 17:03:16 2012 -0400 @@ -23,6 +23,7 @@ */ #include "prims/jvm.h" +#include "runtime/frame.inline.hpp" #include "runtime/os.hpp" #include "utilities/vmError.hpp" @@ -61,6 +62,23 @@ VMError::report_coredump_status(buffer, success); } +address os::get_caller_pc(int n) { +#ifdef _NMT_NOINLINE_ + n ++; +#endif + frame fr = os::current_frame(); + while (n > 0 && fr.pc() && + !os::is_first_C_frame(&fr) && fr.sender_pc()) { + fr = os::get_sender_for_C_frame(&fr); + n --; + } + if (n == 0) { + return fr.pc(); + } else { + return NULL; + } +} + int os::get_last_error() { return errno; }