diff options
| author | Paul Eggert | 2017-12-03 18:17:00 -0800 |
|---|---|---|
| committer | Paul Eggert | 2017-12-03 18:18:02 -0800 |
| commit | a597969f1360b8c28fd4467018792662b698e03a (patch) | |
| tree | d05f411481b000a7773d1351eebd641a878aca5f /src/alloc.c | |
| parent | c54718e0bb390b35d86e8cab7ae1a7d1da9c047c (diff) | |
| download | emacs-a597969f1360b8c28fd4467018792662b698e03a.tar.gz emacs-a597969f1360b8c28fd4467018792662b698e03a.zip | |
allocate_vectorlike minor cleanup
* src/alloc.c (allocate_vectorlike): Move a bit of code out of the
critical section. Although this doesn’t really help performance,
it cleans up the code a bit and should make it easier to add
pointer bounds checking.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/alloc.c b/src/alloc.c index 49c99501f11..4f3928a4824 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -3317,15 +3317,14 @@ sweep_vectors (void) | |||
| 3317 | static struct Lisp_Vector * | 3317 | static struct Lisp_Vector * |
| 3318 | allocate_vectorlike (ptrdiff_t len) | 3318 | allocate_vectorlike (ptrdiff_t len) |
| 3319 | { | 3319 | { |
| 3320 | struct Lisp_Vector *p; | ||
| 3321 | |||
| 3322 | MALLOC_BLOCK_INPUT; | ||
| 3323 | |||
| 3324 | if (len == 0) | 3320 | if (len == 0) |
| 3325 | p = XVECTOR (zero_vector); | 3321 | return XVECTOR (zero_vector); |
| 3326 | else | 3322 | else |
| 3327 | { | 3323 | { |
| 3328 | size_t nbytes = header_size + len * word_size; | 3324 | size_t nbytes = header_size + len * word_size; |
| 3325 | struct Lisp_Vector *p; | ||
| 3326 | |||
| 3327 | MALLOC_BLOCK_INPUT; | ||
| 3329 | 3328 | ||
| 3330 | #ifdef DOUG_LEA_MALLOC | 3329 | #ifdef DOUG_LEA_MALLOC |
| 3331 | if (!mmap_lisp_allowed_p ()) | 3330 | if (!mmap_lisp_allowed_p ()) |
| @@ -3355,11 +3354,11 @@ allocate_vectorlike (ptrdiff_t len) | |||
| 3355 | 3354 | ||
| 3356 | consing_since_gc += nbytes; | 3355 | consing_since_gc += nbytes; |
| 3357 | vector_cells_consed += len; | 3356 | vector_cells_consed += len; |
| 3358 | } | ||
| 3359 | 3357 | ||
| 3360 | MALLOC_UNBLOCK_INPUT; | 3358 | MALLOC_UNBLOCK_INPUT; |
| 3361 | 3359 | ||
| 3362 | return p; | 3360 | return p; |
| 3361 | } | ||
| 3363 | } | 3362 | } |
| 3364 | 3363 | ||
| 3365 | 3364 | ||