diff options
| author | Daniel Colascione | 2013-09-22 01:31:55 -0800 |
|---|---|---|
| committer | Daniel Colascione | 2013-09-22 01:31:55 -0800 |
| commit | 3e0b94e7ff1fc69b077322d672ef5d0b668541c3 (patch) | |
| tree | 9927abd073960f2460f05a43ae9467cd82c00b9b /src/ralloc.c | |
| parent | 76880d884d87d0bc674249e292ccda70f31cca0e (diff) | |
| download | emacs-3e0b94e7ff1fc69b077322d672ef5d0b668541c3.tar.gz emacs-3e0b94e7ff1fc69b077322d672ef5d0b668541c3.zip | |
Add set operations for bool-vector.
http://lists.gnu.org/archive/html/emacs-devel/2013-09/msg00404.html
* data.c (Qbool_vector_p): New symbol.
(bool_vector_spare_mask,popcount_size_t_generic)
(popcount_size_t_msc,popcount_size_t_gcc)
(popcount_size_t)
(bool_vector_binop_driver)
(count_trailing_zero_bits,size_t_to_host_endian)
(Fbool_vector_exclusive_or)
(Fbool_vector_union)
(Fbool_vector_intersection,Fbool_vector_set_difference)
(Fbool_vector_subsetp,Fbool_vector_not)
(Fbool_vector_count_matches)
(Fbool_vector_count_matches_at): New functions.
(syms_of_data): Intern new symbol, functions.
* alloc.c (bool_vector_payload_bytes): New function.
(Fmake_bool_vector): Instead of calling Fmake_vector,
which performs redundant initialization and argument checking,
just call allocate_vector ourselves. Make sure we clear any
terminating padding to zero.
(vector_nbytes,sweep_vectors): Use bool_vector_payload_bytes
instead of open-coding the size calculation.
(vroundup_ct): New macro.
(vroundup): Assume argument >= 0; invoke vroundup_ct.
* casetab.c (shuffle,set_identity): Change lint_assume to assume.
* composite.c (composition_gstring_put_cache): Change
lint_assume to assume.
* conf_post.h (assume): New macro.
(lint_assume): Remove.
* dispnew.c (update_frame_1): Change lint_assume to assume.
* ftfont.c (ftfont_shape_by_flt): Change lint_assume
to assume.
* image.c (gif_load): Change lint_assume to assume.
* lisp.h (eassert_and_assume): New macro.
(Qbool_vector_p): Declare.
(CHECK_BOOL_VECTOR,ROUNDUP,BITS_PER_SIZE_T): New macros.
(swap16,swap32,swap64): New inline functions.
* macfont.c (macfont_shape): Change lint_assume to assume.
* ralloc.c: Rename ROUNDUP to PAGE_ROUNDUP throughout.
* xsettings.c (parse_settings): Use new swap16 and
swap32 from lisp.h instead of file-specific macros.
Diffstat (limited to 'src/ralloc.c')
| -rw-r--r-- | src/ralloc.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ralloc.c b/src/ralloc.c index 5f25ef2c320..5b7d6a512d7 100644 --- a/src/ralloc.c +++ b/src/ralloc.c | |||
| @@ -85,7 +85,7 @@ static int extra_bytes; | |||
| 85 | /* Macros for rounding. Note that rounding to any value is possible | 85 | /* Macros for rounding. Note that rounding to any value is possible |
| 86 | by changing the definition of PAGE. */ | 86 | by changing the definition of PAGE. */ |
| 87 | #define PAGE (getpagesize ()) | 87 | #define PAGE (getpagesize ()) |
| 88 | #define ROUNDUP(size) (((size_t) (size) + page_size - 1) \ | 88 | #define PAGE_ROUNDUP(size) (((size_t) (size) + page_size - 1) \ |
| 89 | & ~((size_t) (page_size - 1))) | 89 | & ~((size_t) (page_size - 1))) |
| 90 | 90 | ||
| 91 | #define MEM_ALIGN sizeof (double) | 91 | #define MEM_ALIGN sizeof (double) |
| @@ -281,7 +281,7 @@ obtain (void *address, size_t size) | |||
| 281 | Get some extra, so we can come here less often. */ | 281 | Get some extra, so we can come here less often. */ |
| 282 | 282 | ||
| 283 | get = size + extra_bytes - already_available; | 283 | get = size + extra_bytes - already_available; |
| 284 | get = (char *) ROUNDUP ((char *) last_heap->end + get) | 284 | get = (char *) PAGE_ROUNDUP ((char *) last_heap->end + get) |
| 285 | - (char *) last_heap->end; | 285 | - (char *) last_heap->end; |
| 286 | 286 | ||
| 287 | if (real_morecore (get) != last_heap->end) | 287 | if (real_morecore (get) != last_heap->end) |
| @@ -344,7 +344,7 @@ relinquish (void) | |||
| 344 | else | 344 | else |
| 345 | { | 345 | { |
| 346 | excess = ((char *) last_heap->end | 346 | excess = ((char *) last_heap->end |
| 347 | - (char *) ROUNDUP ((char *) last_heap->end - excess)); | 347 | - (char *) PAGE_ROUNDUP ((char *) last_heap->end - excess)); |
| 348 | /* If the system doesn't want that much memory back, leave | 348 | /* If the system doesn't want that much memory back, leave |
| 349 | the end of the last heap unchanged to reflect that. This | 349 | the end of the last heap unchanged to reflect that. This |
| 350 | can occur if break_value is still within the original | 350 | can occur if break_value is still within the original |
| @@ -768,9 +768,9 @@ r_alloc_sbrk (ptrdiff_t size) | |||
| 768 | not always find a space which is contiguous to the previous. */ | 768 | not always find a space which is contiguous to the previous. */ |
| 769 | void *new_bloc_start; | 769 | void *new_bloc_start; |
| 770 | heap_ptr h = first_heap; | 770 | heap_ptr h = first_heap; |
| 771 | size_t get = ROUNDUP (size); | 771 | size_t get = PAGE_ROUNDUP (size); |
| 772 | 772 | ||
| 773 | address = (void *) ROUNDUP (virtual_break_value); | 773 | address = (void *) PAGE_ROUNDUP (virtual_break_value); |
| 774 | 774 | ||
| 775 | /* Search the list upward for a heap which is large enough. */ | 775 | /* Search the list upward for a heap which is large enough. */ |
| 776 | while ((char *) h->end < (char *) MEM_ROUNDUP ((char *) address + get)) | 776 | while ((char *) h->end < (char *) MEM_ROUNDUP ((char *) address + get)) |
| @@ -778,7 +778,7 @@ r_alloc_sbrk (ptrdiff_t size) | |||
| 778 | h = h->next; | 778 | h = h->next; |
| 779 | if (h == NIL_HEAP) | 779 | if (h == NIL_HEAP) |
| 780 | break; | 780 | break; |
| 781 | address = (void *) ROUNDUP (h->start); | 781 | address = (void *) PAGE_ROUNDUP (h->start); |
| 782 | } | 782 | } |
| 783 | 783 | ||
| 784 | /* If not found, obtain more space. */ | 784 | /* If not found, obtain more space. */ |
| @@ -790,9 +790,9 @@ r_alloc_sbrk (ptrdiff_t size) | |||
| 790 | return 0; | 790 | return 0; |
| 791 | 791 | ||
| 792 | if (first_heap == last_heap) | 792 | if (first_heap == last_heap) |
| 793 | address = (void *) ROUNDUP (virtual_break_value); | 793 | address = (void *) PAGE_ROUNDUP (virtual_break_value); |
| 794 | else | 794 | else |
| 795 | address = (void *) ROUNDUP (last_heap->start); | 795 | address = (void *) PAGE_ROUNDUP (last_heap->start); |
| 796 | h = last_heap; | 796 | h = last_heap; |
| 797 | } | 797 | } |
| 798 | 798 | ||
| @@ -1054,7 +1054,7 @@ r_alloc_check (void) | |||
| 1054 | for (h = first_heap; h; h = h->next) | 1054 | for (h = first_heap; h; h = h->next) |
| 1055 | { | 1055 | { |
| 1056 | assert (h->prev == ph); | 1056 | assert (h->prev == ph); |
| 1057 | assert ((void *) ROUNDUP (h->end) == h->end); | 1057 | assert ((void *) PAGE_ROUNDUP (h->end) == h->end); |
| 1058 | #if 0 /* ??? The code in ralloc.c does not really try to ensure | 1058 | #if 0 /* ??? The code in ralloc.c does not really try to ensure |
| 1059 | the heap start has any sort of alignment. | 1059 | the heap start has any sort of alignment. |
| 1060 | Perhaps it should. */ | 1060 | Perhaps it should. */ |
| @@ -1190,7 +1190,7 @@ r_alloc_init (void) | |||
| 1190 | if (break_value == NULL) | 1190 | if (break_value == NULL) |
| 1191 | emacs_abort (); | 1191 | emacs_abort (); |
| 1192 | 1192 | ||
| 1193 | extra_bytes = ROUNDUP (50000); | 1193 | extra_bytes = PAGE_ROUNDUP (50000); |
| 1194 | #endif | 1194 | #endif |
| 1195 | 1195 | ||
| 1196 | #ifdef DOUG_LEA_MALLOC | 1196 | #ifdef DOUG_LEA_MALLOC |
| @@ -1212,7 +1212,7 @@ r_alloc_init (void) | |||
| 1212 | #endif | 1212 | #endif |
| 1213 | 1213 | ||
| 1214 | #ifndef SYSTEM_MALLOC | 1214 | #ifndef SYSTEM_MALLOC |
| 1215 | first_heap->end = (void *) ROUNDUP (first_heap->start); | 1215 | first_heap->end = (void *) PAGE_ROUNDUP (first_heap->start); |
| 1216 | 1216 | ||
| 1217 | /* The extra call to real_morecore guarantees that the end of the | 1217 | /* The extra call to real_morecore guarantees that the end of the |
| 1218 | address space is a multiple of page_size, even if page_size is | 1218 | address space is a multiple of page_size, even if page_size is |