* A zero value indicates that it's OK to miss some
* register values.
*/
-GC_INNER void GC_push_roots(GC_bool all, ptr_t cold_gc_frame)
+GC_INNER void GC_push_roots(GC_bool all, ptr_t cold_gc_frame GC_ATTR_UNUSED)
{
int i;
unsigned kind;
* This is usually done by saving the current context on the
* stack, and then just tracing from the stack.
*/
-#ifndef __EMSCRIPTEN__
- GC_push_regs_and_stack(cold_gc_frame);
-#endif
+# ifndef STACK_NOT_SCANNED
+ GC_push_regs_and_stack(cold_gc_frame);
+# endif
if (GC_push_other_roots != 0) (*GC_push_other_roots)();
/* In the threads case, this also pushes thread stacks. */
/* another frame. */
GC_API void * GC_CALL GC_clear_stack(void *arg)
{
-#ifdef __EMSCRIPTEN__
- return arg;
-#endif
+# ifndef STACK_NOT_SCANNED
ptr_t sp = GC_approx_sp(); /* Hotter than actual sp */
# ifdef THREADS
word volatile dummy[SMALL_CLEAR_SIZE];
static unsigned random_no = 0;
- /* Should be more random than it is ... */
- /* Used to occasionally clear a bigger */
- /* chunk. */
+ /* Should be more random than it is ... */
+ /* Used to occasionally clear a bigger */
+ /* chunk. */
# endif
ptr_t limit;
/* frequency decreases, thus clearing frequency would decrease, */
/* thus more junk remains accessible, thus the heap gets */
/* larger ... */
-# ifdef THREADS
- if (++random_no % 13 == 0) {
+# ifdef THREADS
+ if (++random_no % 13 == 0) {
limit = sp;
MAKE_HOTTER(limit, BIG_CLEAR_SIZE*sizeof(word));
limit = (ptr_t)((word)limit & ~0xf);
/* Make it sufficiently aligned for assembly */
/* implementations of GC_clear_stack_inner. */
return GC_clear_stack_inner(arg, limit);
- } else {
+ } else {
BZERO((void *)dummy, SMALL_CLEAR_SIZE*sizeof(word));
- return arg;
- }
-# else
- if (GC_gc_no > GC_stack_last_cleared) {
+ }
+# else
+ if (GC_gc_no > GC_stack_last_cleared) {
/* Start things over, so we clear the entire stack again */
- if (GC_stack_last_cleared == 0) GC_high_water = (ptr_t)GC_stackbottom;
+ if (GC_stack_last_cleared == 0)
+ GC_high_water = (ptr_t)GC_stackbottom;
GC_min_sp = GC_high_water;
GC_stack_last_cleared = GC_gc_no;
GC_bytes_allocd_at_reset = GC_bytes_allocd;
- }
- /* Adjust GC_high_water */
- MAKE_COOLER(GC_high_water, WORDS_TO_BYTES(DEGRADE_RATE) + GC_SLOP);
- if ((word)sp HOTTER_THAN (word)GC_high_water) {
- GC_high_water = sp;
- }
- MAKE_HOTTER(GC_high_water, GC_SLOP);
- limit = GC_min_sp;
- MAKE_HOTTER(limit, SLOP);
- if ((word)sp COOLER_THAN (word)limit) {
+ }
+ /* Adjust GC_high_water */
+ MAKE_COOLER(GC_high_water, WORDS_TO_BYTES(DEGRADE_RATE) + GC_SLOP);
+ if ((word)sp HOTTER_THAN (word)GC_high_water) {
+ GC_high_water = sp;
+ }
+ MAKE_HOTTER(GC_high_water, GC_SLOP);
+ limit = GC_min_sp;
+ MAKE_HOTTER(limit, SLOP);
+ if ((word)sp COOLER_THAN (word)limit) {
limit = (ptr_t)((word)limit & ~0xf);
/* Make it sufficiently aligned for assembly */
/* implementations of GC_clear_stack_inner. */
GC_min_sp = sp;
- return(GC_clear_stack_inner(arg, limit));
- } else if (GC_bytes_allocd - GC_bytes_allocd_at_reset > CLEAR_THRESHOLD) {
+ return GC_clear_stack_inner(arg, limit);
+ } else if (GC_bytes_allocd - GC_bytes_allocd_at_reset
+ > CLEAR_THRESHOLD) {
/* Restart clearing process, but limit how much clearing we do. */
GC_min_sp = sp;
MAKE_HOTTER(GC_min_sp, CLEAR_THRESHOLD/4);
if ((word)GC_min_sp HOTTER_THAN (word)GC_high_water)
GC_min_sp = GC_high_water;
GC_bytes_allocd_at_reset = GC_bytes_allocd;
- }
- return(arg);
+ }
+# endif
# endif
+ return arg;
}
-
/* Return a pointer to the base address of p, given a pointer to a */
/* an address within an object. Return 0 o.w. */
GC_API void * GC_CALL GC_base(void * p)