comparison src/gc.c @ 5027:22179cd0fe15

merge
author Ben Wing <ben@xemacs.org>
date Wed, 10 Feb 2010 07:25:19 -0600
parents 2ade80e8c640
children d4f666cda5e6
comparison
equal deleted inserted replaced
5026:46cf825f6158 5027:22179cd0fe15
1447 /* Maximum amount of C stack to save when a GC happens. */ 1447 /* Maximum amount of C stack to save when a GC happens. */
1448 #ifndef MAX_SAVE_STACK 1448 #ifndef MAX_SAVE_STACK
1449 #define MAX_SAVE_STACK 0 /* 16000 */ 1449 #define MAX_SAVE_STACK 0 /* 16000 */
1450 #endif 1450 #endif
1451 1451
1452 void 1452 static void
1453 show_gc_cursor_and_message (void) 1453 show_gc_cursor_and_message (void)
1454 { 1454 {
1455 /* Now show the GC cursor/message. */ 1455 /* Now show the GC cursor/message. */
1456 pre_gc_cursor = Qnil; 1456 pre_gc_cursor = Qnil;
1457 cursor_changed = 0; 1457 cursor_changed = 0;
1504 } 1504 }
1505 } 1505 }
1506 } 1506 }
1507 } 1507 }
1508 1508
1509 void 1509 static void
1510 remove_gc_cursor_and_message (void) 1510 remove_gc_cursor_and_message (void)
1511 { 1511 {
1512 /* Now remove the GC cursor/message */ 1512 /* Now remove the GC cursor/message */
1513 if (!noninteractive) 1513 if (!noninteractive)
1514 { 1514 {
1534 } 1534 }
1535 } 1535 }
1536 } 1536 }
1537 } 1537 }
1538 1538
1539 void 1539 static void
1540 gc_prepare (void) 1540 gc_prepare (void)
1541 { 1541 {
1542 #if MAX_SAVE_STACK > 0 1542 #if MAX_SAVE_STACK > 0
1543 char stack_top_variable; 1543 char stack_top_variable;
1544 extern char *stack_bottom; 1544 extern char *stack_bottom;
1566 1566
1567 /***** Now we actually start the garbage collection. */ 1567 /***** Now we actually start the garbage collection. */
1568 1568
1569 gc_in_progress = 1; 1569 gc_in_progress = 1;
1570 #ifndef NEW_GC 1570 #ifndef NEW_GC
1571 inhibit_non_essential_conversion_operations = 1; 1571 inhibit_non_essential_conversion_operations++;
1572 #endif /* not NEW_GC */ 1572 #endif /* not NEW_GC */
1573 1573
1574 #if MAX_SAVE_STACK > 0 1574 #if MAX_SAVE_STACK > 0
1575 1575
1576 /* Save a copy of the contents of the stack, for debugging. */ 1576 /* Save a copy of the contents of the stack, for debugging. */
1602 clear_event_resource (); 1602 clear_event_resource ();
1603 cleanup_specifiers (); 1603 cleanup_specifiers ();
1604 cleanup_buffer_undo_lists (); 1604 cleanup_buffer_undo_lists ();
1605 } 1605 }
1606 1606
1607 void 1607 static void
1608 gc_mark_root_set ( 1608 gc_mark_root_set (
1609 #ifdef NEW_GC 1609 #ifdef NEW_GC
1610 enum gc_phase phase 1610 enum gc_phase phase
1611 #else /* not NEW_GC */ 1611 #else /* not NEW_GC */
1612 void 1612 void
1709 #ifdef USE_KKCC 1709 #ifdef USE_KKCC
1710 # undef mark_object 1710 # undef mark_object
1711 #endif 1711 #endif
1712 } 1712 }
1713 1713
1714 void 1714 static void
1715 gc_finish_mark (void) 1715 gc_finish_mark (void)
1716 { 1716 {
1717 #ifdef NEW_GC 1717 #ifdef NEW_GC
1718 GC_SET_PHASE (FINISH_MARK); 1718 GC_SET_PHASE (FINISH_MARK);
1719 #endif /* NEW_GC */ 1719 #endif /* NEW_GC */
1756 prune_ephemerons (); 1756 prune_ephemerons ();
1757 prune_weak_boxes (); 1757 prune_weak_boxes ();
1758 } 1758 }
1759 1759
1760 #ifdef NEW_GC 1760 #ifdef NEW_GC
1761 void 1761 static void
1762 gc_finalize (void) 1762 gc_finalize (void)
1763 { 1763 {
1764 GC_SET_PHASE (FINALIZE); 1764 GC_SET_PHASE (FINALIZE);
1765 register_for_finalization (); 1765 register_for_finalization ();
1766 } 1766 }
1767 1767
1768 void 1768 static void
1769 gc_sweep (void) 1769 gc_sweep (void)
1770 { 1770 {
1771 GC_SET_PHASE (SWEEP); 1771 GC_SET_PHASE (SWEEP);
1772 mc_sweep (); 1772 mc_sweep ();
1773 } 1773 }
1774 #endif /* NEW_GC */ 1774 #endif /* NEW_GC */
1775 1775
1776 1776
1777 void 1777 static void
1778 gc_finish (void) 1778 gc_finish (void)
1779 { 1779 {
1780 #ifdef NEW_GC 1780 #ifdef NEW_GC
1781 GC_SET_PHASE (FINISH_GC); 1781 GC_SET_PHASE (FINISH_GC);
1782 #endif /* NEW_GC */ 1782 #endif /* NEW_GC */
1787 gc_cons_threshold = 10000; 1787 gc_cons_threshold = 10000;
1788 #endif 1788 #endif
1789 recompute_need_to_garbage_collect (); 1789 recompute_need_to_garbage_collect ();
1790 1790
1791 #ifndef NEW_GC 1791 #ifndef NEW_GC
1792 inhibit_non_essential_conversion_operations = 0; 1792 inhibit_non_essential_conversion_operations--;
1793 #endif /* not NEW_GC */ 1793 #endif /* not NEW_GC */
1794 gc_in_progress = 0; 1794 gc_in_progress = 0;
1795 1795
1796 run_post_gc_actions (); 1796 run_post_gc_actions ();
1797 1797
1813 GC_SET_PHASE (NONE); 1813 GC_SET_PHASE (NONE);
1814 #endif /* NEW_GC */ 1814 #endif /* NEW_GC */
1815 } 1815 }
1816 1816
1817 #ifdef NEW_GC 1817 #ifdef NEW_GC
1818 void 1818 static void
1819 gc_suspend_mark_phase (void) 1819 gc_suspend_mark_phase (void)
1820 { 1820 {
1821 PROFILE_RECORD_EXITING_SECTION (QSin_garbage_collection); 1821 PROFILE_RECORD_EXITING_SECTION (QSin_garbage_collection);
1822 write_barrier_enabled = 1; 1822 write_barrier_enabled = 1;
1823 consing_since_gc = 0; 1823 consing_since_gc = 0;
1824 vdb_start_dirty_bits_recording (); 1824 vdb_start_dirty_bits_recording ();
1825 } 1825 }
1826 1826
1827 int 1827 static int
1828 gc_resume_mark_phase (void) 1828 gc_resume_mark_phase (void)
1829 { 1829 {
1830 PROFILE_RECORD_ENTERING_SECTION (QSin_garbage_collection); 1830 PROFILE_RECORD_ENTERING_SECTION (QSin_garbage_collection);
1831 assert (write_barrier_enabled); 1831 assert (write_barrier_enabled);
1832 vdb_stop_dirty_bits_recording (); 1832 vdb_stop_dirty_bits_recording ();
1833 write_barrier_enabled = 0; 1833 write_barrier_enabled = 0;
1834 return vdb_read_dirty_bits (); 1834 return vdb_read_dirty_bits ();
1835 } 1835 }
1836 1836
1837 int 1837 static int
1838 gc_mark (int incremental) 1838 gc_mark (int incremental)
1839 { 1839 {
1840 GC_SET_PHASE (MARK); 1840 GC_SET_PHASE (MARK);
1841 if (!incremental) 1841 if (!incremental)
1842 { 1842 {
1852 } 1852 }
1853 } 1853 }
1854 return 1; 1854 return 1;
1855 } 1855 }
1856 1856
1857 int 1857 static int
1858 gc_resume_mark (int incremental) 1858 gc_resume_mark (int incremental)
1859 { 1859 {
1860 if (!incremental) 1860 if (!incremental)
1861 { 1861 {
1862 if (!KKCC_GC_STACK_EMPTY) 1862 if (!KKCC_GC_STACK_EMPTY)