[compiler-rt] r190666 - [asan] don't record the class_id in FakeFrame (scratching the last bits of performance)
Kostya Serebryany
kcc at google.com
Fri Sep 13 00:50:44 PDT 2013
Author: kcc
Date: Fri Sep 13 02:50:44 2013
New Revision: 190666
URL: http://llvm.org/viewvc/llvm-project?rev=190666&view=rev
Log:
[asan] don't record the class_id in FakeFrame (scratching the last bits of performance)
Modified:
compiler-rt/trunk/lib/asan/asan_fake_stack.cc
compiler-rt/trunk/lib/asan/asan_fake_stack.h
compiler-rt/trunk/lib/asan/tests/asan_fake_stack_test.cc
Modified: compiler-rt/trunk/lib/asan/asan_fake_stack.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_fake_stack.cc?rev=190666&r1=190665&r2=190666&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_fake_stack.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_fake_stack.cc Fri Sep 13 02:50:44 2013
@@ -63,7 +63,6 @@ FakeFrame *FakeStack::Allocate(uptr stac
FakeFrame *res = reinterpret_cast<FakeFrame *>(
GetFrame(stack_size_log, class_id, pos));
res->real_stack = real_stack;
- res->class_id = class_id;
return res;
}
CHECK(0 && "Failed to allocate a fake stack frame");
Modified: compiler-rt/trunk/lib/asan/asan_fake_stack.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_fake_stack.h?rev=190666&r1=190665&r2=190666&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_fake_stack.h (original)
+++ compiler-rt/trunk/lib/asan/asan_fake_stack.h Fri Sep 13 02:50:44 2013
@@ -24,8 +24,7 @@ struct FakeFrame {
uptr magic; // Modified by the instrumented code.
uptr descr; // Modified by the instrumented code.
uptr pc; // Modified by the instrumented code.
- u64 real_stack : 48;
- u64 class_id : 16;
+ uptr real_stack;
};
// For each thread we create a fake stack and place stack objects on this fake
Modified: compiler-rt/trunk/lib/asan/tests/asan_fake_stack_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_fake_stack_test.cc?rev=190666&r1=190665&r2=190666&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_fake_stack_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_fake_stack_test.cc Fri Sep 13 02:50:44 2013
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <stdio.h>
-#include <set>
+#include <map>
namespace __asan {
@@ -104,7 +104,7 @@ TEST(FakeStack, GetFrame) {
TEST(FakeStack, Allocate) {
const uptr stack_size_log = 19;
FakeStack *fs = FakeStack::Create(stack_size_log);
- std::set<FakeFrame *> s;
+ std::map<FakeFrame *, uptr> s;
for (int iter = 0; iter < 2; iter++) {
s.clear();
for (uptr cid = 0; cid < FakeStack::kNumberOfSizeClasses; cid++) {
@@ -113,7 +113,7 @@ TEST(FakeStack, Allocate) {
for (uptr j = 0; j < n; j++) {
FakeFrame *ff = fs->Allocate(stack_size_log, cid, 0);
uptr x = reinterpret_cast<uptr>(ff);
- EXPECT_TRUE(s.insert(ff).second);
+ EXPECT_TRUE(s.insert(std::make_pair(ff, cid)).second);
EXPECT_EQ(x, fs->AddrIsInFakeStack(x));
EXPECT_EQ(x, fs->AddrIsInFakeStack(x + 1));
EXPECT_EQ(x, fs->AddrIsInFakeStack(x + bytes_in_class - 1));
@@ -126,9 +126,9 @@ TEST(FakeStack, Allocate) {
"Failed to allocate a fake stack frame");
}
}
- for (std::set<FakeFrame *>::iterator it = s.begin(); it != s.end(); ++it) {
- FakeFrame *ff = *it;
- fs->Deallocate(ff, stack_size_log, ff->class_id, 0);
+ for (std::map<FakeFrame *, uptr>::iterator it = s.begin(); it != s.end();
+ ++it) {
+ fs->Deallocate(it->first, stack_size_log, it->second, 0);
}
}
fs->Destroy();
More information about the llvm-commits
mailing list