annotate src/mc-alloc.h @ 5167:e374ea766cc1

clean up, rearrange allocation statistics code -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-03-21 Ben Wing <ben@xemacs.org> * alloc.c: * alloc.c (assert_proper_sizing): * alloc.c (c_readonly): * alloc.c (malloced_storage_size): * alloc.c (fixed_type_block_overhead): * alloc.c (lisp_object_storage_size): * alloc.c (inc_lrecord_stats): * alloc.c (dec_lrecord_stats): * alloc.c (pluralize_word): * alloc.c (object_memory_usage_stats): * alloc.c (Fobject_memory_usage): * alloc.c (compute_memusage_stats_length): * alloc.c (disksave_object_finalization_1): * alloc.c (Fgarbage_collect): * mc-alloc.c: * mc-alloc.c (mc_alloced_storage_size): * mc-alloc.h: No functionality change here. Collect the allocations-statistics code that was scattered throughout alloc.c into one place. Add remaining section headings so that all sections have headings clearly identifying the start of the section and its purpose. Expose mc_alloced_storage_size() even when not MEMORY_USAGE_STATS; this fixes build problems and is related to the export of lisp_object_storage_size() and malloced_storage_size() when non-MEMORY_USAGE_STATS in the previous change set.
author Ben Wing <ben@xemacs.org>
date Sun, 21 Mar 2010 04:41:49 -0500
parents 1fae11d56ad2
children 308d34e9f07d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
1 /* New allocator for XEmacs.
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
2 Copyright (C) 2005 Marcus Crestani.
5167
e374ea766cc1 clean up, rearrange allocation statistics code
Ben Wing <ben@xemacs.org>
parents: 5157
diff changeset
3 Copyright (C) 2010 Ben Wing.
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
4
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
5 This file is part of XEmacs.
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
6
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
10 later version.
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
11
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
15 for more details.
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
16
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
21
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
23
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
24 #ifndef INCLUDED_mc_alloc_h_
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
25 #define INCLUDED_mc_alloc_h_
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
26
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
27 /*--- prototypes -------------------------------------------------------*/
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
28
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
29 BEGIN_C_DECLS
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
30
3305
1043bbfa24cf [xemacs-hg @ 2006-03-26 15:24:25 by crestani]
crestani
parents: 3303
diff changeset
31 /* Set to 1 if memory becomes short. */
1043bbfa24cf [xemacs-hg @ 2006-03-26 15:24:25 by crestani]
crestani
parents: 3303
diff changeset
32 extern EMACS_INT memory_shortage;
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
33
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
34
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
35 /* Internal Allocator Functions: */
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
36
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
37 /* Initialize the allocator. This has to be called prior to
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
38 requesting memory. */
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
39 void init_mc_allocator (void);
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
40
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
41 /* Allocate a block of memory of given size and return the pointer to
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
42 it. */
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
43 void *mc_alloc (size_t size);
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
44
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
45 /* Allocate a block of memory as an array with elemcount elements of
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
46 given size and return the pointer to it. Arrays contain several
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
47 objects that are allocated in one consecutive block of memory with
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
48 each element being a fully qualified object---that is, it has a
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
49 Lisp object header and a mark bit. Objects like hash tables and
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
50 dynamic arrays use this function. */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
51 void *mc_alloc_array (size_t size, EMACS_INT elemcount);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
52
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
53 /* Modify the size of the memory block pointed to by ptr. Return the
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
54 address of the new block of given size. The content of the memory
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
55 block will be unchanged to the minimum of the old and new sizes: if
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
56 the new size is smaller, the overlaying data is cut off; if the new
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
57 size is bigger, the newly allocated memory will be uninitialized.*/
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
58 void *mc_realloc (void *ptr, size_t size);
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
59
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
60 /* Modify the size of the array pointed to by ptr. Return the address
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
61 of the new array block with elemcount elements of given size. The
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
62 content of the memory block will be unchanged to the minimum of the
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
63 old and new sizes: if the new size is smaller, the overlaying data
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
64 is cut off; if the new size is bigger, the newly allocated memory
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
65 will be uninitialized.*/
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
66 void *mc_realloc_array (void *ptr, size_t size, EMACS_INT elemcount);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
67
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
68
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
69
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
70 /* Garbage collection related functions and macros: */
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
71
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
72 enum mark_bit_colors
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
73 {
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
74 WHITE = 0,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
75 BLACK = 1,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
76 GREY = 2
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
77 };
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
78
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
79 /* Set the mark bit of the object pointed to by ptr to value.*/
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
80 void set_mark_bit (void *ptr, EMACS_INT value);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
81
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
82 /* Return the mark bit of the object pointed to by ptr. */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
83 EMACS_INT get_mark_bit (void *ptr);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
84
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
85 /* mark bit macros */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
86 /* Returns true if the mark bit of the object pointed to by ptr is set. */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
87 #define MARKED_P(ptr) (get_mark_bit (ptr) != WHITE)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
88
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
89 /* Marks the object pointed to by ptr (sets the mark bit to 1). */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
90 #define MARK(ptr) set_mark_bit (ptr, BLACK)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
91
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
92 /* Unmarks the object pointed to by ptr (sets the mark bit to 0). */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
93 #define UNMARK(ptr) set_mark_bit (ptr, WHITE)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
94
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
95 #define MARK_WHITE(ptr) set_mark_bit (ptr, WHITE)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
96 #define MARK_GREY(ptr) set_mark_bit (ptr, GREY)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
97 #define MARK_BLACK(ptr) set_mark_bit (ptr, BLACK)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
98
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
99 #define MARKED_WHITE_P(ptr) (get_mark_bit (ptr) == WHITE)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
100 #define MARKED_GREY_P(ptr) (get_mark_bit (ptr) == GREY)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
101 #define MARKED_BLACK_P(ptr) (get_mark_bit (ptr) == BLACK)
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
102
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
103 /* The finalizer of every not marked object is called. The macro
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
104 MC_ALLOC_CALL_FINALIZER has to be defined and call the finalizer of
3303
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
105 the object. Returns number of processed pages. */
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
106 EMACS_INT mc_finalize (void);
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
107
3303
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
108 /* All not marked objects of the used heap are freed. Returns number
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
109 of processed pages. */
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
110 EMACS_INT mc_sweep (void);
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
111
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
112
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
113
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
114 /* Portable dumper related functions and macros: */
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
115
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
116 /* The finalizer for disksave of every object is called to shrink the
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
117 dump image. The macro MC_ALLOC_CALL_FINALIZER_FOR_DISKSAVE has to
3303
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
118 be defined and call the finalizer for disksave of the object.
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
119 Returns number of processed pages. */
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
120 EMACS_INT mc_finalize_for_disksave (void);
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
121
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
122
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
123
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
124 /* Functions and macros related with allocation statistics: */
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
125
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
126 /* Returns the real size, including overhead, which is actually alloced
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
127 for an object with given claimed_size. */
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
128 Bytecount mc_alloced_storage_size (Bytecount claimed_size,
5157
1fae11d56ad2 redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents: 4117
diff changeset
129 struct usage_stats *stats);
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
130
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
131
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
132 /* Incremental Garbage Collector / Write Barrier Support: */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
133
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
134 /* Return the PAGESIZE the allocator uses. Generally equals to the
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
135 system's PAGESIZE. */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
136 EMACS_INT mc_get_page_size (void);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
137
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
138 /* Is the fault at ptr on a protected page? */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
139 EMACS_INT fault_on_protected_page (void *ptr);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
140
3303
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
141 /* Remove protection (if there) of heap page of given page header ph.
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
142 Returns number of processed pages. */
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
143 EMACS_INT protect_heap_pages (void);
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
144
3303
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
145 /* Remove protection for all heap pages which are protected. Returns
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
146 number of processed pages. */
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
147 EMACS_INT unprotect_heap_pages (void);
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
148
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
149 /* Remove protection and mark page dirty. */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
150 void unprotect_page_and_mark_dirty (void *ptr);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
151
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
152 /* Repush all objects on dirty pages onto the mark stack. Return
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
153 number of repushed objects. */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
154 int repush_all_objects_on_page (void *ptr);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
155
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
156 /* Mark black if object is currently grey. */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
157 EMACS_INT maybe_mark_black (void *ptr);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
158
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
159 /* Only for debugging---not used anywhere in the sources. */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
160 EMACS_INT object_on_heap_p (void *ptr);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
161
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
162 END_C_DECLS
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
163
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
164 #endif /* INCLUDED_mc_alloc_h_ */