aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorStefan Monnier2004-01-21 03:34:32 +0000
committerStefan Monnier2004-01-21 03:34:32 +0000
commit831b476c5a3d04c772364aaecf981252f515297e (patch)
tree27469564eacd9d6579693ec19ca6953d2825623e /src/alloc.c
parentf56af8ca83c41ae8258461aba41edee392843472 (diff)
downloademacs-831b476c5a3d04c772364aaecf981252f515297e.tar.gz
emacs-831b476c5a3d04c772364aaecf981252f515297e.zip
(lisp_malloc, lisp_align_malloc) [USE_LSB_TAG]:
Don't check range of malloc address. (pure_alloc) [USE_LSB_TAG]: Enforce alignment.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 484478ac3dd..f69ad5f870e 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -598,6 +598,7 @@ lisp_malloc (nbytes, type)
598 598
599 val = (void *) malloc (nbytes); 599 val = (void *) malloc (nbytes);
600 600
601#ifndef USE_LSB_TAG
601 /* If the memory just allocated cannot be addressed thru a Lisp 602 /* If the memory just allocated cannot be addressed thru a Lisp
602 object's pointer, and it needs to be, 603 object's pointer, and it needs to be,
603 that's equivalent to running out of memory. */ 604 that's equivalent to running out of memory. */
@@ -612,6 +613,7 @@ lisp_malloc (nbytes, type)
612 val = 0; 613 val = 0;
613 } 614 }
614 } 615 }
616#endif
615 617
616#if GC_MARK_STACK && !defined GC_MALLOC_CHECK 618#if GC_MARK_STACK && !defined GC_MALLOC_CHECK
617 if (val && type != MEM_TYPE_NON_LISP) 619 if (val && type != MEM_TYPE_NON_LISP)
@@ -772,6 +774,7 @@ lisp_align_malloc (nbytes, type)
772 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); 774 mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
773#endif 775#endif
774 776
777#ifndef USE_LSB_TAG
775 /* If the memory just allocated cannot be addressed thru a Lisp 778 /* If the memory just allocated cannot be addressed thru a Lisp
776 object's pointer, and it needs to be, that's equivalent to 779 object's pointer, and it needs to be, that's equivalent to
777 running out of memory. */ 780 running out of memory. */
@@ -788,6 +791,7 @@ lisp_align_malloc (nbytes, type)
788 memory_full (); 791 memory_full ();
789 } 792 }
790 } 793 }
794#endif
791 795
792 /* Initialize the blocks and put them on the free list. 796 /* Initialize the blocks and put them on the free list.
793 Is `base' was not properly aligned, we can't use the last block. */ 797 Is `base' was not properly aligned, we can't use the last block. */
@@ -4076,6 +4080,9 @@ pure_alloc (size, type)
4076 int type; 4080 int type;
4077{ 4081{
4078 POINTER_TYPE *result; 4082 POINTER_TYPE *result;
4083#ifdef USE_LSB_TAG
4084 size_t alignment = (1 << GCTYPEBITS);
4085#else
4079 size_t alignment = sizeof (EMACS_INT); 4086 size_t alignment = sizeof (EMACS_INT);
4080 4087
4081 /* Give Lisp_Floats an extra alignment. */ 4088 /* Give Lisp_Floats an extra alignment. */
@@ -4087,6 +4094,7 @@ pure_alloc (size, type)
4087 alignment = sizeof (struct Lisp_Float); 4094 alignment = sizeof (struct Lisp_Float);
4088#endif 4095#endif
4089 } 4096 }
4097#endif
4090 4098
4091 again: 4099 again:
4092 result = ALIGN (purebeg + pure_bytes_used, alignment); 4100 result = ALIGN (purebeg + pure_bytes_used, alignment);