Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | static pthread_mutex_t allocator_mutex = { { 0, 0, 0, 0, 0, 0, { 0, 0 } } }; | - |
5 | | - |
6 | static __inline void allocator_grab_lock(void) | - |
7 | { | - |
8 | pthread_mutex_lock(&allocator_mutex); | - |
9 | } executed: } Execution Count:30 | 30 |
10 | | - |
11 | static __inline void allocator_release_lock(void) | - |
12 | { | - |
13 | pthread_mutex_unlock(&allocator_mutex); | - |
14 | } executed: } Execution Count:30 | 30 |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | static pthread_mutex_t global_mutex = { { 0, 0, 0, 0, 0, 0, { 0, 0 } } }; | - |
21 | | - |
22 | static __attribute__((unused)) void sljit_grab_lock(void) | - |
23 | { | - |
24 | pthread_mutex_lock(&global_mutex); | - |
25 | } | 0 |
26 | | - |
27 | static __attribute__((unused)) void sljit_release_lock(void) | - |
28 | { | - |
29 | pthread_mutex_unlock(&global_mutex); | - |
30 | } | 0 |
31 | | - |
32 | | - |
33 | | - |
34 | static sljit_w sljit_page_align = 0; | - |
35 | | - |
36 | static __attribute__((unused)) struct sljit_stack* sljit_allocate_stack(sljit_uw limit, sljit_uw max_limit) | - |
37 | { | - |
38 | struct sljit_stack *stack; | - |
39 | union { | - |
40 | void *ptr; | - |
41 | sljit_uw uw; | - |
42 | } base; | - |
43 | | - |
44 | | - |
45 | | - |
46 | | - |
47 | if (limit > max_limit || limit < 1) never evaluated: limit > max_limit never evaluated: limit < 1 | 0 |
48 | return ((void *)0); never executed: return ((void *)0); | 0 |
49 | | - |
50 | | - |
51 | | - |
52 | | - |
53 | | - |
54 | | - |
55 | | - |
56 | if (!sljit_page_align) { never evaluated: !sljit_page_align | 0 |
57 | sljit_page_align = sysconf(_SC_PAGESIZE); | - |
58 | | - |
59 | if (sljit_page_align < 0) never evaluated: sljit_page_align < 0 | 0 |
60 | sljit_page_align = 4096; never executed: sljit_page_align = 4096; | 0 |
61 | sljit_page_align--; | - |
62 | } | 0 |
63 | | - |
64 | | - |
65 | | - |
66 | max_limit = (max_limit + sljit_page_align) & ~sljit_page_align; | - |
67 | | - |
68 | stack = (struct sljit_stack*)(pcre16_malloc)(sizeof(struct sljit_stack)); | - |
69 | if (!stack) | 0 |
70 | return ((void *)0); never executed: return ((void *)0); | 0 |
71 | base.ptr = mmap(0, max_limit, 0x1 | 0x2, 0x02 | 0x20, -1, 0); | - |
72 | if (base.ptr == ((void *) -1)) { never evaluated: base.ptr == ((void *) -1) | 0 |
73 | (pcre16_free)(stack); | - |
74 | return ((void *)0); never executed: return ((void *)0); | 0 |
75 | } | - |
76 | stack->base = base.uw; | - |
77 | stack->limit = stack->base + limit; | - |
78 | stack->max_limit = stack->base + max_limit; | - |
79 | | - |
80 | stack->top = stack->base; | - |
81 | return stack; never executed: return stack; | 0 |
82 | } | - |
83 | | - |
84 | | - |
85 | | - |
86 | static __attribute__((unused)) void sljit_free_stack(struct sljit_stack* stack) | - |
87 | { | - |
88 | | - |
89 | | - |
90 | | - |
91 | munmap((void*)stack->base, stack->max_limit - stack->base); | - |
92 | | - |
93 | (pcre16_free)(stack); | - |
94 | } | 0 |
95 | | - |
96 | static __attribute__((unused)) sljit_w sljit_stack_resize(struct sljit_stack* stack, sljit_uw new_limit) | - |
97 | { | - |
98 | sljit_uw aligned_old_limit; | - |
99 | sljit_uw aligned_new_limit; | - |
100 | | - |
101 | if ((new_limit > stack->max_limit) || (new_limit < stack->base)) never evaluated: (new_limit > stack->max_limit) never evaluated: (new_limit < stack->base) | 0 |
102 | return -1; never executed: return -1; | 0 |
103 | if (new_limit >= stack->limit) { never evaluated: new_limit >= stack->limit | 0 |
104 | stack->limit = new_limit; | - |
105 | return 0; never executed: return 0; | 0 |
106 | } | - |
107 | aligned_new_limit = (new_limit + sljit_page_align) & ~sljit_page_align; | - |
108 | aligned_old_limit = (stack->limit + sljit_page_align) & ~sljit_page_align; | - |
109 | if (aligned_new_limit < aligned_old_limit) never evaluated: aligned_new_limit < aligned_old_limit | 0 |
110 | | - |
111 | | - |
112 | | - |
113 | madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, 4); never executed: madvise((void*)aligned_new_limit, aligned_old_limit - aligned_new_limit, 4); | 0 |
114 | | - |
115 | stack->limit = new_limit; | - |
116 | return 0; never executed: return 0; | 0 |
117 | | - |
118 | } | - |
119 | | - |
| | |