Back to index

plt-scheme  4.2.1
Defines | Typedefs | Functions | Variables
gc2.h File Reference
#include <stddef.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define THREAD_LOCAL   /* empty */
#define GC_OBJHEAD_SIZE   (sizeof(unsigned long))
#define GC2_EXTERN   extern
#define MZACCT_REQUIRE   0
#define MZACCT_LIMIT   1
#define GC_malloc_atomic_tagged   GC_malloc_one_tagged
#define GC_malloc_small_atomic_tagged   GC_malloc_one_small_dirty_tagged
#define gcLOG_WORD_SIZE   2
#define gcMARK(x)   GC_mark(x)
#define gcMARK_TYPED(t, x)   gcMARK(x)
#define gcMARK_TYPED_NOW(t, x)   gcMARK(x)
#define gcFIXUP_TYPED_NOW(t, x)   GC_fixup(&(x))
#define gcFIXUP_TYPED(t, x)   gcFIXUP_TYPED_NOW(void*, x)
#define gcFIXUP(x)   gcFIXUP_TYPED(void*, x)
#define gcBYTES_TO_WORDS(x)   ((x + (1 << gcLOG_WORD_SIZE) - 1) >> gcLOG_WORD_SIZE)
#define gcWORDS_TO_BYTES(x)   (x << gcLOG_WORD_SIZE)
#define GC_INTERIORABLES_NEVER_MOVE   1

Typedefs

typedef int(* Size_Proc )(void *obj)
typedef int(* Mark_Proc )(void *obj)
typedef int(* Fixup_Proc )(void *obj)
typedef void(* GC_collect_start_callback_Proc )(void)
typedef void(* GC_collect_end_callback_Proc )(void)
typedef void(* GC_collect_inform_callback_Proc )(int major_gc, long pre_used, long post_used)
typedef unsigned long(* GC_get_thread_stack_base_Proc )(void)
typedef void(* GC_finalization_proc )(void *p, void *data)

Functions

