1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/* table.h - definitions for tables for keeping track of allocated memory */
/* Copyright (C) 2001-2025 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne-Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
/* values for flags byte. */
/*
* Memory table entry.
*
* MEM is the address of the allocated pointer.
* SIZE is the requested allocation size.
* FLAGS includes either MT_ALLOC (MEM is allocated) or MT_FREE (MEM is
* not allocated). Other flags later.
* FUNC is set to the name of the function doing the allocation (from the
* `tag' argument to register_alloc().
* FILE and LINE are the filename and line number of the last allocation
* and free (depending on STATUS) of MEM.
* NALLOC and NFREE are incremented on each allocation that returns MEM or
* each free of MEM, respectively (way to keep track of memory reuse
* and how well the free lists are working).
*
*/
typedef struct mr_table mr_table_t;
extern mr_table_t *;
extern void ;
extern void ;
extern void ; /* needs stdio.h */
extern void ;
extern void ;
typedef struct ma_table ma_table_t;
extern void ;
extern void ;
extern void ;
extern void ;
/* NOTE: HASH_MIX taken from dmalloc (http://dmalloc.com) */
/*
* void HASH_MIX
*
* DESCRIPTION:
*
* Mix 3 32-bit values reversibly. For every delta with one or two
* bits set, and the deltas of all three high bits or all three low
* bits, whether the original value of a,b,c is almost all zero or is
* uniformly distributed.
*
* If HASH_MIX() is run forward or backward, at least 32 bits in a,b,c
* have at least 1/4 probability of changing. If mix() is run
* forward, every bit of c will change between 1/3 and 2/3 of the
* time. (Well, 22/100 and 78/100 for some 2-bit deltas.)
*
* HASH_MIX() takes 36 machine instructions, but only 18 cycles on a
* superscalar machine (like a Pentium or a Sparc). No faster mixer
* seems to work, that's the result of my brute-force search. There
* were about 2^68 hashes to choose from. I only tested about a
* billion of those.
*/
/* MALLOC_REGISTER */
/* _MTABLE_H */