diff options
| author | Karoly Lorentey | 2005-11-18 13:13:34 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-11-18 13:13:34 +0000 |
| commit | bffa514a8b8c947c655b463e8073e8e5ac061bc7 (patch) | |
| tree | 0c51140f31c86667569ab1ddba534a16152cd13d /src/alloc.c | |
| parent | f5100f05486a36a443aa021b1a418e4b55988571 (diff) | |
| parent | 1135363e9a6fd149e8f95bfa76421549697a0df0 (diff) | |
| download | emacs-bffa514a8b8c947c655b463e8073e8e5ac061bc7.tar.gz emacs-bffa514a8b8c947c655b463e8073e8e5ac061bc7.zip | |
Merged from miles@gnu.org--gnu-2005 (patch 152-156, 642-654)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-642
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-643
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-644
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-645
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-646
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-647
lisp/gnus/ChangeLog: Remove duplicate entry
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-648
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-649
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-650
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-651
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-652
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-653
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-654
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-152
Update from CVS: lisp/mml.el (mml-preview): Doc fix.
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-153
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-154
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-155
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-156
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-440
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 101 |
1 files changed, 85 insertions, 16 deletions
diff --git a/src/alloc.c b/src/alloc.c index 1e95447549b..bc48f7bb3b4 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -2532,7 +2532,7 @@ void | |||
| 2532 | free_float (ptr) | 2532 | free_float (ptr) |
| 2533 | struct Lisp_Float *ptr; | 2533 | struct Lisp_Float *ptr; |
| 2534 | { | 2534 | { |
| 2535 | *(struct Lisp_Float **)&ptr->data = float_free_list; | 2535 | ptr->u.chain = float_free_list; |
| 2536 | float_free_list = ptr; | 2536 | float_free_list = ptr; |
| 2537 | } | 2537 | } |
| 2538 | 2538 | ||
| @@ -2550,7 +2550,7 @@ make_float (float_value) | |||
| 2550 | /* We use the data field for chaining the free list | 2550 | /* We use the data field for chaining the free list |
| 2551 | so that we won't use the same field that has the mark bit. */ | 2551 | so that we won't use the same field that has the mark bit. */ |
| 2552 | XSETFLOAT (val, float_free_list); | 2552 | XSETFLOAT (val, float_free_list); |
| 2553 | float_free_list = *(struct Lisp_Float **)&float_free_list->data; | 2553 | float_free_list = float_free_list->u.chain; |
| 2554 | } | 2554 | } |
| 2555 | else | 2555 | else |
| 2556 | { | 2556 | { |
| @@ -2650,7 +2650,7 @@ void | |||
| 2650 | free_cons (ptr) | 2650 | free_cons (ptr) |
| 2651 | struct Lisp_Cons *ptr; | 2651 | struct Lisp_Cons *ptr; |
| 2652 | { | 2652 | { |
| 2653 | *(struct Lisp_Cons **)&ptr->cdr = cons_free_list; | 2653 | ptr->u.chain = cons_free_list; |
| 2654 | #if GC_MARK_STACK | 2654 | #if GC_MARK_STACK |
| 2655 | ptr->car = Vdead; | 2655 | ptr->car = Vdead; |
| 2656 | #endif | 2656 | #endif |
| @@ -2669,7 +2669,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, | |||
| 2669 | /* We use the cdr for chaining the free list | 2669 | /* We use the cdr for chaining the free list |
| 2670 | so that we won't use the same field that has the mark bit. */ | 2670 | so that we won't use the same field that has the mark bit. */ |
| 2671 | XSETCONS (val, cons_free_list); | 2671 | XSETCONS (val, cons_free_list); |
| 2672 | cons_free_list = *(struct Lisp_Cons **)&cons_free_list->cdr; | 2672 | cons_free_list = cons_free_list->u.chain; |
| 2673 | } | 2673 | } |
| 2674 | else | 2674 | else |
| 2675 | { | 2675 | { |
| @@ -2704,7 +2704,7 @@ check_cons_list () | |||
| 2704 | struct Lisp_Cons *tail = cons_free_list; | 2704 | struct Lisp_Cons *tail = cons_free_list; |
| 2705 | 2705 | ||
| 2706 | while (tail) | 2706 | while (tail) |
| 2707 | tail = *(struct Lisp_Cons **)&tail->cdr; | 2707 | tail = tail->u.chain; |
| 2708 | #endif | 2708 | #endif |
| 2709 | } | 2709 | } |
| 2710 | 2710 | ||
| @@ -3141,7 +3141,7 @@ Its value and function definition are void, and its property list is nil. */) | |||
| 3141 | if (symbol_free_list) | 3141 | if (symbol_free_list) |
| 3142 | { | 3142 | { |
| 3143 | XSETSYMBOL (val, symbol_free_list); | 3143 | XSETSYMBOL (val, symbol_free_list); |
| 3144 | symbol_free_list = *(struct Lisp_Symbol **)&symbol_free_list->value; | 3144 | symbol_free_list = symbol_free_list->next; |
| 3145 | } | 3145 | } |
| 3146 | else | 3146 | else |
| 3147 | { | 3147 | { |
| @@ -4485,10 +4485,79 @@ mark_stack () | |||
| 4485 | #endif | 4485 | #endif |
| 4486 | } | 4486 | } |
| 4487 | 4487 | ||
| 4488 | |||
| 4489 | #endif /* GC_MARK_STACK != 0 */ | 4488 | #endif /* GC_MARK_STACK != 0 */ |
| 4490 | 4489 | ||
| 4491 | 4490 | ||
| 4491 | |||
| 4492 | /* Return 1 if OBJ is a valid lisp object. | ||
| 4493 | Return 0 if OBJ is NOT a valid lisp object. | ||
| 4494 | Return -1 if we cannot validate OBJ. | ||
| 4495 | */ | ||
| 4496 | |||
| 4497 | int | ||
| 4498 | valid_lisp_object_p (obj) | ||
| 4499 | Lisp_Object obj; | ||
| 4500 | { | ||
| 4501 | #if !GC_MARK_STACK | ||
| 4502 | /* Cannot determine this. */ | ||
| 4503 | return -1; | ||
| 4504 | #else | ||
| 4505 | void *p; | ||
| 4506 | struct mem_node *m; | ||
| 4507 | |||
| 4508 | if (INTEGERP (obj)) | ||
| 4509 | return 1; | ||
| 4510 | |||
| 4511 | p = (void *) XPNTR (obj); | ||
| 4512 | |||
| 4513 | if (PURE_POINTER_P (p)) | ||
| 4514 | return 1; | ||
| 4515 | |||
| 4516 | m = mem_find (p); | ||
| 4517 | |||
| 4518 | if (m == MEM_NIL) | ||
| 4519 | return 0; | ||
| 4520 | |||
| 4521 | switch (m->type) | ||
| 4522 | { | ||
| 4523 | case MEM_TYPE_NON_LISP: | ||
| 4524 | return 0; | ||
| 4525 | |||
| 4526 | case MEM_TYPE_BUFFER: | ||
| 4527 | return live_buffer_p (m, p); | ||
| 4528 | |||
| 4529 | case MEM_TYPE_CONS: | ||
| 4530 | return live_cons_p (m, p); | ||
| 4531 | |||
| 4532 | case MEM_TYPE_STRING: | ||
| 4533 | return live_string_p (m, p); | ||
| 4534 | |||
| 4535 | case MEM_TYPE_MISC: | ||
| 4536 | return live_misc_p (m, p); | ||
| 4537 | |||
| 4538 | case MEM_TYPE_SYMBOL: | ||
| 4539 | return live_symbol_p (m, p); | ||
| 4540 | |||
| 4541 | case MEM_TYPE_FLOAT: | ||
| 4542 | return live_float_p (m, p); | ||
| 4543 | |||
| 4544 | case MEM_TYPE_VECTOR: | ||
| 4545 | case MEM_TYPE_PROCESS: | ||
| 4546 | case MEM_TYPE_HASH_TABLE: | ||
| 4547 | case MEM_TYPE_FRAME: | ||
| 4548 | case MEM_TYPE_WINDOW: | ||
| 4549 | return live_vector_p (m, p); | ||
| 4550 | |||
| 4551 | default: | ||
| 4552 | break; | ||
| 4553 | } | ||
| 4554 | |||
| 4555 | return 0; | ||
| 4556 | #endif | ||
| 4557 | } | ||
| 4558 | |||
| 4559 | |||
| 4560 | |||
| 4492 | 4561 | ||
| 4493 | /*********************************************************************** | 4562 | /*********************************************************************** |
| 4494 | Pure Storage Management | 4563 | Pure Storage Management |
| @@ -4969,7 +5038,7 @@ returns nil, because real GC can't be done. */) | |||
| 4969 | total += total_floats * sizeof (struct Lisp_Float); | 5038 | total += total_floats * sizeof (struct Lisp_Float); |
| 4970 | total += total_intervals * sizeof (struct interval); | 5039 | total += total_intervals * sizeof (struct interval); |
| 4971 | total += total_strings * sizeof (struct Lisp_String); | 5040 | total += total_strings * sizeof (struct Lisp_String); |
| 4972 | 5041 | ||
| 4973 | gc_relative_threshold = total * XFLOAT_DATA (Vgc_cons_percentage); | 5042 | gc_relative_threshold = total * XFLOAT_DATA (Vgc_cons_percentage); |
| 4974 | } | 5043 | } |
| 4975 | else | 5044 | else |
| @@ -5496,14 +5565,14 @@ mark_object (arg) | |||
| 5496 | CHECK_ALLOCATED_AND_LIVE (live_cons_p); | 5565 | CHECK_ALLOCATED_AND_LIVE (live_cons_p); |
| 5497 | CONS_MARK (ptr); | 5566 | CONS_MARK (ptr); |
| 5498 | /* If the cdr is nil, avoid recursion for the car. */ | 5567 | /* If the cdr is nil, avoid recursion for the car. */ |
| 5499 | if (EQ (ptr->cdr, Qnil)) | 5568 | if (EQ (ptr->u.cdr, Qnil)) |
| 5500 | { | 5569 | { |
| 5501 | obj = ptr->car; | 5570 | obj = ptr->car; |
| 5502 | cdr_count = 0; | 5571 | cdr_count = 0; |
| 5503 | goto loop; | 5572 | goto loop; |
| 5504 | } | 5573 | } |
| 5505 | mark_object (ptr->car); | 5574 | mark_object (ptr->car); |
| 5506 | obj = ptr->cdr; | 5575 | obj = ptr->u.cdr; |
| 5507 | cdr_count++; | 5576 | cdr_count++; |
| 5508 | if (cdr_count == mark_object_loop_halt) | 5577 | if (cdr_count == mark_object_loop_halt) |
| 5509 | abort (); | 5578 | abort (); |
| @@ -5650,7 +5719,7 @@ gc_sweep () | |||
| 5650 | if (!CONS_MARKED_P (&cblk->conses[i])) | 5719 | if (!CONS_MARKED_P (&cblk->conses[i])) |
| 5651 | { | 5720 | { |
| 5652 | this_free++; | 5721 | this_free++; |
| 5653 | *(struct Lisp_Cons **)&cblk->conses[i].cdr = cons_free_list; | 5722 | cblk->conses[i].u.chain = cons_free_list; |
| 5654 | cons_free_list = &cblk->conses[i]; | 5723 | cons_free_list = &cblk->conses[i]; |
| 5655 | #if GC_MARK_STACK | 5724 | #if GC_MARK_STACK |
| 5656 | cons_free_list->car = Vdead; | 5725 | cons_free_list->car = Vdead; |
| @@ -5669,7 +5738,7 @@ gc_sweep () | |||
| 5669 | { | 5738 | { |
| 5670 | *cprev = cblk->next; | 5739 | *cprev = cblk->next; |
| 5671 | /* Unhook from the free list. */ | 5740 | /* Unhook from the free list. */ |
| 5672 | cons_free_list = *(struct Lisp_Cons **) &cblk->conses[0].cdr; | 5741 | cons_free_list = cblk->conses[0].u.chain; |
| 5673 | lisp_align_free (cblk); | 5742 | lisp_align_free (cblk); |
| 5674 | n_cons_blocks--; | 5743 | n_cons_blocks--; |
| 5675 | } | 5744 | } |
| @@ -5700,7 +5769,7 @@ gc_sweep () | |||
| 5700 | if (!FLOAT_MARKED_P (&fblk->floats[i])) | 5769 | if (!FLOAT_MARKED_P (&fblk->floats[i])) |
| 5701 | { | 5770 | { |
| 5702 | this_free++; | 5771 | this_free++; |
| 5703 | *(struct Lisp_Float **)&fblk->floats[i].data = float_free_list; | 5772 | fblk->floats[i].u.chain = float_free_list; |
| 5704 | float_free_list = &fblk->floats[i]; | 5773 | float_free_list = &fblk->floats[i]; |
| 5705 | } | 5774 | } |
| 5706 | else | 5775 | else |
| @@ -5716,7 +5785,7 @@ gc_sweep () | |||
| 5716 | { | 5785 | { |
| 5717 | *fprev = fblk->next; | 5786 | *fprev = fblk->next; |
| 5718 | /* Unhook from the free list. */ | 5787 | /* Unhook from the free list. */ |
| 5719 | float_free_list = *(struct Lisp_Float **) &fblk->floats[0].data; | 5788 | float_free_list = fblk->floats[0].u.chain; |
| 5720 | lisp_align_free (fblk); | 5789 | lisp_align_free (fblk); |
| 5721 | n_float_blocks--; | 5790 | n_float_blocks--; |
| 5722 | } | 5791 | } |
| @@ -5804,7 +5873,7 @@ gc_sweep () | |||
| 5804 | 5873 | ||
| 5805 | if (!sym->gcmarkbit && !pure_p) | 5874 | if (!sym->gcmarkbit && !pure_p) |
| 5806 | { | 5875 | { |
| 5807 | *(struct Lisp_Symbol **) &sym->value = symbol_free_list; | 5876 | sym->next = symbol_free_list; |
| 5808 | symbol_free_list = sym; | 5877 | symbol_free_list = sym; |
| 5809 | #if GC_MARK_STACK | 5878 | #if GC_MARK_STACK |
| 5810 | symbol_free_list->function = Vdead; | 5879 | symbol_free_list->function = Vdead; |
| @@ -5828,7 +5897,7 @@ gc_sweep () | |||
| 5828 | { | 5897 | { |
| 5829 | *sprev = sblk->next; | 5898 | *sprev = sblk->next; |
| 5830 | /* Unhook from the free list. */ | 5899 | /* Unhook from the free list. */ |
| 5831 | symbol_free_list = *(struct Lisp_Symbol **)&sblk->symbols[0].value; | 5900 | symbol_free_list = sblk->symbols[0].next; |
| 5832 | lisp_free (sblk); | 5901 | lisp_free (sblk); |
| 5833 | n_symbol_blocks--; | 5902 | n_symbol_blocks--; |
| 5834 | } | 5903 | } |