GC2_EXTERN void GC_set_get_thread_stack_base (unsigned long(*)(void))
GC2_EXTERN void GC_set_stack_base (void *base)
GC2_EXTERN unsigned long GC_get_stack_base (void)
GC2_EXTERN void GC_add_roots (void *start, void *end)
GC2_EXTERN void GC_init_type_tags (int count, int pair, int mutable_pair, int weakbox, int ephemeron, int weakarray, int custbox)
GC2_EXTERN void GC_register_root_custodian (void *)
GC2_EXTERN void GC_register_new_thread (void *, void *)
GC2_EXTERN void GC_register_thread (void *, void *)
GC2_EXTERN
GC_collect_start_callback_Proc 
GC_set_collect_start_callback (GC_collect_start_callback_Proc)
GC2_EXTERN
GC_collect_end_callback_Proc 
GC_set_collect_end_callback (GC_collect_end_callback_Proc)
GC2_EXTERN void GC_set_collect_inform_callback (GC_collect_inform_callback_Proc)
GC2_EXTERN void GC_dump (void)
GC2_EXTERN long GC_get_memory_use (void *c)
GC2_EXTERN int GC_set_account_hook (int type, void *c1, unsigned long b, void *c2)
GC2_EXTERN void GC_gcollect (void)
GC2_EXTERN void GC_free_all (void)
GC2_EXTERN voidGC_malloc (size_t size_in_bytes)
GC2_EXTERN voidGC_malloc_one_tagged (size_t)
GC2_EXTERN voidGC_malloc_one_small_tagged (size_t)
GC2_EXTERN voidGC_malloc_one_small_dirty_tagged (size_t)
GC2_EXTERN voidGC_malloc_pair (void *car, void *cdr)
GC2_EXTERN voidGC_malloc_one_xtagged (size_t)
GC2_EXTERN voidGC_malloc_array_tagged (size_t)
GC2_EXTERN voidGC_malloc_atomic (size_t size_in_bytes)
GC2_EXTERN voidGC_malloc_atomic_uncollectable (size_t size_in_bytes)
GC2_EXTERN voidGC_malloc_allow_interior (size_t size_in_bytes)
GC2_EXTERN voidGC_malloc_atomic_allow_interior (size_t size_in_bytes)
GC2_EXTERN voidGC_malloc_tagged_allow_interior (size_t size_in_bytes)
GC2_EXTERN voidGC_malloc_weak_array (size_t size_in_bytes, void *replace_val)
GC2_EXTERN void GC_free (void *)
GC2_EXTERN voidGC_malloc_weak_box (void *p, void **secondary, int soffset)
GC2_EXTERN voidGC_malloc_ephemeron (void *p, void *p2)
GC2_EXTERN void ** GC_malloc_immobile_box (void *p)
GC2_EXTERN void GC_free_immobile_box (void **b)
GC2_EXTERN long GC_malloc_stays_put_threshold ()
GC2_EXTERN int GC_mtrace_new_id (void *f)
GC2_EXTERN int GC_mtrace_union_current_with (int newval)
GC2_EXTERN void GC_set_finalizer (void *p, int tagged, int level, GC_finalization_proc f, void *data, GC_finalization_proc *oldf, void **olddata)
GC2_EXTERN void GC_finalization_weak_ptr (void **p, int offset)
GC2_EXTERN void ** GC_get_variable_stack ()
GC2_EXTERN void GC_set_variable_stack (void **p)
GC2_EXTERN void GC_register_traversers (short tag, Size_Proc size, Mark_Proc mark, Fixup_Proc fixup, int is_constant_size, int is_atomic)
GC2_EXTERN voidGC_resolve (void *p)
GC2_EXTERN voidGC_fixup_self (void *p)
GC2_EXTERN void GC_mark (const void *p)
GC2_EXTERN void GC_fixup (void *p)
GC2_EXTERN void GC_mark_variable_stack (void **var_stack, long delta, void *limit, void *stack_mem)
GC2_EXTERN void GC_fixup_variable_stack (void **var_stack, long delta, void *limit, void *stack_mem)
GC2_EXTERN int GC_merely_accounting ()
GC2_EXTERN void GC_write_barrier (void *p)
GC2_EXTERN void GC_switch_in_master_gc ()
GC2_EXTERN void GC_switch_out_master_gc ()
GC2_EXTERN void GC_construct_child_gc ()
GC2_EXTERN voidGC_switch_to_master_gc ()
GC2_EXTERN void GC_switch_back_from_master (void *gc)

Variables

GC2_EXTERN void(* GC_out_of_memory )(void)
GC2_EXTERN void(* GC_report_out_of_memory )(void)
GC2_EXTERN void(* GC_mark_xtagged )(void *obj)
GC2_EXTERN void(* GC_fixup_xtagged )(void *obj)
GC2_EXTERN THREAD_LOCAL void ** GC_variable_stack

Define Documentation

#define GC2_EXTERN   extern

Definition at line 57 of file gc2.h.

Definition at line 438 of file gc2.h.

Definition at line 206 of file gc2.h.

Definition at line 207 of file gc2.h.

#define GC_OBJHEAD_SIZE   (sizeof(unsigned long))

Definition at line 42 of file gc2.h.

#define gcBYTES_TO_WORDS (   x)    ((x + (1 << gcLOG_WORD_SIZE) - 1) >> gcLOG_WORD_SIZE)

Definition at line 435 of file gc2.h.

#define gcFIXUP (   x)    gcFIXUP_TYPED(void*, x)

Definition at line 434 of file gc2.h.

#define gcFIXUP_TYPED (   t,
  x 
)    gcFIXUP_TYPED_NOW(void*, x)

Definition at line 433 of file gc2.h.

#define gcFIXUP_TYPED_NOW (   t,
  x 
)    GC_fixup(&(x))

Definition at line 432 of file gc2.h.

#define gcLOG_WORD_SIZE   2

Definition at line 427 of file gc2.h.

#define gcMARK (   x)    GC_mark(x)

Definition at line 429 of file gc2.h.

#define gcMARK_TYPED (   t,
  x 
)    gcMARK(x)

Definition at line 430 of file gc2.h.

