Commit c8cd06a8 by Hans Boehm Committed by Per Bothner

misc.c: Back out buggy changes to stack clearing code.


	* misc.c: Back out buggy changes to stack clearing code.
	Reduce CLEAR_SIZE to 1/4 of original value to reduce time
	spent clearing memory.

From-SVN: r41172
parent 14bc1c0e
2001-04-05 Hans Boehm <hans_boehm@hp.com>
* misc.c: Back out buggy changes to stack clearing code.
Reduce CLEAR_SIZE to 1/4 of original value to reduce time
spent clearing memory.
2001-04-04 Hans Boehm <hans_boehm@hp.com> 2001-04-04 Hans Boehm <hans_boehm@hp.com>
* finalize.c: * finalize.c:
......
...@@ -206,10 +206,10 @@ extern signed_word GC_mem_found; ...@@ -206,10 +206,10 @@ extern signed_word GC_mem_found;
*/ */
word GC_stack_last_cleared = 0; /* GC_no when we last did this */ word GC_stack_last_cleared = 0; /* GC_no when we last did this */
# ifdef THREADS # ifdef THREADS
# define BIG_CLEAR_SIZE 2048 /* Clear this much now and then. */ # define CLEAR_SIZE 512
# define SMALL_CLEAR_SIZE 256 /* Clear this much every time. */ # else
# define CLEAR_SIZE 213
# endif # endif
# define CLEAR_SIZE 213 /* Granularity for GC_clear_stack_inner */
# define DEGRADE_RATE 50 # define DEGRADE_RATE 50
word GC_min_sp; /* Coolest stack pointer value from which we've */ word GC_min_sp; /* Coolest stack pointer value from which we've */
...@@ -266,12 +266,10 @@ ptr_t arg; ...@@ -266,12 +266,10 @@ ptr_t arg;
{ {
register word sp = (word)GC_approx_sp(); /* Hotter than actual sp */ register word sp = (word)GC_approx_sp(); /* Hotter than actual sp */
# ifdef THREADS # ifdef THREADS
word dummy[SMALL_CLEAR_SIZE]; word dummy[CLEAR_SIZE];
unsigned random_no = 0; /* Should be more random than it is ... */ # else
/* Used to occasionally clear a bigger */ register word limit;
/* chunk. */
# endif # endif
register word limit;
# define SLOP 400 # define SLOP 400
/* Extra bytes we clear every time. This clears our own */ /* Extra bytes we clear every time. This clears our own */
...@@ -289,14 +287,7 @@ ptr_t arg; ...@@ -289,14 +287,7 @@ ptr_t arg;
/* thus more junk remains accessible, thus the heap gets */ /* thus more junk remains accessible, thus the heap gets */
/* larger ... */ /* larger ... */
# ifdef THREADS # ifdef THREADS
if (++random_no % 13 == 0) { BZERO(dummy, CLEAR_SIZE*sizeof(word));
limit = sp;
MAKE_HOTTER(limit, BIG_CLEAR_SIZE*sizeof(word));
return GC_lear_stack_inner(arg, limit);
} else {
BZERO(dummy, SMALL_CLEAR_SIZE*sizeof(word));
return arg;
}
# else # else
if (GC_gc_no > GC_stack_last_cleared) { if (GC_gc_no > GC_stack_last_cleared) {
/* Start things over, so we clear the entire stack again */ /* Start things over, so we clear the entire stack again */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment