* config/riscv/riscv.c (riscv_emit_float_compare): Use fallthru
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_stackdepot.h
blobdfb5349de9f3c5da0c0c5026e8b3e0c9ca018200
1 //===-- sanitizer_stackdepot.h ----------------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // This file is shared between AddressSanitizer and ThreadSanitizer
9 // run-time libraries.
10 //===----------------------------------------------------------------------===//
12 #ifndef SANITIZER_STACKDEPOT_H
13 #define SANITIZER_STACKDEPOT_H
15 #include "sanitizer_common.h"
16 #include "sanitizer_internal_defs.h"
17 #include "sanitizer_stacktrace.h"
19 namespace __sanitizer {
21 // StackDepot efficiently stores huge amounts of stack traces.
22 struct StackDepotNode;
23 struct StackDepotHandle {
24 StackDepotNode *node_;
25 StackDepotHandle() : node_(nullptr) {}
26 explicit StackDepotHandle(StackDepotNode *node) : node_(node) {}
27 bool valid() { return node_; }
28 u32 id();
29 int use_count();
30 void inc_use_count_unsafe();
33 const int kStackDepotMaxUseCount = 1U << 20;
35 StackDepotStats *StackDepotGetStats();
36 u32 StackDepotPut(StackTrace stack);
37 StackDepotHandle StackDepotPut_WithHandle(StackTrace stack);
38 // Retrieves a stored stack trace by the id.
39 StackTrace StackDepotGet(u32 id);
41 void StackDepotLockAll();
42 void StackDepotUnlockAll();
44 // Instantiating this class creates a snapshot of StackDepot which can be
45 // efficiently queried with StackDepotGet(). You can use it concurrently with
46 // StackDepot, but the snapshot is only guaranteed to contain those stack traces
47 // which were stored before it was instantiated.
48 class StackDepotReverseMap {
49 public:
50 StackDepotReverseMap();
51 StackTrace Get(u32 id);
53 private:
54 struct IdDescPair {
55 u32 id;
56 StackDepotNode *desc;
58 static bool IdComparator(const IdDescPair &a, const IdDescPair &b);
61 InternalMmapVector<IdDescPair> map_;
63 // Disallow evil constructors.
64 StackDepotReverseMap(const StackDepotReverseMap&);
65 void operator=(const StackDepotReverseMap&);
68 } // namespace __sanitizer
70 #endif // SANITIZER_STACKDEPOT_H