]> git.proxmox.com Git - rustc.git/blob - src/jemalloc/include/jemalloc/internal/quarantine.h
Imported Upstream version 1.9.0+dfsg1
[rustc.git] / src / jemalloc / include / jemalloc / internal / quarantine.h
1 /******************************************************************************/
2 #ifdef JEMALLOC_H_TYPES
3
4 typedef struct quarantine_obj_s quarantine_obj_t;
5 typedef struct quarantine_s quarantine_t;
6
7 /* Default per thread quarantine size if valgrind is enabled. */
8 #define JEMALLOC_VALGRIND_QUARANTINE_DEFAULT (ZU(1) << 24)
9
10 #endif /* JEMALLOC_H_TYPES */
11 /******************************************************************************/
12 #ifdef JEMALLOC_H_STRUCTS
13
14 struct quarantine_obj_s {
15 void *ptr;
16 size_t usize;
17 };
18
19 struct quarantine_s {
20 size_t curbytes;
21 size_t curobjs;
22 size_t first;
23 #define LG_MAXOBJS_INIT 10
24 size_t lg_maxobjs;
25 quarantine_obj_t objs[1]; /* Dynamically sized ring buffer. */
26 };
27
28 #endif /* JEMALLOC_H_STRUCTS */
29 /******************************************************************************/
30 #ifdef JEMALLOC_H_EXTERNS
31
32 void quarantine_alloc_hook_work(tsd_t *tsd);
33 void quarantine(tsd_t *tsd, void *ptr);
34 void quarantine_cleanup(tsd_t *tsd);
35
36 #endif /* JEMALLOC_H_EXTERNS */
37 /******************************************************************************/
38 #ifdef JEMALLOC_H_INLINES
39
40 #ifndef JEMALLOC_ENABLE_INLINE
41 void quarantine_alloc_hook(void);
42 #endif
43
44 #if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_QUARANTINE_C_))
45 JEMALLOC_ALWAYS_INLINE void
46 quarantine_alloc_hook(void)
47 {
48 tsd_t *tsd;
49
50 assert(config_fill && opt_quarantine);
51
52 tsd = tsd_fetch();
53 if (tsd_quarantine_get(tsd) == NULL)
54 quarantine_alloc_hook_work(tsd);
55 }
56 #endif
57
58 #endif /* JEMALLOC_H_INLINES */
59 /******************************************************************************/
60