aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2003-09-17 19:16:27 +0000
committerDave Love2003-09-17 19:16:27 +0000
commit005ca5c7308b87dcf31eb85d8242c8267c604cbb (patch)
tree38c87a1f44752ba41935ec7fd4461ec44c66e0e7
parent48d49eaceed21aedd839c2ef8ebc0018fb37a70a (diff)
downloademacs-005ca5c7308b87dcf31eb85d8242c8267c604cbb.tar.gz
emacs-005ca5c7308b87dcf31eb85d8242c8267c604cbb.zip
Sync with HEAD version.
-rw-r--r--src/alloc.c91
1 files changed, 27 insertions, 64 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 4ebb97aec18..8d74905728b 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -552,7 +552,7 @@ xrealloc (block, size)
552} 552}
553 553
554 554
555/* Like free but block interrupt input.. */ 555/* Like free but block interrupt input. */
556 556
557void 557void
558xfree (block) 558xfree (block)
@@ -711,7 +711,7 @@ struct ablocks
711#define ABLOCKS_BASE(abase) (abase) 711#define ABLOCKS_BASE(abase) (abase)
712#else 712#else
713#define ABLOCKS_BASE(abase) \ 713#define ABLOCKS_BASE(abase) \
714 (1 & (int) ABLOCKS_BUSY (abase) ? abase : ((void**)abase)[-1]) 714 (1 & (long) ABLOCKS_BUSY (abase) ? abase : ((void**)abase)[-1])
715#endif 715#endif
716 716
717/* The list of free ablock. */ 717/* The list of free ablock. */
@@ -738,7 +738,8 @@ lisp_align_malloc (nbytes, type)
738 738
739 if (!free_ablock) 739 if (!free_ablock)
740 { 740 {
741 int i, aligned; 741 int i;
742 EMACS_INT aligned; /* int gets warning casting to 64-bit pointer. */
742 743
743#ifdef DOUG_LEA_MALLOC 744#ifdef DOUG_LEA_MALLOC
744 /* Prevent mmap'ing the chunk. Lisp data may not be mmap'ed 745 /* Prevent mmap'ing the chunk. Lisp data may not be mmap'ed
@@ -791,17 +792,17 @@ lisp_align_malloc (nbytes, type)
791 abase->blocks[i].x.next_free = free_ablock; 792 abase->blocks[i].x.next_free = free_ablock;
792 free_ablock = &abase->blocks[i]; 793 free_ablock = &abase->blocks[i];
793 } 794 }
794 ABLOCKS_BUSY (abase) = (struct ablocks *) aligned; 795 ABLOCKS_BUSY (abase) = (struct ablocks *) (long) aligned;
795 796
796 eassert (0 == ((EMACS_UINT)abase) % BLOCK_ALIGN); 797 eassert (0 == ((EMACS_UINT)abase) % BLOCK_ALIGN);
797 eassert (ABLOCK_ABASE (&abase->blocks[3]) == abase); /* 3 is arbitrary */ 798 eassert (ABLOCK_ABASE (&abase->blocks[3]) == abase); /* 3 is arbitrary */
798 eassert (ABLOCK_ABASE (&abase->blocks[0]) == abase); 799 eassert (ABLOCK_ABASE (&abase->blocks[0]) == abase);
799 eassert (ABLOCKS_BASE (abase) == base); 800 eassert (ABLOCKS_BASE (abase) == base);
800 eassert (aligned == (int)ABLOCKS_BUSY (abase)); 801 eassert (aligned == (long) ABLOCKS_BUSY (abase));
801 } 802 }
802 803
803 abase = ABLOCK_ABASE (free_ablock); 804 abase = ABLOCK_ABASE (free_ablock);
804 ABLOCKS_BUSY (abase) = (struct ablocks *) (2 + (int) ABLOCKS_BUSY (abase)); 805 ABLOCKS_BUSY (abase) = (struct ablocks *) (2 + (long) ABLOCKS_BUSY (abase));
805 val = free_ablock; 806 val = free_ablock;
806 free_ablock = free_ablock->x.next_free; 807 free_ablock = free_ablock->x.next_free;
807 808
@@ -833,11 +834,11 @@ lisp_align_free (block)
833 ablock->x.next_free = free_ablock; 834 ablock->x.next_free = free_ablock;
834 free_ablock = ablock; 835 free_ablock = ablock;
835 /* Update busy count. */ 836 /* Update busy count. */
836 ABLOCKS_BUSY (abase) = (struct ablocks *) (-2 + (int) ABLOCKS_BUSY (abase)); 837 ABLOCKS_BUSY (abase) = (struct ablocks *) (-2 + (long) ABLOCKS_BUSY (abase));
837 838
838 if (2 > (int) ABLOCKS_BUSY (abase)) 839 if (2 > (long) ABLOCKS_BUSY (abase))
839 { /* All the blocks are free. */ 840 { /* All the blocks are free. */
840 int i = 0, aligned = (int) ABLOCKS_BUSY (abase); 841 int i = 0, aligned = (long) ABLOCKS_BUSY (abase);
841 struct ablock **tem = &free_ablock; 842 struct ablock **tem = &free_ablock;
842 struct ablock *atop = &abase->blocks[aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1]; 843 struct ablock *atop = &abase->blocks[aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1];
843 844
@@ -1130,14 +1131,10 @@ int n_interval_blocks;
1130static void 1131static void
1131init_intervals () 1132init_intervals ()
1132{ 1133{
1133 interval_block 1134 interval_block = NULL;
1134 = (struct interval_block *) lisp_malloc (sizeof *interval_block, 1135 interval_block_index = INTERVAL_BLOCK_SIZE;
1135 MEM_TYPE_NON_LISP);
1136 interval_block->next = 0;
1137 bzero ((char *) interval_block->intervals, sizeof interval_block->intervals);
1138 interval_block_index = 0;
1139 interval_free_list = 0; 1136 interval_free_list = 0;
1140 n_interval_blocks = 1; 1137 n_interval_blocks = 0;
1141} 1138}
1142 1139
1143 1140
@@ -2724,13 +2721,10 @@ int n_symbol_blocks;
2724void 2721void
2725init_symbol () 2722init_symbol ()
2726{ 2723{
2727 symbol_block = (struct symbol_block *) lisp_malloc (sizeof *symbol_block, 2724 symbol_block = NULL;
2728 MEM_TYPE_SYMBOL); 2725 symbol_block_index = SYMBOL_BLOCK_SIZE;
2729 symbol_block->next = 0;
2730 bzero ((char *) symbol_block->symbols, sizeof symbol_block->symbols);
2731 symbol_block_index = 0;
2732 symbol_free_list = 0; 2726 symbol_free_list = 0;
2733 n_symbol_blocks = 1; 2727 n_symbol_blocks = 0;
2734} 2728}
2735 2729
2736 2730
@@ -2810,13 +2804,10 @@ int n_marker_blocks;
2810void 2804void
2811init_marker () 2805init_marker ()
2812{ 2806{
2813 marker_block = (struct marker_block *) lisp_malloc (sizeof *marker_block, 2807 marker_block = NULL;
2814 MEM_TYPE_MISC); 2808 marker_block_index = MARKER_BLOCK_SIZE;
2815 marker_block->next = 0;
2816 bzero ((char *) marker_block->markers, sizeof marker_block->markers);
2817 marker_block_index = 0;
2818 marker_free_list = 0; 2809 marker_free_list = 0;
2819 n_marker_blocks = 1; 2810 n_marker_blocks = 0;
2820} 2811}
2821 2812
2822/* Return a newly allocated Lisp_Misc object, with no substructure. */ 2813/* Return a newly allocated Lisp_Misc object, with no substructure. */
@@ -4351,12 +4342,7 @@ returns nil, because real GC can't be done. */)
4351 4342
4352 /* clear_marks (); */ 4343 /* clear_marks (); */
4353 4344
4354 /* Mark all the special slots that serve as the roots of accessibility. 4345 /* Mark all the special slots that serve as the roots of accessibility. */
4355
4356 Usually the special slots to mark are contained in particular structures.
4357 Then we know no slot is marked twice because the structures don't overlap.
4358 In some cases, the structures point to the slots to be marked.
4359 For these, we use MARKBIT to avoid double marking of the slot. */
4360 4346
4361 for (i = 0; i < staticidx; i++) 4347 for (i = 0; i < staticidx; i++)
4362 mark_object (*staticvec[i]); 4348 mark_object (*staticvec[i]);
@@ -4369,11 +4355,7 @@ returns nil, because real GC can't be done. */)
4369 register struct gcpro *tail; 4355 register struct gcpro *tail;
4370 for (tail = gcprolist; tail; tail = tail->next) 4356 for (tail = gcprolist; tail; tail = tail->next)
4371 for (i = 0; i < tail->nvars; i++) 4357 for (i = 0; i < tail->nvars; i++)
4372 if (!XMARKBIT (tail->var[i])) 4358 mark_object (tail->var[i]);
4373 {
4374 mark_object (tail->var[i]);
4375 XMARK (tail->var[i]);
4376 }
4377 } 4359 }
4378#endif 4360#endif
4379 4361
@@ -4395,21 +4377,14 @@ returns nil, because real GC can't be done. */)
4395 } 4377 }
4396 for (backlist = backtrace_list; backlist; backlist = backlist->next) 4378 for (backlist = backtrace_list; backlist; backlist = backlist->next)
4397 { 4379 {
4398 if (!XMARKBIT (*backlist->function)) 4380 mark_object (*backlist->function);
4399 { 4381
4400 mark_object (*backlist->function);
4401 XMARK (*backlist->function);
4402 }
4403 if (backlist->nargs == UNEVALLED || backlist->nargs == MANY) 4382 if (backlist->nargs == UNEVALLED || backlist->nargs == MANY)
4404 i = 0; 4383 i = 0;
4405 else 4384 else
4406 i = backlist->nargs - 1; 4385 i = backlist->nargs - 1;
4407 for (; i >= 0; i--) 4386 for (; i >= 0; i--)
4408 if (!XMARKBIT (backlist->args[i])) 4387 mark_object (backlist->args[i]);
4409 {
4410 mark_object (backlist->args[i]);
4411 XMARK (backlist->args[i]);
4412 }
4413 } 4388 }
4414 mark_kboards (); 4389 mark_kboards ();
4415 4390
@@ -4475,24 +4450,10 @@ returns nil, because real GC can't be done. */)
4475 || GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES) 4450 || GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES)
4476 { 4451 {
4477 register struct gcpro *tail; 4452 register struct gcpro *tail;
4478
4479 for (tail = gcprolist; tail; tail = tail->next)
4480 for (i = 0; i < tail->nvars; i++)
4481 XUNMARK (tail->var[i]);
4482 } 4453 }
4483#endif 4454#endif
4484 4455
4485 unmark_byte_stack (); 4456 unmark_byte_stack ();
4486 for (backlist = backtrace_list; backlist; backlist = backlist->next)
4487 {
4488 XUNMARK (*backlist->function);
4489 if (backlist->nargs == UNEVALLED || backlist->nargs == MANY)
4490 i = 0;
4491 else
4492 i = backlist->nargs - 1;
4493 for (; i >= 0; i--)
4494 XUNMARK (backlist->args[i]);
4495 }
4496 VECTOR_UNMARK (&buffer_defaults); 4457 VECTOR_UNMARK (&buffer_defaults);
4497 VECTOR_UNMARK (&buffer_local_symbols); 4458 VECTOR_UNMARK (&buffer_local_symbols);
4498 4459
@@ -4677,7 +4638,6 @@ mark_object (arg)
4677 int cdr_count = 0; 4638 int cdr_count = 0;
4678 4639
4679 loop: 4640 loop:
4680 XUNMARK (obj);
4681 4641
4682 if (PURE_POINTER_P (XPNTR (obj))) 4642 if (PURE_POINTER_P (XPNTR (obj)))
4683 return; 4643 return;
@@ -5744,3 +5704,6 @@ The time is in seconds as a floating point value. */);
5744 defsubr (&Sgc_status); 5704 defsubr (&Sgc_status);
5745#endif 5705#endif
5746} 5706}
5707
5708/* arch-tag: 6695ca10-e3c5-4c2c-8bc3-ed26a7dda857
5709 (do not change this comment) */