Mercurial > hg > xemacs-beta
changeset 5127:a9c41067dd88 ben-lisp-object
more cleanups, terminology clarification, lots of doc work
-------------------- ChangeLog entries follow: --------------------
man/ChangeLog addition:
2010-03-05 Ben Wing <ben@xemacs.org>
* internals/internals.texi (Introduction to Allocation):
* internals/internals.texi (Integers and Characters):
* internals/internals.texi (Allocation from Frob Blocks):
* internals/internals.texi (lrecords):
* internals/internals.texi (Low-level allocation):
Rewrite section on allocation of Lisp objects to reflect the new
reality. Remove references to nonexistent XSETINT and XSETCHAR.
modules/ChangeLog addition:
2010-03-05 Ben Wing <ben@xemacs.org>
* postgresql/postgresql.c (allocate_pgconn):
* postgresql/postgresql.c (allocate_pgresult):
* postgresql/postgresql.h (struct Lisp_PGconn):
* postgresql/postgresql.h (struct Lisp_PGresult):
* ldap/eldap.c (allocate_ldap):
* ldap/eldap.h (struct Lisp_LDAP):
Same changes as in src/ dir. See large log there in ChangeLog,
but basically:
ALLOC_LISP_OBJECT -> ALLOC_NORMAL_LISP_OBJECT
LISP_OBJECT_HEADER -> NORMAL_LISP_OBJECT_HEADER
../hlo/src/ChangeLog addition:
2010-03-05 Ben Wing <ben@xemacs.org>
* alloc.c:
* alloc.c (old_alloc_sized_lcrecord):
* alloc.c (very_old_free_lcrecord):
* alloc.c (copy_lisp_object):
* alloc.c (zero_sized_lisp_object):
* alloc.c (zero_nonsized_lisp_object):
* alloc.c (lisp_object_storage_size):
* alloc.c (free_normal_lisp_object):
* alloc.c (FREE_FIXED_TYPE_WHEN_NOT_IN_GC):
* alloc.c (ALLOC_FROB_BLOCK_LISP_OBJECT):
* alloc.c (Fcons):
* alloc.c (noseeum_cons):
* alloc.c (make_float):
* alloc.c (make_bignum):
* alloc.c (make_bignum_bg):
* alloc.c (make_ratio):
* alloc.c (make_ratio_bg):
* alloc.c (make_ratio_rt):
* alloc.c (make_bigfloat):
* alloc.c (make_bigfloat_bf):
* alloc.c (size_vector):
* alloc.c (make_compiled_function):
* alloc.c (Fmake_symbol):
* alloc.c (allocate_extent):
* alloc.c (allocate_event):
* alloc.c (make_key_data):
* alloc.c (make_button_data):
* alloc.c (make_motion_data):
* alloc.c (make_process_data):
* alloc.c (make_timeout_data):
* alloc.c (make_magic_data):
* alloc.c (make_magic_eval_data):
* alloc.c (make_eval_data):
* alloc.c (make_misc_user_data):
* alloc.c (Fmake_marker):
* alloc.c (noseeum_make_marker):
* alloc.c (size_string_direct_data):
* alloc.c (make_uninit_string):
* alloc.c (make_string_nocopy):
* alloc.c (mark_lcrecord_list):
* alloc.c (alloc_managed_lcrecord):
* alloc.c (free_managed_lcrecord):
* alloc.c (sweep_lcrecords_1):
* alloc.c (malloced_storage_size):
* buffer.c (allocate_buffer):
* buffer.c (compute_buffer_usage):
* buffer.c (DEFVAR_BUFFER_LOCAL_1):
* buffer.c (nuke_all_buffer_slots):
* buffer.c (common_init_complex_vars_of_buffer):
* buffer.h (struct buffer_text):
* buffer.h (struct buffer):
* bytecode.c:
* bytecode.c (make_compiled_function_args):
* bytecode.c (size_compiled_function_args):
* bytecode.h (struct compiled_function_args):
* casetab.c (allocate_case_table):
* casetab.h (struct Lisp_Case_Table):
* charset.h (struct Lisp_Charset):
* chartab.c (fill_char_table):
* chartab.c (Fmake_char_table):
* chartab.c (make_char_table_entry):
* chartab.c (copy_char_table_entry):
* chartab.c (Fcopy_char_table):
* chartab.c (put_char_table):
* chartab.h (struct Lisp_Char_Table_Entry):
* chartab.h (struct Lisp_Char_Table):
* console-gtk-impl.h (struct gtk_device):
* console-gtk-impl.h (struct gtk_frame):
* console-impl.h (struct console):
* console-msw-impl.h (struct Lisp_Devmode):
* console-msw-impl.h (struct mswindows_device):
* console-msw-impl.h (struct msprinter_device):
* console-msw-impl.h (struct mswindows_frame):
* console-msw-impl.h (struct mswindows_dialog_id):
* console-stream-impl.h (struct stream_console):
* console-stream.c (stream_init_console):
* console-tty-impl.h (struct tty_console):
* console-tty-impl.h (struct tty_device):
* console-tty.c (allocate_tty_console_struct):
* console-x-impl.h (struct x_device):
* console-x-impl.h (struct x_frame):
* console.c (allocate_console):
* console.c (nuke_all_console_slots):
* console.c (DEFVAR_CONSOLE_LOCAL_1):
* console.c (common_init_complex_vars_of_console):
* data.c (make_weak_list):
* data.c (make_weak_box):
* data.c (make_ephemeron):
* database.c:
* database.c (struct Lisp_Database):
* database.c (allocate_database):
* database.c (finalize_database):
* device-gtk.c (allocate_gtk_device_struct):
* device-impl.h (struct device):
* device-msw.c:
* device-msw.c (mswindows_init_device):
* device-msw.c (msprinter_init_device):
* device-msw.c (finalize_devmode):
* device-msw.c (allocate_devmode):
* device-tty.c (allocate_tty_device_struct):
* device-x.c (allocate_x_device_struct):
* device.c:
* device.c (nuke_all_device_slots):
* device.c (allocate_device):
* dialog-msw.c (handle_question_dialog_box):
* elhash.c:
* elhash.c (struct Lisp_Hash_Table):
* elhash.c (finalize_hash_table):
* elhash.c (make_general_lisp_hash_table):
* elhash.c (Fcopy_hash_table):
* elhash.h (htentry):
* emacs.c (main_1):
* eval.c:
* eval.c (size_multiple_value):
* event-stream.c (finalize_command_builder):
* event-stream.c (allocate_command_builder):
* event-stream.c (free_command_builder):
* event-stream.c (event_stream_generate_wakeup):
* event-stream.c (event_stream_resignal_wakeup):
* event-stream.c (event_stream_disable_wakeup):
* event-stream.c (event_stream_wakeup_pending_p):
* events.h (struct Lisp_Timeout):
* events.h (struct command_builder):
* extents-impl.h:
* extents-impl.h (struct extent_auxiliary):
* extents-impl.h (struct extent_info):
* extents-impl.h (set_extent_no_chase_aux_field):
* extents-impl.h (set_extent_no_chase_normal_field):
* extents.c:
* extents.c (gap_array_marker):
* extents.c (gap_array):
* extents.c (extent_list_marker):
* extents.c (extent_list):
* extents.c (stack_of_extents):
* extents.c (gap_array_make_marker):
* extents.c (extent_list_make_marker):
* extents.c (allocate_extent_list):
* extents.c (SLOT):
* extents.c (mark_extent_auxiliary):
* extents.c (allocate_extent_auxiliary):
* extents.c (attach_extent_auxiliary):
* extents.c (size_gap_array):
* extents.c (finalize_extent_info):
* extents.c (allocate_extent_info):
* extents.c (uninit_buffer_extents):
* extents.c (allocate_soe):
* extents.c (copy_extent):
* extents.c (vars_of_extents):
* extents.h:
* faces.c (allocate_face):
* faces.h (struct Lisp_Face):
* faces.h (struct face_cachel):
* file-coding.c:
* file-coding.c (finalize_coding_system):
* file-coding.c (sizeof_coding_system):
* file-coding.c (Fcopy_coding_system):
* file-coding.h (struct Lisp_Coding_System):
* file-coding.h (MARKED_SLOT):
* fns.c (size_bit_vector):
* font-mgr.c:
* font-mgr.c (finalize_fc_pattern):
* font-mgr.c (print_fc_pattern):
* font-mgr.c (Ffc_pattern_p):
* font-mgr.c (Ffc_pattern_create):
* font-mgr.c (Ffc_name_parse):
* font-mgr.c (Ffc_name_unparse):
* font-mgr.c (Ffc_pattern_duplicate):
* font-mgr.c (Ffc_pattern_add):
* font-mgr.c (Ffc_pattern_del):
* font-mgr.c (Ffc_pattern_get):
* font-mgr.c (fc_config_create_using):
* font-mgr.c (fc_strlist_to_lisp_using):
* font-mgr.c (fontset_to_list):
* font-mgr.c (Ffc_config_p):
* font-mgr.c (Ffc_config_up_to_date):
* font-mgr.c (Ffc_config_build_fonts):
* font-mgr.c (Ffc_config_get_cache):
* font-mgr.c (Ffc_config_get_fonts):
* font-mgr.c (Ffc_config_set_current):
* font-mgr.c (Ffc_config_get_blanks):
* font-mgr.c (Ffc_config_get_rescan_interval):
* font-mgr.c (Ffc_config_set_rescan_interval):
* font-mgr.c (Ffc_config_app_font_add_file):
* font-mgr.c (Ffc_config_app_font_add_dir):
* font-mgr.c (Ffc_config_app_font_clear):
* font-mgr.c (size):
* font-mgr.c (Ffc_config_substitute):
* font-mgr.c (Ffc_font_render_prepare):
* font-mgr.c (Ffc_font_match):
* font-mgr.c (Ffc_font_sort):
* font-mgr.c (finalize_fc_config):
* font-mgr.c (print_fc_config):
* font-mgr.h:
* font-mgr.h (struct fc_pattern):
* font-mgr.h (XFC_PATTERN):
* font-mgr.h (struct fc_config):
* font-mgr.h (XFC_CONFIG):
* frame-gtk.c (allocate_gtk_frame_struct):
* frame-impl.h (struct frame):
* frame-msw.c (mswindows_init_frame_1):
* frame-x.c (allocate_x_frame_struct):
* frame.c (nuke_all_frame_slots):
* frame.c (allocate_frame_core):
* gc.c:
* gc.c (GC_CHECK_NOT_FREE):
* glyphs.c (finalize_image_instance):
* glyphs.c (allocate_image_instance):
* glyphs.c (Fcolorize_image_instance):
* glyphs.c (allocate_glyph):
* glyphs.c (unmap_subwindow_instance_cache_mapper):
* glyphs.c (register_ignored_expose):
* glyphs.h (struct Lisp_Image_Instance):
* glyphs.h (struct Lisp_Glyph):
* glyphs.h (struct glyph_cachel):
* glyphs.h (struct expose_ignore):
* gui.c (allocate_gui_item):
* gui.h (struct Lisp_Gui_Item):
* keymap.c (struct Lisp_Keymap):
* keymap.c (make_keymap):
* lisp.h:
* lisp.h (struct Lisp_String_Direct_Data):
* lisp.h (struct Lisp_String_Indirect_Data):
* lisp.h (struct Lisp_Vector):
* lisp.h (struct Lisp_Bit_Vector):
* lisp.h (DECLARE_INLINE_LISP_BIT_VECTOR):
* lisp.h (struct weak_box):
* lisp.h (struct ephemeron):
* lisp.h (struct weak_list):
* lrecord.h:
* lrecord.h (struct lrecord_implementation):
* lrecord.h (MC_ALLOC_CALL_FINALIZER):
* lrecord.h (struct lcrecord_list):
* lstream.c (finalize_lstream):
* lstream.c (sizeof_lstream):
* lstream.c (Lstream_new):
* lstream.c (Lstream_delete):
* lstream.h (struct lstream):
* marker.c:
* marker.c (finalize_marker):
* marker.c (compute_buffer_marker_usage):
* mule-charset.c:
* mule-charset.c (make_charset):
* mule-charset.c (compute_charset_usage):
* objects-impl.h (struct Lisp_Color_Instance):
* objects-impl.h (struct Lisp_Font_Instance):
* objects-tty-impl.h (struct tty_color_instance_data):
* objects-tty-impl.h (struct tty_font_instance_data):
* objects-tty.c (tty_initialize_color_instance):
* objects-tty.c (tty_initialize_font_instance):
* objects.c (finalize_color_instance):
* objects.c (Fmake_color_instance):
* objects.c (finalize_font_instance):
* objects.c (Fmake_font_instance):
* objects.c (reinit_vars_of_objects):
* opaque.c:
* opaque.c (sizeof_opaque):
* opaque.c (make_opaque_ptr):
* opaque.c (free_opaque_ptr):
* opaque.h:
* opaque.h (Lisp_Opaque):
* opaque.h (Lisp_Opaque_Ptr):
* print.c (printing_unreadable_lcrecord):
* print.c (external_object_printer):
* print.c (debug_p4):
* process.c (finalize_process):
* process.c (make_process_internal):
* procimpl.h (struct Lisp_Process):
* rangetab.c (Fmake_range_table):
* rangetab.c (Fcopy_range_table):
* rangetab.h (struct Lisp_Range_Table):
* scrollbar.c:
* scrollbar.c (create_scrollbar_instance):
* scrollbar.c (compute_scrollbar_instance_usage):
* scrollbar.h (struct scrollbar_instance):
* specifier.c (finalize_specifier):
* specifier.c (sizeof_specifier):
* specifier.c (set_specifier_caching):
* specifier.h (struct Lisp_Specifier):
* specifier.h (struct specifier_caching):
* symeval.h:
* symeval.h (SYMBOL_VALUE_MAGIC_P):
* symeval.h (DEFVAR_SYMVAL_FWD):
* symsinit.h:
* syntax.c (init_buffer_syntax_cache):
* syntax.h (struct syntax_cache):
* toolbar.c:
* toolbar.c (allocate_toolbar_button):
* toolbar.c (update_toolbar_button):
* toolbar.h (struct toolbar_button):
* tooltalk.c (struct Lisp_Tooltalk_Message):
* tooltalk.c (make_tooltalk_message):
* tooltalk.c (struct Lisp_Tooltalk_Pattern):
* tooltalk.c (make_tooltalk_pattern):
* ui-gtk.c:
* ui-gtk.c (allocate_ffi_data):
* ui-gtk.c (emacs_gtk_object_finalizer):
* ui-gtk.c (allocate_emacs_gtk_object_data):
* ui-gtk.c (allocate_emacs_gtk_boxed_data):
* ui-gtk.h:
* window-impl.h (struct window):
* window-impl.h (struct window_mirror):
* window.c (finalize_window):
* window.c (allocate_window):
* window.c (new_window_mirror):
* window.c (mark_window_as_deleted):
* window.c (make_dummy_parent):
* window.c (compute_window_mirror_usage):
* window.c (compute_window_usage):
Overall point of this change and previous ones in this repository:
(1) Introduce new, clearer terminology: everything other than int
or char is a "record" object, which comes in two types: "normal
objects" and "frob-block objects". Fix up all places that
referred to frob-block objects as "simple", "basic", etc.
(2) Provide an advertised interface for doing operations on Lisp
objects, including creating new types, that is clean and
consistent in its naming, uses the above-referenced terms and
avoids referencing "lrecords", "old lcrecords", etc., which should
hide under the surface.
(3) Make the size_in_bytes and finalizer methods take a
Lisp_Object rather than a void * for consistency with other methods.
(4) Separate finalizer method into finalizer and disksaver, so
that normal finalize methods don't have to worry about disksaving.
Other specifics:
(1) Renaming:
LISP_OBJECT_HEADER -> NORMAL_LISP_OBJECT_HEADER
ALLOC_LISP_OBJECT -> ALLOC_NORMAL_LISP_OBJECT
implementation->basic_p -> implementation->frob_block_p
ALLOCATE_FIXED_TYPE_AND_SET_IMPL -> ALLOC_FROB_BLOCK_LISP_OBJECT
*FCCONFIG*, wrap_fcconfig -> *FC_CONFIG*, wrap_fc_config
*FCPATTERN*, wrap_fcpattern -> *FC_PATTERN*, wrap_fc_pattern
(the last two changes make the naming of these macros consistent
with the naming of all other macros, since the objects are named
fc-config and fc-pattern with a hyphen)
(2) Lots of documentation fixes in lrecord.h.
(3) Eliminate macros for copying, freeing, zeroing objects, getting
their storage size. Instead, new functions:
zero_sized_lisp_object()
zero_nonsized_lisp_object()
lisp_object_storage_size()
free_normal_lisp_object()
(copy_lisp_object() already exists)
LISP_OBJECT_FROB_BLOCK_P() (actually a macro)
Eliminated:
free_lrecord()
zero_lrecord()
copy_lrecord()
copy_sized_lrecord()
old_copy_lcrecord()
old_copy_sized_lcrecord()
old_zero_lcrecord()
old_zero_sized_lcrecord()
LISP_OBJECT_STORAGE_SIZE()
COPY_SIZED_LISP_OBJECT()
COPY_SIZED_LCRECORD()
COPY_LISP_OBJECT()
ZERO_LISP_OBJECT()
FREE_LISP_OBJECT()
(4) Catch the remaining places where lrecord stuff was used directly
and use the advertised interface, e.g. alloc_sized_lrecord() ->
ALLOC_SIZED_LISP_OBJECT().
(5) Make certain statically-declared pseudo-objects
(buffer_local_flags, console_local_flags) have their lheader
initialized correctly, so things like copy_lisp_object() can work
on them. Make extent_auxiliary_defaults a proper heap object
Vextent_auxiliary_defaults, and make extent auxiliaries dumpable
so that this object can be dumped. allocate_extent_auxiliary()
now just creates the object, and attach_extent_auxiliary()
creates an extent auxiliary and attaches to an extent, like the
old allocate_extent_auxiliary().
(6) Create EXTENT_AUXILIARY_SLOTS macro, similar to the foo-slots.h
files but in a macro instead of a file. The purpose is to avoid
duplication when iterating over all the slots in an extent auxiliary.
Use it.
(7) In lstream.c, don't zero out object after allocation because
allocation routines take care of this.
(8) In marker.c, fix a mistake in computing marker overhead.
(9) In print.c, clean up printing_unreadable_lcrecord(),
external_object_printer() to avoid lots of ifdef NEW_GC's.
(10) Separate toolbar-button allocation into a separate
allocate_toolbar_button() function for use in the example code
in lrecord.h.
line wrap: on
line diff
--- a/man/ChangeLog Wed Feb 24 19:04:27 2010 -0600 +++ b/man/ChangeLog Fri Mar 05 04:08:17 2010 -0600 @@ -1,3 +1,13 @@ +2010-03-05 Ben Wing <ben@xemacs.org> + + * internals/internals.texi (Introduction to Allocation): + * internals/internals.texi (Integers and Characters): + * internals/internals.texi (Allocation from Frob Blocks): + * internals/internals.texi (lrecords): + * internals/internals.texi (Low-level allocation): + Rewrite section on allocation of Lisp objects to reflect the new + reality. Remove references to nonexistent XSETINT and XSETCHAR. + 2010-02-20 Ben Wing <ben@xemacs.org> * internals/internals.texi (Intro to Window and Frame Geometry):
--- a/man/internals/internals.texi Wed Feb 24 19:04:27 2010 -0600 +++ b/man/internals/internals.texi Fri Mar 05 04:08:17 2010 -0600 @@ -7752,7 +7752,7 @@ @code{GCPRO}ed. @end itemize - In the remaining two categories, the type is stored in the object +In the remaining two categories, the type is stored in the object itself. The tag for all such objects is the generic @dfn{lrecord} (Lisp_Type_Record) tag. The first bytes of the object's structure are an integer (actually a char) characterising the object's type and some @@ -8488,45 +8488,40 @@ @cindex integers and characters @cindex characters, integers and - Integer and character Lisp objects are created from integers using the -macros @code{XSETINT()} and @code{XSETCHAR()} or the equivalent +Integer and character Lisp objects are created from integers using the functions @code{make_int()} and @code{make_char()}. (These are actually macros on most systems.) These functions basically just do some moving of bits around, since the integral value of the object is stored directly in the @code{Lisp_Object}. - @code{XSETINT()} and the like will truncate values given to them that -are too big; i.e. you won't get the value you expected but the tag bits -will at least be correct. - @node Allocation from Frob Blocks, lrecords, Integers and Characters, Allocation of Objects in XEmacs Lisp @section Allocation from Frob Blocks @cindex allocation from frob blocks @cindex frob blocks, allocation from -The uninitialized memory required by a @code{Lisp_Object} of a particular type -is allocated using -@code{ALLOCATE_FIXED_TYPE()}. This only occurs inside of the -lowest-level object-creating functions in @file{alloc.c}: -@code{Fcons()}, @code{make_float()}, @code{Fmake_byte_code()}, -@code{Fmake_symbol()}, @code{allocate_extent()}, -@code{allocate_event()}, @code{Fmake_marker()}, and -@code{make_uninit_string()}. The idea is that, for each type, there are -a number of frob blocks (each 2K in size); each frob block is divided up -into object-sized chunks. Each frob block will have some of these -chunks that are currently assigned to objects, and perhaps some that are -free. (If a frob block has nothing but free chunks, it is freed at the -end of the garbage collection cycle.) The free chunks are stored in a -free list, which is chained by storing a pointer in the first four bytes -of the chunk. (Except for the free chunks at the end of the last frob -block, which are handled using an index which points past the end of the +The uninitialized memory required by a @code{Lisp_Object} of a +particular type is allocated using @code{ALLOCATE_FIXED_TYPE()}. This +only occurs inside of the lowest-level object-creating functions in +@file{alloc.c}: @code{Fcons()}, @code{make_float()}, +@code{Fmake_byte_code()}, @code{Fmake_symbol()}, +@code{allocate_extent()}, @code{allocate_event()}, +@code{Fmake_marker()}, and @code{make_uninit_string()}. The idea is +that, for each type, there are a number of frob blocks (each 2K in +size); each frob block is divided up into object-sized chunks. Each +frob block will have some of these chunks that are currently assigned +to objects, and perhaps some that are free. (If a frob block has +nothing but free chunks, it is freed at the end of the garbage +collection cycle.) The free chunks are stored in a free list, which +is chained by storing a pointer in the first four bytes of the +chunk. (Except for the free chunks at the end of the last frob block, +which are handled using an index which points past the end of the last-allocated chunk in the last frob block.) @code{ALLOCATE_FIXED_TYPE()} first tries to retrieve a chunk from the free list; if that fails, it calls @code{ALLOCATE_FIXED_TYPE_FROM_BLOCK()}, which looks at the end of the last frob block for space, and creates a new frob block if there is -none. (There are actually two versions of these macros, one of which is -more defensive but less efficient and is used for error-checking.) +none. (There are actually two versions of these macros, one of which +is more defensive but less efficient and is used for error-checking.) @node lrecords, Low-level allocation, Allocation from Frob Blocks, Allocation of Objects in XEmacs Lisp @section lrecords @@ -8537,7 +8532,7 @@ @strong{This node needs updating for the ``new garbage collection algorithms'' (KKCC) and the ``incremental'' collector.} - All lrecords have at the beginning of their structure a @code{struct +All lrecords have at the beginning of their structure a @code{struct lrecord_header}. This just contains a type number and some flags, including the mark bit. All builtin type numbers are defined as constants in @code{enum lrecord_type}, to allow the compiler to generate @@ -8546,11 +8541,11 @@ lrecord_implementation}, which is a structure containing method pointers and such. There is one of these for each type, and it is a global, constant, statically-declared structure that is declared in the -@code{DEFINE_LRECORD_IMPLEMENTATION()} macro. - - Simple lrecords (of type (b) above) just have a @code{struct -lrecord_header} at their beginning. lcrecords, however, actually have a -@code{struct lcrecord_header}. This, in turn, has a @code{struct +@code{DEFINE_*_LISP_OBJECT()} macro. + +Frob-block lrecords just have a @code{struct lrecord_header} at their +beginning. lcrecords, however, actually have a +@code{struct old_lcrecord_header}. This, in turn, has a @code{struct lrecord_header} at its beginning, so sanity is preserved; but it also has a pointer used to chain all lcrecords together, and a special ID field used to distinguish one lcrecord from another. (This field is used @@ -8560,25 +8555,24 @@ @strong{lcrecords are now obsolete when using the write-barrier-based collector.} - Simple lrecords are created using @code{ALLOCATE_FIXED_TYPE()}, just -like for other frob blocks. The only change is that the implementation -pointer must be initialized correctly. (The implementation structure for -an lrecord, or rather the pointer to it, is named @code{lrecord_float}, -@code{lrecord_extent}, @code{lrecord_buffer}, etc.) - - lcrecords are created using @code{alloc_lcrecord()}. This takes a -size to allocate and an implementation pointer. (The size needs to be -passed because some lcrecords, such as window configurations, are of -variable size.) This basically just @code{malloc()}s the storage, -initializes the @code{struct lcrecord_header}, and chains the lcrecord -onto the head of the list of all lcrecords, which is stored in the -variable @code{all_lcrecords}. The calls to @code{alloc_lcrecord()} -generally occur in the lowest-level allocation function for each lrecord -type. - -Whenever you create an lrecord, you need to call either -@code{DEFINE_LRECORD_IMPLEMENTATION()} or -@code{DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION()}. This needs to be +Frob-block objects are created using @code{ALLOC_FROB_BLOCK_LISP_OBJECT()}. +All this does is call @code{ALLOCATE_FIXED_TYPE()} to allocate an +object, and @code{set_lheader_implementation()} to initialize the header. + +Normal objects (i.e. lcrecords) are created using +@code{ALLOC_NORMAL_LISP_OBJECT()}, which takes a type name (resolved +internally to a structure named @code{lrecord_foo} for type +@code{foo}). If they are of variable size, however, they are created +with @code{ALLOC_SIZED_LISP_OBJECT()}, which takes a size to allocate +in addition to a type. This basically just @code{malloc()}s the +storage, initializes the @code{struct lcrecord_header}, and chains the +lcrecord onto the head of the list of all lcrecords, which is stored +in the variable @code{all_lcrecords}. The calls to the above +allocation macros generally occur in the lowest-level allocation +function for each lrecord type. + +Whenever you create a normal object, you need to call one of the +@code{DEFINE_*_LISP_OBJECT()} macros. This needs to be specified in a @file{.c} file, at the top level. What this actually does is define and initialize the implementation structure for the lrecord. (And possibly declares a function @code{error_check_foo()} that @@ -8595,26 +8589,73 @@ to add new object types without having to add a specific case for each new type in a bunch of different places. - The difference between @code{DEFINE_LRECORD_IMPLEMENTATION()} and -@code{DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION()} is that the former is -used for fixed-size object types and the latter is for variable-size -object types. Most object types are fixed-size; some complex -types, however (e.g. window configurations), are variable-size. -Variable-size object types have an extra method, which is called -to determine the actual size of a particular object of that type. -(Currently this is only used for keeping allocation statistics.) - - For the purpose of keeping allocation statistics, the allocation +The various macros for defining Lisp objects are as follows: + +@itemize @bullet +@item +@code{DEFINE_*_LISP_OBJECT} is for objects with constant size. (Either +@code{DEFINE_DUMPABLE_LISP_OBJECT} for objects that can be saved in a +dumped executable, or @code{DEFINE_NODUMP_LISP_OBJECT} for objects +that cannot be saved -- e.g. that contain pointers to non-persistent +external objects such as window-system windows.) + +@item +@code{DEFINE_*_SIZABLE_LISP_OBJECT} is for objects whose size varies. +This includes some simple types such as vectors, bit vectors and +opaque objects, as well complex types, especially types such as +specifiers, lstreams or coding systems that have subtypes and include +subtype-specific data attached to the end of the structure. +Variable-size objects have an extra method that returns the size of +the object. This is not used at allocation (rather, the size is +specified in the call to the allocation macro), but is used for +operations such as copying a Lisp object, as well as for keeping +allocation statistics. + +@item +@code{DEFINE_*_FROB_BLOCK_LISP_OBJECT} is for objects that are +allocated in large blocks (``frob blocks''), which are parceled up +individually. Such objects need special handling in @file{alloc.c}. +This does not apply to NEW_GC, because it does this automatically. + +@item +@code{DEFINE_*_INTERNAL_LISP_OBJECT} is for ``internal'' objects that +should never be visible on the Lisp level. This is a shorthand for +the most common type of internal objects, which have no equal or hash +method (since they generally won't appear in hash tables), no +finalizer and @code{internal_object_printer()} as their print method +(which prints that the object is internal and shouldn't be visible +externally). For internal objects needing a finalizer, equal or hash +method, or wanting to customize the print method, use the normal +@code{DEFINE_*_LISP_OBJECT} mechanism for defining these objects. + +@item +@code{DEFINE_*_GENERAL_LISP_OBJECT} is for objects that need to +provide one of the less common methods that are omitted on most +objects. These methods include the methods supporting the unified +property interface using @code{get}, @code{put}, @code{remprop} and +@code{object-plist}, and (for dumpable objects only) the +@code{disksaver} method. + +@item +@code{DEFINE_MODULE_*} is for objects defined in an external module. +@end itemize + +@code{MAKE_LISP_OBJECT} and @code{MAKE_MODULE_LISP_OBJECT} are what +underlies all of these; they define a structure containing pointers to +object methods and other info such as the size of the structure +containing the object. + +For the purpose of keeping allocation statistics, the allocation engine keeps a list of all the different types that exist. Note that, -since @code{DEFINE_LRECORD_IMPLEMENTATION()} is a macro that is -specified at top-level, there is no way for it to initialize the global -data structures containing type information, like +since @code{DEFINE_*_LISP_OBJECT()} is a macro that is +specified at top-level, there is no way for it to initialize the +global data structures containing type information, like @code{lrecord_implementations_table}. For this reason a call to -@code{INIT_LRECORD_IMPLEMENTATION} must be added to the same source file -containing @code{DEFINE_LRECORD_IMPLEMENTATION}, but instead of to the -top level, to one of the init functions, typically -@code{syms_of_@var{foo}.c}. @code{INIT_LRECORD_IMPLEMENTATION} must be -called before an object of this type is used. +@code{INIT_LISP_OBJECT()} must be added to the same source +file containing @code{DEFINE_*_LISP_OBJECT()}, but instead of +to the top level, to one of the init functions, typically +@code{syms_of_@var{foo}.c}. @code{INIT_LISP_OBJECT()} must +be called before an object of this type is used. The type number is also used to index into an array holding the number of objects of each type and the total memory allocated for objects of @@ -8622,24 +8663,25 @@ stage. These statistics are returned by the call to @code{garbage-collect}. - Note that for every type defined with a @code{DEFINE_LRECORD_*()} -macro, there needs to be a @code{DECLARE_LRECORD_IMPLEMENTATION()} -somewhere in a @file{.h} file, and this @file{.h} file needs to be -included by @file{inline.c}. - - Furthermore, there should generally be a set of @code{XFOOBAR()}, -@code{FOOBARP()}, etc. macros in a @file{.h} (or occasionally @file{.c}) -file. To create one of these, copy an existing model and modify as -necessary. - - @strong{Please note:} If you define an lrecord in an external -dynamically-loaded module, you must use @code{DECLARE_EXTERNAL_LRECORD}, -@code{DEFINE_EXTERNAL_LRECORD_IMPLEMENTATION}, and -@code{DEFINE_EXTERNAL_LRECORD_SEQUENCE_IMPLEMENTATION} instead of the -non-EXTERNAL forms. These macros will dynamically add new type numbers -to the global enum that records them, whereas the non-EXTERNAL forms -assume that the programmer has already inserted the correct type numbers -into the enum's code at compile-time. +Note that for every type defined with a @code{DEFINE_*_LISP_OBJECT()} +macro, there needs to be a @code{DECLARE_LISP_OBJECT()} somewhere in a +@file{.h} file, and this @file{.h} file needs to be included by +@file{inline.c}. + +Furthermore, there should generally be a set of @code{XFOOBAR()}, +@code{FOOBARP()}, etc. macros in a @file{.h} (or occasionally +@file{.c}) file. To create one of these, copy an existing model and +modify as necessary. + +@strong{Please note:} If you define an lrecord in an external +dynamically-loaded module, you must use +@code{DECLARE_MODULE_LISP_OBJECT()}, +@code{DEFINE_MODULE_*_LISP_OBJECT()}, and +@code{INIT_MODULE_LISP_OBJECT()} instead of the non-MODULE +forms. These macros will dynamically add new type numbers to the +global enum that records them, whereas the non-MODULE forms assume +that the programmer has already inserted the correct type numbers into +the enum's code at compile-time. The various methods in the lrecord implementation structure are: @@ -8703,25 +8745,18 @@ The finalize method can be NULL if nothing needs to be done. -WARNING #1: The finalize method is also called at the end of the dump -phase; this time with the for_disksave parameter set to non-zero. The -object is @emph{not} about to disappear, so you have to make sure to -@emph{not} free any extra @code{malloc()}ed memory if you're going to -need it later. (Also, signal an error if there are any operating-system -and window-system resources here, because they can't be dumped.) - Finalize methods should, as a rule, set to zero any pointers after -they've been freed, and check to make sure pointers are not zero before -freeing. Although I'm pretty sure that finalize methods are not called -twice on the same object (except for the @code{for_disksave} proviso), -we've gotten nastily burned in some cases by not doing this. - -WARNING #2: The finalize method is @emph{only} called for -lcrecords, @emph{not} for simply lrecords. If you need a -finalize method for simple lrecords, you have to stick +they've been freed, and check to make sure pointers are not zero +before freeing. Although I'm pretty sure that finalize methods are +not called twice on the same object, we've gotten nastily burned in +some cases by not doing this. + +WARNING #1: The finalize method is @emph{only} called for +normal objects, @emph{not} for frob-block objects. If you need a +finalize method for frob-block objects, you have to stick it in the @code{ADDITIONAL_FREE_foo()} macro in @file{alloc.c}. -WARNING #3: Things are in an @emph{extremely} bizarre state +WARNING #2: Things are in an @emph{extremely} bizarre state when @code{ADDITIONAL_FREE_foo()} is called, so you have to be incredibly careful when writing one of these functions. See the comment in @code{gc_sweep()}. If you ever have to add @@ -8761,17 +8796,33 @@ @item @dfn{getprop}, @dfn{putprop}, @dfn{remprop}, and @dfn{plist} methods. -These are used for object types that have properties. I don't feel like -documenting them here. If you create one of these objects, you have to -use different macros to define them, -i.e. @code{DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS()} or -@code{DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION_WITH_PROPS()}. +These are used for object types that have properties, and are called +when @code{get}, @code{put}, @code{remprop}, and @code{object-plist}, +respectively are called on the object. If you create one of these +objects, you have to use a different macro to define them, +i.e. @code{DEFINE_*_GENERAL_LISP_OBJECT()}. @item A @dfn{size_in_bytes} method, when the object is of variable-size. -(i.e. declared with a @code{_SEQUENCE_IMPLEMENTATION} macro.) This should -simply return the object's size in bytes, exactly as you might expect. -For an example, see the methods for window configurations and opaques. +(i.e. declared with a @code{DEFINE_*_SIZABLE_*_LISP_OBJECT} macro.) +This should simply return the object's size in bytes, exactly as you +might expect. For an example, see the methods for lstreams and opaques. + +@item +A @dfn{disksave} method. This is called at the end of the dump phase. +It is used for objects that contain pointers or handles to objects +created in external libraries, such as window-system windows or file +handles. Such external objects cannot be dumped, so it is necessary +to release them at dump time and arrange somehow or other for them to +be resurrected if necessary later on. + +It seems that even non-dumpable objects may be around at dump time, +and a disksaver may be provided. (In fact, the only object currently +with a disksaver, lstream, is non-dumpable.) + +Objects rarely need to provide this method; most of the time it will +be NULL. If you want to provide this method, you have to use the +@code{DEFINE_*_GENERAL_LISP_OBJECT()} macro to define your object. @end enumerate @node Low-level allocation, Cons, lrecords, Allocation of Objects in XEmacs Lisp
--- a/modules/ChangeLog Wed Feb 24 19:04:27 2010 -0600 +++ b/modules/ChangeLog Fri Mar 05 04:08:17 2010 -0600 @@ -1,3 +1,17 @@ +2010-03-05 Ben Wing <ben@xemacs.org> + + * postgresql/postgresql.c (allocate_pgconn): + * postgresql/postgresql.c (allocate_pgresult): + * postgresql/postgresql.h (struct Lisp_PGconn): + * postgresql/postgresql.h (struct Lisp_PGresult): + * ldap/eldap.c (allocate_ldap): + * ldap/eldap.h (struct Lisp_LDAP): + Same changes as in src/ dir. See large log there in ChangeLog, + but basically: + + ALLOC_LISP_OBJECT -> ALLOC_NORMAL_LISP_OBJECT + LISP_OBJECT_HEADER -> NORMAL_LISP_OBJECT_HEADER + 2010-02-06 Ben Wing <ben@xemacs.org> * canna/canna_api.c:
--- a/modules/ldap/eldap.c Wed Feb 24 19:04:27 2010 -0600 +++ b/modules/ldap/eldap.c Fri Mar 05 04:08:17 2010 -0600 @@ -141,7 +141,7 @@ static Lisp_LDAP * allocate_ldap (void) { - Lisp_LDAP *ldap = XLDAP (ALLOC_LISP_OBJECT (ldap)); + Lisp_LDAP *ldap = XLDAP (ALLOC_NORMAL_LISP_OBJECT (ldap)); ldap->ld = NULL; ldap->host = Qnil;
--- a/modules/ldap/eldap.h Wed Feb 24 19:04:27 2010 -0600 +++ b/modules/ldap/eldap.h Fri Mar 05 04:08:17 2010 -0600 @@ -38,7 +38,7 @@ struct Lisp_LDAP { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; /* The LDAP connection handle used by the LDAP API */ LDAP *ld; /* Name of the host we connected to */
--- a/modules/postgresql/postgresql.c Wed Feb 24 19:04:27 2010 -0600 +++ b/modules/postgresql/postgresql.c Fri Mar 05 04:08:17 2010 -0600 @@ -268,7 +268,7 @@ Lisp_PGconn *pgconn = ALLOC_LCRECORD_TYPE (Lisp_PGconn, &lrecord_pgconn); #else - Lisp_PGconn *pgconn = XPGCONN (ALLOC_LISP_OBJECT (pgconn)); + Lisp_PGconn *pgconn = XPGCONN (ALLOC_NORMAL_LISP_OBJECT (pgconn)); #endif pgconn->pgconn = (PGconn *)NULL; return pgconn; @@ -420,7 +420,7 @@ Lisp_PGresult *pgresult = ALLOC_LCRECORD_TYPE (Lisp_PGresult, &lrecord_pgresult); #else - Lisp_PGresult *pgresult = XPGRESULT (ALLOC_LISP_OBJECT (pgresult)); + Lisp_PGresult *pgresult = XPGRESULT (ALLOC_NORMAL_LISP_OBJECT (pgresult)); #endif pgresult->pgresult = (PGresult *)NULL; return pgresult;
--- a/modules/postgresql/postgresql.h Wed Feb 24 19:04:27 2010 -0600 +++ b/modules/postgresql/postgresql.h Fri Mar 05 04:08:17 2010 -0600 @@ -28,7 +28,7 @@ */ struct Lisp_PGconn { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; PGconn *pgconn; }; typedef struct Lisp_PGconn Lisp_PGconn; @@ -48,7 +48,7 @@ */ struct Lisp_PGresult { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; PGresult *pgresult; }; typedef struct Lisp_PGresult Lisp_PGresult;
--- a/src/ChangeLog Wed Feb 24 19:04:27 2010 -0600 +++ b/src/ChangeLog Fri Mar 05 04:08:17 2010 -0600 @@ -1,3 +1,408 @@ +2010-03-05 Ben Wing <ben@xemacs.org> + + * alloc.c: + * alloc.c (old_alloc_sized_lcrecord): + * alloc.c (very_old_free_lcrecord): + * alloc.c (copy_lisp_object): + * alloc.c (zero_sized_lisp_object): + * alloc.c (zero_nonsized_lisp_object): + * alloc.c (lisp_object_storage_size): + * alloc.c (free_normal_lisp_object): + * alloc.c (FREE_FIXED_TYPE_WHEN_NOT_IN_GC): + * alloc.c (ALLOC_FROB_BLOCK_LISP_OBJECT): + * alloc.c (Fcons): + * alloc.c (noseeum_cons): + * alloc.c (make_float): + * alloc.c (make_bignum): + * alloc.c (make_bignum_bg): + * alloc.c (make_ratio): + * alloc.c (make_ratio_bg): + * alloc.c (make_ratio_rt): + * alloc.c (make_bigfloat): + * alloc.c (make_bigfloat_bf): + * alloc.c (size_vector): + * alloc.c (make_compiled_function): + * alloc.c (Fmake_symbol): + * alloc.c (allocate_extent): + * alloc.c (allocate_event): + * alloc.c (make_key_data): + * alloc.c (make_button_data): + * alloc.c (make_motion_data): + * alloc.c (make_process_data): + * alloc.c (make_timeout_data): + * alloc.c (make_magic_data): + * alloc.c (make_magic_eval_data): + * alloc.c (make_eval_data): + * alloc.c (make_misc_user_data): + * alloc.c (Fmake_marker): + * alloc.c (noseeum_make_marker): + * alloc.c (size_string_direct_data): + * alloc.c (make_uninit_string): + * alloc.c (make_string_nocopy): + * alloc.c (mark_lcrecord_list): + * alloc.c (alloc_managed_lcrecord): + * alloc.c (free_managed_lcrecord): + * alloc.c (sweep_lcrecords_1): + * alloc.c (malloced_storage_size): + * buffer.c (allocate_buffer): + * buffer.c (compute_buffer_usage): + * buffer.c (DEFVAR_BUFFER_LOCAL_1): + * buffer.c (nuke_all_buffer_slots): + * buffer.c (common_init_complex_vars_of_buffer): + * buffer.h (struct buffer_text): + * buffer.h (struct buffer): + * bytecode.c: + * bytecode.c (make_compiled_function_args): + * bytecode.c (size_compiled_function_args): + * bytecode.h (struct compiled_function_args): + * casetab.c (allocate_case_table): + * casetab.h (struct Lisp_Case_Table): + * charset.h (struct Lisp_Charset): + * chartab.c (fill_char_table): + * chartab.c (Fmake_char_table): + * chartab.c (make_char_table_entry): + * chartab.c (copy_char_table_entry): + * chartab.c (Fcopy_char_table): + * chartab.c (put_char_table): + * chartab.h (struct Lisp_Char_Table_Entry): + * chartab.h (struct Lisp_Char_Table): + * console-gtk-impl.h (struct gtk_device): + * console-gtk-impl.h (struct gtk_frame): + * console-impl.h (struct console): + * console-msw-impl.h (struct Lisp_Devmode): + * console-msw-impl.h (struct mswindows_device): + * console-msw-impl.h (struct msprinter_device): + * console-msw-impl.h (struct mswindows_frame): + * console-msw-impl.h (struct mswindows_dialog_id): + * console-stream-impl.h (struct stream_console): + * console-stream.c (stream_init_console): + * console-tty-impl.h (struct tty_console): + * console-tty-impl.h (struct tty_device): + * console-tty.c (allocate_tty_console_struct): + * console-x-impl.h (struct x_device): + * console-x-impl.h (struct x_frame): + * console.c (allocate_console): + * console.c (nuke_all_console_slots): + * console.c (DEFVAR_CONSOLE_LOCAL_1): + * console.c (common_init_complex_vars_of_console): + * data.c (make_weak_list): + * data.c (make_weak_box): + * data.c (make_ephemeron): + * database.c: + * database.c (struct Lisp_Database): + * database.c (allocate_database): + * database.c (finalize_database): + * device-gtk.c (allocate_gtk_device_struct): + * device-impl.h (struct device): + * device-msw.c: + * device-msw.c (mswindows_init_device): + * device-msw.c (msprinter_init_device): + * device-msw.c (finalize_devmode): + * device-msw.c (allocate_devmode): + * device-tty.c (allocate_tty_device_struct): + * device-x.c (allocate_x_device_struct): + * device.c: + * device.c (nuke_all_device_slots): + * device.c (allocate_device): + * dialog-msw.c (handle_question_dialog_box): + * elhash.c: + * elhash.c (struct Lisp_Hash_Table): + * elhash.c (finalize_hash_table): + * elhash.c (make_general_lisp_hash_table): + * elhash.c (Fcopy_hash_table): + * elhash.h (htentry): + * emacs.c (main_1): + * eval.c: + * eval.c (size_multiple_value): + * event-stream.c (finalize_command_builder): + * event-stream.c (allocate_command_builder): + * event-stream.c (free_command_builder): + * event-stream.c (event_stream_generate_wakeup): + * event-stream.c (event_stream_resignal_wakeup): + * event-stream.c (event_stream_disable_wakeup): + * event-stream.c (event_stream_wakeup_pending_p): + * events.h (struct Lisp_Timeout): + * events.h (struct command_builder): + * extents-impl.h: + * extents-impl.h (struct extent_auxiliary): + * extents-impl.h (struct extent_info): + * extents-impl.h (set_extent_no_chase_aux_field): + * extents-impl.h (set_extent_no_chase_normal_field): + * extents.c: + * extents.c (gap_array_marker): + * extents.c (gap_array): + * extents.c (extent_list_marker): + * extents.c (extent_list): + * extents.c (stack_of_extents): + * extents.c (gap_array_make_marker): + * extents.c (extent_list_make_marker): + * extents.c (allocate_extent_list): + * extents.c (SLOT): + * extents.c (mark_extent_auxiliary): + * extents.c (allocate_extent_auxiliary): + * extents.c (attach_extent_auxiliary): + * extents.c (size_gap_array): + * extents.c (finalize_extent_info): + * extents.c (allocate_extent_info): + * extents.c (uninit_buffer_extents): + * extents.c (allocate_soe): + * extents.c (copy_extent): + * extents.c (vars_of_extents): + * extents.h: + * faces.c (allocate_face): + * faces.h (struct Lisp_Face): + * faces.h (struct face_cachel): + * file-coding.c: + * file-coding.c (finalize_coding_system): + * file-coding.c (sizeof_coding_system): + * file-coding.c (Fcopy_coding_system): + * file-coding.h (struct Lisp_Coding_System): + * file-coding.h (MARKED_SLOT): + * fns.c (size_bit_vector): + * font-mgr.c: + * font-mgr.c (finalize_fc_pattern): + * font-mgr.c (print_fc_pattern): + * font-mgr.c (Ffc_pattern_p): + * font-mgr.c (Ffc_pattern_create): + * font-mgr.c (Ffc_name_parse): + * font-mgr.c (Ffc_name_unparse): + * font-mgr.c (Ffc_pattern_duplicate): + * font-mgr.c (Ffc_pattern_add): + * font-mgr.c (Ffc_pattern_del): + * font-mgr.c (Ffc_pattern_get): + * font-mgr.c (fc_config_create_using): + * font-mgr.c (fc_strlist_to_lisp_using): + * font-mgr.c (fontset_to_list): + * font-mgr.c (Ffc_config_p): + * font-mgr.c (Ffc_config_up_to_date): + * font-mgr.c (Ffc_config_build_fonts): + * font-mgr.c (Ffc_config_get_cache): + * font-mgr.c (Ffc_config_get_fonts): + * font-mgr.c (Ffc_config_set_current): + * font-mgr.c (Ffc_config_get_blanks): + * font-mgr.c (Ffc_config_get_rescan_interval): + * font-mgr.c (Ffc_config_set_rescan_interval): + * font-mgr.c (Ffc_config_app_font_add_file): + * font-mgr.c (Ffc_config_app_font_add_dir): + * font-mgr.c (Ffc_config_app_font_clear): + * font-mgr.c (size): + * font-mgr.c (Ffc_config_substitute): + * font-mgr.c (Ffc_font_render_prepare): + * font-mgr.c (Ffc_font_match): + * font-mgr.c (Ffc_font_sort): + * font-mgr.c (finalize_fc_config): + * font-mgr.c (print_fc_config): + * font-mgr.h: + * font-mgr.h (struct fc_pattern): + * font-mgr.h (XFC_PATTERN): + * font-mgr.h (struct fc_config): + * font-mgr.h (XFC_CONFIG): + * frame-gtk.c (allocate_gtk_frame_struct): + * frame-impl.h (struct frame): + * frame-msw.c (mswindows_init_frame_1): + * frame-x.c (allocate_x_frame_struct): + * frame.c (nuke_all_frame_slots): + * frame.c (allocate_frame_core): + * gc.c: + * gc.c (GC_CHECK_NOT_FREE): + * glyphs.c (finalize_image_instance): + * glyphs.c (allocate_image_instance): + * glyphs.c (Fcolorize_image_instance): + * glyphs.c (allocate_glyph): + * glyphs.c (unmap_subwindow_instance_cache_mapper): + * glyphs.c (register_ignored_expose): + * glyphs.h (struct Lisp_Image_Instance): + * glyphs.h (struct Lisp_Glyph): + * glyphs.h (struct glyph_cachel): + * glyphs.h (struct expose_ignore): + * gui.c (allocate_gui_item): + * gui.h (struct Lisp_Gui_Item): + * keymap.c (struct Lisp_Keymap): + * keymap.c (make_keymap): + * lisp.h: + * lisp.h (struct Lisp_String_Direct_Data): + * lisp.h (struct Lisp_String_Indirect_Data): + * lisp.h (struct Lisp_Vector): + * lisp.h (struct Lisp_Bit_Vector): + * lisp.h (DECLARE_INLINE_LISP_BIT_VECTOR): + * lisp.h (struct weak_box): + * lisp.h (struct ephemeron): + * lisp.h (struct weak_list): + * lrecord.h: + * lrecord.h (struct lrecord_implementation): + * lrecord.h (MC_ALLOC_CALL_FINALIZER): + * lrecord.h (struct lcrecord_list): + * lstream.c (finalize_lstream): + * lstream.c (sizeof_lstream): + * lstream.c (Lstream_new): + * lstream.c (Lstream_delete): + * lstream.h (struct lstream): + * marker.c: + * marker.c (finalize_marker): + * marker.c (compute_buffer_marker_usage): + * mule-charset.c: + * mule-charset.c (make_charset): + * mule-charset.c (compute_charset_usage): + * objects-impl.h (struct Lisp_Color_Instance): + * objects-impl.h (struct Lisp_Font_Instance): + * objects-tty-impl.h (struct tty_color_instance_data): + * objects-tty-impl.h (struct tty_font_instance_data): + * objects-tty.c (tty_initialize_color_instance): + * objects-tty.c (tty_initialize_font_instance): + * objects.c (finalize_color_instance): + * objects.c (Fmake_color_instance): + * objects.c (finalize_font_instance): + * objects.c (Fmake_font_instance): + * objects.c (reinit_vars_of_objects): + * opaque.c: + * opaque.c (sizeof_opaque): + * opaque.c (make_opaque_ptr): + * opaque.c (free_opaque_ptr): + * opaque.h: + * opaque.h (Lisp_Opaque): + * opaque.h (Lisp_Opaque_Ptr): + * print.c (printing_unreadable_lcrecord): + * print.c (external_object_printer): + * print.c (debug_p4): + * process.c (finalize_process): + * process.c (make_process_internal): + * procimpl.h (struct Lisp_Process): + * rangetab.c (Fmake_range_table): + * rangetab.c (Fcopy_range_table): + * rangetab.h (struct Lisp_Range_Table): + * scrollbar.c: + * scrollbar.c (create_scrollbar_instance): + * scrollbar.c (compute_scrollbar_instance_usage): + * scrollbar.h (struct scrollbar_instance): + * specifier.c (finalize_specifier): + * specifier.c (sizeof_specifier): + * specifier.c (set_specifier_caching): + * specifier.h (struct Lisp_Specifier): + * specifier.h (struct specifier_caching): + * symeval.h: + * symeval.h (SYMBOL_VALUE_MAGIC_P): + * symeval.h (DEFVAR_SYMVAL_FWD): + * symsinit.h: + * syntax.c (init_buffer_syntax_cache): + * syntax.h (struct syntax_cache): + * toolbar.c: + * toolbar.c (allocate_toolbar_button): + * toolbar.c (update_toolbar_button): + * toolbar.h (struct toolbar_button): + * tooltalk.c (struct Lisp_Tooltalk_Message): + * tooltalk.c (make_tooltalk_message): + * tooltalk.c (struct Lisp_Tooltalk_Pattern): + * tooltalk.c (make_tooltalk_pattern): + * ui-gtk.c: + * ui-gtk.c (allocate_ffi_data): + * ui-gtk.c (emacs_gtk_object_finalizer): + * ui-gtk.c (allocate_emacs_gtk_object_data): + * ui-gtk.c (allocate_emacs_gtk_boxed_data): + * ui-gtk.h: + * window-impl.h (struct window): + * window-impl.h (struct window_mirror): + * window.c (finalize_window): + * window.c (allocate_window): + * window.c (new_window_mirror): + * window.c (mark_window_as_deleted): + * window.c (make_dummy_parent): + * window.c (compute_window_mirror_usage): + * window.c (compute_window_usage): + + Overall point of this change and previous ones in this repository: + + (1) Introduce new, clearer terminology: everything other than int + or char is a "record" object, which comes in two types: "normal + objects" and "frob-block objects". Fix up all places that + referred to frob-block objects as "simple", "basic", etc. + + (2) Provide an advertised interface for doing operations on Lisp + objects, including creating new types, that is clean and + consistent in its naming, uses the above-referenced terms and + avoids referencing "lrecords", "old lcrecords", etc., which should + hide under the surface. + + (3) Make the size_in_bytes and finalizer methods take a + Lisp_Object rather than a void * for consistency with other methods. + + (4) Separate finalizer method into finalizer and disksaver, so + that normal finalize methods don't have to worry about disksaving. + + Other specifics: + + (1) Renaming: + + LISP_OBJECT_HEADER -> NORMAL_LISP_OBJECT_HEADER + ALLOC_LISP_OBJECT -> ALLOC_NORMAL_LISP_OBJECT + implementation->basic_p -> implementation->frob_block_p + ALLOCATE_FIXED_TYPE_AND_SET_IMPL -> ALLOC_FROB_BLOCK_LISP_OBJECT + *FCCONFIG*, wrap_fcconfig -> *FC_CONFIG*, wrap_fc_config + *FCPATTERN*, wrap_fcpattern -> *FC_PATTERN*, wrap_fc_pattern + + (the last two changes make the naming of these macros consistent + with the naming of all other macros, since the objects are named + fc-config and fc-pattern with a hyphen) + + (2) Lots of documentation fixes in lrecord.h. + + (3) Eliminate macros for copying, freeing, zeroing objects, getting + their storage size. Instead, new functions: + + zero_sized_lisp_object() + zero_nonsized_lisp_object() + lisp_object_storage_size() + free_normal_lisp_object() + (copy_lisp_object() already exists) + LISP_OBJECT_FROB_BLOCK_P() (actually a macro) + + Eliminated: + + free_lrecord() + zero_lrecord() + copy_lrecord() + copy_sized_lrecord() + old_copy_lcrecord() + old_copy_sized_lcrecord() + old_zero_lcrecord() + old_zero_sized_lcrecord() + LISP_OBJECT_STORAGE_SIZE() + COPY_SIZED_LISP_OBJECT() + COPY_SIZED_LCRECORD() + COPY_LISP_OBJECT() + ZERO_LISP_OBJECT() + FREE_LISP_OBJECT() + + (4) Catch the remaining places where lrecord stuff was used directly + and use the advertised interface, e.g. alloc_sized_lrecord() -> + ALLOC_SIZED_LISP_OBJECT(). + + (5) Make certain statically-declared pseudo-objects + (buffer_local_flags, console_local_flags) have their lheader + initialized correctly, so things like copy_lisp_object() can work + on them. Make extent_auxiliary_defaults a proper heap object + Vextent_auxiliary_defaults, and make extent auxiliaries dumpable + so that this object can be dumped. allocate_extent_auxiliary() + now just creates the object, and attach_extent_auxiliary() + creates an extent auxiliary and attaches to an extent, like the + old allocate_extent_auxiliary(). + + (6) Create EXTENT_AUXILIARY_SLOTS macro, similar to the foo-slots.h + files but in a macro instead of a file. The purpose is to avoid + duplication when iterating over all the slots in an extent auxiliary. + Use it. + + (7) In lstream.c, don't zero out object after allocation because + allocation routines take care of this. + + (8) In marker.c, fix a mistake in computing marker overhead. + + (9) In print.c, clean up printing_unreadable_lcrecord(), + external_object_printer() to avoid lots of ifdef NEW_GC's. + + (10) Separate toolbar-button allocation into a separate + allocate_toolbar_button() function for use in the example code + in lrecord.h. + 2010-01-20 Ben Wing <ben@xemacs.org> * alloc.c:
--- a/src/alloc.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/alloc.c Fri Mar 05 04:08:17 2010 -0600 @@ -148,10 +148,10 @@ #endif #ifdef NEW_GC -/* The call to recompute_need_to_garbage_collect is moved to - free_lrecord, since DECREMENT_CONS_COUNTER is extensively called +/* [[ The call to recompute_need_to_garbage_collect is moved to + free_normal_lisp_object, since DECREMENT_CONS_COUNTER is extensively called during sweep and recomputing need_to_garbage_collect all the time - is not needed. */ + is not needed. ]] -- not accurate! */ #define DECREMENT_CONS_COUNTER(size) do { \ consing_since_gc -= (size); \ total_consing -= (size); \ @@ -672,12 +672,6 @@ implementation); } -void -free_lrecord (Lisp_Object UNUSED (lrecord)) -{ - /* Manual frees are not allowed with asynchronous finalization */ - return; -} #else /* not NEW_GC */ /* The most basic of the lcrecord allocation functions. Not usually called @@ -692,7 +686,7 @@ assert_proper_sizing (size); type_checking_assert - (!implementation->basic_p + (!implementation->frob_block_p && !(implementation->hash == NULL && implementation->equal != NULL)); @@ -750,7 +744,7 @@ } } if (lrecord->implementation->finalizer) - lrecord->implementation->finalizer (lrecord); + lrecord->implementation->finalizer (wrap_pointer_1 (lrecord)); xfree (lrecord); return; } @@ -800,7 +794,7 @@ (char *) XRECORD_LHEADER (src) + sizeof (struct lrecord_header), size - sizeof (struct lrecord_header)); #else /* not NEW_GC */ - if (imp->basic_p) + if (imp->frob_block_p) memcpy ((char *) XRECORD_LHEADER (dst) + sizeof (struct lrecord_header), (char *) XRECORD_LHEADER (src) + sizeof (struct lrecord_header), size - sizeof (struct lrecord_header)); @@ -813,6 +807,98 @@ #endif /* not NEW_GC */ } +/* Zero out all parts of a Lisp object other than the header, for a + variable-sized object. The size needs to be given explicitly because + at the time this is called, the contents of the object may not be + defined, or may not be set up in such a way that we can reliably + retrieve the size, since it may depend on settings inside of the object. */ + +void +zero_sized_lisp_object (Lisp_Object obj, Bytecount size) +{ +#ifndef NEW_GC + const struct lrecord_implementation *imp = + XRECORD_LHEADER_IMPLEMENTATION (obj); +#endif /* not NEW_GC */ + +#ifdef NEW_GC + memset ((char *) XRECORD_LHEADER (obj) + sizeof (struct lrecord_header), 0, + size - sizeof (struct lrecord_header)); +#else /* not NEW_GC */ + if (imp->frob_block_p) + memset ((char *) XRECORD_LHEADER (obj) + sizeof (struct lrecord_header), 0, + size - sizeof (struct lrecord_header)); + else + memset ((char *) XRECORD_LHEADER (obj) + + sizeof (struct old_lcrecord_header), 0, + size - sizeof (struct old_lcrecord_header)); +#endif /* not NEW_GC */ +} + +/* Zero out all parts of a Lisp object other than the header, for an object + that isn't variable-size. Objects that are variable-size need to use + zero_sized_lisp_object(). + */ + +void +zero_nonsized_lisp_object (Lisp_Object obj) +{ + const struct lrecord_implementation *imp = + XRECORD_LHEADER_IMPLEMENTATION (obj); + assert (!imp->size_in_bytes_method); + + zero_sized_lisp_object (obj, lisp_object_size (obj)); +} + +#ifdef MEMORY_USAGE_STATS + +Bytecount +lisp_object_storage_size (Lisp_Object obj, struct overhead_stats *ovstats) +{ +#ifndef NEW_GC + const struct lrecord_implementation *imp = + XRECORD_LHEADER_IMPLEMENTATION (obj); +#endif /* not NEW_GC */ + Bytecount size = lisp_object_size (obj); + +#ifdef NEW_GC + return mc_alloced_storage_size (size, ovstats); +#else + if (imp->frob_block_p) + { + Bytecount overhead = fixed_type_block_overhead (size); + if (ovstats) + { + ovstats->was_requested += size; + ovstats->malloc_overhead += overhead; + } + return size + overhead; + } + else + return malloced_storage_size (XPNTR (obj), size, ovstats); +#endif +} + +#endif /* MEMORY_USAGE_STATS */ + +void +free_normal_lisp_object (Lisp_Object obj) +{ +#ifndef NEW_GC + const struct lrecord_implementation *imp = + XRECORD_LHEADER_IMPLEMENTATION (obj); +#endif /* not NEW_GC */ + +#ifdef NEW_GC + /* Manual frees are not allowed with asynchronous finalization */ + return; +#else + assert (!imp->frob_block_p); + assert (!imp->size_in_bytes_method); + old_free_lcrecord (obj); +#endif +} + /************************************************************************/ /* Debugger support */ @@ -1189,7 +1275,7 @@ #ifdef NEW_GC #define FREE_FIXED_TYPE_WHEN_NOT_IN_GC(lo, type, structtype, ptr) \ - free_lrecord (lo) + free_normal_lisp_object (lo) #else /* not NEW_GC */ /* Like FREE_FIXED_TYPE() but used when we are explicitly freeing a structure through free_cons(), free_marker(), etc. @@ -1216,23 +1302,23 @@ #endif /* (not) NEW_GC */ #ifdef NEW_GC -#define ALLOCATE_FIXED_TYPE_AND_SET_IMPL(type, lisp_type, var, lrec_ptr)\ +#define ALLOC_FROB_BLOCK_LISP_OBJECT(type, lisp_type, var, lrec_ptr)\ do { \ - (var) = (lisp_type *) XPNTR (ALLOC_LISP_OBJECT (type)); \ + (var) = (lisp_type *) XPNTR (ALLOC_NORMAL_LISP_OBJECT (type)); \ } while (0) -#define NOSEEUM_ALLOCATE_FIXED_TYPE_AND_SET_IMPL(type, lisp_type, var, \ +#define NOSEEUM_ALLOC_FROB_BLOCK_LISP_OBJECT(type, lisp_type, var, \ lrec_ptr) \ do { \ (var) = (lisp_type *) XPNTR (noseeum_alloc_lrecord (lrec_ptr)); \ } while (0) #else /* not NEW_GC */ -#define ALLOCATE_FIXED_TYPE_AND_SET_IMPL(type, lisp_type, var, lrec_ptr) \ +#define ALLOC_FROB_BLOCK_LISP_OBJECT(type, lisp_type, var, lrec_ptr) \ do \ { \ ALLOCATE_FIXED_TYPE (type, lisp_type, var); \ set_lheader_implementation (&(var)->lheader, lrec_ptr); \ } while (0) -#define NOSEEUM_ALLOCATE_FIXED_TYPE_AND_SET_IMPL(type, lisp_type, var, \ +#define NOSEEUM_ALLOC_FROB_BLOCK_LISP_OBJECT(type, lisp_type, var, \ lrec_ptr) \ do \ { \ @@ -1309,7 +1395,7 @@ Lisp_Object val; Lisp_Cons *c; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (cons, Lisp_Cons, c, &lrecord_cons); + ALLOC_FROB_BLOCK_LISP_OBJECT (cons, Lisp_Cons, c, &lrecord_cons); val = wrap_cons (c); XSETCAR (val, car); XSETCDR (val, cdr); @@ -1325,7 +1411,7 @@ Lisp_Object val; Lisp_Cons *c; - NOSEEUM_ALLOCATE_FIXED_TYPE_AND_SET_IMPL (cons, Lisp_Cons, c, &lrecord_cons); + NOSEEUM_ALLOC_FROB_BLOCK_LISP_OBJECT (cons, Lisp_Cons, c, &lrecord_cons); val = wrap_cons (c); XCAR (val) = car; XCDR (val) = cdr; @@ -1437,11 +1523,11 @@ { Lisp_Float *f; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (float, Lisp_Float, f, &lrecord_float); + ALLOC_FROB_BLOCK_LISP_OBJECT (float, Lisp_Float, f, &lrecord_float); /* Avoid dump-time `uninitialized memory read' purify warnings. */ if (sizeof (struct lrecord_header) + sizeof (double) != sizeof (*f)) - zero_lrecord (f); + zero_nonsized_lisp_object (wrap_float (f)); float_data (f) = float_value; return wrap_float (f); @@ -1464,7 +1550,7 @@ { Lisp_Bignum *b; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (bignum, Lisp_Bignum, b, &lrecord_bignum); + ALLOC_FROB_BLOCK_LISP_OBJECT (bignum, Lisp_Bignum, b, &lrecord_bignum); bignum_init (bignum_data (b)); bignum_set_long (bignum_data (b), bignum_value); return wrap_bignum (b); @@ -1477,7 +1563,7 @@ { Lisp_Bignum *b; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (bignum, Lisp_Bignum, b, &lrecord_bignum); + ALLOC_FROB_BLOCK_LISP_OBJECT (bignum, Lisp_Bignum, b, &lrecord_bignum); bignum_init (bignum_data (b)); bignum_set (bignum_data (b), bg); return wrap_bignum (b); @@ -1494,7 +1580,7 @@ { Lisp_Ratio *r; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (ratio, Lisp_Ratio, r, &lrecord_ratio); + ALLOC_FROB_BLOCK_LISP_OBJECT (ratio, Lisp_Ratio, r, &lrecord_ratio); ratio_init (ratio_data (r)); ratio_set_long_ulong (ratio_data (r), numerator, denominator); ratio_canonicalize (ratio_data (r)); @@ -1506,7 +1592,7 @@ { Lisp_Ratio *r; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (ratio, Lisp_Ratio, r, &lrecord_ratio); + ALLOC_FROB_BLOCK_LISP_OBJECT (ratio, Lisp_Ratio, r, &lrecord_ratio); ratio_init (ratio_data (r)); ratio_set_bignum_bignum (ratio_data (r), numerator, denominator); ratio_canonicalize (ratio_data (r)); @@ -1518,7 +1604,7 @@ { Lisp_Ratio *r; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (ratio, Lisp_Ratio, r, &lrecord_ratio); + ALLOC_FROB_BLOCK_LISP_OBJECT (ratio, Lisp_Ratio, r, &lrecord_ratio); ratio_init (ratio_data (r)); ratio_set (ratio_data (r), rat); return wrap_ratio (r); @@ -1537,7 +1623,7 @@ { Lisp_Bigfloat *f; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (bigfloat, Lisp_Bigfloat, f, &lrecord_bigfloat); + ALLOC_FROB_BLOCK_LISP_OBJECT (bigfloat, Lisp_Bigfloat, f, &lrecord_bigfloat); if (precision == 0UL) bigfloat_init (bigfloat_data (f)); else @@ -1552,7 +1638,7 @@ { Lisp_Bigfloat *f; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (bigfloat, Lisp_Bigfloat, f, &lrecord_bigfloat); + ALLOC_FROB_BLOCK_LISP_OBJECT (bigfloat, Lisp_Bigfloat, f, &lrecord_bigfloat); bigfloat_init_prec (bigfloat_data (f), bigfloat_get_prec (float_value)); bigfloat_set (bigfloat_data (f), float_value); return wrap_bigfloat (f); @@ -1576,10 +1662,11 @@ } static Bytecount -size_vector (const void *lheader) -{ +size_vector (Lisp_Object obj) +{ + return FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Vector, Lisp_Object, contents, - ((Lisp_Vector *) lheader)->size); + XVECTOR (obj)->size); } static int @@ -1873,7 +1960,7 @@ { Lisp_Compiled_Function *f; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (compiled_function, Lisp_Compiled_Function, + ALLOC_FROB_BLOCK_LISP_OBJECT (compiled_function, Lisp_Compiled_Function, f, &lrecord_compiled_function); f->stack_depth = 0; @@ -2011,7 +2098,7 @@ CHECK_STRING (name); - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (symbol, Lisp_Symbol, p, &lrecord_symbol); + ALLOC_FROB_BLOCK_LISP_OBJECT (symbol, Lisp_Symbol, p, &lrecord_symbol); p->name = name; p->plist = Qnil; p->value = Qunbound; @@ -2033,7 +2120,7 @@ { struct extent *e; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (extent, struct extent, e, &lrecord_extent); + ALLOC_FROB_BLOCK_LISP_OBJECT (extent, struct extent, e, &lrecord_extent); extent_object (e) = Qnil; set_extent_start (e, -1); set_extent_end (e, -1); @@ -2061,7 +2148,7 @@ { Lisp_Event *e; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (event, Lisp_Event, e, &lrecord_event); + ALLOC_FROB_BLOCK_LISP_OBJECT (event, Lisp_Event, e, &lrecord_event); return wrap_event (e); } @@ -2075,9 +2162,9 @@ { Lisp_Key_Data *d; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (key_data, Lisp_Key_Data, d, + ALLOC_FROB_BLOCK_LISP_OBJECT (key_data, Lisp_Key_Data, d, &lrecord_key_data); - zero_lrecord (d); + zero_nonsized_lisp_object (wrap_key_data (d)); d->keysym = Qnil; return wrap_key_data (d); @@ -2091,8 +2178,8 @@ { Lisp_Button_Data *d; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (button_data, Lisp_Button_Data, d, &lrecord_button_data); - zero_lrecord (d); + ALLOC_FROB_BLOCK_LISP_OBJECT (button_data, Lisp_Button_Data, d, &lrecord_button_data); + zero_nonsized_lisp_object (wrap_button_data (d)); return wrap_button_data (d); } @@ -2104,8 +2191,8 @@ { Lisp_Motion_Data *d; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (motion_data, Lisp_Motion_Data, d, &lrecord_motion_data); - zero_lrecord (d); + ALLOC_FROB_BLOCK_LISP_OBJECT (motion_data, Lisp_Motion_Data, d, &lrecord_motion_data); + zero_nonsized_lisp_object (wrap_motion_data (d)); return wrap_motion_data (d); } @@ -2118,8 +2205,8 @@ { Lisp_Process_Data *d; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (process_data, Lisp_Process_Data, d, &lrecord_process_data); - zero_lrecord (d); + ALLOC_FROB_BLOCK_LISP_OBJECT (process_data, Lisp_Process_Data, d, &lrecord_process_data); + zero_nonsized_lisp_object (wrap_process_data (d)); d->process = Qnil; return wrap_process_data (d); @@ -2133,8 +2220,8 @@ { Lisp_Timeout_Data *d; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (timeout_data, Lisp_Timeout_Data, d, &lrecord_timeout_data); - zero_lrecord (d); + ALLOC_FROB_BLOCK_LISP_OBJECT (timeout_data, Lisp_Timeout_Data, d, &lrecord_timeout_data); + zero_nonsized_lisp_object (wrap_timeout_data (d)); d->function = Qnil; d->object = Qnil; @@ -2149,8 +2236,8 @@ { Lisp_Magic_Data *d; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (magic_data, Lisp_Magic_Data, d, &lrecord_magic_data); - zero_lrecord (d); + ALLOC_FROB_BLOCK_LISP_OBJECT (magic_data, Lisp_Magic_Data, d, &lrecord_magic_data); + zero_nonsized_lisp_object (wrap_magic_data (d)); return wrap_magic_data (d); } @@ -2163,8 +2250,8 @@ { Lisp_Magic_Eval_Data *d; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (magic_eval_data, Lisp_Magic_Eval_Data, d, &lrecord_magic_eval_data); - zero_lrecord (d); + ALLOC_FROB_BLOCK_LISP_OBJECT (magic_eval_data, Lisp_Magic_Eval_Data, d, &lrecord_magic_eval_data); + zero_nonsized_lisp_object (wrap_magic_eval_data (d)); d->object = Qnil; return wrap_magic_eval_data (d); @@ -2178,8 +2265,8 @@ { Lisp_Eval_Data *d; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (eval_data, Lisp_Eval_Data, d, &lrecord_eval_data); - zero_lrecord (d); + ALLOC_FROB_BLOCK_LISP_OBJECT (eval_data, Lisp_Eval_Data, d, &lrecord_eval_data); + zero_nonsized_lisp_object (wrap_eval_data (d)); d->function = Qnil; d->object = Qnil; @@ -2194,8 +2281,8 @@ { Lisp_Misc_User_Data *d; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (misc_user_data, Lisp_Misc_User_Data, d, &lrecord_misc_user_data); - zero_lrecord (d); + ALLOC_FROB_BLOCK_LISP_OBJECT (misc_user_data, Lisp_Misc_User_Data, d, &lrecord_misc_user_data); + zero_nonsized_lisp_object (wrap_misc_user_data (d)); d->function = Qnil; d->object = Qnil; @@ -2218,7 +2305,7 @@ { Lisp_Marker *p; - ALLOCATE_FIXED_TYPE_AND_SET_IMPL (marker, Lisp_Marker, p, &lrecord_marker); + ALLOC_FROB_BLOCK_LISP_OBJECT (marker, Lisp_Marker, p, &lrecord_marker); p->buffer = 0; p->membpos = 0; marker_next (p) = 0; @@ -2232,7 +2319,7 @@ { Lisp_Marker *p; - NOSEEUM_ALLOCATE_FIXED_TYPE_AND_SET_IMPL (marker, Lisp_Marker, p, + NOSEEUM_ALLOC_FROB_BLOCK_LISP_OBJECT (marker, Lisp_Marker, p, &lrecord_marker); p->buffer = 0; p->membpos = 0; @@ -2249,7 +2336,7 @@ /* The data for "short" strings generally resides inside of structs of type string_chars_block. The Lisp_String structure is allocated just like any - other basic lrecord, and these are freelisted when they get garbage + other frob-block lrecord, and these are freelisted when they get garbage collected. The data for short strings get compacted, but the data for large strings do not. @@ -2419,9 +2506,9 @@ }; static Bytecount -size_string_direct_data (const void *lheader) -{ - return STRING_FULLSIZE (((Lisp_String_Direct_Data *) lheader)->size); +size_string_direct_data (Lisp_Object obj) +{ + return STRING_FULLSIZE (XSTRING_DIRECT_DATA (obj)->size); } @@ -2548,7 +2635,7 @@ assert (length >= 0 && fullsize > 0); #ifdef NEW_GC - s = XSTRING (ALLOC_LISP_OBJECT (string)); + s = XSTRING (ALLOC_NORMAL_LISP_OBJECT (string)); #else /* not NEW_GC */ /* Allocate the string header */ ALLOCATE_FIXED_TYPE (string, Lisp_String, s); @@ -3010,7 +3097,7 @@ #endif #ifdef NEW_GC - s = XSTRING (ALLOC_LISP_OBJECT (string)); + s = XSTRING (ALLOC_NORMAL_LISP_OBJECT (string)); mcpro (wrap_pointer_1 (s)); /* otherwise nocopy_strings get collected and static data is tried to be freed. */ @@ -3025,7 +3112,7 @@ s->plist = Qnil; #ifdef NEW_GC set_lispstringp_indirect (s); - STRING_DATA_OBJECT (s) = ALLOC_LISP_OBJECT (string_indirect_data); + STRING_DATA_OBJECT (s) = ALLOC_NORMAL_LISP_OBJECT (string_indirect_data); XSTRING_INDIRECT_DATA_DATA (STRING_DATA_OBJECT (s)) = (Ibyte *) contents; XSTRING_INDIRECT_DATA_SIZE (STRING_DATA_OBJECT (s)) = length; #else /* not NEW_GC */ @@ -3046,7 +3133,7 @@ /************************************************************************/ /* Lcrecord lists are used to manage the allocation of particular - sorts of lcrecords, to avoid calling ALLOC_LISP_OBJECT() (and thus + sorts of lcrecords, to avoid calling ALLOC_NORMAL_LISP_OBJECT() (and thus malloc() and garbage-collection junk) as much as possible. It is similar to the Blocktype class. @@ -3085,7 +3172,7 @@ ! MARKED_RECORD_HEADER_P (lheader) && /* Only lcrecords should be here. */ - ! list->implementation->basic_p + ! list->implementation->frob_block_p && /* Only free lcrecords should be here. */ free_header->lcheader.free @@ -3144,7 +3231,7 @@ assert (free_header->lcheader.free); assert (lheader->type == lrecord_type_free); /* Only lcrecords should be here. */ - assert (! (list->implementation->basic_p)); + assert (! (list->implementation->frob_block_p)); #if 0 /* Not used anymore, now that we set the type of the header to lrecord_type_free. */ /* The type of the lcrecord must be right. */ @@ -3159,7 +3246,7 @@ free_header->lcheader.free = 0; /* Put back the correct type, as we set it to lrecord_type_free. */ lheader->type = list->implementation->lrecord_type_index; - old_zero_sized_lcrecord (free_header, list->size); + zero_sized_lisp_object (val, list->size); return val; } else @@ -3208,7 +3295,7 @@ /* Make sure the size is correct. This will catch, for example, putting a window configuration on the wrong free list. */ - gc_checking_assert (detagged_lisp_object_size (lheader) == list->size); + gc_checking_assert (lisp_object_size (lcrecord) == list->size); /* Make sure the object isn't already freed. */ gc_checking_assert (!free_header->lcheader.free); /* Freeing stuff in dumped memory is bad. If you trip this, you @@ -3216,7 +3303,7 @@ gc_checking_assert (!OBJECT_DUMPED_P (lcrecord)); if (implementation->finalizer) - implementation->finalizer (lheader); + implementation->finalizer (lcrecord); /* Yes, there are two ways to indicate freeness -- the type is lrecord_type_free or the ->free flag is set. We used to do only the latter; now we do the former as well for KKCC purposes. Probably @@ -3582,7 +3669,7 @@ if (! MARKED_RECORD_HEADER_P (h) && ! header->free) { if (LHEADER_IMPLEMENTATION (h)->finalizer) - LHEADER_IMPLEMENTATION (h)->finalizer (h); + LHEADER_IMPLEMENTATION (h)->finalizer (wrap_pointer_1 (h)); } } @@ -4870,7 +4957,7 @@ that some minimum block size is imposed (e.g. 16 bytes). */ Bytecount -malloced_storage_size (void *UNUSED (ptr), Bytecount claimed_size, +malloced_storage_size (void * UNUSED (ptr), Bytecount claimed_size, struct overhead_stats *stats) { Bytecount orig_claimed_size = claimed_size;
--- a/src/buffer.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/buffer.c Fri Mar 05 04:08:17 2010 -0600 @@ -600,12 +600,11 @@ static struct buffer * allocate_buffer (void) { - Lisp_Object obj = ALLOC_LISP_OBJECT (buffer); - struct buffer *b = XBUFFER (obj); - - COPY_LISP_OBJECT (b, XBUFFER (Vbuffer_defaults)); - - return b; + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (buffer); + + copy_lisp_object (obj, Vbuffer_defaults); + + return XBUFFER (obj); } static Lisp_Object @@ -1777,7 +1776,7 @@ struct overhead_stats *ovstats) { xzero (*stats); - stats->other += LISP_OBJECT_STORAGE_SIZE (b, sizeof (*b), ovstats); + stats->other += lisp_object_storage_size (wrap_buffer (b), ovstats); stats->text += compute_buffer_text_usage (b, ovstats); stats->markers += compute_buffer_marker_usage (b, ovstats); stats->extents += compute_buffer_extent_usage (b, ovstats); @@ -2141,7 +2140,7 @@ do \ { \ struct symbol_value_forward *I_hate_C = \ - XSYMBOL_VALUE_FORWARD (ALLOC_LISP_OBJECT (symbol_value_forward)); \ + XSYMBOL_VALUE_FORWARD (ALLOC_NORMAL_LISP_OBJECT (symbol_value_forward)); \ /*mcpro ((Lisp_Object) I_hate_C);*/ \ \ I_hate_C->magic.value = &(buffer_local_flags.field_name); \ @@ -2216,7 +2215,7 @@ static void nuke_all_buffer_slots (struct buffer *b, Lisp_Object zap) { - ZERO_LISP_OBJECT (b); + zero_nonsized_lisp_object (wrap_buffer (b)); b->extent_info = Qnil; b->indirect_children = Qnil; @@ -2231,9 +2230,9 @@ { /* Make sure all markable slots in buffer_defaults are initialized reasonably, so mark_buffer won't choke. */ - Lisp_Object defobj = ALLOC_LISP_OBJECT (buffer); + Lisp_Object defobj = ALLOC_NORMAL_LISP_OBJECT (buffer); struct buffer *defs = XBUFFER (defobj); - Lisp_Object symobj = ALLOC_LISP_OBJECT (buffer); + Lisp_Object symobj = ALLOC_NORMAL_LISP_OBJECT (buffer); struct buffer *syms = XBUFFER (symobj); staticpro_nodump (&Vbuffer_defaults); @@ -2296,6 +2295,8 @@ The local flag bits are in the local_var_flags slot of the buffer. */ + set_lheader_implementation ((struct lrecord_header *) + &buffer_local_flags, &lrecord_buffer); nuke_all_buffer_slots (&buffer_local_flags, make_int (-2)); buffer_local_flags.filename = always_local_no_default; buffer_local_flags.directory = always_local_no_default;
--- a/src/buffer.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/buffer.h Fri Mar 05 04:08:17 2010 -0600 @@ -80,7 +80,7 @@ struct buffer_text { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ Ibyte *beg; /* Actual address of buffer contents. */ Bytebpos gpt; /* Index of gap in buffer. */ @@ -157,7 +157,7 @@ struct buffer { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; /* This structure holds the coordinates of the buffer contents in ordinary buffers. In indirect buffers, this is not used. */
--- a/src/bytecode.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/bytecode.c Fri Mar 05 04:08:17 2010 -0600 @@ -1,7 +1,7 @@ /* Execution of byte code produced by bytecomp.el. Implementation of compiled-function objects. Copyright (C) 1992, 1993 Free Software Foundation, Inc. - Copyright (C) 1995, 2002 Ben Wing. + Copyright (C) 1995, 2002, 2010 Ben Wing. This file is part of XEmacs. @@ -66,21 +66,20 @@ { Lisp_Compiled_Function_Args *args; args = XCOMPILED_FUNCTION_ARGS - (alloc_sized_lrecord + (ALLOC_SIZED_LISP_OBJECT (FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Compiled_Function_Args, Lisp_Object, args, totalargs), - &lrecord_compiled_function_args)); + compiled_function_args)); args->size = totalargs; return wrap_compiled_function_args (args); } static Bytecount -size_compiled_function_args (const void *lheader) +size_compiled_function_args (Lisp_Object obj) { return FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Compiled_Function_Args, Lisp_Object, args, - ((Lisp_Compiled_Function_Args *) - lheader)->size); + XCOMPILED_FUNCTION_ARGS (obj)->size); } static const struct memory_description compiled_function_args_description[] = {
--- a/src/bytecode.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/bytecode.h Fri Mar 05 04:08:17 2010 -0600 @@ -34,7 +34,7 @@ #ifdef NEW_GC struct compiled_function_args { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; long size; Lisp_Object args[1]; };
--- a/src/casetab.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/casetab.c Fri Mar 05 04:08:17 2010 -0600 @@ -129,7 +129,7 @@ static Lisp_Object allocate_case_table (int init_tables) { - Lisp_Object obj = ALLOC_LISP_OBJECT (case_table); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (case_table); Lisp_Case_Table *ct = XCASE_TABLE (obj); if (init_tables)
--- a/src/casetab.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/casetab.h Fri Mar 05 04:08:17 2010 -0600 @@ -25,7 +25,7 @@ struct Lisp_Case_Table { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object downcase_table; Lisp_Object upcase_table; Lisp_Object case_canon_table;
--- a/src/charset.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/charset.h Fri Mar 05 04:08:17 2010 -0600 @@ -185,7 +185,7 @@ struct Lisp_Charset { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; int id; Lisp_Object name;
--- a/src/chartab.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/chartab.c Fri Mar 05 04:08:17 2010 -0600 @@ -477,7 +477,7 @@ if (!EQ (ct->level1[i], Qnull_pointer) && CHAR_TABLE_ENTRYP (ct->level1[i]) && !OBJECT_DUMPED_P (ct->level1[1])) - FREE_LISP_OBJECT (ct->level1[i]); + free_normal_lisp_object (ct->level1[i]); ct->level1[i] = value; } #endif /* MULE */ @@ -596,7 +596,7 @@ */ (type)) { - Lisp_Object obj = ALLOC_LISP_OBJECT (char_table); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (char_table); Lisp_Char_Table *ct = XCHAR_TABLE (obj); enum char_table_type ty = symbol_to_char_table_type (type); @@ -630,7 +630,7 @@ make_char_table_entry (Lisp_Object initval) { int i; - Lisp_Object obj = ALLOC_LISP_OBJECT (char_table_entry); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (char_table_entry); Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (obj); for (i = 0; i < 96; i++) @@ -644,7 +644,7 @@ { Lisp_Char_Table_Entry *cte = XCHAR_TABLE_ENTRY (entry); int i; - Lisp_Object obj = ALLOC_LISP_OBJECT (char_table_entry); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (char_table_entry); Lisp_Char_Table_Entry *ctenew = XCHAR_TABLE_ENTRY (obj); for (i = 0; i < 96; i++) @@ -675,7 +675,7 @@ CHECK_CHAR_TABLE (char_table); ct = XCHAR_TABLE (char_table); assert(!ct->mirror_table_p); - obj = ALLOC_LISP_OBJECT (char_table); + obj = ALLOC_NORMAL_LISP_OBJECT (char_table); ctnew = XCHAR_TABLE (obj); ctnew->type = ct->type; ctnew->parent = ct->parent; @@ -1071,7 +1071,7 @@ int lb = XCHARSET_LEADING_BYTE (range->charset) - MIN_LEADING_BYTE; if (CHAR_TABLE_ENTRYP (ct->level1[lb]) && !OBJECT_DUMPED_P (ct->level1[lb])) - FREE_LISP_OBJECT (ct->level1[lb]); + free_normal_lisp_object (ct->level1[lb]); ct->level1[lb] = val; } break;
--- a/src/chartab.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/chartab.h Fri Mar 05 04:08:17 2010 -0600 @@ -42,7 +42,7 @@ struct Lisp_Char_Table_Entry { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; /* In the interests of simplicity, we just use a fixed 96-entry table. If we felt like being smarter, we could make this @@ -80,7 +80,7 @@ struct Lisp_Char_Table { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object ascii[NUM_ASCII_CHARS]; Lisp_Object default_;
--- a/src/console-gtk-impl.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/console-gtk-impl.h Fri Mar 05 04:08:17 2010 -0600 @@ -50,7 +50,7 @@ struct gtk_device { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ /* Gtk application info. */ GtkWidget *gtk_app_shell; @@ -144,7 +144,7 @@ struct gtk_frame { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ /* The widget of this frame. */
--- a/src/console-impl.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/console-impl.h Fri Mar 05 04:08:17 2010 -0600 @@ -409,7 +409,7 @@ struct console { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; /* Description of this console's methods. */ struct console_methods *conmeths;
--- a/src/console-msw-impl.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/console-msw-impl.h Fri Mar 05 04:08:17 2010 -0600 @@ -57,7 +57,7 @@ struct Lisp_Devmode { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; /* Pointer to the DEVMODE structure */ DEVMODEW *devmode; @@ -82,7 +82,7 @@ struct mswindows_device { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ Lisp_Object fontlist; /* List of (STRING . FIXED-P), device fonts */ HDC hcdc; /* Compatible DC */ @@ -110,7 +110,7 @@ struct msprinter_device { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ HDC hdc, hcdc; /* Printer and the comp. DCs */ HANDLE hprinter; @@ -168,7 +168,7 @@ struct mswindows_frame { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ /* win32 window handle */ @@ -312,7 +312,7 @@ struct mswindows_dialog_id { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object frame; Lisp_Object callbacks;
--- a/src/console-stream-impl.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/console-stream-impl.h Fri Mar 05 04:08:17 2010 -0600 @@ -35,7 +35,7 @@ struct stream_console { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ FILE *in; FILE *out;
--- a/src/console-stream.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/console-stream.c Fri Mar 05 04:08:17 2010 -0600 @@ -72,7 +72,7 @@ #ifdef NEW_GC if (CONSOLE_STREAM_DATA (con) == NULL) CONSOLE_STREAM_DATA (con) = - XSTREAM_CONSOLE (ALLOC_LISP_OBJECT (stream_console)); + XSTREAM_CONSOLE (ALLOC_NORMAL_LISP_OBJECT (stream_console)); #else /* not NEW_GC */ if (CONSOLE_STREAM_DATA (con) == NULL) CONSOLE_STREAM_DATA (con) = xnew_and_zero (struct stream_console);
--- a/src/console-tty-impl.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/console-tty-impl.h Fri Mar 05 04:08:17 2010 -0600 @@ -40,7 +40,7 @@ struct tty_console { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ int infd, outfd; Lisp_Object instream, outstream; @@ -256,7 +256,7 @@ struct tty_device { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ #ifdef HAVE_TERMIOS speed_t ospeed; /* Output speed (from sg_ospeed) */
--- a/src/console-tty.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/console-tty.c Fri Mar 05 04:08:17 2010 -0600 @@ -75,7 +75,7 @@ { /* zero out all slots except the lisp ones ... */ #ifdef NEW_GC - CONSOLE_TTY_DATA (con) = XTTY_CONSOLE (ALLOC_LISP_OBJECT (tty_console)); + CONSOLE_TTY_DATA (con) = XTTY_CONSOLE (ALLOC_NORMAL_LISP_OBJECT (tty_console)); #else /* not NEW_GC */ CONSOLE_TTY_DATA (con) = xnew_and_zero (struct tty_console); #endif /* not NEW_GC */
--- a/src/console-x-impl.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/console-x-impl.h Fri Mar 05 04:08:17 2010 -0600 @@ -45,7 +45,7 @@ struct x_device { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ /* The X connection of this device. */ Display *display; @@ -243,7 +243,7 @@ struct x_frame { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ /* The widget of this frame.
--- a/src/console.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/console.c Fri Mar 05 04:08:17 2010 -0600 @@ -193,11 +193,11 @@ static struct console * allocate_console (Lisp_Object type) { - Lisp_Object console = ALLOC_LISP_OBJECT (console); + Lisp_Object console = ALLOC_NORMAL_LISP_OBJECT (console); struct console *con = XCONSOLE (console); struct gcpro gcpro1; - COPY_LISP_OBJECT (con, XCONSOLE (Vconsole_defaults)); + copy_lisp_object (console, Vconsole_defaults); GCPRO1 (console); @@ -661,7 +661,7 @@ static void nuke_all_console_slots (struct console *con, Lisp_Object zap) { - ZERO_LISP_OBJECT (con); + zero_nonsized_lisp_object (wrap_console (con)); #define MARKED_SLOT(x) con->x = zap; #include "conslots.h" @@ -1318,7 +1318,7 @@ #define DEFVAR_CONSOLE_LOCAL_1(lname, field_name, forward_type, magic_fun) \ do { \ struct symbol_value_forward *I_hate_C = \ - XSYMBOL_VALUE_FORWARD (ALLOC_LISP_OBJECT (symbol_value_forward)); \ + XSYMBOL_VALUE_FORWARD (ALLOC_NORMAL_LISP_OBJECT (symbol_value_forward)); \ /*mcpro ((Lisp_Object) I_hate_C);*/ \ \ I_hate_C->magic.value = &(console_local_flags.field_name); \ @@ -1395,9 +1395,9 @@ /* Make sure all markable slots in console_defaults are initialized reasonably, so mark_console won't choke. */ - Lisp_Object defobj = ALLOC_LISP_OBJECT (console); + Lisp_Object defobj = ALLOC_NORMAL_LISP_OBJECT (console); struct console *defs = XCONSOLE (defobj); - Lisp_Object symobj = ALLOC_LISP_OBJECT (console); + Lisp_Object symobj = ALLOC_NORMAL_LISP_OBJECT (console); struct console *syms = XCONSOLE (symobj); staticpro_nodump (&Vconsole_defaults); @@ -1441,6 +1441,8 @@ The local flag bits are in the local_var_flags slot of the console. */ + set_lheader_implementation ((struct lrecord_header *) + &console_local_flags, &lrecord_console); nuke_all_console_slots (&console_local_flags, make_int (-2)); console_local_flags.defining_kbd_macro = always_local_resettable; console_local_flags.last_kbd_macro = always_local_resettable;
--- a/src/data.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/data.c Fri Mar 05 04:08:17 2010 -0600 @@ -2642,7 +2642,7 @@ Lisp_Object make_weak_list (enum weak_list_type type) { - Lisp_Object result = ALLOC_LISP_OBJECT (weak_list); + Lisp_Object result = ALLOC_NORMAL_LISP_OBJECT (weak_list); struct weak_list *wl = XWEAK_LIST (result); wl->list = Qnil; @@ -3113,7 +3113,7 @@ Lisp_Object make_weak_box (Lisp_Object value) { - Lisp_Object result = ALLOC_LISP_OBJECT (weak_box); + Lisp_Object result = ALLOC_NORMAL_LISP_OBJECT (weak_box); struct weak_box *wb = XWEAK_BOX (result); wb->value = value; @@ -3334,7 +3334,7 @@ { Lisp_Object temp = Qnil; struct gcpro gcpro1, gcpro2; - Lisp_Object result = ALLOC_LISP_OBJECT (ephemeron); + Lisp_Object result = ALLOC_NORMAL_LISP_OBJECT (ephemeron); struct ephemeron *eph = XEPHEMERON (result); eph->key = Qnil;
--- a/src/database.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/database.c Fri Mar 05 04:08:17 2010 -0600 @@ -1,6 +1,6 @@ /* Database access routines Copyright (C) 1996, William M. Perry - Copyright (C) 2001, 2002, 2005 Ben Wing. + Copyright (C) 2001, 2002, 2005, 2010 Ben Wing. This file is part of XEmacs. @@ -147,7 +147,7 @@ struct Lisp_Database { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object fname; int mode; int access_; @@ -180,7 +180,7 @@ static Lisp_Database * allocate_database (void) { - Lisp_Object obj = ALLOC_LISP_OBJECT (database); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (database); Lisp_Database *db = XDATABASE (obj); db->fname = Qnil; @@ -236,9 +236,9 @@ } static void -finalize_database (void *header) +finalize_database (Lisp_Object obj) { - Lisp_Database *db = (Lisp_Database *) header; + Lisp_Database *db = XDATABASE (obj); db->funcs->close (db); }
--- a/src/device-gtk.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/device-gtk.c Fri Mar 05 04:08:17 2010 -0600 @@ -115,7 +115,7 @@ allocate_gtk_device_struct (struct device *d) { #ifdef NEW_GC - d->device_data = XGTK_DEVICE (ALLOC_LISP_OBJECT (gtk_device)); + d->device_data = XGTK_DEVICE (ALLOC_NORMAL_LISP_OBJECT (gtk_device)); #else /* not NEW_GC */ d->device_data = xnew_and_zero (struct gtk_device); #endif /* not NEW_GC */
--- a/src/device-impl.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/device-impl.h Fri Mar 05 04:08:17 2010 -0600 @@ -71,7 +71,7 @@ struct device { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; /* Methods for this device's console. This can also be retrieved through device->console, but it's faster this way. */
--- a/src/device-msw.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/device-msw.c Fri Mar 05 04:08:17 2010 -0600 @@ -1,7 +1,7 @@ /* device functions for mswindows. Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. Copyright (C) 1994, 1995 Free Software Foundation, Inc. - Copyright (C) 2000, 2001, 2002 Ben Wing. + Copyright (C) 2000, 2001, 2002, 2010 Ben Wing. This file is part of XEmacs. @@ -162,7 +162,7 @@ init_one_device (d); #ifdef NEW_GC - d->device_data = XMSWINDOWS_DEVICE (ALLOC_LISP_OBJECT (mswindows_device)); + d->device_data = XMSWINDOWS_DEVICE (ALLOC_NORMAL_LISP_OBJECT (mswindows_device)); #else /* not NEW_GC */ d->device_data = xnew_and_zero (struct mswindows_device); #endif /* not NEW_GC */ @@ -518,7 +518,7 @@ Extbyte *printer_name; #ifdef NEW_GC - d->device_data = XMSPRINTER_DEVICE (ALLOC_LISP_OBJECT (msprinter_device)); + d->device_data = XMSPRINTER_DEVICE (ALLOC_NORMAL_LISP_OBJECT (msprinter_device)); #else /* not NEW_GC */ d->device_data = xnew_and_zero (struct msprinter_device); #endif /* not NEW_GC */ @@ -1158,9 +1158,9 @@ } static void -finalize_devmode (void *header) +finalize_devmode (Lisp_Object obj) { - Lisp_Devmode *dm = (Lisp_Devmode *) header; + Lisp_Devmode *dm = XDEVMODE (obj); assert (NILP (dm->device)); } @@ -1205,7 +1205,7 @@ allocate_devmode (DEVMODEW* src_devmode, int do_copy, Lisp_Object src_name, struct device *d) { - Lisp_Object obj = ALLOC_LISP_OBJECT (devmode); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (devmode); Lisp_Devmode *dm = XDEVMODE (obj); if (d)
--- a/src/device-tty.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/device-tty.c Fri Mar 05 04:08:17 2010 -0600 @@ -58,7 +58,7 @@ allocate_tty_device_struct (struct device *d) { #ifdef NEW_GC - d->device_data = XTTY_DEVICE (ALLOC_LISP_OBJECT (tty_device)); + d->device_data = XTTY_DEVICE (ALLOC_NORMAL_LISP_OBJECT (tty_device)); #else /* not NEW_GC */ d->device_data = xnew_and_zero (struct tty_device); #endif /* not NEW_GC */
--- a/src/device-x.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/device-x.c Fri Mar 05 04:08:17 2010 -0600 @@ -228,7 +228,7 @@ allocate_x_device_struct (struct device *d) { #ifdef NEW_GC - d->device_data = XX_DEVICE (ALLOC_LISP_OBJECT (x_device)); + d->device_data = XX_DEVICE (ALLOC_NORMAL_LISP_OBJECT (x_device)); #else /* not NEW_GC */ d->device_data = xnew_and_zero (struct x_device); #endif /* not NEW_GC */
--- a/src/device.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/device.c Fri Mar 05 04:08:17 2010 -0600 @@ -1,7 +1,7 @@ /* Generic device functions. Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. Copyright (C) 1994, 1995 Free Software Foundation, Inc. - Copyright (C) 1995, 1996, 2002 Ben Wing. + Copyright (C) 1995, 1996, 2002, 2010 Ben Wing. This file is part of XEmacs. @@ -200,7 +200,7 @@ static void nuke_all_device_slots (struct device *d, Lisp_Object zap) { - ZERO_LISP_OBJECT (d); + zero_nonsized_lisp_object (wrap_device (d)); #define MARKED_SLOT(x) d->x = zap; #include "devslots.h" @@ -209,7 +209,7 @@ static struct device * allocate_device (Lisp_Object console) { - Lisp_Object obj = ALLOC_LISP_OBJECT (device); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (device); struct device *d = XDEVICE (obj); struct gcpro gcpro1;
--- a/src/dialog-msw.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/dialog-msw.c Fri Mar 05 04:08:17 2010 -0600 @@ -748,7 +748,7 @@ list. */ { int i; - Lisp_Object obj = ALLOC_LISP_OBJECT (mswindows_dialog_id); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (mswindows_dialog_id); struct mswindows_dialog_id *did = XMSWINDOWS_DIALOG_ID (obj); did->frame = wrap_frame (f);
--- a/src/elhash.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/elhash.c Fri Mar 05 04:08:17 2010 -0600 @@ -1,6 +1,6 @@ /* Implementation of the hash table lisp object type. Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. - Copyright (C) 1995, 1996, 2002, 2004 Ben Wing. + Copyright (C) 1995, 1996, 2002, 2004, 2010 Ben Wing. Copyright (C) 1997 Free Software Foundation, Inc. This file is part of XEmacs. @@ -96,7 +96,7 @@ struct Lisp_Hash_Table { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Elemcount size; Elemcount count; Elemcount rehash_count; @@ -421,9 +421,9 @@ } static void -finalize_hash_table (void *header) +finalize_hash_table (Lisp_Object obj) { - Lisp_Hash_Table *ht = (Lisp_Hash_Table *) header; + Lisp_Hash_Table *ht = XHASH_TABLE (obj); free_hentries (ht->hentries, ht->size); ht->hentries = 0; } @@ -583,7 +583,7 @@ double rehash_threshold, enum hash_table_weakness weakness) { - Lisp_Object hash_table = ALLOC_LISP_OBJECT (hash_table); + Lisp_Object hash_table = ALLOC_NORMAL_LISP_OBJECT (hash_table); Lisp_Hash_Table *ht = XHASH_TABLE (hash_table); ht->test_function = test_function; @@ -1037,9 +1037,9 @@ (hash_table)) { const Lisp_Hash_Table *ht_old = xhash_table (hash_table); - Lisp_Object obj = ALLOC_LISP_OBJECT (hash_table); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (hash_table); Lisp_Hash_Table *ht = XHASH_TABLE (obj); - COPY_LISP_OBJECT (ht, ht_old); + copy_lisp_object (obj, hash_table); /* We leave room for one never-occupied sentinel htentry at the end. */ ht->hentries = allocate_hash_table_entries (ht_old->size + 1);
--- a/src/elhash.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/elhash.h Fri Mar 05 04:08:17 2010 -0600 @@ -36,7 +36,7 @@ typedef struct htentry { #ifdef NEW_GC - LISP_OBJECT_HEADER lheader; + NORMAL_LISP_OBJECT_HEADER lheader; #endif /* NEW_GC */ Lisp_Object key; Lisp_Object value;
--- a/src/emacs.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/emacs.c Fri Mar 05 04:08:17 2010 -0600 @@ -2021,7 +2021,7 @@ - make_int() - make_char() - make_extent() - - ALLOC_LISP_OBJECT() + - ALLOC_NORMAL_LISP_OBJECT() - ALLOC_SIZED_LISP_OBJECT() - Fcons() - listN() @@ -2312,7 +2312,6 @@ #endif reinit_vars_of_event_stream (); reinit_vars_of_events (); - reinit_vars_of_extents (); reinit_vars_of_file_coding (); reinit_vars_of_fileio (); #ifdef USE_C_FONT_LOCK
--- a/src/eval.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/eval.c Fri Mar 05 04:08:17 2010 -0600 @@ -4623,12 +4623,11 @@ } static Bytecount -size_multiple_value (const void *lheader) +size_multiple_value (Lisp_Object obj) { return FLEXIBLE_ARRAY_STRUCT_SIZEOF (struct multiple_value, Lisp_Object, contents, - ((struct multiple_value *) lheader)-> - allocated_count); + XMULTIPLE_VALUE (obj)->allocated_count); } static const struct memory_description multiple_value_description[] = {
--- a/src/event-stream.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/event-stream.c Fri Mar 05 04:08:17 2010 -0600 @@ -352,9 +352,9 @@ } static void -finalize_command_builder (void *header) +finalize_command_builder (Lisp_Object obj) { - struct command_builder *b = (struct command_builder *) header; + struct command_builder *b = XCOMMAND_BUILDER (obj); if (b->echo_buf) { xfree (b->echo_buf); @@ -382,7 +382,7 @@ Lisp_Object allocate_command_builder (Lisp_Object console, int with_echo_buf) { - Lisp_Object builder_obj = ALLOC_LISP_OBJECT (command_builder); + Lisp_Object builder_obj = ALLOC_NORMAL_LISP_OBJECT (command_builder); struct command_builder *builder = XCOMMAND_BUILDER (builder_obj); builder->console = console; @@ -453,7 +453,7 @@ xfree (builder->echo_buf); builder->echo_buf = NULL; } - FREE_LISP_OBJECT (wrap_command_builder (builder)); + free_normal_lisp_object (wrap_command_builder (builder)); } static void @@ -1043,7 +1043,7 @@ Lisp_Object function, Lisp_Object object, int async_p) { - Lisp_Object op = ALLOC_LISP_OBJECT (timeout); + Lisp_Object op = ALLOC_NORMAL_LISP_OBJECT (timeout); Lisp_Timeout *timeout = XTIMEOUT (op); EMACS_TIME current_time; EMACS_TIME interval; @@ -1161,7 +1161,7 @@ *timeout_list = noseeum_cons (op, *timeout_list); } else - FREE_LISP_OBJECT (op); + free_normal_lisp_object (op); UNGCPRO; return id; @@ -1198,7 +1198,7 @@ signal_remove_async_interval_timeout (timeout->interval_id); else event_stream_remove_timeout (timeout->interval_id); - FREE_LISP_OBJECT (op); + free_normal_lisp_object (op); } }
--- a/src/events.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/events.h Fri Mar 05 04:08:17 2010 -0600 @@ -660,7 +660,7 @@ struct Lisp_Timeout { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; int id; /* Id we use to identify the timeout over its lifetime */ int interval_id; /* Id for this particular interval; this may be different each time the timeout is @@ -1117,7 +1117,7 @@ */ struct command_builder { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object console; /* back pointer to the console this command builder is for */ #if 0
--- a/src/extents-impl.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/extents-impl.h Fri Mar 05 04:08:17 2010 -0600 @@ -1,5 +1,5 @@ /* Copyright (c) 1994, 1995 Free Software Foundation. - Copyright (c) 1995, 1996, 2002 Ben Wing. + Copyright (c) 1995, 1996, 2002, 2010 Ben Wing. This file is part of XEmacs. @@ -101,35 +101,42 @@ have this structure around and thus the size of an extent is smaller. */ typedef struct extent_auxiliary extent_auxiliary; + +#define EXTENT_AUXILIARY_SLOTS \ + SLOT (begin_glyph) \ + SLOT (end_glyph) \ + SLOT (parent) \ + /* We use a weak list here. Originally I didn't do this and \ + depended on having the extent's finalization method remove \ + itself from its parent's children list. This runs into \ + lots and lots of problems though because everything is in \ + a really really bizarre state when an extent's finalization \ + method is called (it happens in sweep_extents() by way of \ + ADDITIONAL_FREE_extent()) and it's extremely difficult to \ + avoid getting hosed by just-freed objects. */ \ + SLOT (children) \ + SLOT (invisible) \ + SLOT (read_only) \ + SLOT (mouse_face) \ + SLOT (initial_redisplay_function) \ + SLOT (before_change_functions) \ + SLOT (after_change_functions) + + struct extent_auxiliary { - LISP_OBJECT_HEADER header; - - Lisp_Object begin_glyph; - Lisp_Object end_glyph; - Lisp_Object parent; - /* We use a weak list here. Originally I didn't do this and - depended on having the extent's finalization method remove - itself from its parent's children list. This runs into - lots and lots of problems though because everything is in - a really really bizarre state when an extent's finalization - method is called (it happens in sweep_extents() by way of - ADDITIONAL_FREE_extent()) and it's extremely difficult to - avoid getting hosed by just-freed objects. */ - Lisp_Object children; - Lisp_Object invisible; - Lisp_Object read_only; - Lisp_Object mouse_face; - Lisp_Object initial_redisplay_function; - Lisp_Object before_change_functions, after_change_functions; + NORMAL_LISP_OBJECT_HEADER header; +#define SLOT(x) Lisp_Object x; + EXTENT_AUXILIARY_SLOTS +#undef SLOT int priority; }; -extern struct extent_auxiliary extent_auxiliary_defaults; +extern Lisp_Object Vextent_auxiliary_defaults; struct extent_info { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; struct extent_list *extents; struct stack_of_extents *soe; @@ -153,7 +160,7 @@ { return e->flags.has_aux ? XEXTENT_AUXILIARY (XCAR (e->plist)) : - & extent_auxiliary_defaults; + XEXTENT_AUXILIARY (Vextent_auxiliary_defaults); } #define extent_no_chase_aux_field(e, field) (extent_aux_or_default(e)->field) @@ -167,8 +174,8 @@ #define set_extent_no_chase_aux_field(e, field, value) do { \ EXTENT sencaf_e = (e); \ if (! sencaf_e->flags.has_aux) \ - allocate_extent_auxiliary (sencaf_e); \ - XEXTENT_AUXILIARY (XCAR (sencaf_e->plist))->field = (value);\ + attach_extent_auxiliary (sencaf_e); \ + XEXTENT_AUXILIARY (XCAR (sencaf_e->plist))->field = (value); \ } while (0) #define set_extent_no_chase_normal_field(e, field, value) \
--- a/src/extents.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/extents.c Fri Mar 05 04:08:17 2010 -0600 @@ -243,7 +243,7 @@ typedef struct gap_array_marker { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ int pos; struct gap_array_marker *next; @@ -273,7 +273,7 @@ typedef struct gap_array { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ Elemcount gap; Elemcount gapsize; @@ -319,7 +319,7 @@ typedef struct extent_list_marker { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ Gap_Array_Marker *m; int endp; @@ -329,7 +329,7 @@ typedef struct extent_list { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ Gap_Array *start; Gap_Array *end; @@ -382,19 +382,13 @@ #define EXTENT_GAP_ARRAY_AT(ga, pos) (* (EXTENT *) GAP_ARRAY_EL_ADDR(ga, pos)) /* ------------------------------- */ -/* auxiliary extent structure */ -/* ------------------------------- */ - -struct extent_auxiliary extent_auxiliary_defaults; - -/* ------------------------------- */ /* buffer-extent primitives */ /* ------------------------------- */ typedef struct stack_of_extents { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ Extent_List *extents; Memxpos pos; /* Position of stack of extents. EXTENTS is the list of @@ -442,6 +436,8 @@ Lisp_Object Vlast_highlighted_extent; +Lisp_Object Vextent_auxiliary_defaults; + Lisp_Object QSin_map_extents_internal; Fixnum mouse_highlight_priority; @@ -691,7 +687,7 @@ assert (pos >= 0 && pos <= ga->numels); #ifdef NEW_GC - m = XGAP_ARRAY_MARKER (ALLOC_LISP_OBJECT (gap_array_marker)); + m = XGAP_ARRAY_MARKER (ALLOC_NORMAL_LISP_OBJECT (gap_array_marker)); #else /* not NEW_GC */ if (gap_array_marker_freelist) { @@ -929,7 +925,7 @@ Extent_List_Marker *m; #ifdef NEW_GC - m = XEXTENT_LIST_MARKER (ALLOC_LISP_OBJECT (extent_list_marker)); + m = XEXTENT_LIST_MARKER (ALLOC_NORMAL_LISP_OBJECT (extent_list_marker)); #else /* not NEW_GC */ if (extent_list_marker_freelist) { @@ -978,7 +974,7 @@ allocate_extent_list (void) { #ifdef NEW_GC - Extent_List *el = XEXTENT_LIST (ALLOC_LISP_OBJECT (extent_list)); + Extent_List *el = XEXTENT_LIST (ALLOC_NORMAL_LISP_OBJECT (extent_list)); #else /* not NEW_GC */ Extent_List *el = xnew (Extent_List); #endif /* not NEW_GC */ @@ -1004,46 +1000,48 @@ /************************************************************************/ static const struct memory_description extent_auxiliary_description[] ={ - { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, begin_glyph) }, - { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, end_glyph) }, - { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, parent) }, - { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, children) }, - { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, invisible) }, - { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, read_only) }, - { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, mouse_face) }, - { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, initial_redisplay_function) }, - { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, before_change_functions) }, - { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, after_change_functions) }, +#define SLOT(x) \ + { XD_LISP_OBJECT, offsetof (struct extent_auxiliary, x) }, + EXTENT_AUXILIARY_SLOTS +#undef SLOT { XD_END } }; static Lisp_Object mark_extent_auxiliary (Lisp_Object obj) { struct extent_auxiliary *data = XEXTENT_AUXILIARY (obj); - mark_object (data->begin_glyph); - mark_object (data->end_glyph); - mark_object (data->invisible); - mark_object (data->children); - mark_object (data->read_only); - mark_object (data->mouse_face); - mark_object (data->initial_redisplay_function); - mark_object (data->before_change_functions); - mark_object (data->after_change_functions); - return data->parent; -} - -DEFINE_NODUMP_INTERNAL_LISP_OBJECT ("extent-auxiliary", - extent_auxiliary, - mark_extent_auxiliary, - extent_auxiliary_description, - struct extent_auxiliary); +#define SLOT(x) mark_object (data->x); + EXTENT_AUXILIARY_SLOTS +#undef SLOT + + return Qnil; +} + +DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("extent-auxiliary", + extent_auxiliary, + mark_extent_auxiliary, + extent_auxiliary_description, + struct extent_auxiliary); + + +static Lisp_Object +allocate_extent_auxiliary (void) +{ + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (extent_auxiliary); + struct extent_auxiliary *data = XEXTENT_AUXILIARY (obj); + +#define SLOT(x) data->x = Qnil; + EXTENT_AUXILIARY_SLOTS +#undef SLOT + + return obj; +} + void -allocate_extent_auxiliary (EXTENT ext) -{ - Lisp_Object obj = ALLOC_LISP_OBJECT (extent_auxiliary); - struct extent_auxiliary *data = XEXTENT_AUXILIARY (obj); - - COPY_LISP_OBJECT (data, &extent_auxiliary_defaults); +attach_extent_auxiliary (EXTENT ext) +{ + Lisp_Object obj = allocate_extent_auxiliary (); + ext->plist = Fcons (obj, ext->plist); ext->flags.has_aux = 1; } @@ -1123,9 +1121,9 @@ #ifdef NEW_GC static Bytecount -size_gap_array (const void *lheader) -{ - Gap_Array *ga = (Gap_Array *) lheader; +size_gap_array (Lisp_Object obj) +{ + Gap_Array *ga = XGAP_ARRAY (obj); return offsetof (Gap_Array, array) + (ga->numels + ga->gapsize) * ga->elsize; } @@ -1266,9 +1264,9 @@ struct extent_info); #else /* not NEW_GC */ static void -finalize_extent_info (void *header) -{ - struct extent_info *data = (struct extent_info *) header; +finalize_extent_info (Lisp_Object obj) +{ + struct extent_info *data = XEXTENT_INFO (obj); data->soe = 0; data->extents = 0; @@ -1294,7 +1292,7 @@ static Lisp_Object allocate_extent_info (void) { - Lisp_Object obj = ALLOC_LISP_OBJECT (extent_info); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (extent_info); struct extent_info *data = XEXTENT_INFO (obj); data->extents = allocate_extent_list (); @@ -1456,15 +1454,11 @@ void uninit_buffer_extents (struct buffer *b) { -#ifndef NEW_GC - struct extent_info *data = XEXTENT_INFO (b->extent_info); -#endif /* not NEW_GC */ - /* Don't destroy the extents here -- there may still be children extents pointing to the extents. */ detach_all_extents (wrap_buffer (b)); #ifndef NEW_GC - finalize_extent_info (data); + finalize_extent_info (b->extent_info); #endif /* not NEW_GC */ } @@ -1785,7 +1779,7 @@ { #ifdef NEW_GC struct stack_of_extents *soe = - XSTACK_OF_EXTENTS (ALLOC_LISP_OBJECT (stack_of_extents)); + XSTACK_OF_EXTENTS (ALLOC_NORMAL_LISP_OBJECT (stack_of_extents)); #else /* not NEW_GC */ struct stack_of_extents *soe = xnew_and_zero (struct stack_of_extents); #endif /* not NEW_GC */ @@ -4043,10 +4037,9 @@ /* also need to copy the aux struct. It won't work for this extent to share the same aux struct as the original one. */ - Lisp_Object ea = ALLOC_LISP_OBJECT (extent_auxiliary); - struct extent_auxiliary *data = XEXTENT_AUXILIARY (ea); - - COPY_LISP_OBJECT (data, XEXTENT_AUXILIARY (XCAR (original->plist))); + Lisp_Object ea = ALLOC_NORMAL_LISP_OBJECT (extent_auxiliary); + + copy_lisp_object (ea, XCAR (original->plist)); XCAR (e->plist) = ea; } @@ -7565,22 +7558,6 @@ } void -reinit_vars_of_extents (void) -{ - extent_auxiliary_defaults.begin_glyph = Qnil; - extent_auxiliary_defaults.end_glyph = Qnil; - extent_auxiliary_defaults.parent = Qnil; - extent_auxiliary_defaults.children = Qnil; - extent_auxiliary_defaults.priority = 0; - extent_auxiliary_defaults.invisible = Qnil; - extent_auxiliary_defaults.read_only = Qnil; - extent_auxiliary_defaults.mouse_face = Qnil; - extent_auxiliary_defaults.initial_redisplay_function = Qnil; - extent_auxiliary_defaults.before_change_functions = Qnil; - extent_auxiliary_defaults.after_change_functions = Qnil; -} - -void vars_of_extents (void) { DEFVAR_INT ("mouse-highlight-priority", &mouse_highlight_priority /* @@ -7624,4 +7601,8 @@ QSin_map_extents_internal = build_defer_string ("(in map-extents-internal)"); staticpro (&QSin_map_extents_internal); -} + + Vextent_auxiliary_defaults = + allocate_extent_auxiliary (); + staticpro (&Vextent_auxiliary_defaults); +}
--- a/src/extents.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/extents.h Fri Mar 05 04:08:17 2010 -0600 @@ -1,5 +1,5 @@ /* Copyright (c) 1994, 1995 Free Software Foundation. - Copyright (c) 1995, 1996, 2002 Ben Wing. + Copyright (c) 1995, 1996, 2002, 2010 Ben Wing. This file is part of XEmacs. @@ -228,7 +228,7 @@ /* from alloc.c */ struct extent *allocate_extent (void); -void allocate_extent_auxiliary (EXTENT ext); +void attach_extent_auxiliary (EXTENT ext); void init_buffer_extents (struct buffer *b); void uninit_buffer_extents (struct buffer *b);
--- a/src/faces.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/faces.c Fri Mar 05 04:08:17 2010 -0600 @@ -399,7 +399,7 @@ static Lisp_Face * allocate_face (void) { - Lisp_Object obj = ALLOC_LISP_OBJECT (face); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (face); Lisp_Face *result = XFACE (obj); reset_face (result);
--- a/src/faces.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/faces.h Fri Mar 05 04:08:17 2010 -0600 @@ -34,7 +34,7 @@ struct Lisp_Face { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object name; Lisp_Object doc_string; @@ -119,7 +119,7 @@ struct face_cachel { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ /* There are two kinds of cachels; those created from a single face and those created by merging more than one face. In the former
--- a/src/file-coding.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/file-coding.c Fri Mar 05 04:08:17 2010 -0600 @@ -2,7 +2,7 @@ #### rename me to coding-system.c or coding.c Copyright (C) 1991, 1995 Free Software Foundation, Inc. Copyright (C) 1995 Sun Microsystems, Inc. - Copyright (C) 2000, 2001, 2002, 2003, 2005 Ben Wing. + Copyright (C) 2000, 2001, 2002, 2003, 2005, 2010 Ben Wing. This file is part of XEmacs. @@ -318,20 +318,19 @@ #ifndef NEW_GC static void -finalize_coding_system (void *header) +finalize_coding_system (Lisp_Object obj) { - Lisp_Object cs = wrap_coding_system ((Lisp_Coding_System *) header); /* Since coding systems never go away, this function is not necessary. But it would be necessary if we changed things so that coding systems could go away. */ - MAYBE_XCODESYSMETH (cs, finalize, (cs)); + MAYBE_XCODESYSMETH (obj, finalize, (obj)); } #endif /* not NEW_GC */ static Bytecount -sizeof_coding_system (const void *header) +sizeof_coding_system (Lisp_Object obj) { - const Lisp_Coding_System *p = (const Lisp_Coding_System *) header; + const Lisp_Coding_System *p = XCODING_SYSTEM (obj); return offsetof (Lisp_Coding_System, data) + p->methods->extra_data_size; } @@ -1448,12 +1447,8 @@ invalid_operation_2 ("Coding systems not same type", old_coding_system, new_coding_system); - { - Lisp_Coding_System *to = XCODING_SYSTEM (new_coding_system); - Lisp_Coding_System *from = XCODING_SYSTEM (old_coding_system); - COPY_SIZED_LISP_OBJECT (to, from, sizeof_coding_system (from)); - to->name = new_name; - } + copy_lisp_object (new_coding_system, old_coding_system); + XCODING_SYSTEM (new_coding_system)->name = new_name; return new_coding_system; }
--- a/src/file-coding.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/file-coding.h Fri Mar 05 04:08:17 2010 -0600 @@ -188,7 +188,7 @@ struct Lisp_Coding_System { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; struct coding_system_methods *methods; #define CODING_SYSTEM_SLOT_DECLARATION
--- a/src/fns.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/fns.c Fri Mar 05 04:08:17 2010 -0600 @@ -119,9 +119,9 @@ } static Bytecount -size_bit_vector (const void *lheader) +size_bit_vector (Lisp_Object obj) { - Lisp_Bit_Vector *v = (Lisp_Bit_Vector *) lheader; + Lisp_Bit_Vector *v = XBIT_VECTOR (obj); return FLEXIBLE_ARRAY_STRUCT_SIZEOF (Lisp_Bit_Vector, unsigned long, bits, BIT_VECTOR_LONG_STORAGE (bit_vector_length (v))); }
--- a/src/font-mgr.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/font-mgr.c Fri Mar 05 04:08:17 2010 -0600 @@ -3,6 +3,7 @@ Copyright (C) 2003 Eric Knauel and Matthias Neubauer Copyright (C) 2005 Eric Knauel Copyright (C) 2004-2009 Free Software Foundation, Inc. +Copyright (C) 2010 Ben Wing. Authors: Eric Knauel <knauel@informatik.uni-tuebingen.de> Matthias Neubauer <neubauer@informatik.uni-freiburg.de> @@ -93,9 +94,9 @@ ****************************************************************/ static void -finalize_fc_pattern (void *header) +finalize_fc_pattern (Lisp_Object obj) { - struct fc_pattern *p = (struct fc_pattern *) header; + struct fc_pattern *p = XFC_PATTERN (obj); if (p->fcpatPtr) { FcPatternDestroy (p->fcpatPtr); @@ -107,7 +108,7 @@ print_fc_pattern (Lisp_Object obj, Lisp_Object printcharfun, int UNUSED(escapeflag)) { - struct fc_pattern *c = XFCPATTERN (obj); + struct fc_pattern *c = XFC_PATTERN (obj); if (print_readably) printing_unreadable_object ("#<fc-pattern 0x%x>", c->header.uid); write_fmt_string (printcharfun, "#<fc-pattern 0x%x>", c->header.uid); @@ -226,7 +227,7 @@ */ (object)) { - return FCPATTERNP(object) ? Qt : Qnil; + return FC_PATTERNP(object) ? Qt : Qnil; } DEFUN("fc-pattern-create", Ffc_pattern_create, 0, 0, 0, /* @@ -234,10 +235,10 @@ */ ()) { - fc_pattern *fcpat = XFCPATTERN (ALLOC_LISP_OBJECT (fc_pattern)); + fc_pattern *fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); fcpat->fcpatPtr = FcPatternCreate (); - return wrap_fcpattern (fcpat); + return wrap_fc_pattern (fcpat); } DEFUN("fc-name-parse", Ffc_name_parse, 1, 1, 0, /* @@ -245,12 +246,12 @@ */ (name)) { - fc_pattern *fcpat = XFCPATTERN (ALLOC_LISP_OBJECT (fc_pattern)); + fc_pattern *fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); CHECK_STRING (name); fcpat->fcpatPtr = FcNameParse ((FcChar8 *) extract_fcapi_string (name)); - return wrap_fcpattern (fcpat); + return wrap_fc_pattern (fcpat); } /* #### Ga-a-ack! Xft's similar function is actually a different API. @@ -262,8 +263,8 @@ { FcChar8 *name; Lisp_Object result; - CHECK_FCPATTERN(pattern); - name = FcNameUnparse (XFCPATTERN_PTR (pattern)); + CHECK_FC_PATTERN(pattern); + name = FcNameUnparse (XFC_PATTERN_PTR (pattern)); result = build_fcapi_string (name); xfree (name); return result; @@ -275,11 +276,11 @@ (pattern)) { struct fc_pattern *copy = NULL; - CHECK_FCPATTERN (pattern); + CHECK_FC_PATTERN (pattern); - copy = XFCPATTERN (ALLOC_LISP_OBJECT (fc_pattern)); - copy->fcpatPtr = FcPatternDuplicate (XFCPATTERN_PTR (pattern)); - return wrap_fcpattern (copy); + copy = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); + copy->fcpatPtr = FcPatternDuplicate (XFC_PATTERN_PTR (pattern)); + return wrap_fc_pattern (copy); } DEFUN("fc-pattern-add", Ffc_pattern_add, 3, 3, 0, /* @@ -295,11 +296,11 @@ const Extbyte *obj; FcPattern *fcpat; - CHECK_FCPATTERN (pattern); + CHECK_FC_PATTERN (pattern); CHECK_STRING (property); obj = fc_intern (property); - fcpat = XFCPATTERN_PTR (pattern); + fcpat = XFC_PATTERN_PTR (pattern); if (STRINGP(value)) { @@ -330,10 +331,10 @@ { Bool res; - CHECK_FCPATTERN(pattern); + CHECK_FC_PATTERN(pattern); CHECK_STRING(property); - res = FcPatternDel(XFCPATTERN_PTR(pattern), extract_fcapi_string (property)); + res = FcPatternDel(XFC_PATTERN_PTR(pattern), extract_fcapi_string (property)); return res ? Qt : Qnil; } @@ -423,7 +424,7 @@ /* process arguments */ - CHECK_FCPATTERN (pattern); + CHECK_FC_PATTERN (pattern); #if 0 /* Don't support the losing symbol-for-property interface. */ @@ -447,7 +448,7 @@ if (!NILP (type)) CHECK_SYMBOL (type); /* get property */ - fc_result = FcPatternGet (XFCPATTERN_PTR (pattern), + fc_result = FcPatternGet (XFC_PATTERN_PTR (pattern), fc_property, NILP (id) ? 0 : XINT(id), &fc_value); @@ -515,16 +516,16 @@ /* Linear search: fc_configs are not going to multiply like conses. */ { LIST_LOOP_2 (cfg, configs) - if (fc == XFCCONFIG_PTR (cfg)) + if (fc == XFC_CONFIG_PTR (cfg)) return cfg; } { - fc_config *fccfg = XFCCONFIG (ALLOC_LISP_OBJECT (fc_config)); + fc_config *fccfg = XFC_CONFIG (ALLOC_NORMAL_LISP_OBJECT (fc_config)); fccfg->fccfgPtr = fc; - configs = Fcons (wrap_fcconfig (fccfg), configs); + configs = Fcons (wrap_fc_config (fccfg), configs); XWEAK_LIST_LIST (Vfc_config_weak_list) = configs; - return wrap_fcconfig (fccfg); + return wrap_fc_config (fccfg); } } @@ -536,8 +537,8 @@ Lisp_Object value = Qnil; FcStrList *thing_list; - CHECK_FCCONFIG (config); - thing_list = (*getter) (XFCCONFIG_PTR(config)); + CHECK_FC_CONFIG (config); + thing_list = (*getter) (XFC_CONFIG_PTR(config)); /* Yes, we need to do this check -- sheesh, Keith! */ if (!thing_list) return Qnil; @@ -559,9 +560,9 @@ invalid_state ("failed to create FcFontSet", Qunbound); for (idx = 0; idx < fontset->nfont; ++idx) { - fcpat = XFCPATTERN (ALLOC_LISP_OBJECT (fc_pattern)); + fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); fcpat->fcpatPtr = FcPatternDuplicate (fontset->fonts[idx]); - fontlist = Fcons (wrap_fcpattern(fcpat), fontlist); + fontlist = Fcons (wrap_fc_pattern(fcpat), fontlist); } if (destroyp) FcFontSetDestroy (fontset); @@ -573,7 +574,7 @@ */ (object)) { - return FCCONFIGP (object) ? Qt : Qnil; + return FC_CONFIGP (object) ? Qt : Qnil; } DEFUN("fc-config-create", Ffc_config_create, 0, 0, 0, /* @@ -606,8 +607,8 @@ in-memory version is in sync with the disk version. */ (config)) { - CHECK_FCCONFIG (config); - return FcConfigUptoDate (XFCCONFIG_PTR (config)) == FcFalse ? Qnil : Qt; + CHECK_FC_CONFIG (config); + return FcConfigUptoDate (XFC_CONFIG_PTR (config)) == FcFalse ? Qnil : Qt; } DEFUN("fc-config-build-fonts", Ffc_config_build_fonts, 1, 1, 0, /* @@ -619,8 +620,8 @@ XEmacs: signal out-of-memory, or return nil on success. */ (config)) { - CHECK_FCCONFIG (config); - if (FcConfigBuildFonts (XFCCONFIG_PTR (config)) == FcFalse) + CHECK_FC_CONFIG (config); + if (FcConfigBuildFonts (XFC_CONFIG_PTR (config)) == FcFalse) out_of_memory ("FcConfigBuildFonts failed", config); return Qnil; } @@ -661,9 +662,9 @@ information. */ (config)) { - CHECK_FCCONFIG (config); + CHECK_FC_CONFIG (config); /* Surely FcConfigGetCache just casts an FcChar8* to char*. */ - return build_fcapi_string ((FcChar8 *) FcConfigGetCache (XFCCONFIG_PTR (config))); + return build_fcapi_string ((FcChar8 *) FcConfigGetCache (XFC_CONFIG_PTR (config))); } DEFUN("fc-config-get-fonts", Ffc_config_get_fonts, 2, 2, 0, /* @@ -680,7 +681,7 @@ FcSetName name = FcSetSystem; FcFontSet *fs = NULL; - CHECK_FCCONFIG (config); + CHECK_FC_CONFIG (config); CHECK_SYMBOL (set); if (EQ (set, intern ("fc-set-system"))) @@ -690,7 +691,7 @@ else wtaerror ("must be in (fc-set-system fc-set-application)", set); - fs = FcConfigGetFonts (XFCCONFIG_PTR (config), name); + fs = FcConfigGetFonts (XFC_CONFIG_PTR (config), name); return fs ? fontset_to_list (fs, DestroyNo) : Qnil; } @@ -704,7 +705,7 @@ */ (config)) { - CHECK_FCCONFIG (config); + CHECK_FC_CONFIG (config); /* *sigh* "Success" DOES NOT mean you have any fonts available. It is easy to crash fontconfig, and XEmacs with it. Without the following check, this will do it: @@ -713,7 +714,7 @@ (set-face-font 'default "serif-12")) */ - if (FcConfigBuildFonts (XFCCONFIG_PTR (config)) == FcFalse) + if (FcConfigBuildFonts (XFC_CONFIG_PTR (config)) == FcFalse) out_of_memory ("FcConfigBuildFonts failed", config); /* #### We'd like to avoid this consing, and FcConfigGetFonts sometimes returns NULL, but it doesn't always. This will do for now .... */ @@ -721,7 +722,7 @@ && NILP (Ffc_config_get_fonts (config, intern ("fc-set-application")))) signal_error (intern ("args-out-of-range"), "no fonts found", config); /* Should never happen, but I don't trust Keith anymore .... */ - if (FcConfigSetCurrent (XFCCONFIG_PTR (config)) == FcFalse) + if (FcConfigSetCurrent (XFC_CONFIG_PTR (config)) == FcFalse) out_of_memory ("FcConfigBuildFonts failed in set", config); return Qnil; } @@ -735,7 +736,7 @@ #### Unimplemented. */ (config)) { - CHECK_FCCONFIG (config); + CHECK_FC_CONFIG (config); signal_error (Qunimplemented, "no method to convert FcBlanks object", intern ("fc-config-get-blanks")); } @@ -748,8 +749,8 @@ the last check. */ (config)) { - CHECK_FCCONFIG (config); - return make_int (FcConfigGetRescanInterval (XFCCONFIG_PTR (config))); + CHECK_FC_CONFIG (config); + return make_int (FcConfigGetRescanInterval (XFC_CONFIG_PTR (config))); } DEFUN("fc-config-set-rescan-interval", Ffc_config_set_rescan_interval, 2, 2, 0, /* @@ -759,9 +760,9 @@ XEmacs: signal such error, or return nil on success. */ (config, rescan_interval)) { - CHECK_FCCONFIG (config); + CHECK_FC_CONFIG (config); CHECK_INT (rescan_interval); - if (FcConfigSetRescanInterval (XFCCONFIG_PTR (config), + if (FcConfigSetRescanInterval (XFC_CONFIG_PTR (config), XINT (rescan_interval)) == FcFalse) signal_error (Qio_error, "FcConfigSetRescanInverval barfed", intern ("fc-config-set-rescan-interval")); @@ -775,10 +776,10 @@ Adds an application-specific font to the configuration. */ (config, file)) { - CHECK_FCCONFIG (config); + CHECK_FC_CONFIG (config); CHECK_STRING (file); if (FcConfigAppFontAddFile - (XFCCONFIG_PTR (config), + (XFC_CONFIG_PTR (config), /* #### FIXME! is Qfile_name right? */ (FcChar8 *) LISP_STRING_TO_EXTERNAL (file, Qfile_name)) == FcFalse) return Qnil; @@ -794,10 +795,10 @@ the application-specific set of fonts. */ (config, dir)) { - CHECK_FCCONFIG (config); + CHECK_FC_CONFIG (config); CHECK_STRING (dir); if (FcConfigAppFontAddDir - (XFCCONFIG_PTR (config), + (XFC_CONFIG_PTR (config), /* #### FIXME! is Qfile_name right? */ (FcChar8 *) LISP_STRING_TO_EXTERNAL (dir, Qfile_name)) == FcFalse) return Qnil; @@ -811,8 +812,8 @@ Clears the set of application-specific fonts. */ (config)) { - CHECK_FCCONFIG (config); - FcConfigAppFontClear (XFCCONFIG_PTR (config)); + CHECK_FC_CONFIG (config); + FcConfigAppFontClear (XFC_CONFIG_PTR (config)); return Qnil; } @@ -884,8 +885,8 @@ specified point size (default 12), dpi (default 75) and scale (default 1). */ (pattern)) { - CHECK_FCPATTERN (pattern); - FcDefaultSubstitute (XFCPATTERN_PTR (pattern)); + CHECK_FC_PATTERN (pattern); + FcDefaultSubstitute (XFC_PATTERN_PTR (pattern)); return Qnil; } @@ -919,14 +920,14 @@ wtaerror ("need `fc-match-pattern' or `fc-match-font'", kind); /* Typecheck arguments */ - CHECK_FCPATTERN (pattern); - if (!NILP (testpat)) CHECK_FCPATTERN (testpat); - if (!NILP (config)) CHECK_FCCONFIG (config); + CHECK_FC_PATTERN (pattern); + if (!NILP (testpat)) CHECK_FC_PATTERN (testpat); + if (!NILP (config)) CHECK_FC_CONFIG (config); return (FcConfigSubstituteWithPat - (NILP (config) ? FcConfigGetCurrent () : XFCCONFIG_PTR (config), - XFCPATTERN_PTR (pattern), - NILP (testpat) ? NULL : XFCPATTERN_PTR (testpat), + (NILP (config) ? FcConfigGetCurrent () : XFC_CONFIG_PTR (config), + XFC_PATTERN_PTR (pattern), + NILP (testpat) ? NULL : XFC_PATTERN_PTR (testpat), knd) == FcTrue) ? Qt : Qnil; } @@ -953,14 +954,14 @@ if (NILP (config)) { config = Ffc_config_get_current (); } - CHECK_FCPATTERN (pattern); - CHECK_FCPATTERN (font); - CHECK_FCCONFIG (config); + CHECK_FC_PATTERN (pattern); + CHECK_FC_PATTERN (font); + CHECK_FC_CONFIG (config); /* I don't think this can fail? */ - return wrap_fcpattern (FcFontRenderPrepare (XFCCONFIG_PTR(config), - XFCPATTERN_PTR(font), - XFCPATTERN_PTR(pattern))); + return wrap_fc_pattern (FcFontRenderPrepare (XFC_CONFIG_PTR(config), + XFC_PATTERN_PTR(font), + XFC_PATTERN_PTR(pattern))); } DEFUN("fc-font-match", Ffc_font_match, 2, 3, 0, /* @@ -981,18 +982,18 @@ FcPattern *p; FcConfig *fcc; - CHECK_FCPATTERN(pattern); + CHECK_FC_PATTERN(pattern); if (NILP(device)) return Qnil; CHECK_X_DEVICE(device); if (!DEVICE_LIVE_P(XDEVICE(device))) return Qnil; if (!NILP (config)) - CHECK_FCCONFIG (config); + CHECK_FC_CONFIG (config); - res_fcpat = XFCPATTERN (ALLOC_LISP_OBJECT (fc_pattern)); - p = XFCPATTERN_PTR(pattern); - fcc = NILP (config) ? FcConfigGetCurrent () : XFCCONFIG_PTR (config); + res_fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); + p = XFC_PATTERN_PTR(pattern); + fcc = NILP (config) ? FcConfigGetCurrent () : XFC_CONFIG_PTR (config); FcConfigSubstitute (fcc, p, FcMatchPattern); FcDefaultSubstitute (p); @@ -1009,7 +1010,7 @@ return Qfc_internal_error; } else - return wrap_fcpattern(res_fcpat); + return wrap_fc_pattern(res_fcpat); } /* #### fix this name to correspond to Ben's new nomenclature */ @@ -1029,13 +1030,13 @@ FcObjectSet *os; FcFontSet *fontset; - CHECK_FCPATTERN (pattern); + CHECK_FC_PATTERN (pattern); CHECK_LIST (properties); os = FcObjectSetCreate (); string_list_to_fcobjectset (properties, os); /* #### why don't we need to do the "usual substitutions"? */ - fontset = FcFontList (NULL, XFCPATTERN_PTR (pattern), os); + fontset = FcFontList (NULL, XFC_PATTERN_PTR (pattern), os); FcObjectSetDestroy (os); return fontset_to_list (fontset, DestroyYes); @@ -1061,12 +1062,12 @@ match other font-listing APIs. */ (UNUSED (device), pattern, trim, nosub)) { - CHECK_FCPATTERN (pattern); + CHECK_FC_PATTERN (pattern); { FcConfig *fcc = FcConfigGetCurrent(); FcFontSet *fontset; - FcPattern *p = XFCPATTERN_PTR (pattern); + FcPattern *p = XFC_PATTERN_PTR (pattern); FcResult fcresult; if (NILP(nosub)) /* #### temporary debug hack */ @@ -1092,9 +1093,9 @@ */ static void -finalize_fc_config (void *header) +finalize_fc_config (Lisp_Object obj) { - struct fc_config *p = (struct fc_config *) header; + struct fc_config *p = XFC_CONFIG (obj); if (p->fccfgPtr && p->fccfgPtr != FcConfigGetCurrent()) { /* If we get here, all of *our* references are garbage (see comment on @@ -1109,7 +1110,7 @@ print_fc_config (Lisp_Object obj, Lisp_Object printcharfun, int UNUSED(escapeflag)) { - struct fc_config *c = XFCCONFIG (obj); + struct fc_config *c = XFC_CONFIG (obj); if (print_readably) printing_unreadable_object ("#<fc-config 0x%x>", c->header.uid); write_fmt_string (printcharfun, "#<fc-config 0x%x>", c->header.uid);
--- a/src/font-mgr.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/font-mgr.h Fri Mar 05 04:08:17 2010 -0600 @@ -54,38 +54,38 @@ struct fc_pattern { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; FcPattern *fcpatPtr; }; typedef struct fc_pattern fc_pattern; DECLARE_LISP_OBJECT(fc_pattern, struct fc_pattern); -#define XFCPATTERN(x) XRECORD (x, fc_pattern, struct fc_pattern) -#define wrap_fcpattern(p) wrap_record (p, fc_pattern) -#define FCPATTERNP(x) RECORDP (x, fc_pattern) -#define CHECK_FCPATTERN(x) CHECK_RECORD (x, fc_pattern) -#define CONCHECK_FCPATTERN(x) CONCHECK_RECORD (x, fc_pattern) -#define XFCPATTERN_PTR(x) (XFCPATTERN(x)->fcpatPtr) +#define XFC_PATTERN(x) XRECORD (x, fc_pattern, struct fc_pattern) +#define wrap_fc_pattern(p) wrap_record (p, fc_pattern) +#define FC_PATTERNP(x) RECORDP (x, fc_pattern) +#define CHECK_FC_PATTERN(x) CHECK_RECORD (x, fc_pattern) +#define CONCHECK_FC_PATTERN(x) CONCHECK_RECORD (x, fc_pattern) +#define XFC_PATTERN_PTR(x) (XFC_PATTERN(x)->fcpatPtr) #define FONTCONFIG_EXPOSE_CONFIG #ifdef FONTCONFIG_EXPOSE_CONFIG struct fc_config { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; FcConfig *fccfgPtr; }; typedef struct fc_config fc_config; DECLARE_LISP_OBJECT(fc_config, struct fc_config); -#define XFCCONFIG(x) XRECORD (x, fc_config, struct fc_config) -#define wrap_fcconfig(p) wrap_record (p, fc_config) -#define FCCONFIGP(x) RECORDP (x, fc_config) -#define CHECK_FCCONFIG(x) CHECK_RECORD (x, fc_config) -#define CONCHECK_FCCONFIG(x) CONCHECK_RECORD (x, fc_config) -#define XFCCONFIG_PTR(x) (XFCCONFIG(x)->fccfgPtr) +#define XFC_CONFIG(x) XRECORD (x, fc_config, struct fc_config) +#define wrap_fc_config(p) wrap_record (p, fc_config) +#define FC_CONFIGP(x) RECORDP (x, fc_config) +#define CHECK_FC_CONFIG(x) CHECK_RECORD (x, fc_config) +#define CONCHECK_FC_CONFIG(x) CONCHECK_RECORD (x, fc_config) +#define XFC_CONFIG_PTR(x) (XFC_CONFIG(x)->fccfgPtr) #endif /* FONTCONFIG_EXPOSE_CONFIG */
--- a/src/frame-gtk.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/frame-gtk.c Fri Mar 05 04:08:17 2010 -0600 @@ -972,7 +972,7 @@ /* zero out all slots. */ #ifdef NEW_GC - f->frame_data = XGTK_FRAME (ALLOC_LISP_OBJECT (gtk_frame)); + f->frame_data = XGTK_FRAME (ALLOC_NORMAL_LISP_OBJECT (gtk_frame)); #else /* not NEW_GC */ f->frame_data = xnew_and_zero (struct gtk_frame); #endif /* not NEW_GC */
--- a/src/frame-impl.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/frame-impl.h Fri Mar 05 04:08:17 2010 -0600 @@ -41,7 +41,7 @@ struct frame { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; /* Methods for this frame's console. This can also be retrieved through frame->device->console, but it's faster this way. */
--- a/src/frame-msw.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/frame-msw.c Fri Mar 05 04:08:17 2010 -0600 @@ -172,7 +172,7 @@ CHECK_INT (height); #ifdef NEW_GC - f->frame_data = XMSWINDOWS_FRAME (ALLOC_LISP_OBJECT (mswindows_frame)); + f->frame_data = XMSWINDOWS_FRAME (ALLOC_NORMAL_LISP_OBJECT (mswindows_frame)); #else /* not NEW_GC */ f->frame_data = xnew_and_zero (struct mswindows_frame); #endif /* not NEW_GC */
--- a/src/frame-x.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/frame-x.c Fri Mar 05 04:08:17 2010 -0600 @@ -2033,7 +2033,7 @@ { /* zero out all slots. */ #ifdef NEW_GC - f->frame_data = XX_FRAME (ALLOC_LISP_OBJECT (x_frame)); + f->frame_data = XX_FRAME (ALLOC_NORMAL_LISP_OBJECT (x_frame)); #else /* not NEW_GC */ f->frame_data = xnew_and_zero (struct x_frame); #endif /* not NEW_GC */
--- a/src/frame.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/frame.c Fri Mar 05 04:08:17 2010 -0600 @@ -588,7 +588,7 @@ static void nuke_all_frame_slots (struct frame *f) { - ZERO_LISP_OBJECT (f); + zero_nonsized_lisp_object (wrap_frame (f)); #define MARKED_SLOT(x) f->x = Qnil; #include "frameslots.h" @@ -603,7 +603,7 @@ { /* This function can GC */ Lisp_Object root_window; - Lisp_Object frame = ALLOC_LISP_OBJECT (frame); + Lisp_Object frame = ALLOC_NORMAL_LISP_OBJECT (frame); struct frame *f = XFRAME (frame); nuke_all_frame_slots (f);
--- a/src/gc.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/gc.c Fri Mar 05 04:08:17 2010 -0600 @@ -589,7 +589,7 @@ #else /* not NEW_GC */ #define GC_CHECK_NOT_FREE(lheader) \ gc_checking_assert (! LRECORD_FREE_P (lheader)); \ - gc_checking_assert (LHEADER_IMPLEMENTATION (lheader)->basic_p || \ + gc_checking_assert (LHEADER_IMPLEMENTATION (lheader)->frob_block_p || \ ! ((struct old_lcrecord_header *) lheader)->free) #endif /* not NEW_GC */
--- a/src/glyphs.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/glyphs.c Fri Mar 05 04:08:17 2010 -0600 @@ -1112,9 +1112,9 @@ } static void -finalize_image_instance (void *header) -{ - Lisp_Image_Instance *i = (Lisp_Image_Instance *) header; +finalize_image_instance (Lisp_Object obj) +{ + Lisp_Image_Instance *i = XIMAGE_INSTANCE (obj); /* objects like this exist at dump time, so don't bomb out. */ if (IMAGE_INSTANCE_TYPE (i) == IMAGE_NOTHING @@ -1324,7 +1324,7 @@ allocate_image_instance (Lisp_Object governing_domain, Lisp_Object parent, Lisp_Object instantiator) { - Lisp_Object obj = ALLOC_LISP_OBJECT (image_instance); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (image_instance); Lisp_Image_Instance *lp = XIMAGE_INSTANCE (obj); /* It's not possible to simply keep a record of the domain in which @@ -1990,7 +1990,7 @@ device-specific method to copy the window-system subobject. */ new_ = allocate_image_instance (XIMAGE_INSTANCE_DOMAIN (image_instance), Qnil, Qnil); - COPY_LISP_OBJECT (XIMAGE_INSTANCE (new_), XIMAGE_INSTANCE (image_instance)); + copy_lisp_object (new_, image_instance); /* note that if this method returns non-zero, this method MUST copy any window-system resources, so that when one image instance is freed, the other one is not hosed. */ @@ -3833,7 +3833,7 @@ Lisp_Object locale)) { /* This function can GC */ - Lisp_Object obj = ALLOC_LISP_OBJECT (glyph); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (glyph); Lisp_Glyph *g = XGLYPH (obj); g->type = type; @@ -4549,7 +4549,7 @@ XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)) = delq_no_quit (value, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))); - finalize_image_instance (XIMAGE_INSTANCE (value)); + finalize_image_instance (value); } } return 0; @@ -4652,7 +4652,7 @@ struct expose_ignore *ei; #ifdef NEW_GC - ei = XEXPOSE_IGNORE (ALLOC_LISP_OBJECT (expose_ignore)); + ei = XEXPOSE_IGNORE (ALLOC_NORMAL_LISP_OBJECT (expose_ignore)); #else /* not NEW_GC */ ei = Blocktype_alloc (the_expose_ignore_blocktype); #endif /* not NEW_GC */
--- a/src/glyphs.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/glyphs.h Fri Mar 05 04:08:17 2010 -0600 @@ -596,7 +596,7 @@ struct Lisp_Image_Instance { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object domain; /* The domain in which we were cached. */ Lisp_Object device; /* The device of the domain. Recorded since the domain may get deleted @@ -948,7 +948,7 @@ struct Lisp_Glyph { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; enum glyph_type type; @@ -1070,7 +1070,7 @@ struct glyph_cachel { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ Lisp_Object glyph; @@ -1198,7 +1198,7 @@ struct expose_ignore { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ int x, y; int width, height;
--- a/src/gui.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/gui.c Fri Mar 05 04:08:17 2010 -0600 @@ -197,7 +197,7 @@ Lisp_Object allocate_gui_item (void) { - Lisp_Object obj = ALLOC_LISP_OBJECT (gui_item); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (gui_item); gui_item_init (obj); return obj;
--- a/src/gui.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/gui.h Fri Mar 05 04:08:17 2010 -0600 @@ -44,7 +44,7 @@ menu item or submenu properties */ struct Lisp_Gui_Item { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object name; /* String */ Lisp_Object callback; /* Symbol or form */ Lisp_Object callback_ex; /* Form taking context arguments */
--- a/src/keymap.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/keymap.c Fri Mar 05 04:08:17 2010 -0600 @@ -148,7 +148,7 @@ struct Lisp_Keymap { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #define MARKED_SLOT(x) Lisp_Object x; #include "keymap-slots.h" }; @@ -776,7 +776,7 @@ static Lisp_Object make_keymap (Elemcount size) { - Lisp_Object obj = ALLOC_LISP_OBJECT (keymap); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (keymap); Lisp_Keymap *keymap = XKEYMAP (obj); #define MARKED_SLOT(x) keymap->x = Qnil;
--- a/src/lisp.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/lisp.h Fri Mar 05 04:08:17 2010 -0600 @@ -3014,7 +3014,7 @@ #ifdef NEW_GC struct Lisp_String_Direct_Data { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Bytecount size; Ibyte data[1]; }; @@ -3034,7 +3034,7 @@ struct Lisp_String_Indirect_Data { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Bytecount size; Ibyte *data; }; @@ -3188,7 +3188,7 @@ struct Lisp_Vector { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; long size; Lisp_Object contents[1]; }; @@ -3225,7 +3225,7 @@ struct Lisp_Bit_Vector { - LISP_OBJECT_HEADER lheader; + NORMAL_LISP_OBJECT_HEADER lheader; Elemcount size; unsigned long bits[1]; }; @@ -3279,7 +3279,7 @@ /* For when we want to include a bit vector in another structure, and we know it's of a fixed size. */ #define DECLARE_INLINE_LISP_BIT_VECTOR(numbits) struct { \ - LISP_OBJECT_HEADER lheader; \ + NORMAL_LISP_OBJECT_HEADER lheader; \ Elemcount size; \ unsigned long bits[BIT_VECTOR_LONG_STORAGE(numbits)]; \ } @@ -3734,7 +3734,7 @@ struct weak_box { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object value; Lisp_Object next_weak_box; /* don't mark through this! */ @@ -3756,7 +3756,7 @@ struct ephemeron { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object key; @@ -3815,7 +3815,7 @@ struct weak_list { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object list; /* don't mark through this! */ enum weak_list_type type; Lisp_Object next_weak; /* don't mark through this! */ @@ -4700,7 +4700,6 @@ #endif /* not NEW_GC */ int c_readonly (Lisp_Object); int lisp_readonly (Lisp_Object); -MODULE_API void copy_lisp_object (Lisp_Object dst, Lisp_Object src); MODULE_API Lisp_Object build_istring (const Ibyte *); MODULE_API Lisp_Object build_cistring (const CIbyte *); MODULE_API Lisp_Object build_ascstring (const Ascbyte *);
--- a/src/lrecord.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/lrecord.h Fri Mar 05 04:08:17 2010 -0600 @@ -26,40 +26,136 @@ #ifndef INCLUDED_lrecord_h_ #define INCLUDED_lrecord_h_ -/* The "lrecord" type of Lisp object is used for all object types other - than a few simple ones (like char and int). This allows many types to be - implemented but only a few bits required in a Lisp object for type - information. (The tradeoff is that each object has its type marked in - it, thereby increasing its size.) All lrecords begin with a `struct - lrecord_header', which identifies the lisp object type, by providing an - index into a table of `struct lrecord_implementation', which describes - the behavior of the lisp object. It also contains some other data bits. +/* All objects other than char and int are implemented as structures and + passed by reference. Such objects are called "record objects" ("record" + is another term for "structure"). The "wrapped" value of such an object + (i.e. when stored in a variable of type Lisp_Object) is simply the raw + pointer coerced to an integral type the same size as the pointer + (usually `long'). + + Under old-GC (i.e. when NEW_GC is not defined), there are two kinds of + record objects: normal objects (those allocated on their own with + xmalloc()) and frob-block objects (those allocated as pieces of large, + usually 2K, chunks of memory known as "frob blocks"). Under NEW_GC, + there is only one type of record object. Stuff below that applies to + frob-block objects is assumed to apply to the same type of object as + normal objects under NEW_GC. + + Record objects have a header at the beginning of their structure, which + is used internally to identify the type of the object (so that an + object's type can be recovered from its pointer); in addition, it holds + a few flags and a "UID", which for most objects is shown when it is + printed, and is primarily useful for debugging purposes. The header of + a normal object is declared as NORMAL_LISP_OBJECT_HEADER and that of a + frob-block object FROB_BLOCK_LISP_OBJECT_HEADER. + + FROB_BLOCK_LISP_OBJECT_HEADER boils down to a `struct lrecord_header'. + This is a 32-bit value made up of bit fields, where 8 bits are used to + hold the type, 2 or 3 bits are used for flags associated with the + garbage collector, and the remaining 21 or 22 bits hold the UID. + + Under NEW_GC, NORMAL_LISP_OBJECT_HEADER also resolves to `struct + lrecord_header'. Under old-GC, however, NORMAL_LISP_OBJECT_HEADER + resolves to a `struct old_lcrecord_header' (note the `c'), which is a + larger structure -- on 32-bit machines it occupies 3 machine words + instead of 1. Such an object is known internally as an "lcrecord". The + first word of `struct old_lcrecord_header' is an embedded `struct + lrecord_header' with the same information as for frob-block objects; + that way, all objects can be cast to a `struct lrecord_header' to + determine their type or other info. The other words consist of a + pointer, used to thread all lcrecords together in one big linked list, + and a 32-bit structure that contains another UID field (#### which + should be deleted, as it is redundant; it dates back to the days when + the lrecord_header consisted of a pointer to an object's implementation + structure rather than an index). + + Under old-GC, normal objects (i.e. lcrecords) are allocated in + individual chunks using the underlying allocator (i.e. xmalloc(), which + is a thin wrapper around malloc()). Frob-block objects are more + efficient than normal objects, as they have a smaller header and don't + have the additional memory overhead associated with malloc() -- instead, + as mentioned above, they are carved out of 2K chunks of memory called + "frob blocks"). However, it is slightly more tricky to create such + objects, as they require special routines in alloc.c to create an object + of each such type and to sweep them during garbage collection. In + addition, there is currently no mechanism for handling variable-sized + frob-block objects (e.g. vectors), whereas variable-sized normal objects + are not a problem. Frob-block objects are typically used for basic + objects that exist in large numbers, such as `cons' or `string'. -#ifndef NEW_GC - Lrecords are of two types: straight lrecords, and lcrecords. - Straight lrecords are used for those types of objects that have - their own allocation routines (typically allocated out of 2K chunks - of memory called `frob blocks'). These objects have a `struct - lrecord_header' at the top, containing only the bits needed to find - the lrecord_implementation for the object. There are special - routines in alloc.c to create an object of each such type. + Note that strings are an apparent exception to the statement above that + variable-sized objects can't be handled. Under old-GC strings work as + follows. A string consists of two parts -- a fixed-size "string header" + that is allocated as a standard frob-block object, and a "string-chars" + structure that is allocated out of special 8K-sized frob blocks that + have a dedicated garbage-collection handler that compacts the blocks + during the sweep stage, relocating the string-chars data (but not the + string headers) to eliminate gaps. Strings larger than 8K are not + placed in frob blocks, but instead are stored as individually malloc()ed + blocks of memory. Strings larger than 8K are called "big strings" and + those smaller than 8K are called "small strings". + + Under new-GC, there is no difference between big and small strings, + just as there is no difference between normal and frob-block objects. + There is only one allocation method, which is capable of handling + variable-sized objects. This apparently allocates all objects in + frob blocks according to the size of the object. + + To create a new normal Lisp object, see the toolbar-button example + below. To create a new frob-block Lisp object, follow the lead of + one of the existing frob-block objects, such as extents or events. + Note that you do not need to supply all the methods (see below); + reasonable defaults are provided for many of them. Alternatively, if + you're just looking for a way of encapsulating data (which possibly + could contain Lisp_Objects in it), you may well be able to use the + opaque type. +*/ + +/* + How to declare a Lisp object: + + NORMAL_LISP_OBJECT_HEADER: + Header for normal objects + + FROB_BLOCK_LISP_OBJECT_HEADER: + Header for frob-block objects - Lcrecords are used for less common sorts of objects that don't do - their own allocation. Each such object is malloc()ed individually, - and the objects are chained together through a `next' pointer. - Lcrecords have a `struct old_lcrecord_header' at the top, which - contains a `struct lrecord_header' and a `next' pointer, and are - allocated using old_alloc_lcrecord_type() or its variants. -#endif + How to allocate a Lisp object: + + - For normal objects of a fixed size, simply call + ALLOC_NORMAL_LISP_OBJECT (type), where TYPE is the name of the type + (e.g. toolbar_button). Such objects can be freed manually using + free_normal_lisp_object. + + - For normal objects whose size can vary (and hence which have a + size_in_bytes_method rather than a static_size), call + ALLOC_SIZED_LISP_OBJECT (size, type), where TYPE is the + name of the type. NOTE: You cannot call free_normal_lisp_object() on such + on object! (At least when not NEW_GC) + + - For frob-block objects, use + ALLOC_FROB_BLOCK_LISP_OBJECT (type, lisp_type, var, lrec_ptr). + But these objects need special handling; if you don't understand this, + just ignore it. - Creating a new Lisp object type is fairly easy; just follow the - lead of some existing type (e.g. hash tables). Note that you - do not need to supply all the methods (see below); reasonable - defaults are provided for many of them. Alternatively, if you're - just looking for a way of encapsulating data (which possibly - could contain Lisp_Objects in it), you may well be able to use - the opaque type. -*/ + - Some lrecords, which are used totally internally, use the + noseeum-* functions for debugging reasons. + + Other operations: + + - copy_lisp_object (dst, src) + + - zero_nonsized_lisp_object (obj), zero_sized_lisp_object (obj, size): + BUT NOTE, it is not necessary to zero out newly allocated Lisp objects. + This happens automatically. + + - lisp_object_size (obj): Return the size of a Lisp object. NOTE: This + requires that the object is properly initialized. + + - lisp_object_storage_size (obj, stats): Return the storage size of a + Lisp objcet, including malloc or frob-block overhead; also, if STATS + is non-NULL, accumulate info about the size and overhead into STATS. + */ #ifdef NEW_GC /* @@ -74,46 +170,34 @@ object descriptions exist to indicate the size of these structures and the Lisp object pointers within them. - At least one definite issue is that under New-GC dumpable objects cannot - contain any finalizers (see pdump_register_object()). This means that any - substructures in dumpable objects that are allocated separately and - normally freed in a finalizer need instead to be made into actual Lisp - objects. If those structures are Dynarrs, they need to be made into - Dynarr Lisp objects (e.g. face-cachel-dynarr or glyph-cachel-dynarr), - which are created using Dynarr_lisp_new() or Dynarr_new_new2(). - Furthermore, the objects contained in the Dynarr also need to be Lisp - objects (e.g. face-cachel or glyph-cachel). + At least one definite issue is that under New-GC dumpable objects cannot + contain any finalizers (see pdump_register_object()). This means that + any substructures in dumpable objects that are allocated separately and + normally freed in a finalizer need instead to be made into actual Lisp + objects. If those structures are Dynarrs, they need to be made into + Dynarr Lisp objects (e.g. face-cachel-dynarr or glyph-cachel-dynarr), + which are created using Dynarr_lisp_new() or Dynarr_new_new2(). + Furthermore, the objects contained in the Dynarr also need to be Lisp + objects (e.g. face-cachel or glyph-cachel). --ben */ - #endif - - #ifdef NEW_GC -#define ALLOC_LISP_OBJECT(type) alloc_lrecord (&lrecord_##type) +#define ALLOC_NORMAL_LISP_OBJECT(type) alloc_lrecord (&lrecord_##type) #define ALLOC_SIZED_LISP_OBJECT(size, type) \ alloc_sized_lrecord (size, &lrecord_##type) -#define COPY_SIZED_LISP_OBJECT copy_sized_lrecord -#define COPY_LISP_OBJECT copy_lrecord -#define LISP_OBJECT_STORAGE_SIZE(ptr, size, stats) \ - mc_alloced_storage_size (size, stats) -#define ZERO_LISP_OBJECT zero_lrecord -#define LISP_OBJECT_HEADER struct lrecord_header +#define NORMAL_LISP_OBJECT_HEADER struct lrecord_header #define FROB_BLOCK_LISP_OBJECT_HEADER struct lrecord_header -#define FREE_LISP_OBJECT free_lrecord +#define LISP_OBJECT_FROB_BLOCK_P(obj) 0 #else /* not NEW_GC */ -#define ALLOC_LISP_OBJECT(type) alloc_automanaged_lcrecord (&lrecord_##type) +#define ALLOC_NORMAL_LISP_OBJECT(type) alloc_automanaged_lcrecord (&lrecord_##type) #define ALLOC_SIZED_LISP_OBJECT(size, type) \ old_alloc_sized_lcrecord (size, &lrecord_##type) -#define COPY_SIZED_LISP_OBJECT old_copy_sized_lcrecord -#define COPY_LISP_OBJECT old_copy_lcrecord -#define LISP_OBJECT_STORAGE_SIZE malloced_storage_size -#define ZERO_LISP_OBJECT old_zero_lcrecord -#define LISP_OBJECT_HEADER struct old_lcrecord_header +#define NORMAL_LISP_OBJECT_HEADER struct old_lcrecord_header #define FROB_BLOCK_LISP_OBJECT_HEADER struct lrecord_header -#define FREE_LISP_OBJECT old_free_lcrecord +#define LISP_OBJECT_FROB_BLOCK_P(obj) (XRECORD_LHEADER_IMPLEMENTATION(obj)->frob_block_p) #endif /* not NEW_GC */ BEGIN_C_DECLS @@ -393,7 +477,7 @@ memory or releasing pointers or handles to objects created in external libraries, such as window-system windows or file handles. This can be NULL, meaning no special finalization is necessary. */ - void (*finalizer) (void *header); + void (*finalizer) (Lisp_Object obj); /* This can be NULL, meaning compare objects with EQ(). */ int (*equal) (Lisp_Object obj1, Lisp_Object obj2, int depth, @@ -436,19 +520,20 @@ /* Only one of `static_size' and `size_in_bytes_method' is non-0. If `static_size' is 0, this type is not instantiable by - ALLOC_LISP_OBJECT(). If both are 0 (this should never happen), this - object cannot be instantiated; you will get an abort() if you try.*/ + ALLOC_NORMAL_LISP_OBJECT(). If both are 0 (this should never happen), + this object cannot be instantiated; you will get an abort() if you + try.*/ Bytecount static_size; - Bytecount (*size_in_bytes_method) (const void *header); + Bytecount (*size_in_bytes_method) (Lisp_Object); /* The (constant) index into lrecord_implementations_table */ enum lrecord_type lrecord_type_index; #ifndef NEW_GC - /* A "basic" lrecord is any lrecord that's not an lcrecord, i.e. + /* A "frob-block" lrecord is any lrecord that's not an lcrecord, i.e. one that does not have an old_lcrecord_header at the front and which is (usually) allocated in frob blocks. */ - unsigned int basic_p :1; + unsigned int frob_block_p :1; #endif /* not NEW_GC */ }; @@ -460,6 +545,8 @@ extern MODULE_API const struct lrecord_implementation * lrecord_implementations_table[lrecord_type_last_built_in_type + MODULE_DEFINABLE_TYPE_COUNT]; +/* Given a Lisp object, return its implementation + (struct lrecord_implementation) */ #define XRECORD_LHEADER_IMPLEMENTATION(obj) \ LHEADER_IMPLEMENTATION (XRECORD_LHEADER (obj)) #define LHEADER_IMPLEMENTATION(lh) lrecord_implementations_table[(lh)->type] @@ -496,7 +583,7 @@ if (MCACF_implementation && MCACF_implementation->finalizer) \ { \ GC_STAT_FINALIZED; \ - MCACF_implementation->finalizer (ptr); \ + MCACF_implementation->finalizer (MCACF_obj); \ } \ } \ } while (0) @@ -769,7 +856,7 @@ struct Lisp_Hash_Table { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Elemcount size; Elemcount count; Elemcount rehash_count; @@ -834,7 +921,7 @@ struct Lisp_Specifier { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; struct specifier_methods *methods; ... @@ -1396,7 +1483,7 @@ 1. Declare the struct for your object in a header file somewhere. Remember that it must begin with - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; 2. Put the "standard junk" (DECLARE_LISP_OBJECT()/XFOO/etc.) below the struct definition -- see below. @@ -1429,121 +1516,156 @@ --ben -An example: + An example: ------------------------------ in toolbar.h ----------------------------- -struct toolbar_button -{ - LISP_OBJECT_HEADER header; - - Lisp_Object next; - Lisp_Object frame; - - Lisp_Object up_glyph; - Lisp_Object down_glyph; - Lisp_Object disabled_glyph; - - Lisp_Object cap_up_glyph; - Lisp_Object cap_down_glyph; - Lisp_Object cap_disabled_glyph; - - Lisp_Object callback; - Lisp_Object enabled_p; - Lisp_Object help_string; - - char enabled; - char down; - char pushright; - char blank; - - int x, y; - int width, height; - int dirty; - int vertical; - int border_width; -}; - -[[ the standard junk: ]] - -DECLARE_LISP_OBJECT (toolbar_button, struct toolbar_button); -#define XTOOLBAR_BUTTON(x) XRECORD (x, toolbar_button, struct toolbar_button) -#define wrap_toolbar_button(p) wrap_record (p, toolbar_button) -#define TOOLBAR_BUTTONP(x) RECORDP (x, toolbar_button) -#define CHECK_TOOLBAR_BUTTON(x) CHECK_RECORD (x, toolbar_button) -#define CONCHECK_TOOLBAR_BUTTON(x) CONCHECK_RECORD (x, toolbar_button) - + struct toolbar_button + { + NORMAL_LISP_OBJECT_HEADER header; + + Lisp_Object next; + Lisp_Object frame; + + Lisp_Object up_glyph; + Lisp_Object down_glyph; + Lisp_Object disabled_glyph; + + Lisp_Object cap_up_glyph; + Lisp_Object cap_down_glyph; + Lisp_Object cap_disabled_glyph; + + Lisp_Object callback; + Lisp_Object enabled_p; + Lisp_Object help_string; + + char enabled; + char down; + char pushright; + char blank; + + int x, y; + int width, height; + int dirty; + int vertical; + int border_width; + }; + + [[ the standard junk: ]] + + DECLARE_LISP_OBJECT (toolbar_button, struct toolbar_button); + #define XTOOLBAR_BUTTON(x) XRECORD (x, toolbar_button, struct toolbar_button) + #define wrap_toolbar_button(p) wrap_record (p, toolbar_button) + #define TOOLBAR_BUTTONP(x) RECORDP (x, toolbar_button) + #define CHECK_TOOLBAR_BUTTON(x) CHECK_RECORD (x, toolbar_button) + #define CONCHECK_TOOLBAR_BUTTON(x) CONCHECK_RECORD (x, toolbar_button) + ------------------------------ in toolbar.c ----------------------------- - -#include "toolbar.h" - -... + + #include "toolbar.h" + + ... + + static const struct memory_description toolbar_button_description [] = { + { XD_LISP_OBJECT, offsetof (struct toolbar_button, next) }, + { XD_LISP_OBJECT, offsetof (struct toolbar_button, frame) }, + { XD_LISP_OBJECT, offsetof (struct toolbar_button, up_glyph) }, + { XD_LISP_OBJECT, offsetof (struct toolbar_button, down_glyph) }, + { XD_LISP_OBJECT, offsetof (struct toolbar_button, disabled_glyph) }, + { XD_LISP_OBJECT, offsetof (struct toolbar_button, cap_up_glyph) }, + { XD_LISP_OBJECT, offsetof (struct toolbar_button, cap_down_glyph) }, + { XD_LISP_OBJECT, offsetof (struct toolbar_button, cap_disabled_glyph) }, + { XD_LISP_OBJECT, offsetof (struct toolbar_button, callback) }, + { XD_LISP_OBJECT, offsetof (struct toolbar_button, enabled_p) }, + { XD_LISP_OBJECT, offsetof (struct toolbar_button, help_string) }, + { XD_END } + }; + + static Lisp_Object + allocate_toolbar_button (struct frame *f, int pushright) + { + struct toolbar_button *tb; + + tb = XTOOLBAR_BUTTON (ALLOC_NORMAL_LISP_OBJECT (toolbar_button)); + tb->next = Qnil; + tb->frame = wrap_frame (f); + tb->up_glyph = Qnil; + tb->down_glyph = Qnil; + tb->disabled_glyph = Qnil; + tb->cap_up_glyph = Qnil; + tb->cap_down_glyph = Qnil; + tb->cap_disabled_glyph = Qnil; + tb->callback = Qnil; + tb->enabled_p = Qnil; + tb->help_string = Qnil; + + tb->pushright = pushright; + tb->x = tb->y = tb->width = tb->height = -1; + tb->dirty = 1; + + return wrap_toolbar_button (tb); + } + + static Lisp_Object + mark_toolbar_button (Lisp_Object obj) + { + struct toolbar_button *data = XTOOLBAR_BUTTON (obj); + mark_object (data->next); + mark_object (data->frame); + mark_object (data->up_glyph); + mark_object (data->down_glyph); + mark_object (data->disabled_glyph); + mark_object (data->cap_up_glyph); + mark_object (data->cap_down_glyph); + mark_object (data->cap_disabled_glyph); + mark_object (data->callback); + mark_object (data->enabled_p); + return data->help_string; + } + + DEFINE_NODUMP_LISP_OBJECT ("toolbar-button", toolbar_button, + mark_toolbar_button, + external_object_printer, 0, 0, 0, + toolbar_button_description, + struct toolbar_button); + + ... + + void + syms_of_toolbar (void) + { + INIT_LISP_OBJECT (toolbar_button); + + ...; + } + +------------------------------ in inline.c ----------------------------- + + #ifdef HAVE_TOOLBARS + #include "toolbar.h" + #endif + +------------------------------ in lrecord.h ----------------------------- + + enum lrecord_type + { + ... + lrecord_type_toolbar_button, + ... + }; -static const struct memory_description toolbar_button_description [] = { - { XD_LISP_OBJECT, offsetof (struct toolbar_button, next) }, - { XD_LISP_OBJECT, offsetof (struct toolbar_button, frame) }, - { XD_LISP_OBJECT, offsetof (struct toolbar_button, up_glyph) }, - { XD_LISP_OBJECT, offsetof (struct toolbar_button, down_glyph) }, - { XD_LISP_OBJECT, offsetof (struct toolbar_button, disabled_glyph) }, - { XD_LISP_OBJECT, offsetof (struct toolbar_button, cap_up_glyph) }, - { XD_LISP_OBJECT, offsetof (struct toolbar_button, cap_down_glyph) }, - { XD_LISP_OBJECT, offsetof (struct toolbar_button, cap_disabled_glyph) }, - { XD_LISP_OBJECT, offsetof (struct toolbar_button, callback) }, - { XD_LISP_OBJECT, offsetof (struct toolbar_button, enabled_p) }, - { XD_LISP_OBJECT, offsetof (struct toolbar_button, help_string) }, - { XD_END } -}; - -static Lisp_Object -mark_toolbar_button (Lisp_Object obj) -\{ - struct toolbar_button *data = XTOOLBAR_BUTTON (obj); - mark_object (data->next); - mark_object (data->frame); - mark_object (data->up_glyph); - mark_object (data->down_glyph); - mark_object (data->disabled_glyph); - mark_object (data->cap_up_glyph); - mark_object (data->cap_down_glyph); - mark_object (data->cap_disabled_glyph); - mark_object (data->callback); - mark_object (data->enabled_p); - return data->help_string; -} +------------------------------ in .gdbinit.in.in ----------------------------- -DEFINE_NODUMP_LISP_OBJECT ("toolbar-button", toolbar_button, - mark_toolbar_button, - external_object_printer, 0, 0, 0, - toolbar_button_description, - struct toolbar_button); - -... - -void -syms_of_toolbar (void) -{ - INIT_LISP_OBJECT (toolbar_button); - - ...; -} + ... + else + if $lrecord_type == lrecord_type_toolbar_button + pstructtype toolbar_button + ... + ... + ... + end ------------------------------- in inline.c ----------------------------- - -#ifdef HAVE_TOOLBARS -#include "toolbar.h" -#endif - ------------------------------- in lrecord.h ----------------------------- - -enum lrecord_type -{ - ... - lrecord_type_toolbar_button, - ... -}; - - ---ben + --ben */ @@ -1676,32 +1798,12 @@ dead_wrong_type_argument (predicate, x); \ } while (0) -/* How to allocate a Lisp object: - - - For most objects, simply call ALLOC_LISP_OBJECT (type), where TYPE is - the name of the type (e.g. toolbar_button). Such objects can be freed - manually using FREE_LISP_OBJECT. - - - For objects whose size can vary (and hence which have a - size_in_bytes_method rather than a static_size), call - ALLOC_SIZED_LISP_OBJECT (size, type), where TYPE is the - name of the type. NOTE: You cannot call FREE_LISP_OBJECT() on such - on object! (At least when not NEW_GC) - - - Basic lrecords (of which there are a limited number, which exist only - when not NEW_GC, and which have special handling in alloc.c) need - special handling; if you don't understand this, just ignore it. - - - Some lrecords, which are used totally internally, use the - noseeum-* functions for the reason of debugging. - */ - #ifndef NEW_GC /*-------------------------- lcrecord-list -----------------------------*/ struct lcrecord_list { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object free; Elemcount size; const struct lrecord_implementation *implementation; @@ -1722,13 +1824,13 @@ lrecords. lcrecords themselves are divided into three types: (1) auto-managed, (2) hand-managed, and (3) unmanaged. "Managed" refers to using a special object called an lcrecord-list to keep track of freed - lcrecords, which can freed with FREE_LISP_OBJECT() or the like and later be - recycled when a new lcrecord is required, rather than requiring new - malloc(). Thus, allocation of lcrecords can be very + lcrecords, which can freed with free_normal_lisp_object() or the like + and later be recycled when a new lcrecord is required, rather than + requiring new malloc(). Thus, allocation of lcrecords can be very cheap. (Technically, the lcrecord-list manager could divide up large chunks of memory and allocate out of that, mimicking what happens with lrecords. At that point, however, we'd want to rethink the whole - division between lrecords and lcrecords.) + division between lrecords and lcrecords.) NOTE: There is a fundamental limitation of lcrecord-lists, which is that they only handle blocks of a particular, fixed size. Thus, objects that @@ -1736,9 +1838,9 @@ in particular dictate the various types of management: -- "Auto-managed" means that you just go ahead and allocate the lcrecord - whenever you want, using ALLOC_LISP_OBJECT(), and the appropriate + whenever you want, using ALLOC_NORMAL_LISP_OBJECT(), and the appropriate lcrecord-list manager is automatically created. To free, you just call - "FREE_LISP_OBJECT()" and the appropriate lcrecord-list manager is + "free_normal_lisp_object()" and the appropriate lcrecord-list manager is automatically located and called. The limitation here of course is that all your objects are of the same size. (#### Eventually we should have a more sophisticated system that tracks the sizes seen and creates one @@ -1816,24 +1918,6 @@ void old_free_lcrecord (Lisp_Object rec); - -/* Copy the data from one lcrecord structure into another, but don't - overwrite the header information. */ - -#define old_copy_sized_lcrecord(dst, src, size) \ - memcpy ((Rawbyte *) (dst) + sizeof (struct old_lcrecord_header), \ - (Rawbyte *) (src) + sizeof (struct old_lcrecord_header), \ - (size) - sizeof (struct old_lcrecord_header)) - -#define old_copy_lcrecord(dst, src) \ - old_copy_sized_lcrecord (dst, src, sizeof (*(dst))) - -#define old_zero_sized_lcrecord(lcr, size) \ - memset ((Rawbyte *) (lcr) + sizeof (struct old_lcrecord_header), 0, \ - (size) - sizeof (struct old_lcrecord_header)) - -#define old_zero_lcrecord(lcr) old_zero_sized_lcrecord (lcr, sizeof (*(lcr))) - #else /* NEW_GC */ MODULE_API Lisp_Object alloc_sized_lrecord (Bytecount size, @@ -1849,27 +1933,8 @@ int elemcount, const struct lrecord_implementation *imp); -void free_lrecord (Lisp_Object rec); - - -/* Copy the data from one lrecord structure into another, but don't - overwrite the header information. */ - -#define copy_sized_lrecord(dst, src, size) \ - memcpy ((char *) (dst) + sizeof (struct lrecord_header), \ - (char *) (src) + sizeof (struct lrecord_header), \ - (size) - sizeof (struct lrecord_header)) - -#define copy_lrecord(dst, src) copy_sized_lrecord (dst, src, sizeof (*(dst))) - #endif /* NEW_GC */ -#define zero_sized_lrecord(lcr, size) \ - memset ((char *) (lcr) + sizeof (struct lrecord_header), 0, \ - (size) - sizeof (struct lrecord_header)) - -#define zero_lrecord(lcr) zero_sized_lrecord (lcr, sizeof (*(lcr))) - DECLARE_INLINE_HEADER ( Bytecount detagged_lisp_object_size (const struct lrecord_header *h) @@ -1878,7 +1943,7 @@ const struct lrecord_implementation *imp = LHEADER_IMPLEMENTATION (h); return (imp->size_in_bytes_method ? - imp->size_in_bytes_method (h) : + imp->size_in_bytes_method (wrap_pointer_1 (h)) : imp->static_size); } @@ -1890,6 +1955,17 @@ return detagged_lisp_object_size (XRECORD_LHEADER (o)); } +struct overhead_stats; + +MODULE_API void copy_lisp_object (Lisp_Object dst, Lisp_Object src); +MODULE_API void zero_sized_lisp_object (Lisp_Object obj, Bytecount size); +MODULE_API void zero_nonsized_lisp_object (Lisp_Object obj); +#ifdef MEMORY_USAGE_STATS +Bytecount lisp_object_storage_size (Lisp_Object obj, + struct overhead_stats *ovstats); +#endif /* MEMORY_USAGE_STATS */ +void free_normal_lisp_object (Lisp_Object obj); + /************************************************************************/ /* Dumping */
--- a/src/lstream.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/lstream.c Fri Mar 05 04:08:17 2010 -0600 @@ -69,11 +69,11 @@ } static void -finalize_lstream (void *header) +finalize_lstream (Lisp_Object obj) { /* WARNING WARNING WARNING. This function (and all finalize functions) may get called more than once on the same object. */ - Lstream *lstr = (Lstream *) header; + Lstream *lstr = XLSTREAM (obj); if (lstr->flags & LSTREAM_FL_IS_OPEN) Lstream_close (lstr); @@ -104,9 +104,9 @@ } static Bytecount -sizeof_lstream (const void *header) +sizeof_lstream (Lisp_Object obj) { - return aligned_sizeof_lstream (((const Lstream *) header)->imp->size); + return aligned_sizeof_lstream (XLSTREAM (obj)->imp->size); } static const struct memory_description lstream_implementation_description_1[] @@ -193,8 +193,8 @@ { Lstream *p; #ifdef NEW_GC - p = XLSTREAM (alloc_sized_lrecord (aligned_sizeof_lstream (imp->size), - &lrecord_lstream)); + p = XLSTREAM (ALLOC_SIZED_LISP_OBJECT (aligned_sizeof_lstream (imp->size), + lstream)); #else /* not NEW_GC */ int i; @@ -216,9 +216,10 @@ p = XLSTREAM (alloc_managed_lcrecord (Vlstream_free_list[i])); #endif /* not NEW_GC */ - /* Zero it out, except the header. */ - memset ((char *) p + sizeof (p->header), '\0', - aligned_sizeof_lstream (imp->size) - sizeof (p->header)); + /* Formerly, we zeroed out the object minus its header, but it's now + handled automatically. ALLOC_SIZED_LISP_OBJECT() always zeroes out + the whole object other than its header, and alloc_managed_lcrecord() + does the same. */ p->imp = imp; Lstream_set_buffering (p, LSTREAM_BLOCK_BUFFERED, 0); p->flags = LSTREAM_FL_IS_OPEN; @@ -297,7 +298,7 @@ Lisp_Object val = wrap_lstream (lstr); #ifdef NEW_GC - free_lrecord (val); + free_normal_lisp_object (val); #else /* not NEW_GC */ for (i = 0; i < lstream_type_count; i++) {
--- a/src/lstream.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/lstream.h Fri Mar 05 04:08:17 2010 -0600 @@ -230,7 +230,7 @@ struct lstream { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; const Lstream_implementation *imp; /* methods for this stream */ Lstream_buffering buffering; /* type of buffering in use */ Bytecount buffering_size; /* number of bytes buffered */
--- a/src/marker.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/marker.c Fri Mar 05 04:08:17 2010 -0600 @@ -1,6 +1,6 @@ /* Markers: examining, setting and killing. Copyright (C) 1985, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. - Copyright (C) 2002 Ben Wing. + Copyright (C) 2002, 2010 Ben Wing. This file is part of XEmacs. @@ -107,10 +107,9 @@ #ifdef NEW_GC static void -finalize_marker (void *header) +finalize_marker (Lisp_Object obj) { - Lisp_Object tem = wrap_marker (header); - unchain_marker (tem); + unchain_marker (obj); } DEFINE_DUMPABLE_FROB_BLOCK_LISP_OBJECT ("marker", marker, @@ -509,7 +508,7 @@ total += sizeof (Lisp_Marker); ovstats->was_requested += total; #ifdef NEW_GC - overhead = mc_alloced_storage_size (total, 0); + overhead = mc_alloced_storage_size (total, 0) - total; #else /* not NEW_GC */ overhead = fixed_type_block_overhead (total); #endif /* not NEW_GC */
--- a/src/mule-charset.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/mule-charset.c Fri Mar 05 04:08:17 2010 -0600 @@ -1,7 +1,7 @@ /* Functions to handle multilingual characters. Copyright (C) 1992, 1995 Free Software Foundation, Inc. Copyright (C) 1995 Sun Microsystems, Inc. - Copyright (C) 2001, 2002, 2004, 2005 Ben Wing. + Copyright (C) 2001, 2002, 2004, 2005, 2010 Ben Wing. This file is part of XEmacs. @@ -195,7 +195,7 @@ if (!overwrite) { - obj = ALLOC_LISP_OBJECT (charset); + obj = ALLOC_NORMAL_LISP_OBJECT (charset); cs = XCHARSET (obj); if (final) @@ -999,9 +999,8 @@ compute_charset_usage (Lisp_Object charset, struct charset_stats *stats, struct overhead_stats *ovstats) { - struct Lisp_Charset *c = XCHARSET (charset); xzero (*stats); - stats->other += LISP_OBJECT_STORAGE_SIZE (c, sizeof (*c), ovstats); + stats->other += lisp_object_storage_size (charset, ovstats); stats->from_unicode += compute_from_unicode_table_size (charset, ovstats); stats->to_unicode += compute_to_unicode_table_size (charset, ovstats); }
--- a/src/objects-impl.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/objects-impl.h Fri Mar 05 04:08:17 2010 -0600 @@ -99,7 +99,7 @@ struct Lisp_Color_Instance { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object name; Lisp_Object device; @@ -119,7 +119,7 @@ struct Lisp_Font_Instance { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object name; /* the instantiator used to create the font instance */ Lisp_Object truename; /* used by the device-specific methods; we need to call them to get the truename (#### in reality,
--- a/src/objects-tty-impl.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/objects-tty-impl.h Fri Mar 05 04:08:17 2010 -0600 @@ -30,7 +30,7 @@ struct tty_color_instance_data { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ Lisp_Object symbol; /* so we don't have to constantly call Fintern() */ }; @@ -56,7 +56,7 @@ struct tty_font_instance_data { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ Lisp_Object charset; };
--- a/src/objects-tty.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/objects-tty.c Fri Mar 05 04:08:17 2010 -0600 @@ -192,7 +192,7 @@ /* Don't allocate the data until we're sure that we will succeed. */ #ifdef NEW_GC c->data = - XTTY_COLOR_INSTANCE_DATA (ALLOC_LISP_OBJECT (tty_color_instance_data)); + XTTY_COLOR_INSTANCE_DATA (ALLOC_NORMAL_LISP_OBJECT (tty_color_instance_data)); #else /* not NEW_GC */ c->data = xnew (struct tty_color_instance_data); #endif /* not NEW_GC */ @@ -277,7 +277,7 @@ /* Don't allocate the data until we're sure that we will succeed. */ #ifdef NEW_GC f->data = - XTTY_FONT_INSTANCE_DATA (ALLOC_LISP_OBJECT (tty_font_instance_data)); + XTTY_FONT_INSTANCE_DATA (ALLOC_NORMAL_LISP_OBJECT (tty_font_instance_data)); #else /* not NEW_GC */ f->data = xnew (struct tty_font_instance_data); #endif /* not NEW_GC */
--- a/src/objects.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/objects.c Fri Mar 05 04:08:17 2010 -0600 @@ -113,9 +113,9 @@ } static void -finalize_color_instance (void *header) +finalize_color_instance (Lisp_Object obj) { - Lisp_Color_Instance *c = (Lisp_Color_Instance *) header; + Lisp_Color_Instance *c = XCOLOR_INSTANCE (obj); if (!NILP (c->device)) MAYBE_DEVMETH (XDEVICE (c->device), finalize_color_instance, (c)); @@ -180,7 +180,7 @@ CHECK_STRING (name); device = wrap_device (decode_device (device)); - obj = ALLOC_LISP_OBJECT (color_instance); + obj = ALLOC_NORMAL_LISP_OBJECT (color_instance); c = XCOLOR_INSTANCE (obj); c->name = name; c->device = device; @@ -331,9 +331,9 @@ } static void -finalize_font_instance (void *header) +finalize_font_instance (Lisp_Object obj) { - Lisp_Font_Instance *f = (Lisp_Font_Instance *) header; + Lisp_Font_Instance *f = XFONT_INSTANCE (obj); if (!NILP (f->device)) { @@ -402,7 +402,7 @@ device = wrap_device (decode_device (device)); - obj = ALLOC_LISP_OBJECT (font_instance); + obj = ALLOC_NORMAL_LISP_OBJECT (font_instance); f = XFONT_INSTANCE (obj); f->name = name; f->truename = Qnil; @@ -1294,7 +1294,7 @@ reinit_vars_of_objects (void) { { - Lisp_Object obj = ALLOC_LISP_OBJECT (color_instance); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (color_instance); Lisp_Color_Instance *c = XCOLOR_INSTANCE (obj); c->name = Qnil; c->device = Qnil; @@ -1305,7 +1305,7 @@ } { - Lisp_Object obj = ALLOC_LISP_OBJECT (font_instance); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (font_instance); Lisp_Font_Instance *f = XFONT_INSTANCE (obj); f->name = Qnil; f->truename = Qnil;
--- a/src/opaque.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/opaque.c Fri Mar 05 04:08:17 2010 -0600 @@ -1,6 +1,6 @@ /* Opaque Lisp objects. Copyright (C) 1993, 1994, 1995 Sun Microsystems, Inc. - Copyright (C) 1995, 1996, 2002 Ben Wing. + Copyright (C) 1995, 1996, 2002, 2010 Ben Wing. This file is part of XEmacs. @@ -62,9 +62,9 @@ } static Bytecount -sizeof_opaque (const void *header) +sizeof_opaque (Lisp_Object obj) { - return aligned_sizeof_opaque (((const Lisp_Opaque *) header)->size); + return aligned_sizeof_opaque (XOPAQUE (obj)->size); } /* Return an opaque object of size SIZE. @@ -162,7 +162,7 @@ make_opaque_ptr (void *val) { #ifdef NEW_GC - Lisp_Object res = ALLOC_LISP_OBJECT (opaque_ptr); + Lisp_Object res = ALLOC_NORMAL_LISP_OBJECT (opaque_ptr); #else /* not NEW_GC */ Lisp_Object res = alloc_managed_lcrecord (Vopaque_ptr_free_list); #endif /* not NEW_GC */ @@ -177,7 +177,7 @@ free_opaque_ptr (Lisp_Object ptr) { #ifdef NEW_GC - free_lrecord (ptr); + free_normal_lisp_object (ptr); #else /* not NEW_GC */ free_managed_lcrecord (Vopaque_ptr_free_list, ptr); #endif /* not NEW_GC */
--- a/src/opaque.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/opaque.h Fri Mar 05 04:08:17 2010 -0600 @@ -28,7 +28,7 @@ typedef struct Lisp_Opaque { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Bytecount size; max_align_t data[1]; } Lisp_Opaque; @@ -54,7 +54,7 @@ typedef struct Lisp_Opaque_Ptr { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; void *ptr; } Lisp_Opaque_Ptr;
--- a/src/print.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/print.c Fri Mar 05 04:08:17 2010 -0600 @@ -1539,55 +1539,38 @@ DOESNT_RETURN printing_unreadable_lcrecord (Lisp_Object obj, const Ibyte *name) { - LISP_OBJECT_HEADER *header = (LISP_OBJECT_HEADER *) XPNTR (obj); + NORMAL_LISP_OBJECT_HEADER *header = (NORMAL_LISP_OBJECT_HEADER *) XPNTR (obj); + const struct lrecord_implementation *imp = + XRECORD_LHEADER_IMPLEMENTATION (obj); #ifndef NEW_GC /* This must be a real lcrecord */ - assert (!LHEADER_IMPLEMENTATION (&header->lheader)->basic_p); + assert (!imp->frob_block_p); #endif if (name) - printing_unreadable_object - ("#<%s %s 0x%x>", -#ifdef NEW_GC - LHEADER_IMPLEMENTATION (header)->name, -#else /* not NEW_GC */ - LHEADER_IMPLEMENTATION (&header->lheader)->name, -#endif /* not NEW_GC */ - name, - header->uid); + printing_unreadable_object ("#<%s %s 0x%x>", imp->name, name, header->uid); else - printing_unreadable_object - ("#<%s 0x%x>", -#ifdef NEW_GC - LHEADER_IMPLEMENTATION (header)->name, -#else /* not NEW_GC */ - LHEADER_IMPLEMENTATION (&header->lheader)->name, -#endif /* not NEW_GC */ - header->uid); + printing_unreadable_object ("#<%s 0x%x>", imp->name, header->uid); } void external_object_printer (Lisp_Object obj, Lisp_Object printcharfun, int UNUSED (escapeflag)) { - LISP_OBJECT_HEADER *header = (LISP_OBJECT_HEADER *) XPNTR (obj); + NORMAL_LISP_OBJECT_HEADER *header = (NORMAL_LISP_OBJECT_HEADER *) XPNTR (obj); + const struct lrecord_implementation *imp = + XRECORD_LHEADER_IMPLEMENTATION (obj); #ifndef NEW_GC /* This must be a real lcrecord */ - assert (!LHEADER_IMPLEMENTATION (&header->lheader)->basic_p); + assert (!imp->frob_block_p); #endif if (print_readably) printing_unreadable_lcrecord (obj, 0); - write_fmt_string (printcharfun, "#<%s 0x%x>", -#ifdef NEW_GC - LHEADER_IMPLEMENTATION (header)->name, -#else /* not NEW_GC */ - LHEADER_IMPLEMENTATION (&header->lheader)->name, -#endif /* not NEW_GC */ - header->uid); + write_fmt_string (printcharfun, "#<%s 0x%x>", imp->name, header->uid); } void @@ -2454,7 +2437,7 @@ debug_out ("#<%s addr=0x%lx uid=0x%lx>", LHEADER_IMPLEMENTATION (header)->name, (EMACS_INT) header, - (EMACS_INT) (LHEADER_IMPLEMENTATION (header)->basic_p ? + (EMACS_INT) (LHEADER_IMPLEMENTATION (header)->frob_block_p ? ((struct lrecord_header *) header)->uid : ((struct old_lcrecord_header *) header)->uid)); #endif /* not NEW_GC */
--- a/src/process.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/process.c Fri Mar 05 04:08:17 2010 -0600 @@ -176,11 +176,11 @@ #endif /* HAVE_WINDOW_SYSTEM */ static void -finalize_process (void *header) +finalize_process (Lisp_Object obj) { /* #### this probably needs to be tied into the tty event loop */ /* #### when there is one */ - Lisp_Process *p = (Lisp_Process *) header; + Lisp_Process *p = XPROCESS (obj); #ifdef HAVE_WINDOW_SYSTEM debug_process_finalization (p); #endif /* HAVE_WINDOW_SYSTEM */ @@ -465,7 +465,7 @@ { Lisp_Object name1; int i; - Lisp_Object obj = ALLOC_LISP_OBJECT (process); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (process); Lisp_Process *p = XPROCESS (obj); #define MARKED_SLOT(x) p->x = Qnil;
--- a/src/procimpl.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/procimpl.h Fri Mar 05 04:08:17 2010 -0600 @@ -94,7 +94,7 @@ struct Lisp_Process { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; /* Exit code if process has terminated, signal which stopped/interrupted process
--- a/src/rangetab.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/rangetab.c Fri Mar 05 04:08:17 2010 -0600 @@ -331,7 +331,7 @@ */ (type)) { - Lisp_Object obj = ALLOC_LISP_OBJECT (range_table); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (range_table); Lisp_Range_Table *rt = XRANGE_TABLE (obj); rt->entries = Dynarr_new (range_table_entry); rt->type = range_table_symbol_to_type (type); @@ -351,7 +351,7 @@ CHECK_RANGE_TABLE (range_table); rt = XRANGE_TABLE (range_table); - obj = ALLOC_LISP_OBJECT (range_table); + obj = ALLOC_NORMAL_LISP_OBJECT (range_table); rtnew = XRANGE_TABLE (obj); rtnew->entries = Dynarr_new (range_table_entry); rtnew->type = rt->type;
--- a/src/rangetab.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/rangetab.h Fri Mar 05 04:08:17 2010 -0600 @@ -49,7 +49,7 @@ struct Lisp_Range_Table { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; range_table_entry_dynarr *entries; enum range_table_type type; };
--- a/src/scrollbar.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/scrollbar.c Fri Mar 05 04:08:17 2010 -0600 @@ -3,7 +3,7 @@ Copyright (C) 1995 Free Software Foundation, Inc. Copyright (C) 1995 Sun Microsystems, Inc. Copyright (C) 1995 Darrell Kindred <dkindred+@cmu.edu>. - Copyright (C) 2003 Ben Wing. + Copyright (C) 2003, 2010 Ben Wing. This file is part of XEmacs. @@ -196,7 +196,7 @@ create_scrollbar_instance (struct frame *f, int vertical) { struct device *d = XDEVICE (f->device); - Lisp_Object obj = ALLOC_LISP_OBJECT (scrollbar_instance); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (scrollbar_instance); struct scrollbar_instance *instance = XSCROLLBAR_INSTANCE (obj); MAYBE_DEVMETH (d, create_scrollbar_instance, (f, vertical, instance)); @@ -269,7 +269,8 @@ while (inst) { - total += LISP_OBJECT_STORAGE_SIZE (inst, sizeof (*inst), ovstats); + total += lisp_object_storage_size (wrap_scrollbar_instance (inst), + ovstats); inst = inst->next; }
--- a/src/scrollbar.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/scrollbar.h Fri Mar 05 04:08:17 2010 -0600 @@ -27,7 +27,7 @@ struct scrollbar_instance { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; /* Used by the frame caches. */ struct scrollbar_instance *next;
--- a/src/specifier.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/specifier.c Fri Mar 05 04:08:17 2010 -0600 @@ -307,9 +307,9 @@ #ifndef NEW_GC static void -finalize_specifier (void *header) +finalize_specifier (Lisp_Object obj) { - Lisp_Specifier *sp = (Lisp_Specifier *) header; + Lisp_Specifier *sp = XSPECIFIER (obj); if (!GHOST_SPECIFIER_P(sp) && sp->caching) { xfree (sp->caching); @@ -371,9 +371,9 @@ } static Bytecount -sizeof_specifier (const void *header) +sizeof_specifier (Lisp_Object obj) { - const Lisp_Specifier *p = (const Lisp_Specifier *) header; + const Lisp_Specifier *p = XSPECIFIER (obj); return aligned_sizeof_specifier (GHOST_SPECIFIER_P (p) ? 0 : p->methods->extra_data_size); @@ -3386,7 +3386,7 @@ if (!sp->caching) #ifdef NEW_GC - sp->caching = XSPECIFIER_CACHING (ALLOC_LISP_OBJECT (specifier_caching)); + sp->caching = XSPECIFIER_CACHING (ALLOC_NORMAL_LISP_OBJECT (specifier_caching)); #else /* not NEW_GC */ sp->caching = xnew_and_zero (struct specifier_caching); #endif /* not NEW_GC */
--- a/src/specifier.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/specifier.h Fri Mar 05 04:08:17 2010 -0600 @@ -220,7 +220,7 @@ struct Lisp_Specifier { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; struct specifier_methods *methods; /* we keep a chained list of all current specifiers, for GC cleanup @@ -428,7 +428,7 @@ struct specifier_caching { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ int offset_into_struct_window; void (*value_changed_in_window) (Lisp_Object specifier, struct window *w,
--- a/src/symbols.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/symbols.c Fri Mar 05 04:08:17 2010 -0600 @@ -2290,7 +2290,7 @@ { struct symbol_value_buffer_local *bfwd = XSYMBOL_VALUE_BUFFER_LOCAL - (ALLOC_LISP_OBJECT (symbol_value_buffer_local)); + (ALLOC_NORMAL_LISP_OBJECT (symbol_value_buffer_local)); Lisp_Object foo; bfwd->magic.type = SYMVAL_BUFFER_LOCAL; @@ -2398,7 +2398,7 @@ /* Make sure variable is set up to hold per-buffer values */ bfwd = XSYMBOL_VALUE_BUFFER_LOCAL - (ALLOC_LISP_OBJECT (symbol_value_buffer_local)); + (ALLOC_NORMAL_LISP_OBJECT (symbol_value_buffer_local)); bfwd->magic.type = SYMVAL_SOME_BUFFER_LOCAL; bfwd->current_buffer = Qnil; @@ -3191,7 +3191,7 @@ { bfwd = XSYMBOL_VALUE_LISP_MAGIC - (ALLOC_LISP_OBJECT (symbol_value_lisp_magic)); + (ALLOC_NORMAL_LISP_OBJECT (symbol_value_lisp_magic)); bfwd->magic.type = SYMVAL_LISP_MAGIC; for (i = 0; i < MAGIC_HANDLER_MAX; i++) { @@ -3409,7 +3409,7 @@ reject_constant_symbols (variable, Qunbound, 0, Qt); bfwd = - XSYMBOL_VALUE_VARALIAS (ALLOC_LISP_OBJECT (symbol_value_varalias)); + XSYMBOL_VALUE_VARALIAS (ALLOC_NORMAL_LISP_OBJECT (symbol_value_varalias)); bfwd->magic.type = SYMVAL_VARALIAS; bfwd->aliasee = aliased; bfwd->shadowed = valcontents;
--- a/src/symeval.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/symeval.h Fri Mar 05 04:08:17 2010 -0600 @@ -77,7 +77,7 @@ struct symbol_value_magic { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; void *value; enum symbol_value_type type; }; @@ -401,7 +401,7 @@ do \ { \ struct symbol_value_forward *I_hate_C = \ - XSYMBOL_VALUE_FORWARD (ALLOC_LISP_OBJECT (symbol_value_forward)); \ + XSYMBOL_VALUE_FORWARD (ALLOC_NORMAL_LISP_OBJECT (symbol_value_forward)); \ /* mcpro ((Lisp_Object) I_hate_C);*/ \ \ MARK_LRECORD_AS_LISP_READONLY (I_hate_C); \ @@ -488,7 +488,7 @@ void flush_all_buffer_local_cache (void); struct multiple_value { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Elemcount count; Elemcount allocated_count; Elemcount first_desired;
--- a/src/symsinit.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/symsinit.h Fri Mar 05 04:08:17 2010 -0600 @@ -382,7 +382,6 @@ void vars_of_events (void); void reinit_vars_of_events (void); void vars_of_extents (void); -void reinit_vars_of_extents (void); void vars_of_faces (void); void vars_of_file_coding (void); void reinit_vars_of_file_coding (void);
--- a/src/syntax.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/syntax.c Fri Mar 05 04:08:17 2010 -0600 @@ -521,7 +521,7 @@ { struct syntax_cache *cache; #ifdef NEW_GC - buf->syntax_cache = XSYNTAX_CACHE (ALLOC_LISP_OBJECT (syntax_cache)); + buf->syntax_cache = XSYNTAX_CACHE (ALLOC_NORMAL_LISP_OBJECT (syntax_cache)); #else /* not NEW_GC */ buf->syntax_cache = xnew_and_zero (struct syntax_cache); #endif /* not NEW_GC */
--- a/src/syntax.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/syntax.h Fri Mar 05 04:08:17 2010 -0600 @@ -296,7 +296,7 @@ struct syntax_cache { #ifdef NEW_GC - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; #endif /* NEW_GC */ int use_code; /* Whether to use syntax_code or syntax_table. This is set
--- a/src/toolbar.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/toolbar.c Fri Mar 05 04:08:17 2010 -0600 @@ -71,6 +71,33 @@ { XD_END } }; + +static Lisp_Object +allocate_toolbar_button (struct frame *f, int pushright) +{ + struct toolbar_button *tb; + + tb = XTOOLBAR_BUTTON (ALLOC_NORMAL_LISP_OBJECT (toolbar_button)); + tb->next = Qnil; + tb->frame = wrap_frame (f); + tb->up_glyph = Qnil; + tb->down_glyph = Qnil; + tb->disabled_glyph = Qnil; + tb->cap_up_glyph = Qnil; + tb->cap_down_glyph = Qnil; + tb->cap_disabled_glyph = Qnil; + tb->callback = Qnil; + tb->enabled_p = Qnil; + tb->help_string = Qnil; + + tb->pushright = pushright; + tb->x = tb->y = tb->width = tb->height = -1; + tb->dirty = 1; + + return wrap_toolbar_button (tb); +} + + static Lisp_Object mark_toolbar_button (Lisp_Object obj) { @@ -301,27 +328,7 @@ buffer = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f))->buffer; if (!tb) - { - tb = XTOOLBAR_BUTTON (ALLOC_LISP_OBJECT (toolbar_button)); - tb->next = Qnil; - tb->frame = wrap_frame (f); - tb->up_glyph = Qnil; - tb->down_glyph = Qnil; - tb->disabled_glyph = Qnil; - tb->cap_up_glyph = Qnil; - tb->cap_down_glyph = Qnil; - tb->cap_disabled_glyph = Qnil; - tb->callback = Qnil; - tb->enabled_p = Qnil; - tb->help_string = Qnil; - - tb->enabled = 0; - tb->down = 0; - tb->pushright = pushright; - tb->blank = 0; - tb->x = tb->y = tb->width = tb->height = -1; - tb->dirty = 1; - } + tb = XTOOLBAR_BUTTON (allocate_toolbar_button (f, pushright)); retval = wrap_toolbar_button (tb); /* Let's make sure nothing gets mucked up by the potential call to
--- a/src/toolbar.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/toolbar.h Fri Mar 05 04:08:17 2010 -0600 @@ -38,7 +38,7 @@ struct toolbar_button { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object next; Lisp_Object frame;
--- a/src/tooltalk.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/tooltalk.c Fri Mar 05 04:08:17 2010 -0600 @@ -147,7 +147,7 @@ struct Lisp_Tooltalk_Message { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object plist_sym, callback; Tt_message m; }; @@ -187,7 +187,7 @@ static Lisp_Object make_tooltalk_message (Tt_message m) { - Lisp_Object obj = ALLOC_LISP_OBJECT (tooltalk_message); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (tooltalk_message); Lisp_Tooltalk_Message *msg = XTOOLTALK_MESSAGE (obj); msg->m = m; @@ -222,7 +222,7 @@ struct Lisp_Tooltalk_Pattern { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; Lisp_Object plist_sym, callback; Tt_pattern p; }; @@ -262,7 +262,7 @@ static Lisp_Object make_tooltalk_pattern (Tt_pattern p) { - Lisp_Object obj = ALLOC_LISP_OBJECT (tooltalk_pattern); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (tooltalk_pattern); Lisp_Tooltalk_Pattern *pat = XTOOLTALK_PATTERN (obj); pat->p = p;
--- a/src/ui-gtk.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/ui-gtk.c Fri Mar 05 04:08:17 2010 -0600 @@ -4,6 +4,7 @@ ** ** Created by: William M. Perry <wmperry@gnu.org> ** Copyright (c) 2000 William M. Perry <wmperry@gnu.org> +** Copyright (C) 2010 Ben Wing. ** ** This file is part of XEmacs. ** @@ -295,7 +296,7 @@ static emacs_ffi_data * allocate_ffi_data (void) { - Lisp_Object obj = ALLOC_LISP_OBJECT (emacs_ffi); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (emacs_ffi); emacs_ffi_data *data = XFFI (obj); data->return_type = GTK_TYPE_NONE; @@ -923,9 +924,9 @@ } static void -emacs_gtk_object_finalizer (void *header) +emacs_gtk_object_finalizer (Lisp_Object obj) { - emacs_gtk_object_data *data = (emacs_gtk_object_data *) header; + emacs_gtk_object_data *data = XEMACS_GTK_OBJECT_DATA (obj); if (data->alive_p) gtk_object_unref (data->object); @@ -948,7 +949,7 @@ static emacs_gtk_object_data * allocate_emacs_gtk_object_data (void) { - Lisp_Object obj = ALLOC_LISP_OBJECT (emacs_gtk_object); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (emacs_gtk_object); emacs_gtk_object_data *data = XGTK_OBJECT (obj); data->object = NULL; @@ -1152,7 +1153,7 @@ static emacs_gtk_boxed_data * allocate_emacs_gtk_boxed_data (void) { - Lisp_Object obj = ALLOC_LISP_OBJECT (emacs_gtk_boxed); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (emacs_gtk_boxed); emacs_gtk_boxed_data *data = XGTK_BOXED (obj); data->object = NULL;
--- a/src/ui-gtk.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/ui-gtk.h Fri Mar 05 04:08:17 2010 -0600 @@ -36,7 +36,7 @@ #define MAX_GTK_ARGS 100 typedef struct { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; GtkType return_type; GtkType args[MAX_GTK_ARGS]; gint n_args; @@ -54,7 +54,7 @@ /* Encapsulate a GtkObject in Lisp */ typedef struct { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; gboolean alive_p; GtkObject *object; Lisp_Object plist; @@ -71,7 +71,7 @@ /* Encapsulate a GTK_TYPE_BOXED in lisp */ typedef struct { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; GtkType object_type; void *object; } emacs_gtk_boxed_data;
--- a/src/window-impl.h Wed Feb 24 19:04:27 2010 -0600 +++ b/src/window-impl.h Fri Mar 05 04:08:17 2010 -0600 @@ -84,7 +84,7 @@ struct window { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; /* The upper left corner coordinates of this window, as integers (pixels) relative to upper left corner of frame = 0, 0 */ @@ -168,7 +168,7 @@ struct window_mirror { - LISP_OBJECT_HEADER header; + NORMAL_LISP_OBJECT_HEADER header; /* Frame this mirror is on. */ struct frame *frame;
--- a/src/window.c Wed Feb 24 19:04:27 2010 -0600 +++ b/src/window.c Fri Mar 05 04:08:17 2010 -0600 @@ -325,9 +325,9 @@ } static void -finalize_window (void *header) +finalize_window (Lisp_Object obj) { - struct window *w = (struct window *) header; + struct window *w = XWINDOW (obj); if (w->line_start_cache) { @@ -389,7 +389,7 @@ Lisp_Object allocate_window (void) { - Lisp_Object obj = ALLOC_LISP_OBJECT (window); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (window); struct window *p = XWINDOW (obj); #define WINDOW_SLOT(slot) p->slot = Qnil; @@ -533,7 +533,7 @@ static struct window_mirror * new_window_mirror (struct frame *f) { - Lisp_Object obj = ALLOC_LISP_OBJECT (window_mirror); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (window_mirror); struct window_mirror *t = XWINDOW_MIRROR (obj); t->frame = f; @@ -2137,7 +2137,7 @@ /* Free the extra data structures attached to windows immediately so they don't sit around consuming excess space. They will be reinitialized by the window-configuration code as necessary. */ - finalize_window ((void *) w); + finalize_window (wrap_window (w)); /* Nobody should be accessing anything in this object any more, and making them Qnil allows for better GC'ing in case a pointer @@ -3866,10 +3866,10 @@ make_dummy_parent (Lisp_Object window) { struct window *o = XWINDOW (window); - Lisp_Object obj = ALLOC_LISP_OBJECT (window); + Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (window); struct window *p = XWINDOW (obj); - COPY_LISP_OBJECT (p, o); + copy_lisp_object (obj, window); /* Don't copy the pointers to the line start cache or the face instances. */ @@ -5177,7 +5177,7 @@ { if (!mir) return; - stats->other += LISP_OBJECT_STORAGE_SIZE (mir, sizeof (*mir), ovstats); + stats->other += lisp_object_storage_size (wrap_window_mirror (mir), ovstats); #ifdef HAVE_SCROLLBARS { struct device *d = XDEVICE (FRAME_DEVICE (mir->frame)); @@ -5201,7 +5201,7 @@ struct overhead_stats *ovstats) { xzero (*stats); - stats->other += LISP_OBJECT_STORAGE_SIZE (w, sizeof (*w), ovstats); + stats->other += lisp_object_storage_size (wrap_window (w), ovstats); stats->face += compute_face_cachel_usage (w->face_cachels, ovstats); stats->glyph += compute_glyph_cachel_usage (w->glyph_cachels, ovstats); stats->line_start +=