#define gcMARK_TYPED_NOW (   t,
  x 
)    gcMARK(x)

Definition at line 431 of file gc2.h.

#define gcWORDS_TO_BYTES (   x)    (x << gcLOG_WORD_SIZE)

Definition at line 436 of file gc2.h.

#define MZACCT_LIMIT   1

Definition at line 137 of file gc2.h.

#define MZACCT_REQUIRE   0

Definition at line 136 of file gc2.h.

#define THREAD_LOCAL   /* empty */

Definition at line 12 of file gc2.h.


Typedef Documentation

typedef int(* Fixup_Proc)(void *obj)

Definition at line 23 of file gc2.h.

Definition at line 25 of file gc2.h.

typedef void(* GC_collect_inform_callback_Proc)(int major_gc, long pre_used, long post_used)

Definition at line 26 of file gc2.h.

Definition at line 24 of file gc2.h.

Definition at line 273 of file gc2.h.

typedef unsigned long(* GC_get_thread_stack_base_Proc)(void)

Definition at line 27 of file gc2.h.

typedef int(* Mark_Proc)(void *obj)

Definition at line 22 of file gc2.h.

typedef int(* Size_Proc)(void *obj)

Definition at line 21 of file gc2.h.


Function Documentation

GC2_EXTERN void GC_add_roots ( void start,
void end 
)

Definition at line 211 of file copy.c.

{
  if (roots_count >= roots_size) {
    unsigned long *naya;

    roots_size = roots_size ? 2 * roots_size : 500;
    naya = (unsigned long *)malloc(sizeof(unsigned long) * (roots_size + 1));

    memcpy((void *)naya, (void *)roots, 
          sizeof(unsigned long) * roots_count);

    if (roots)
      free(roots);

    roots = naya;
  }

  roots[roots_count++] = PTR_TO_INT(start);
  roots[roots_count++] = PTR_TO_INT(end) - PTR_ALIGNMENT;
}

Definition at line 1171 of file misc.c.

{
    GC_printf0("***Static roots:\n");
    GC_print_static_roots();
    GC_printf0("\n***Heap sections:\n");
    GC_print_heap_sects();
    GC_printf0("\n***Free blocks:\n");
    GC_print_hblkfreelist();
    GC_printf0("\n***Blocks in use:\n");
    GC_print_block_list();
    GC_printf0("\n***Finalization statistics:\n");
    GC_print_finalization_stats();
}

Definition at line 641 of file compact.c.

