[compiler-rt] r192441 - [Sanitizer] StackTrace: kill CopyTo and reimplement CopyFrom
Alexey Samsonov
samsonov at google.com
Sun Oct 13 23:58:32 PDT 2013
On Mon, Oct 14, 2013 at 10:46 AM, Kostya Serebryany <kcc at google.com> wrote:
> Did you do performance testing?
>
No. CopyFrom() is currently only used in unittests (I agree with you,
though - we may benefit from putting its body into the header w/o extra
function calls).
> Our current implementation of internal_memcpy is not that great and your
> change might have negative impact on performance.
>
>
> On Fri, Oct 11, 2013 at 3:14 PM, Alexey Samsonov <samsonov at google.com>wrote:
>
>> Author: samsonov
>> Date: Fri Oct 11 06:14:20 2013
>> New Revision: 192441
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=192441&view=rev
>> Log:
>> [Sanitizer] StackTrace: kill CopyTo and reimplement CopyFrom
>>
>> Modified:
>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc?rev=192441&r1=192440&r2=192441&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.cc Fri
>> Oct 11 06:14:20 2013
>> @@ -13,6 +13,7 @@
>>
>> #include "sanitizer_common.h"
>> #include "sanitizer_flags.h"
>> +#include "sanitizer_libc.h"
>> #include "sanitizer_procmaps.h"
>> #include "sanitizer_stacktrace.h"
>> #include "sanitizer_symbolizer.h"
>> @@ -34,6 +35,11 @@ uptr StackTrace::GetPreviousInstructionP
>> #endif
>> }
>>
>> +void StackTrace::CopyFrom(const uptr *src, uptr src_size) {
>> + size = Min(src_size, kStackTraceMax);
>> + internal_memcpy(trace, src, sizeof(trace[0]) * size);
>> +}
>> +
>> static void PrintStackFramePrefix(uptr frame_num, uptr pc) {
>> Printf(" #%zu 0x%zx", frame_num, pc);
>> }
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h?rev=192441&r1=192440&r2=192441&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_stacktrace.h Fri Oct
>> 11 06:14:20 2013
>> @@ -36,20 +36,8 @@ struct StackTrace {
>> uptr trace[kStackTraceMax];
>> static void PrintStack(const uptr *addr, uptr size, bool symbolize,
>> SymbolizeCallback symbolize_callback);
>> - void CopyTo(uptr *dst, uptr dst_size) {
>> - for (uptr i = 0; i < size && i < dst_size; i++)
>> - dst[i] = trace[i];
>> - for (uptr i = size; i < dst_size; i++)
>> - dst[i] = 0;
>> - }
>>
>> - void CopyFrom(uptr *src, uptr src_size) {
>> - size = src_size;
>> - if (size > kStackTraceMax) size = kStackTraceMax;
>> - for (uptr i = 0; i < size; i++) {
>> - trace[i] = src[i];
>> - }
>> - }
>> + void CopyFrom(const uptr *src, uptr src_size);
>>
>> void FastUnwindStack(uptr pc, uptr bp, uptr stack_top, uptr
>> stack_bottom,
>> uptr max_depth);
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
--
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131014/617e5c28/attachment.html>
More information about the llvm-commits
mailing list