annotate src/mc-alloc.h @ 5043:d0c14ea98592

various frame-geometry fixes -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-15 Ben Wing <ben@xemacs.org> * EmacsFrame.c: * EmacsFrame.c (EmacsFrameResize): * console-msw-impl.h: * console-msw-impl.h (struct mswindows_frame): * console-msw-impl.h (FRAME_MSWINDOWS_TARGET_RECT): * device-tty.c: * device-tty.c (tty_asynch_device_change): * event-msw.c: * event-msw.c (mswindows_wnd_proc): * faces.c (Fface_list): * faces.h: * frame-gtk.c: * frame-gtk.c (gtk_set_initial_frame_size): * frame-gtk.c (gtk_set_frame_size): * frame-msw.c: * frame-msw.c (mswindows_init_frame_1): * frame-msw.c (mswindows_set_frame_size): * frame-msw.c (mswindows_size_frame_internal): * frame-msw.c (msprinter_init_frame_3): * frame.c: * frame.c (enum): * frame.c (Fmake_frame): * frame.c (adjust_frame_size): * frame.c (store_minibuf_frame_prop): * frame.c (Fframe_property): * frame.c (Fframe_properties): * frame.c (Fframe_displayable_pixel_height): * frame.c (Fframe_displayable_pixel_width): * frame.c (internal_set_frame_size): * frame.c (Fset_frame_height): * frame.c (Fset_frame_pixel_height): * frame.c (Fset_frame_displayable_pixel_height): * frame.c (Fset_frame_width): * frame.c (Fset_frame_pixel_width): * frame.c (Fset_frame_displayable_pixel_width): * frame.c (Fset_frame_size): * frame.c (Fset_frame_pixel_size): * frame.c (Fset_frame_displayable_pixel_size): * frame.c (frame_conversion_internal_1): * frame.c (get_frame_displayable_pixel_size): * frame.c (change_frame_size_1): * frame.c (change_frame_size): * frame.c (generate_title_string): * frame.h: * gtk-xemacs.c: * gtk-xemacs.c (gtk_xemacs_size_request): * gtk-xemacs.c (gtk_xemacs_size_allocate): * gtk-xemacs.c (gtk_xemacs_paint): * gutter.c: * gutter.c (update_gutter_geometry): * redisplay.c (end_hold_frame_size_changes): * redisplay.c (redisplay_frame): * toolbar.c: * toolbar.c (update_frame_toolbars_geometry): * window.c: * window.c (frame_pixsize_valid_p): * window.c (check_frame_size): Various fixes to frame geometry to make it a bit easier to understand and fix some bugs. 1. IMPORTANT: Some renamings. Will need to be applied carefully to the carbon repository, in the following order: -- pixel_to_char_size -> pixel_to_frame_unit_size -- char_to_pixel_size -> frame_unit_to_pixel_size -- pixel_to_real_char_size -> pixel_to_char_size -- char_to_real_pixel_size -> char_to_pixel_size -- Reverse second and third arguments of change_frame_size() and change_frame_size_1() to try to make functions consistent in putting width before height. -- Eliminate old round_size_to_char, because it didn't really do anything differently from round_size_to_real_char() -- round_size_to_real_char -> round_size_to_char; any places that called the old round_size_to_char should just call the new one. 2. IMPORTANT FOR CARBON: The set_frame_size() method is now passed sizes in "frame units", like all other frame-sizing functions, rather than some hacked-up combination of char-cell units and total pixel size. This only affects window systems that use "pixelated geometry", and I'm not sure if Carbon is one of them. MS Windows is pixelated, X and GTK are not. For pixelated-geometry systems, the size in set_frame_size() is in displayable pixels rather than total pixels and needs to be converted appropriately; take a look at the changes made to mswindows_set_frame_size() method if necessary. 3. Add a big long comment in frame.c describing how frame geometry works. 4. Remove MS Windows-specific character height and width fields, duplicative and unused. 5. frame-displayable-pixel-* and set-frame-displayable-pixel-* didn't use to work on MS Windows, but they do now. 6. In general, clean up the handling of "pixelated geometry" so that fewer functions have to worry about this. This is really an abomination that should be removed entirely but that will have to happen later. Fix some buggy code in frame_conversion_internal() that happened to "work" because it was countered by oppositely buggy code in change_frame_size(). 7. Clean up some frame-size code in toolbar.c and use functions already provided in frame.c instead of rolling its own. 8. Fix check_frame_size() in window.c, which formerly didn't take pixelated geometry into account.
author Ben Wing <ben@xemacs.org>
date Mon, 15 Feb 2010 22:14:11 -0600
parents 229bd619740a
children 1fae11d56ad2
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.
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
3
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
4 This file is part of XEmacs.
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
5
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
6 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
7 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
8 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
9 later version.
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
10
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
11 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
12 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
13 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
14 for more details.
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
15
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
16 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
17 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
18 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
19 Boston, MA 02111-1307, USA. */
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
20
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
21 /* Synched up with: Not in FSF. */
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
22
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
23 #ifndef INCLUDED_mc_alloc_h_
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
24 #define INCLUDED_mc_alloc_h_
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
25
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
26 /*--- prototypes -------------------------------------------------------*/
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
27
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
28 BEGIN_C_DECLS
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
29
3305
1043bbfa24cf [xemacs-hg @ 2006-03-26 15:24:25 by crestani]
crestani
parents: 3303
diff changeset
30 /* Set to 1 if memory becomes short. */
1043bbfa24cf [xemacs-hg @ 2006-03-26 15:24:25 by crestani]
crestani
parents: 3303
diff changeset
31 extern EMACS_INT memory_shortage;
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
32
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
33
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
34 /* Internal Allocator Functions: */
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
35
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
36 /* 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
37 requesting memory. */
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
38 void init_mc_allocator (void);
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
39
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
40 /* 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
41 it. */
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
42 void *mc_alloc (size_t size);
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
43
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
44 /* 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
45 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
46 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
47 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
48 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
49 dynamic arrays use this function. */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
50 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
51
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
52 /* 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
53 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
54 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
55 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
56 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
57 void *mc_realloc (void *ptr, size_t size);
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
58
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
59 /* 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
60 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
61 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
62 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
63 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
64 will be uninitialized.*/
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
65 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
66
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
67
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 /* Garbage collection related functions and macros: */
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
70
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
71 enum mark_bit_colors
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
72 {
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
73 WHITE = 0,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
74 BLACK = 1,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
75 GREY = 2
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
76 };
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 /* 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
79 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
80
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
81 /* 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
82 EMACS_INT get_mark_bit (void *ptr);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
83
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
84 /* mark bit macros */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
85 /* 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
86 #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
87
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
88 /* 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
89 #define MARK(ptr) set_mark_bit (ptr, BLACK)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
90
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
91 /* 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
92 #define UNMARK(ptr) set_mark_bit (ptr, WHITE)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
93
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
94 #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
95 #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
96 #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
97
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
98 #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
99 #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
100 #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
101
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
102 /* 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
103 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
104 the object. Returns number of processed pages. */
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
105 EMACS_INT mc_finalize (void);
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
106
3303
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
107 /* 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
108 of processed pages. */
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
109 EMACS_INT mc_sweep (void);
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
110
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 /* Portable dumper related functions and macros: */
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
114
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
115 /* 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
116 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
117 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
118 Returns number of processed pages. */
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
119 EMACS_INT mc_finalize_for_disksave (void);
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
120
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 /* Functions and macros related with allocation statistics: */
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
124
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
125 #ifdef MEMORY_USAGE_STATS
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,
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
129 struct overhead_stats *stats);
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
130 #endif /* MEMORY_USAGE_STATS */
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
131
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
132
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
133 /* Incremental Garbage Collector / Write Barrier Support: */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
134
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
135 /* 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
136 system's PAGESIZE. */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
137 EMACS_INT mc_get_page_size (void);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
138
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
139 /* 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
140 EMACS_INT fault_on_protected_page (void *ptr);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
141
3303
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
142 /* 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
143 Returns number of processed pages. */
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
144 EMACS_INT protect_heap_pages (void);
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
145
3303
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
146 /* 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
147 number of processed pages. */
619edf713d55 [xemacs-hg @ 2006-03-26 14:05:29 by crestani]
crestani
parents: 3263
diff changeset
148 EMACS_INT unprotect_heap_pages (void);
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
149
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
150 /* Remove protection and mark page dirty. */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
151 void unprotect_page_and_mark_dirty (void *ptr);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
152
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
153 /* 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
154 number of repushed objects. */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
155 int repush_all_objects_on_page (void *ptr);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
156
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
157 /* Mark black if object is currently grey. */
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
158 EMACS_INT maybe_mark_black (void *ptr);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
159
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
160 /* 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
161 EMACS_INT object_on_heap_p (void *ptr);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2994
diff changeset
162
2720
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
163 END_C_DECLS
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
164
6fa9919a9a0b [xemacs-hg @ 2005-04-08 23:10:01 by crestani]
crestani
parents:
diff changeset
165 #endif /* INCLUDED_mc_alloc_h_ */