diff options
| author | Andreas Schwab | 2005-11-15 13:53:45 +0000 |
|---|---|---|
| committer | Andreas Schwab | 2005-11-15 13:53:45 +0000 |
| commit | 28a099a4aa5b85217d0b5a5c9a725c96d162e702 (patch) | |
| tree | 913e4baa188172ea12654f7fcf4909590fec5ee5 /src/alloc.c | |
| parent | 3a623feeb50955cabd0cd855cf96ed4d9e05a0ce (diff) | |
| download | emacs-28a099a4aa5b85217d0b5a5c9a725c96d162e702.tar.gz emacs-28a099a4aa5b85217d0b5a5c9a725c96d162e702.zip | |
(free_float): Make free list chaining aliasing-safe.
(make_float): Likewise.
(free_cons): Likewise.
(Fcons): Likewise.
(check_cons_list): Likewise.
(Fmake_symbol): Likewise.
(allocate_misc): Likewise.
(free_misc): Likewise.
(gc_sweep): Likewise.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/alloc.c b/src/alloc.c index d006b6e3f01..08bba475e76 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -2531,7 +2531,7 @@ void | |||
| 2531 | free_float (ptr) | 2531 | free_float (ptr) |
| 2532 | struct Lisp_Float *ptr; | 2532 | struct Lisp_Float *ptr; |
| 2533 | { | 2533 | { |
| 2534 | *(struct Lisp_Float **)&ptr->data = float_free_list; | 2534 | ptr->u.chain = float_free_list; |
| 2535 | float_free_list = ptr; | 2535 | float_free_list = ptr; |
| 2536 | } | 2536 | } |
| 2537 | 2537 | ||
| @@ -2549,7 +2549,7 @@ make_float (float_value) | |||
| 2549 | /* We use the data field for chaining the free list | 2549 | /* We use the data field for chaining the free list |
| 2550 | so that we won't use the same field that has the mark bit. */ | 2550 | so that we won't use the same field that has the mark bit. */ |
| 2551 | XSETFLOAT (val, float_free_list); | 2551 | XSETFLOAT (val, float_free_list); |
| 2552 | float_free_list = *(struct Lisp_Float **)&float_free_list->data; | 2552 | float_free_list = float_free_list->u.chain; |
| 2553 | } | 2553 | } |
| 2554 | else | 2554 | else |
| 2555 | { | 2555 | { |
| @@ -2649,7 +2649,7 @@ void | |||
| 2649 | free_cons (ptr) | 2649 | free_cons (ptr) |
| 2650 | struct Lisp_Cons *ptr; | 2650 | struct Lisp_Cons *ptr; |
| 2651 | { | 2651 | { |
| 2652 | *(struct Lisp_Cons **)&ptr->cdr = cons_free_list; | 2652 | ptr->u.chain = cons_free_list; |
| 2653 | #if GC_MARK_STACK | 2653 | #if GC_MARK_STACK |
| 2654 | ptr->car = Vdead; | 2654 | ptr->car = Vdead; |
| 2655 | #endif | 2655 | #endif |
| @@ -2668,7 +2668,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, | |||
| 2668 | /* We use the cdr for chaining the free list | 2668 | /* We use the cdr for chaining the free list |
| 2669 | so that we won't use the same field that has the mark bit. */ | 2669 | so that we won't use the same field that has the mark bit. */ |
| 2670 | XSETCONS (val, cons_free_list); | 2670 | XSETCONS (val, cons_free_list); |
| 2671 | cons_free_list = *(struct Lisp_Cons **)&cons_free_list->cdr; | 2671 | cons_free_list = cons_free_list->u.chain; |
| 2672 | } | 2672 | } |
| 2673 | else | 2673 | else |
| 2674 | { | 2674 | { |
| @@ -2703,7 +2703,7 @@ check_cons_list () | |||
| 2703 | struct Lisp_Cons *tail = cons_free_list; | 2703 | struct Lisp_Cons *tail = cons_free_list; |
| 2704 | 2704 | ||
| 2705 | while (tail) | 2705 | while (tail) |
| 2706 | tail = *(struct Lisp_Cons **)&tail->cdr; | 2706 | tail = tail->u.chain; |
| 2707 | #endif | 2707 | #endif |
| 2708 | } | 2708 | } |
| 2709 | 2709 | ||
| @@ -3140,7 +3140,7 @@ Its value and function definition are void, and its property list is nil. */) | |||
| 3140 | if (symbol_free_list) | 3140 | if (symbol_free_list) |
| 3141 | { | 3141 | { |
| 3142 | XSETSYMBOL (val, symbol_free_list); | 3142 | XSETSYMBOL (val, symbol_free_list); |
| 3143 | symbol_free_list = *(struct Lisp_Symbol **)&symbol_free_list->value; | 3143 | symbol_free_list = symbol_free_list->next; |
| 3144 | } | 3144 | } |
| 3145 | else | 3145 | else |
| 3146 | { | 3146 | { |
| @@ -5563,14 +5563,14 @@ mark_object (arg) | |||
| 5563 | CHECK_ALLOCATED_AND_LIVE (live_cons_p); | 5563 | CHECK_ALLOCATED_AND_LIVE (live_cons_p); |
| 5564 | CONS_MARK (ptr); | 5564 | CONS_MARK (ptr); |
| 5565 | /* If the cdr is nil, avoid recursion for the car. */ | 5565 | /* If the cdr is nil, avoid recursion for the car. */ |
| 5566 | if (EQ (ptr->cdr, Qnil)) | 5566 | if (EQ (ptr->u.cdr, Qnil)) |
| 5567 | { | 5567 | { |
| 5568 | obj = ptr->car; | 5568 | obj = ptr->car; |
| 5569 | cdr_count = 0; | 5569 | cdr_count = 0; |
| 5570 | goto loop; | 5570 | goto loop; |
| 5571 | } | 5571 | } |
| 5572 | mark_object (ptr->car); | 5572 | mark_object (ptr->car); |
| 5573 | obj = ptr->cdr; | 5573 | obj = ptr->u.cdr; |
| 5574 | cdr_count++; | 5574 | cdr_count++; |
| 5575 | if (cdr_count == mark_object_loop_halt) | 5575 | if (cdr_count == mark_object_loop_halt) |
| 5576 | abort (); | 5576 | abort (); |
| @@ -5717,7 +5717,7 @@ gc_sweep () | |||
| 5717 | if (!CONS_MARKED_P (&cblk->conses[i])) | 5717 | if (!CONS_MARKED_P (&cblk->conses[i])) |
| 5718 | { | 5718 | { |
| 5719 | this_free++; | 5719 | this_free++; |
| 5720 | *(struct Lisp_Cons **)&cblk->conses[i].cdr = cons_free_list; | 5720 | cblk->conses[i].u.chain = cons_free_list; |
| 5721 | cons_free_list = &cblk->conses[i]; | 5721 | cons_free_list = &cblk->conses[i]; |
| 5722 | #if GC_MARK_STACK | 5722 | #if GC_MARK_STACK |
| 5723 | cons_free_list->car = Vdead; | 5723 | cons_free_list->car = Vdead; |
| @@ -5736,7 +5736,7 @@ gc_sweep () | |||
| 5736 | { | 5736 | { |
| 5737 | *cprev = cblk->next; | 5737 | *cprev = cblk->next; |
| 5738 | /* Unhook from the free list. */ | 5738 | /* Unhook from the free list. */ |
| 5739 | cons_free_list = *(struct Lisp_Cons **) &cblk->conses[0].cdr; | 5739 | cons_free_list = cblk->conses[0].u.chain; |
| 5740 | lisp_align_free (cblk); | 5740 | lisp_align_free (cblk); |
| 5741 | n_cons_blocks--; | 5741 | n_cons_blocks--; |
| 5742 | } | 5742 | } |
| @@ -5767,7 +5767,7 @@ gc_sweep () | |||
| 5767 | if (!FLOAT_MARKED_P (&fblk->floats[i])) | 5767 | if (!FLOAT_MARKED_P (&fblk->floats[i])) |
| 5768 | { | 5768 | { |
| 5769 | this_free++; | 5769 | this_free++; |
| 5770 | *(struct Lisp_Float **)&fblk->floats[i].data = float_free_list; | 5770 | fblk->floats[i].u.chain = float_free_list; |
| 5771 | float_free_list = &fblk->floats[i]; | 5771 | float_free_list = &fblk->floats[i]; |
| 5772 | } | 5772 | } |
| 5773 | else | 5773 | else |
| @@ -5783,7 +5783,7 @@ gc_sweep () | |||
| 5783 | { | 5783 | { |
| 5784 | *fprev = fblk->next; | 5784 | *fprev = fblk->next; |
| 5785 | /* Unhook from the free list. */ | 5785 | /* Unhook from the free list. */ |
| 5786 | float_free_list = *(struct Lisp_Float **) &fblk->floats[0].data; | 5786 | float_free_list = fblk->floats[0].u.chain; |
| 5787 | lisp_align_free (fblk); | 5787 | lisp_align_free (fblk); |
| 5788 | n_float_blocks--; | 5788 | n_float_blocks--; |
| 5789 | } | 5789 | } |
| @@ -5871,7 +5871,7 @@ gc_sweep () | |||
| 5871 | 5871 | ||
| 5872 | if (!sym->gcmarkbit && !pure_p) | 5872 | if (!sym->gcmarkbit && !pure_p) |
| 5873 | { | 5873 | { |
| 5874 | *(struct Lisp_Symbol **) &sym->value = symbol_free_list; | 5874 | sym->next = symbol_free_list; |
| 5875 | symbol_free_list = sym; | 5875 | symbol_free_list = sym; |
| 5876 | #if GC_MARK_STACK | 5876 | #if GC_MARK_STACK |
| 5877 | symbol_free_list->function = Vdead; | 5877 | symbol_free_list->function = Vdead; |
| @@ -5895,7 +5895,7 @@ gc_sweep () | |||
| 5895 | { | 5895 | { |
| 5896 | *sprev = sblk->next; | 5896 | *sprev = sblk->next; |
| 5897 | /* Unhook from the free list. */ | 5897 | /* Unhook from the free list. */ |
| 5898 | symbol_free_list = *(struct Lisp_Symbol **)&sblk->symbols[0].value; | 5898 | symbol_free_list = sblk->symbols[0].next; |
| 5899 | lisp_free (sblk); | 5899 | lisp_free (sblk); |
| 5900 | n_symbol_blocks--; | 5900 | n_symbol_blocks--; |
| 5901 | } | 5901 | } |