Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
obj_map.c File Reference
#include "gc_priv.h"

Go to the source code of this file.

Functions

void GC_invalidate_map (hdr *hhdr)
void GC_register_displacement (GC_word offset)
void GC_register_displacement_inner (word offset)
GC_bool GC_add_map_entry (word sz)

Variables

char * GC_invalid_map = 0

Function Documentation

Definition at line 103 of file obj_map.c.

{
    register unsigned obj_start;
    register unsigned displ;
    register char * new_map;
    
    if (sz > MAXOBJSZ) sz = 0;
    if (GC_obj_map[sz] != 0) {
        return(TRUE);
    }
    new_map = GC_scratch_alloc(MAP_SIZE);
    if (new_map == 0) return(FALSE);
#   ifdef PRINTSTATS
        GC_printf1("Adding block map for size %lu\n", (unsigned long)sz);
#   endif
    for (displ = 0; displ < HBLKSIZE; displ++) {
        MAP_ENTRY(new_map,displ) = OBJ_INVALID;
    }
    if (sz == 0) {
        for(displ = 0; displ <= MAX_OFFSET; displ++) {
            if (OFFSET_VALID(displ)) {
                MAP_ENTRY(new_map,displ+HDR_BYTES) = BYTES_TO_WORDS(displ);
            }
        }
    } else {
        for (obj_start = HDR_BYTES;
             obj_start + WORDS_TO_BYTES(sz) <= HBLKSIZE;
             obj_start += WORDS_TO_BYTES(sz)) {
             for (displ = 0; displ < WORDS_TO_BYTES(sz); displ++) {
                 if (OFFSET_VALID(displ)) {
                     MAP_ENTRY(new_map, obj_start + displ) =
                                                 BYTES_TO_WORDS(displ);
                 }
             }
        }
    }
    GC_obj_map[sz] = new_map;
    return(TRUE);
}

Here is the call graph for this function:

void GC_invalidate_map ( hdr hhdr)

Definition at line 28 of file obj_map.c.

{
    register int displ;
    
    if (GC_invalid_map == 0) {
        GC_invalid_map = GC_scratch_alloc(MAP_SIZE);
        if (GC_invalid_map == 0) {
            GC_err_printf0(
              "Cant initialize GC_invalid_map: insufficient memory\n");
            EXIT();
        }
        for (displ = 0; displ < HBLKSIZE; displ++) {
            MAP_ENTRY(GC_invalid_map, displ) = OBJ_INVALID;
        }
    }
    hhdr -> hb_map = GC_invalid_map;
}

Here is the call graph for this function:

Definition at line 53 of file obj_map.c.

{
# ifndef ALL_INTERIOR_POINTERS
    DCL_LOCK_STATE;
    
    DISABLE_SIGNALS();
    LOCK();
    GC_register_displacement_inner(offset);
    UNLOCK();
    ENABLE_SIGNALS();
# endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 68 of file obj_map.c.

{
# ifndef ALL_INTERIOR_POINTERS
    register unsigned i;
    
    if (offset > MAX_OFFSET) {
        ABORT("Bad argument to GC_register_displacement");
    }
    if (!GC_valid_offsets[offset]) {
      GC_valid_offsets[offset] = TRUE;
      GC_modws_valid_offsets[offset % sizeof(word)] = TRUE;
      for (i = 0; i <= MAXOBJSZ; i++) {
          if (GC_obj_map[i] != 0) {
             if (i == 0) {
               GC_obj_map[i][offset + HDR_BYTES] = (char)BYTES_TO_WORDS(offset);
             } else {
               register unsigned j;
               register unsigned lb = WORDS_TO_BYTES(i);
               
               if (offset < lb) {
                 for (j = offset + HDR_BYTES; j < HBLKSIZE; j += lb) {
                   GC_obj_map[i][j] = (char)BYTES_TO_WORDS(offset);
                 }
               }
             }
          }
      }
    }
# endif
}

Variable Documentation

char* GC_invalid_map = 0

Definition at line 24 of file obj_map.c.