diff options
| author | Miles Bader | 2004-06-29 16:46:06 +0000 |
|---|---|---|
| committer | Miles Bader | 2004-06-29 16:46:06 +0000 |
| commit | 12483a9413619e286efc673a2b277d85cebf3b0c (patch) | |
| tree | d489e0fa758c0d51d792d42140cbeafa4aede31b /src/alloc.c | |
| parent | c786a8ae1c5e84d0f0903d516dd0fc190dc1193c (diff) | |
| parent | 619b6adbd2b96accbbf18051bf69149a029557ee (diff) | |
| download | emacs-12483a9413619e286efc673a2b277d85cebf3b0c.tar.gz emacs-12483a9413619e286efc673a2b277d85cebf3b0c.zip | |
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-17
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-417
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-419
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-420
Tweak permissions
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-421
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-430
Update from CVS
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 56 |
1 files changed, 50 insertions, 6 deletions
diff --git a/src/alloc.c b/src/alloc.c index ea7886dd4dc..994dc21079f 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -579,6 +579,22 @@ xstrdup (s) | |||
| 579 | } | 579 | } |
| 580 | 580 | ||
| 581 | 581 | ||
| 582 | /* Unwind for SAFE_ALLOCA */ | ||
| 583 | |||
| 584 | Lisp_Object | ||
| 585 | safe_alloca_unwind (arg) | ||
| 586 | Lisp_Object arg; | ||
| 587 | { | ||
| 588 | register struct Lisp_Save_Value *p = XSAVE_VALUE (arg); | ||
| 589 | |||
| 590 | p->dogc = 0; | ||
| 591 | xfree (p->pointer); | ||
| 592 | p->pointer = 0; | ||
| 593 | free_misc (arg); | ||
| 594 | return Qnil; | ||
| 595 | } | ||
| 596 | |||
| 597 | |||
| 582 | /* Like malloc but used for allocating Lisp data. NBYTES is the | 598 | /* Like malloc but used for allocating Lisp data. NBYTES is the |
| 583 | number of bytes to allocate, TYPE describes the intended use of the | 599 | number of bytes to allocate, TYPE describes the intended use of the |
| 584 | allcated memory block (for strings, for conses, ...). */ | 600 | allcated memory block (for strings, for conses, ...). */ |
| @@ -2863,17 +2879,32 @@ allocate_misc () | |||
| 2863 | marker_block = new; | 2879 | marker_block = new; |
| 2864 | marker_block_index = 0; | 2880 | marker_block_index = 0; |
| 2865 | n_marker_blocks++; | 2881 | n_marker_blocks++; |
| 2882 | total_free_markers += MARKER_BLOCK_SIZE; | ||
| 2866 | } | 2883 | } |
| 2867 | XSETMISC (val, &marker_block->markers[marker_block_index]); | 2884 | XSETMISC (val, &marker_block->markers[marker_block_index]); |
| 2868 | marker_block_index++; | 2885 | marker_block_index++; |
| 2869 | } | 2886 | } |
| 2870 | 2887 | ||
| 2888 | --total_free_markers; | ||
| 2871 | consing_since_gc += sizeof (union Lisp_Misc); | 2889 | consing_since_gc += sizeof (union Lisp_Misc); |
| 2872 | misc_objects_consed++; | 2890 | misc_objects_consed++; |
| 2873 | XMARKER (val)->gcmarkbit = 0; | 2891 | XMARKER (val)->gcmarkbit = 0; |
| 2874 | return val; | 2892 | return val; |
| 2875 | } | 2893 | } |
| 2876 | 2894 | ||
| 2895 | /* Free a Lisp_Misc object */ | ||
| 2896 | |||
| 2897 | void | ||
| 2898 | free_misc (misc) | ||
| 2899 | Lisp_Object misc; | ||
| 2900 | { | ||
| 2901 | XMISC (misc)->u_marker.type = Lisp_Misc_Free; | ||
| 2902 | XMISC (misc)->u_free.chain = marker_free_list; | ||
| 2903 | marker_free_list = XMISC (misc); | ||
| 2904 | |||
| 2905 | total_free_markers++; | ||
| 2906 | } | ||
| 2907 | |||
| 2877 | /* Return a Lisp_Misc_Save_Value object containing POINTER and | 2908 | /* Return a Lisp_Misc_Save_Value object containing POINTER and |
| 2878 | INTEGER. This is used to package C values to call record_unwind_protect. | 2909 | INTEGER. This is used to package C values to call record_unwind_protect. |
| 2879 | The unwind function can get the C values back using XSAVE_VALUE. */ | 2910 | The unwind function can get the C values back using XSAVE_VALUE. */ |
| @@ -2891,6 +2922,7 @@ make_save_value (pointer, integer) | |||
| 2891 | p = XSAVE_VALUE (val); | 2922 | p = XSAVE_VALUE (val); |
| 2892 | p->pointer = pointer; | 2923 | p->pointer = pointer; |
| 2893 | p->integer = integer; | 2924 | p->integer = integer; |
| 2925 | p->dogc = 0; | ||
| 2894 | return val; | 2926 | return val; |
| 2895 | } | 2927 | } |
| 2896 | 2928 | ||
| @@ -2919,12 +2951,7 @@ free_marker (marker) | |||
| 2919 | Lisp_Object marker; | 2951 | Lisp_Object marker; |
| 2920 | { | 2952 | { |
| 2921 | unchain_marker (XMARKER (marker)); | 2953 | unchain_marker (XMARKER (marker)); |
| 2922 | 2954 | free_misc (marker); | |
| 2923 | XMISC (marker)->u_marker.type = Lisp_Misc_Free; | ||
| 2924 | XMISC (marker)->u_free.chain = marker_free_list; | ||
| 2925 | marker_free_list = XMISC (marker); | ||
| 2926 | |||
| 2927 | total_free_markers++; | ||
| 2928 | } | 2955 | } |
| 2929 | 2956 | ||
| 2930 | 2957 | ||
| @@ -4924,6 +4951,7 @@ mark_object (arg) | |||
| 4924 | if (XMARKER (obj)->gcmarkbit) | 4951 | if (XMARKER (obj)->gcmarkbit) |
| 4925 | break; | 4952 | break; |
| 4926 | XMARKER (obj)->gcmarkbit = 1; | 4953 | XMARKER (obj)->gcmarkbit = 1; |
| 4954 | |||
| 4927 | switch (XMISCTYPE (obj)) | 4955 | switch (XMISCTYPE (obj)) |
| 4928 | { | 4956 | { |
| 4929 | case Lisp_Misc_Buffer_Local_Value: | 4957 | case Lisp_Misc_Buffer_Local_Value: |
| @@ -4948,6 +4976,8 @@ mark_object (arg) | |||
| 4948 | /* DO NOT mark thru the marker's chain. | 4976 | /* DO NOT mark thru the marker's chain. |
| 4949 | The buffer's markers chain does not preserve markers from gc; | 4977 | The buffer's markers chain does not preserve markers from gc; |
| 4950 | instead, markers are removed from the chain when freed by gc. */ | 4978 | instead, markers are removed from the chain when freed by gc. */ |
| 4979 | break; | ||
| 4980 | |||
| 4951 | case Lisp_Misc_Intfwd: | 4981 | case Lisp_Misc_Intfwd: |
| 4952 | case Lisp_Misc_Boolfwd: | 4982 | case Lisp_Misc_Boolfwd: |
| 4953 | case Lisp_Misc_Objfwd: | 4983 | case Lisp_Misc_Objfwd: |
| @@ -4957,7 +4987,21 @@ mark_object (arg) | |||
| 4957 | since all markable slots in current buffer marked anyway. */ | 4987 | since all markable slots in current buffer marked anyway. */ |
| 4958 | /* Don't need to do Lisp_Objfwd, since the places they point | 4988 | /* Don't need to do Lisp_Objfwd, since the places they point |
| 4959 | are protected with staticpro. */ | 4989 | are protected with staticpro. */ |
| 4990 | break; | ||
| 4991 | |||
| 4960 | case Lisp_Misc_Save_Value: | 4992 | case Lisp_Misc_Save_Value: |
| 4993 | { | ||
| 4994 | register struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj); | ||
| 4995 | /* If DOGC is set, POINTER is the address of a memory | ||
| 4996 | area containing INTEGER potential Lisp_Objects. */ | ||
| 4997 | if (ptr->dogc) | ||
| 4998 | { | ||
| 4999 | Lisp_Object *p = (Lisp_Object *) ptr->pointer; | ||
| 5000 | int nelt; | ||
| 5001 | for (nelt = ptr->integer; nelt > 0; nelt--, p++) | ||
| 5002 | mark_maybe_object (*p); | ||
| 5003 | } | ||
| 5004 | } | ||
| 4961 | break; | 5005 | break; |
| 4962 | 5006 | ||
| 4963 | case Lisp_Misc_Overlay: | 5007 | case Lisp_Misc_Overlay: |