diff options
| author | Richard M. Stallman | 1994-09-17 00:25:35 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-09-17 00:25:35 +0000 |
| commit | 426076815fd51f7f545a8116c3b6a273ca8e6839 (patch) | |
| tree | 8ca60e89b394868f71400dcacc38f25c6e2b1260 /src/alloc.c | |
| parent | bbd619d769e0f033881cfd903309b1c447798770 (diff) | |
| download | emacs-426076815fd51f7f545a8116c3b6a273ca8e6839.tar.gz emacs-426076815fd51f7f545a8116c3b6a273ca8e6839.zip | |
(pure, pure_size): Use EMACS_INT.
(free_float, free_cons, PAD, STRING_FULLSIZE, struct string_block)
(make_pure_string, make_pure_vector, Fgarbage_collect, mark_object)
(gc_sweep, compact_strings, Fmemory_limit): Use EMACS_INT.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/src/alloc.c b/src/alloc.c index 0b2207e1d86..965a1e97795 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -77,7 +77,7 @@ int undo_strong_limit; | |||
| 77 | Lisp_Object Vpurify_flag; | 77 | Lisp_Object Vpurify_flag; |
| 78 | 78 | ||
| 79 | #ifndef HAVE_SHM | 79 | #ifndef HAVE_SHM |
| 80 | int pure[PURESIZE / sizeof (int)] = {0,}; /* Force it into data space! */ | 80 | EMACS_INT pure[PURESIZE / sizeof (EMACS_INT)] = {0,}; /* Force it into data space! */ |
| 81 | #define PUREBEG (char *) pure | 81 | #define PUREBEG (char *) pure |
| 82 | #else | 82 | #else |
| 83 | #define pure PURE_SEG_BITS /* Use shared memory segment */ | 83 | #define pure PURE_SEG_BITS /* Use shared memory segment */ |
| @@ -89,7 +89,7 @@ int pure[PURESIZE / sizeof (int)] = {0,}; /* Force it into data space! */ | |||
| 89 | you should be able to change that without too much recompilation. | 89 | you should be able to change that without too much recompilation. |
| 90 | So map_in_data initializes pure_size, and the dependencies work | 90 | So map_in_data initializes pure_size, and the dependencies work |
| 91 | out. */ | 91 | out. */ |
| 92 | int pure_size; | 92 | EMACS_INT pure_size; |
| 93 | #endif /* not HAVE_SHM */ | 93 | #endif /* not HAVE_SHM */ |
| 94 | 94 | ||
| 95 | /* Index in pure at which next pure object will be allocated. */ | 95 | /* Index in pure at which next pure object will be allocated. */ |
| @@ -435,7 +435,7 @@ init_float () | |||
| 435 | free_float (ptr) | 435 | free_float (ptr) |
| 436 | struct Lisp_Float *ptr; | 436 | struct Lisp_Float *ptr; |
| 437 | { | 437 | { |
| 438 | XFASTINT (ptr->type) = (int) float_free_list; | 438 | XFASTINT (ptr->type) = (EMACS_INT) float_free_list; |
| 439 | float_free_list = ptr; | 439 | float_free_list = ptr; |
| 440 | } | 440 | } |
| 441 | 441 | ||
| @@ -508,7 +508,7 @@ init_cons () | |||
| 508 | free_cons (ptr) | 508 | free_cons (ptr) |
| 509 | struct Lisp_Cons *ptr; | 509 | struct Lisp_Cons *ptr; |
| 510 | { | 510 | { |
| 511 | XFASTINT (ptr->car) = (int) cons_free_list; | 511 | XFASTINT (ptr->car) = (EMACS_INT) cons_free_list; |
| 512 | cons_free_list = ptr; | 512 | cons_free_list = ptr; |
| 513 | } | 513 | } |
| 514 | 514 | ||
| @@ -826,7 +826,7 @@ struct string_block_head | |||
| 826 | struct string_block | 826 | struct string_block |
| 827 | { | 827 | { |
| 828 | struct string_block *next, *prev; | 828 | struct string_block *next, *prev; |
| 829 | int pos; | 829 | EMACS_INT pos; |
| 830 | char chars[STRING_BLOCK_SIZE]; | 830 | char chars[STRING_BLOCK_SIZE]; |
| 831 | }; | 831 | }; |
| 832 | 832 | ||
| @@ -847,11 +847,11 @@ struct string_block *large_string_blocks; | |||
| 847 | 847 | ||
| 848 | #define STRING_FULLSIZE(size) (((size) + sizeof (struct Lisp_String) + PAD) \ | 848 | #define STRING_FULLSIZE(size) (((size) + sizeof (struct Lisp_String) + PAD) \ |
| 849 | & ~(PAD - 1)) | 849 | & ~(PAD - 1)) |
| 850 | #define PAD (sizeof (int)) | 850 | #define PAD (sizeof (EMACS_INT)) |
| 851 | 851 | ||
| 852 | #if 0 | 852 | #if 0 |
| 853 | #define STRING_FULLSIZE(SIZE) \ | 853 | #define STRING_FULLSIZE(SIZE) \ |
| 854 | (((SIZE) + 2 * sizeof (int)) & ~(sizeof (int) - 1)) | 854 | (((SIZE) + 2 * sizeof (EMACS_INT)) & ~(sizeof (EMACS_INT) - 1)) |
| 855 | #endif | 855 | #endif |
| 856 | 856 | ||
| 857 | void | 857 | void |
| @@ -1010,7 +1010,7 @@ make_pure_string (data, length) | |||
| 1010 | int length; | 1010 | int length; |
| 1011 | { | 1011 | { |
| 1012 | register Lisp_Object new; | 1012 | register Lisp_Object new; |
| 1013 | register int size = sizeof (int) + INTERVAL_PTR_SIZE + length + 1; | 1013 | register int size = sizeof (EMACS_INT) + INTERVAL_PTR_SIZE + length + 1; |
| 1014 | 1014 | ||
| 1015 | if (pureptr + size > PURESIZE) | 1015 | if (pureptr + size > PURESIZE) |
| 1016 | error ("Pure Lisp storage exhausted"); | 1016 | error ("Pure Lisp storage exhausted"); |
| @@ -1024,8 +1024,8 @@ make_pure_string (data, length) | |||
| 1024 | #if defined (USE_TEXT_PROPERTIES) | 1024 | #if defined (USE_TEXT_PROPERTIES) |
| 1025 | XSTRING (new)->intervals = NULL_INTERVAL; | 1025 | XSTRING (new)->intervals = NULL_INTERVAL; |
| 1026 | #endif | 1026 | #endif |
| 1027 | pureptr += (size + sizeof (int) - 1) | 1027 | pureptr += (size + sizeof (EMACS_INT) - 1) |
| 1028 | / sizeof (int) * sizeof (int); | 1028 | / sizeof (EMACS_INT) * sizeof (EMACS_INT); |
| 1029 | return new; | 1029 | return new; |
| 1030 | } | 1030 | } |
| 1031 | 1031 | ||
| @@ -1086,10 +1086,10 @@ make_pure_float (num) | |||
| 1086 | 1086 | ||
| 1087 | Lisp_Object | 1087 | Lisp_Object |
| 1088 | make_pure_vector (len) | 1088 | make_pure_vector (len) |
| 1089 | int len; | 1089 | EMACS_INT len; |
| 1090 | { | 1090 | { |
| 1091 | register Lisp_Object new; | 1091 | register Lisp_Object new; |
| 1092 | register int size = sizeof (struct Lisp_Vector) + (len - 1) * sizeof (Lisp_Object); | 1092 | register EMACS_INT size = sizeof (struct Lisp_Vector) + (len - 1) * sizeof (Lisp_Object); |
| 1093 | 1093 | ||
| 1094 | if (pureptr + size > PURESIZE) | 1094 | if (pureptr + size > PURESIZE) |
| 1095 | error ("Pure Lisp storage exhausted"); | 1095 | error ("Pure Lisp storage exhausted"); |
| @@ -1235,7 +1235,7 @@ Garbage collection happens automatically if you cons more than\n\ | |||
| 1235 | stack_copy = (char *) xrealloc (stack_copy, (stack_copy_size = i)); | 1235 | stack_copy = (char *) xrealloc (stack_copy, (stack_copy_size = i)); |
| 1236 | if (stack_copy) | 1236 | if (stack_copy) |
| 1237 | { | 1237 | { |
| 1238 | if ((int) (&stack_top_variable - stack_bottom) > 0) | 1238 | if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0) |
| 1239 | bcopy (stack_bottom, stack_copy, i); | 1239 | bcopy (stack_bottom, stack_copy, i); |
| 1240 | else | 1240 | else |
| 1241 | bcopy (&stack_top_variable, stack_copy, i); | 1241 | bcopy (&stack_top_variable, stack_copy, i); |
| @@ -1503,9 +1503,9 @@ mark_object (objptr) | |||
| 1503 | } | 1503 | } |
| 1504 | else | 1504 | else |
| 1505 | XFASTINT (*objptr) = ptr->size; | 1505 | XFASTINT (*objptr) = ptr->size; |
| 1506 | if ((int)objptr & 1) abort (); | 1506 | if ((EMACS_INT) objptr & 1) abort (); |
| 1507 | ptr->size = (int) objptr & ~MARKBIT; | 1507 | ptr->size = (EMACS_INT) objptr & ~MARKBIT; |
| 1508 | if ((int) objptr & MARKBIT) | 1508 | if ((EMACS_INT) objptr & MARKBIT) |
| 1509 | ptr->size ++; | 1509 | ptr->size ++; |
| 1510 | } | 1510 | } |
| 1511 | } | 1511 | } |
| @@ -1517,7 +1517,7 @@ mark_object (objptr) | |||
| 1517 | case Lisp_Window_Configuration: | 1517 | case Lisp_Window_Configuration: |
| 1518 | { | 1518 | { |
| 1519 | register struct Lisp_Vector *ptr = XVECTOR (obj); | 1519 | register struct Lisp_Vector *ptr = XVECTOR (obj); |
| 1520 | register int size = ptr->size; | 1520 | register EMACS_INT size = ptr->size; |
| 1521 | /* The reason we use ptr1 is to avoid an apparent hardware bug | 1521 | /* The reason we use ptr1 is to avoid an apparent hardware bug |
| 1522 | that happens occasionally on the FSF's HP 300s. | 1522 | that happens occasionally on the FSF's HP 300s. |
| 1523 | The bug is that a2 gets clobbered by recursive calls to mark_object. | 1523 | The bug is that a2 gets clobbered by recursive calls to mark_object. |
| @@ -1540,7 +1540,7 @@ mark_object (objptr) | |||
| 1540 | there. */ | 1540 | there. */ |
| 1541 | { | 1541 | { |
| 1542 | register struct Lisp_Vector *ptr = XVECTOR (obj); | 1542 | register struct Lisp_Vector *ptr = XVECTOR (obj); |
| 1543 | register int size = ptr->size; | 1543 | register EMACS_INT size = ptr->size; |
| 1544 | /* See comment above under Lisp_Vector. */ | 1544 | /* See comment above under Lisp_Vector. */ |
| 1545 | struct Lisp_Vector *volatile ptr1 = ptr; | 1545 | struct Lisp_Vector *volatile ptr1 = ptr; |
| 1546 | register int i; | 1546 | register int i; |
| @@ -1563,7 +1563,7 @@ mark_object (objptr) | |||
| 1563 | { | 1563 | { |
| 1564 | /* See comment above under Lisp_Vector for why this is volatile. */ | 1564 | /* See comment above under Lisp_Vector for why this is volatile. */ |
| 1565 | register struct frame *volatile ptr = XFRAME (obj); | 1565 | register struct frame *volatile ptr = XFRAME (obj); |
| 1566 | register int size = ptr->size; | 1566 | register EMACS_INT size = ptr->size; |
| 1567 | 1567 | ||
| 1568 | if (size & ARRAY_MARK_FLAG) break; /* Already marked */ | 1568 | if (size & ARRAY_MARK_FLAG) break; /* Already marked */ |
| 1569 | ptr->size |= ARRAY_MARK_FLAG; /* Else mark it */ | 1569 | ptr->size |= ARRAY_MARK_FLAG; /* Else mark it */ |
| @@ -1733,7 +1733,7 @@ gc_sweep () | |||
| 1733 | for (i = 0; i < lim; i++) | 1733 | for (i = 0; i < lim; i++) |
| 1734 | if (!XMARKBIT (cblk->conses[i].car)) | 1734 | if (!XMARKBIT (cblk->conses[i].car)) |
| 1735 | { | 1735 | { |
| 1736 | XFASTINT (cblk->conses[i].car) = (int) cons_free_list; | 1736 | XFASTINT (cblk->conses[i].car) = (EMACS_INT) cons_free_list; |
| 1737 | num_free++; | 1737 | num_free++; |
| 1738 | cons_free_list = &cblk->conses[i]; | 1738 | cons_free_list = &cblk->conses[i]; |
| 1739 | } | 1739 | } |
| @@ -1763,7 +1763,7 @@ gc_sweep () | |||
| 1763 | for (i = 0; i < lim; i++) | 1763 | for (i = 0; i < lim; i++) |
| 1764 | if (!XMARKBIT (fblk->floats[i].type)) | 1764 | if (!XMARKBIT (fblk->floats[i].type)) |
| 1765 | { | 1765 | { |
| 1766 | XFASTINT (fblk->floats[i].type) = (int) float_free_list; | 1766 | XFASTINT (fblk->floats[i].type) = (EMACS_INT) float_free_list; |
| 1767 | num_free++; | 1767 | num_free++; |
| 1768 | float_free_list = &fblk->floats[i]; | 1768 | float_free_list = &fblk->floats[i]; |
| 1769 | } | 1769 | } |
| @@ -1827,7 +1827,7 @@ gc_sweep () | |||
| 1827 | for (i = 0; i < lim; i++) | 1827 | for (i = 0; i < lim; i++) |
| 1828 | if (!XMARKBIT (sblk->symbols[i].plist)) | 1828 | if (!XMARKBIT (sblk->symbols[i].plist)) |
| 1829 | { | 1829 | { |
| 1830 | XFASTINT (sblk->symbols[i].value) = (int) symbol_free_list; | 1830 | XFASTINT (sblk->symbols[i].value) = (EMACS_INT) symbol_free_list; |
| 1831 | symbol_free_list = &sblk->symbols[i]; | 1831 | symbol_free_list = &sblk->symbols[i]; |
| 1832 | num_free++; | 1832 | num_free++; |
| 1833 | } | 1833 | } |
| @@ -1865,7 +1865,7 @@ gc_sweep () | |||
| 1865 | tem1 = &mblk->markers[i]; /* tem1 avoids Sun compiler bug */ | 1865 | tem1 = &mblk->markers[i]; /* tem1 avoids Sun compiler bug */ |
| 1866 | XSET (tem, Lisp_Marker, tem1); | 1866 | XSET (tem, Lisp_Marker, tem1); |
| 1867 | unchain_marker (tem); | 1867 | unchain_marker (tem); |
| 1868 | XFASTINT (mblk->markers[i].chain) = (int) marker_free_list; | 1868 | XFASTINT (mblk->markers[i].chain) = (EMACS_INT) marker_free_list; |
| 1869 | marker_free_list = &mblk->markers[i]; | 1869 | marker_free_list = &mblk->markers[i]; |
| 1870 | num_free++; | 1870 | num_free++; |
| 1871 | } | 1871 | } |
| @@ -2002,18 +2002,18 @@ compact_strings () | |||
| 2002 | = (struct Lisp_String *) &from_sb->chars[pos]; | 2002 | = (struct Lisp_String *) &from_sb->chars[pos]; |
| 2003 | 2003 | ||
| 2004 | register struct Lisp_String *newaddr; | 2004 | register struct Lisp_String *newaddr; |
| 2005 | register int size = nextstr->size; | 2005 | register EMACS_INT size = nextstr->size; |
| 2006 | 2006 | ||
| 2007 | /* NEXTSTR is the old address of the next string. | 2007 | /* NEXTSTR is the old address of the next string. |
| 2008 | Just skip it if it isn't marked. */ | 2008 | Just skip it if it isn't marked. */ |
| 2009 | if ((unsigned) size > STRING_BLOCK_SIZE) | 2009 | if ((EMACS_UINT) size > STRING_BLOCK_SIZE) |
| 2010 | { | 2010 | { |
| 2011 | /* It is marked, so its size field is really a chain of refs. | 2011 | /* It is marked, so its size field is really a chain of refs. |
| 2012 | Find the end of the chain, where the actual size lives. */ | 2012 | Find the end of the chain, where the actual size lives. */ |
| 2013 | while ((unsigned) size > STRING_BLOCK_SIZE) | 2013 | while ((EMACS_UINT) size > STRING_BLOCK_SIZE) |
| 2014 | { | 2014 | { |
| 2015 | if (size & 1) size ^= MARKBIT | 1; | 2015 | if (size & 1) size ^= MARKBIT | 1; |
| 2016 | size = *(int *)size & ~MARKBIT; | 2016 | size = *(EMACS_INT *)size & ~MARKBIT; |
| 2017 | } | 2017 | } |
| 2018 | 2018 | ||
| 2019 | total_string_size += size; | 2019 | total_string_size += size; |
| @@ -2039,14 +2039,14 @@ compact_strings () | |||
| 2039 | 2039 | ||
| 2040 | /* Copy the string itself to the new place. */ | 2040 | /* Copy the string itself to the new place. */ |
| 2041 | if (nextstr != newaddr) | 2041 | if (nextstr != newaddr) |
| 2042 | bcopy (nextstr, newaddr, size + 1 + sizeof (int) | 2042 | bcopy (nextstr, newaddr, size + 1 + sizeof (EMACS_INT) |
| 2043 | + INTERVAL_PTR_SIZE); | 2043 | + INTERVAL_PTR_SIZE); |
| 2044 | 2044 | ||
| 2045 | /* Go through NEXTSTR's chain of references | 2045 | /* Go through NEXTSTR's chain of references |
| 2046 | and make each slot in the chain point to | 2046 | and make each slot in the chain point to |
| 2047 | the new address of this string. */ | 2047 | the new address of this string. */ |
| 2048 | size = newaddr->size; | 2048 | size = newaddr->size; |
| 2049 | while ((unsigned) size > STRING_BLOCK_SIZE) | 2049 | while ((EMACS_UINT) size > STRING_BLOCK_SIZE) |
| 2050 | { | 2050 | { |
| 2051 | register Lisp_Object *objptr; | 2051 | register Lisp_Object *objptr; |
| 2052 | if (size & 1) size ^= MARKBIT | 1; | 2052 | if (size & 1) size ^= MARKBIT | 1; |
| @@ -2121,7 +2121,7 @@ We divide the value by 1024 to make sure it fits in a Lisp integer.") | |||
| 2121 | { | 2121 | { |
| 2122 | Lisp_Object end; | 2122 | Lisp_Object end; |
| 2123 | 2123 | ||
| 2124 | XSET (end, Lisp_Int, (int) sbrk (0) / 1024); | 2124 | XSET (end, Lisp_Int, (EMACS_INT) sbrk (0) / 1024); |
| 2125 | 2125 | ||
| 2126 | return end; | 2126 | return end; |
| 2127 | } | 2127 | } |