@@ -25,9 +25,9 @@ struct StackDepotNode {
25
25
using hash_type = u64 ;
26
26
hash_type stack_hash;
27
27
u32 link;
28
- u32 tag;
29
28
30
29
static const u32 kTabSizeLog = SANITIZER_ANDROID ? 16 : 20 ;
30
+ static const u32 kStackSizeBits = 16 ;
31
31
32
32
typedef StackTrace args_type;
33
33
bool eq (hash_type hash, const args_type &args) const {
@@ -78,10 +78,10 @@ uptr StackDepotNode::allocated() {
78
78
}
79
79
80
80
void StackDepotNode::store (u32 id, const args_type &args, hash_type hash) {
81
- tag = args.tag ;
82
81
stack_hash = hash;
83
82
uptr *stack_trace = traceAllocator.alloc (args.size + 1 );
84
- *stack_trace = args.size ;
83
+ CHECK_LT (args.size , 1 << kStackSizeBits );
84
+ *stack_trace = args.size + (args.tag << kStackSizeBits );
85
85
internal_memcpy (stack_trace + 1 , args.trace , args.size * sizeof (uptr));
86
86
tracePtrs[id] = stack_trace;
87
87
}
@@ -90,7 +90,9 @@ StackDepotNode::args_type StackDepotNode::load(u32 id) const {
90
90
const uptr *stack_trace = tracePtrs[id];
91
91
if (!stack_trace)
92
92
return {};
93
- return args_type (stack_trace + 1 , *stack_trace, tag);
93
+ uptr size = *stack_trace & ((1 << kStackSizeBits ) - 1 );
94
+ uptr tag = *stack_trace >> kStackSizeBits ;
95
+ return args_type (stack_trace + 1 , size, tag);
94
96
}
95
97
96
98
StackDepotStats StackDepotGetStats () { return theDepot.GetStats (); }
0 commit comments