{
  Fnl_Weak_Link *wl;

#if CHECKS
  if (offset < 0)
    CRASH(6);
#endif

  /* Allcation might trigger GC, so we use park: */
  park[0] = p;

  wl = (Fnl_Weak_Link *)GC_malloc_atomic(sizeof(Fnl_Weak_Link));

  p = park[0];
  park[0] = NULL;

  wl->p = p;
  wl->next = fnl_weaks;
  wl->offset = offset * sizeof(void*);

  fnl_weaks = wl;

  fnl_weak_link_count++;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2226 of file compact.c.

{
  void *p = *(void **)pp;
  unsigned long g;
  MPage *map;

  if ((long)p & 0x1) return;
  g = ((unsigned long)p >> MAPS_SHIFT);

  map = mpage_maps[g];
  if (map) {
    unsigned long addr = (((unsigned long)p & MAP_MASK) >> MAP_SHIFT);
    MPage *page;

    page = map + addr;

#if DEFINE_MALLOC_FREE
    if (page->type == MTYPE_MALLOCFREE)
      return;
#endif

    if (page->type) {
      if (page->compact_to_age < min_referenced_page_age)
       min_referenced_page_age = page->compact_to_age;

      if (!(page->flags & (MFLAG_OLD | MFLAG_BIGBLOCK))) {
       long offset = ((long)p & MPAGE_MASK) >> LOG_WORD_SIZE;
       OffsetTy v;
       void *r;

       if (page->type > MTYPE_TAGGED) {
#if CHECKS
         if (!offset) {
           /* Can't point to beginning of non-tagged block! */
           CRASH(25);
         }
#endif
         offset--;
       }

       v = OFFSET_SIZE(page->u.offsets, offset);
#if CHECKS
       if (page->type > MTYPE_TAGGED) {
         if (!v) {
           /* Can't point to beginning of non-tagged block! */
           CRASH(26);
         }
       }
#endif
       
       if (offset < page->compact_boundary)
         r = (void *)(page->o.compact_to + v);
       else
         r = (void *)(((long)p & MPAGE_START) + ((long)v << LOG_WORD_SIZE));

#if SEARCH
       if (r == search_for)
         stop();
#endif

#if CHECKS
       if (!(find_page(r)->flags & COLOR_MASK)) {
         bad_dest_addr = r;
         CRASH(27);
       }
#endif

       if (r != p)
         *(void **)pp = r;
      }
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3578 of file compact.c.

{
  return p;
}
GC2_EXTERN void GC_fixup_variable_stack ( void **  var_stack,
long  delta,
void limit,
void stack_mem 
)

Definition at line 4034 of file compact.c.

{
  MPage *page;

  page = find_page(p);

  if ((page->flags & MFLAG_BIGBLOCK)
      && !(page->flags & MFLAG_CONTINUED)
      && (p == page->block_start)) {
    memory_in_use -= page->u.size;

    if (page->prev)
      page->prev->next = page->next;
    else
      first = page->next;
    if (page->next)
      page->next->prev = page->prev;
    else
      last = page->prev;

    free_bigpage(page);
  }
}

Definition at line 4795 of file compact.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 529 of file compact.c.

{
  ImmobileBox *ib = (ImmobileBox *)b;

  if (!ib)
    return;

  if (ib->prev)
    ib->prev->next = ib->next;
  else
    immobile = ib->next;
  if (ib->next)
    ib->next->prev = ib->prev;

  free(ib);
}

Here is the caller graph for this function:

Definition at line 4063 of file compact.c.

{
  gcollect(1);
}

Definition at line 4068 of file compact.c.

{
  return memory_in_use;
}

Here is the call graph for this function:

GC2_EXTERN unsigned long GC_get_stack_base ( void  )

Definition at line 43 of file AmigaOS.c.

{
    struct Process *proc = (struct Process*)SysBase->ThisTask;
 
    /* Reference: Amiga Guru Book Pages: 42,567,574 */
    if (proc->pr_Task.tc_Node.ln_Type==NT_PROCESS
        && proc->pr_CLI != NULL) {
       /* first ULONG is StackSize */
       /*longPtr = proc->pr_ReturnAddr;
       size = longPtr[0];*/

       return (char *)proc->pr_ReturnAddr + sizeof(ULONG);
    } else {
       return (char *)proc->pr_Task.tc_SPUpper;
    }
}

Definition at line 169 of file compact.c.

{ return GC_variable_stack; }
GC2_EXTERN void GC_init_type_tags ( int  count,
int  pair,
int  mutable_pair,
int  weakbox,
int  ephemeron,
int  weakarray,
int  custbox 
)

Definition at line 458 of file compact.c.

{
  CompactGC *gc;
  weak_box_tag = weakbox;
  ephemeron_tag = ephemeron;
  weak_array_tag = weakarray;
  pair_tag = pair;

  gc = malloc(sizeof(CompactGC));
  GC = gc;
  CompactGC_initialize(gc);
}

Here is the call graph for this function:

Here is the caller graph for this function:

GC2_EXTERN void* GC_malloc ( size_t  size_in_bytes)

Definition at line 300 of file malloc.c.

{
register ptr_t op;
register ptr_t *opp;
register word lw;
DCL_LOCK_STATE;

    if( EXPECT(SMALL_OBJ(lb), 1) ) {
#       ifdef MERGE_SIZES
         lw = GC_size_map[lb];
#      else
         lw = ALIGNED_WORDS(lb);
#       endif
       opp = &(GC_objfreelist[lw]);
       FASTLOCK();
        if( EXPECT(!FASTLOCK_SUCCEEDED() || (op = *opp) == 0, 0) ) {
            FASTUNLOCK();
            return(GENERAL_MALLOC((word)lb, NORMAL));
        }
        /* See above comment on signals.  */
       GC_ASSERT(0 == obj_link(op)
                || (word)obj_link(op)
                     <= (word)GC_greatest_plausible_heap_addr
                   && (word)obj_link(op)
                     >= (word)GC_least_plausible_heap_addr);
        *opp = obj_link(op);
        obj_link(op) = 0;
        GC_words_allocd += lw;
        FASTUNLOCK();
        return((GC_PTR) op);
   } else {
       return(GENERAL_MALLOC((word)lb, NORMAL));
   }
}
GC2_EXTERN void* GC_malloc_allow_interior ( size_t  size_in_bytes)

Definition at line 3965 of file compact.c.

{
  return malloc_bigblock(size_in_bytes, MTYPE_ARRAY, 1);
}

Here is the call graph for this function:

Definition at line 3980 of file compact.c.

{
  return malloc_untagged(size_in_bytes, MTYPE_TAGGED_ARRAY, &tagged_array);
}

Here is the call graph for this function:

Here is the caller graph for this function:

GC2_EXTERN void* GC_malloc_atomic ( size_t  size_in_bytes)

Definition at line 245 of file malloc.c.

{
register ptr_t op;
register ptr_t * opp;
register word lw;
DCL_LOCK_STATE;

    if( EXPECT(SMALL_OBJ(lb), 1) ) {
#       ifdef MERGE_SIZES
         lw = GC_size_map[lb];
#      else
         lw = ALIGNED_WORDS(lb);
#       endif
       opp = &(GC_aobjfreelist[lw]);
       FASTLOCK();
        if( EXPECT(!FASTLOCK_SUCCEEDED() || (op = *opp) == 0, 0) ) {
            FASTUNLOCK();
            return(GENERAL_MALLOC((word)lb, PTRFREE));
        }
        /* See above comment on signals.  */
        *opp = obj_link(op);
        GC_words_allocd += lw;
        FASTUNLOCK();
        return((GC_PTR) op);
   } else {
       return(GENERAL_MALLOC((word)lb, PTRFREE));
   }
}
GC2_EXTERN void* GC_malloc_atomic_allow_interior ( size_t  size_in_bytes)

Definition at line 3970 of file compact.c.

{
  return malloc_bigblock(size_in_bytes, MTYPE_ATOMIC, 1);
}

Here is the call graph for this function:

GC2_EXTERN void* GC_malloc_atomic_uncollectable ( size_t  size_in_bytes)

Definition at line 3997 of file compact.c.

{
  void *p;
  p = malloc(size_in_bytes);
  memset(p, 0, size_in_bytes);
  return p;
}

Definition at line 262 of file weak.c.

{
  GCTYPE *gc = GC_get_GC();
  GC_Ephemeron *eph;

  /* Allcation might trigger GC, so we use park: */
  gc->park[0] = k;
  gc->park[1] = v;

  eph = (GC_Ephemeron *)GC_malloc_one_tagged(sizeof(GC_Ephemeron));

  k = gc->park[0];
  v = gc->park[1];
  gc->park[0] = NULL;
  gc->park[1] = NULL;
  
  eph->type = gc->ephemeron_tag;
  eph->key = k;
  eph->val = v;

  return eph;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 513 of file compact.c.

{
  ImmobileBox *ib;

  ib = (ImmobileBox *)malloc(sizeof(ImmobileBox));
  ib->p = p;
  ib->next = immobile;
  if (immobile)
    immobile->prev = ib;
  ib->prev = NULL;

  immobile = ib;

  return (void **)ib;
}

Here is the caller graph for this function:

Definition at line 3859 of file compact.c.

{
  return GC_malloc_one_tagged(size_in_bytes);
}

Here is the call graph for this function:

Definition at line 3854 of file compact.c.

{
  return GC_malloc_one_tagged(size_in_bytes);
}

Here is the call graph for this function:

Definition at line 3780 of file compact.c.

{
  size_t size_in_words;
  void **m, **naya;

#if CHECKS
  GC_check_variable_stack();
#endif

  size_in_words = ((size_in_bytes + 3) >> LOG_WORD_SIZE);

#if CHECKS
  if (size_in_words < 2)
    CRASH(37);
#endif

  if (size_in_words >= (BIGBLOCK_MIN_SIZE >> LOG_WORD_SIZE)) {
    return malloc_bigblock(size_in_words << LOG_WORD_SIZE, MTYPE_TAGGED, 1);
  }

#if USE_FREELIST
  m = (void *)tagged.free_lists[size_in_words];
  if (m) {
    int i;

    tagged.free_lists[size_in_words] = m[1];

    for (i = 0; i < size_in_words; i++)
      m[i] = NULL;

    on_free_list -= size_in_words;
    
    return m;
  }
#endif

#if ALIGN_DOUBLES
  if (!(size_in_words & 0x1)) {
    /* Make sure memory is 8-aligned */
    if (((long)tagged.low & 0x4)) {
      if (tagged.low == tagged.high) {
       new_page(MTYPE_TAGGED, 0, &tagged, 1);
       return GC_malloc_one_tagged(size_in_words << LOG_WORD_SIZE);
      }
      ((Type_Tag *)tagged.low)[0] = SKIP;
      tagged.low += 1;
    }
  }
#endif

#if SEARCH
  if (size_in_bytes == search_size)
    stop();
#endif

  m = tagged.low;
  naya = tagged.low + size_in_words;
  if (naya >= tagged.high) {
    if (tagged.low < tagged.high)
      *(Type_Tag *)tagged.low = TAGGED_EOM;
    new_page(MTYPE_TAGGED, 0, &tagged, 1);
    return GC_malloc_one_tagged(size_in_words << LOG_WORD_SIZE);
  }
  tagged.low = naya;

#if SEARCH
  if (m == search_for) {
    stop();
  }
#endif

  return m;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3985 of file compact.c.

{
  return malloc_untagged(size_in_bytes, MTYPE_XTAGGED, &xtagged);
}

Here is the call graph for this function:

GC2_EXTERN void* GC_malloc_pair ( void car,
void cdr 
)

Definition at line 3864 of file compact.c.

{
  void *p;

  park[0] = a;
  park[1] = b;
  p = GC_malloc_one_tagged(3 << LOG_WORD_SIZE);
  a = park[0];
  b = park[1];

  ((Type_Tag *)p)[0] = pair_tag;
  ((void **)p)[1] = a;
  ((void **)p)[2] = b;

  return p;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4058 of file compact.c.

{ 
  return BIGBLOCK_MIN_SIZE;
}

Here is the caller graph for this function:

GC2_EXTERN void* GC_malloc_tagged_allow_interior ( size_t  size_in_bytes)

Definition at line 3975 of file compact.c.

{
  return malloc_bigblock(size_in_bytes, MTYPE_TAGGED, 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

GC2_EXTERN void* GC_malloc_weak_array ( size_t  size_in_bytes,
void replace_val 
)

Definition at line 311 of file copy.c.

{
  GC_Weak_Array *w;

  /* Allcation might trigger GC, so we use park: */
  park[0] = replace_val;

  w = (GC_Weak_Array *)GC_malloc_one_tagged(size_in_bytes 
                                       + sizeof(GC_Weak_Array) 
                                       - sizeof(void *));

  replace_val = park[0];
  park[0] = NULL;

  w->type = gc_weak_array_tag;
  w->replace_val = replace_val;
  w->count = (size_in_bytes >> 2);
  
  return w;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GC2_EXTERN void* GC_malloc_weak_box ( void p,
void **  secondary,
int  soffset 
)

Definition at line 369 of file copy.c.

{
  GC_Weak_Box *w;

  /* Allcation might trigger GC, so we use park: */
  park[0] = p;
  park[1] = secondary;

  w = (GC_Weak_Box *)GC_malloc_one_tagged(sizeof(GC_Weak_Box));

  p = park[0];
  park[0] = NULL;
  secondary = (void **)park[1];
  park[1] = NULL;
  
  w->type = weak_box_tag;
  w->val = p;
  w->secondary_erase = secondary;
  w->soffset = soffset;

  return w;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 981 of file compact.c.

{
  unsigned long g;
  MPage *map;

#if CHECKS
  if (just_checking) {
    return;
  }
#endif
#if MARK_STATS
  mark_calls++;
#endif

  if ((long)p & 0x1) return;
  g = ((unsigned long)p >> MAPS_SHIFT);

  map = mpage_maps[g];
  if (map) {
    MPage *page;
    mflags_t flags;

    page = map + (((unsigned long)p & MAP_MASK) >> MAP_SHIFT);

#if SEARCH
    if (p == search_mark) {
      stop();
    }
#endif

#if DEFINE_MALLOC_FREE
    if (page->type == MTYPE_MALLOCFREE) {
#if CHECKS
      check_not_freed(page, p);
#endif
      return;
    }
#endif

    flags = page->flags;
    if (flags & (MFLAG_MARK | MFLAG_CONTINUED)) {
#if MARK_STATS
      mark_hits++;
#endif

      if (flags & MFLAG_BIGBLOCK) {
       if (flags & MFLAG_CONTINUED) {
         void *p2;
         unsigned long g2;
#if MARK_STATS
         mark_recalls++;
#endif
         p2 = page->o.bigblock_start;
         g2 = ((unsigned long)p2 >> MAPS_SHIFT);
         page = mpage_maps[g2] + (((unsigned long)p2 & MAP_MASK) >> MAP_SHIFT);
         flags = page->flags;

         if (!(flags & MFLAG_MARK))
           return;
       }

       if (!(flags & COLOR_MASK)) {
#if MARK_STATS
         mark_colors++;
#endif
         page->flags = (flags | MFLAG_GRAY);
         
         if (page->type != MTYPE_ATOMIC) {
           page->gray_next = gray_first;
           gray_first = page;
         }

#if KEEP_BACKPOINTERS
         page->backpointer_page = mark_src;
#endif
       }
      } else {
       long offset;
       OffsetArrTy v;
       mtype_t type;
       
       type = page->type;

       /* Check for lazy initialization: */
       if (!(flags & MFLAG_INITED)) {
         if (type <= MTYPE_TAGGED)
           init_tagged_mpage((void **)page->block_start, page);
         else
           init_untagged_mpage((void **)page->block_start, page);
         flags |= MFLAG_INITED;
         page->flags = flags;
       }

       if (type > MTYPE_TAGGED) {
#if CHECKS
         if (!((long)p & MPAGE_MASK)) {
           /* Can't point to beginning of non-tagged block! */
           CRASH(9);
         }
#endif
         p = BYTEPTR(p) - WORD_SIZE;
       }

       offset = ((long)p & MPAGE_MASK) >> LOG_WORD_SIZE;

#if CHECKS
       if (offset >= page->alloc_boundary) {
         /* Past allocation region. */
         CRASH(10);
       }
#endif

       v = OFFSET_COLOR_UNMASKED(page->u.offsets, offset);
       if (!(v & COLOR_MASK)) {
#if MARK_STATS
         mark_colors++;
#endif

         switch(type) {
         case MTYPE_ATOMIC:
           OFFSET_SET_COLOR_UNMASKED(page->u.offsets, offset, v | MFLAG_BLACK);
           if (!(flags & MFLAG_BLACK)) {
             page->flags = (flags | MFLAG_BLACK);
           }
#if KEEP_BACKPOINTERS
           page->backpointer_page[offset] = mark_src;
#endif
           break;
         case MTYPE_TAGGED:
#if CHECKS
           {
             Type_Tag tag = *(Type_Tag *)p;
             if ((tag < 0) || (tag >= NUMBER_OF_TAGS) || !size_table[tag]) {
              GCPRINT(GCOUTF, "bad tag: %d at %lx\n", tag, (long)p);
              CRASH(11);
             }
           }
#endif
         case MTYPE_XTAGGED:
         case MTYPE_ARRAY:
           if (mark_stack_pos < MARK_STACK_MAX) {
             page->flags = (flags | MFLAG_BLACK);
             OFFSET_SET_COLOR_UNMASKED(page->u.offsets, offset, v | MFLAG_BLACK); /* black can mean on stack */
# if RECORD_MARK_SRC
#  if CHECKS
             if ((long)mark_src & 0x1) CRASH(12);
#  endif
             mark_src_stack[mark_stack_pos] = mark_src;
             mark_src_type[mark_stack_pos] = mark_type;
# endif
             mark_stack[mark_stack_pos] = (void *)p;
             mark_stack_type[mark_stack_pos++] = type;
#if KEEP_BACKPOINTERS
             page->backpointer_page[offset] = mark_src;
#endif
             break;
           }
         default: /* ^^^ fallthrough */
           OFFSET_SET_COLOR_UNMASKED(page->u.offsets, offset, v | MFLAG_GRAY);
#if TIME
           mark_stackoflw++;
#endif
#if KEEP_BACKPOINTERS
           page->backpointer_page[offset] = mark_src;
#endif
           if (!(flags & MFLAG_GRAY)) {
             page->flags = (flags | MFLAG_GRAY);
             
             page->gray_next = gray_first;
             gray_first = page;
             
             page->gray_start = offset;
             page->gray_end = offset;
           } else {
             if (page->gray_start > offset)
              page->gray_start = offset;
             if (page->gray_end < offset)
              page->gray_end = offset;
           }
         }
       } else {
#if CHECKS
         if (!(flags & COLOR_MASK)) {
           CRASH(13);
         }
#endif
       }
      }
    }
  }
}

Here is the call graph for this function:

GC2_EXTERN void GC_mark_variable_stack ( void **  var_stack,
long  delta,
void limit,
void stack_mem 
)

Definition at line 1586 of file newgc.c.

{
  NewGC *gc = GC_get_GC();
  return gc->doing_memory_accounting;
}

Definition at line 4078 of file compact.c.

{
  return 0;
}

Here is the caller graph for this function:

Definition at line 4083 of file compact.c.

{
  return 0;
}

Here is the caller graph for this function:

Definition at line 495 of file compact.c.

{
}

Here is the caller graph for this function:

Definition at line 171 of file compact.c.

{}

Here is the caller graph for this function:

Definition at line 492 of file compact.c.

{
}

Here is the caller graph for this function:

GC2_EXTERN void GC_register_traversers ( short  tag,
Size_Proc  size,
Mark_Proc  mark,
Fixup_Proc  fixup,
int  is_constant_size,
int  is_atomic 
)

Definition at line 471 of file compact.c.

{
  if (is_constant_size) {
    long v;
    v = size(NULL);
    if (v < 100)
      size = (Size_Proc)v;
  }

  size_table[tag] = size;
  mark_table[tag] = mark;
  fixup_table[tag] = fixup;
}

Here is the caller graph for this function:

Definition at line 3569 of file compact.c.

{
  if (resolve_for_fixup) {
    GC_fixup(&p);
    return p;
  } else
    return p;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GC2_EXTERN int GC_set_account_hook ( int  type,
void c1,
unsigned long  b,
void c2 
)

Definition at line 4073 of file compact.c.

{
  return 0;
}

Here is the caller graph for this function:

Definition at line 331 of file alloc.c.

Definition at line 172 of file newgc.c.

Here is the caller graph for this function:

Definition at line 325 of file alloc.c.

GC2_EXTERN void GC_set_finalizer ( void p,
int  tagged,
int  level,
GC_finalization_proc  f,
void data,
GC_finalization_proc oldf,
void **  olddata 
)
GC2_EXTERN void GC_set_get_thread_stack_base ( unsigned   long*)(void)

Here is the caller graph for this function:

Definition at line 448 of file compact.c.

{
  stack_base = (unsigned long)base;
}

Definition at line 170 of file compact.c.

Here is the caller graph for this function:

Definition at line 2719 of file compact.c.

Here is the call graph for this function:


Variable Documentation

Definition at line 191 of file gc2.h.

Definition at line 190 of file gc2.h.

Definition at line 117 of file gc2.h.

Definition at line 122 of file gc2.h.

Definition at line 291 of file gc2.h.