osprey-gcc/gcc/ggc-page.c File Reference

#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
#include "rtl.h"
#include "tm_p.h"
#include "toplev.h"
#include "flags.h"
#include "ggc.h"
#include "timevar.h"
#include "params.h"
#include "tree-flow.h"

Include dependency graph for ggc-page.c:

Go to the source code of this file.

Data Types

type  max_alignment
type  page_entry
type  page_group
type  globals
type  ggc_pch_data
type  ggc_pch_data::ggc_pch_ondisk

Defines

#define VALGRIND_DISCARD(x)
#define USING_MALLOC_PAGE_GROUPS
#define GGC_DEBUG_LEVEL   (0)
#define HOST_BITS_PER_PTR   HOST_BITS_PER_LONG
#define PAGE_L1_BITS   (8)
#define PAGE_L2_BITS   (32 - PAGE_L1_BITS - G.lg_pagesize)
#define PAGE_L1_SIZE   ((size_t) 1 << PAGE_L1_BITS)
#define PAGE_L2_SIZE   ((size_t) 1 << PAGE_L2_BITS)
#define LOOKUP_L1(p)   (((size_t) (p) >> (32 - PAGE_L1_BITS)) & ((1 << PAGE_L1_BITS) - 1))
#define LOOKUP_L2(p)   (((size_t) (p) >> G.lg_pagesize) & ((1 << PAGE_L2_BITS) - 1))
#define OBJECTS_PER_PAGE(ORDER)   objects_per_page_table[ORDER]
#define OBJECTS_IN_PAGE(P)   ((P)->bytes / OBJECT_SIZE ((P)->order))
#define OBJECT_SIZE(ORDER)   object_size_table[ORDER]
#define DIV_MULT(ORDER)   inverse_table[ORDER].mult
#define DIV_SHIFT(ORDER)   inverse_table[ORDER].shift
#define OFFSET_TO_BIT(OFFSET, ORDER)   (((OFFSET) * DIV_MULT (ORDER)) >> DIV_SHIFT (ORDER))
#define NUM_EXTRA_ORDERS   ARRAY_SIZE (extra_order_size_table)
#define RTL_SIZE(NSLOTS)   (RTX_HDR_SIZE + (NSLOTS) * sizeof (rtunion))
#define TREE_EXP_SIZE(OPS)   (sizeof (struct tree_exp) + ((OPS) - 1) * sizeof (tree))
#define NUM_ORDERS   (HOST_BITS_PER_PTR + NUM_EXTRA_ORDERS)
#define MAX_ALIGNMENT   (offsetof (struct max_alignment, u))
#define ROUND_UP_VALUE(x, f)   ((f) - 1 - ((f) - 1 + (x)) % (f))
#define ROUND_UP(x, f)   (CEIL (x, f) * (f))
#define BITMAP_SIZE(Num_objects)   (CEIL ((Num_objects), HOST_BITS_PER_LONG) * sizeof(long))
#define GGC_QUIRE_SIZE   16
#define INITIAL_PTE_COUNT   128
#define prefetch(X)   ((void) X)
#define save_in_use_p_i(__i)   (G.save_in_use[__i])
#define save_in_use_p(__p)   (save_in_use_p_i (__p->index_by_depth))
#define poison_pages()
#define validate_free_objects()
#define SCALE(x)
#define STAT_LABEL(x)   ((x) < 1024*10 ? ' ' : ((x) < 1024*1024*10 ? 'k' : 'M'))

Typedefs

typedef page_entry ** page_table [PAGE_L1_SIZE]

Functions/Subroutines

static int ggc_allocated_p (const void *)
static page_entrylookup_page_table_entry (const void *)
static void set_page_table_entry (void *, page_entry *)
static size_t page_group_index (char *, char *)
static void set_page_group_in_use (page_group *, char *)
static void clear_page_group_in_use (page_group *, char *)
static struct page_entryalloc_page (unsigned)
static void free_page (struct page_entry *)
static void release_pages (void)
static void clear_marks (void)
static void sweep_pages (void)
static void ggc_recalculate_in_use_p (page_entry *)
static void compute_inverse (unsigned)
static void adjust_depth (void)
static void move_ptes_to_front (int, int)
void debug_print_page_list (int)
static void push_depth (unsigned int)
static void push_by_depth (page_entry *, unsigned long *)
voidggc_alloc_typed_stat (enum gt_types_enum type ATTRIBUTE_UNUSED, size_t size MEM_STAT_DECL)
voidggc_alloc_zone_stat (size_t size, struct alloc_zone *zone ATTRIBUTE_UNUSED MEM_STAT_DECL)
voidggc_alloc_stat (size_t size MEM_STAT_DECL)
int ggc_set_mark (const void *p)
int ggc_marked_p (const void *p)
size_t ggc_get_size (const void *p)
void ggc_free (void *p)
void init_ggc (void)
struct alloc_zonenew_ggc_zone (const char *name ATTRIBUTE_UNUSED)
void destroy_ggc_zone (struct alloc_zone *zone ATTRIBUTE_UNUSED)
void ggc_push_context (void)
void ggc_pop_context (void)
void ggc_collect (void)
void ggc_print_statistics (void)
struct ggc_pch_datainit_ggc_pch (void)
void ggc_pch_count_object (struct ggc_pch_data *d, void *x ATTRIBUTE_UNUSED, size_t size, bool is_string ATTRIBUTE_UNUSED)
size_t ggc_pch_total_size (struct ggc_pch_data *d)
void ggc_pch_this_base (struct ggc_pch_data *d, void *base)
char * ggc_pch_alloc_object (struct ggc_pch_data *d, void *x ATTRIBUTE_UNUSED, size_t size, bool is_string ATTRIBUTE_UNUSED)
void ggc_pch_prepare_write (struct ggc_pch_data *d ATTRIBUTE_UNUSED, FILE *f ATTRIBUTE_UNUSED)
void ggc_pch_write_object (struct ggc_pch_data *d ATTRIBUTE_UNUSED, FILE *f, void *x, void *newx ATTRIBUTE_UNUSED, size_t size, bool is_string ATTRIBUTE_UNUSED)
void ggc_pch_finish (struct ggc_pch_data *d, FILE *f)
void ggc_pch_read (FILE *f, void *addr)

Variables

static const size_t extra_order_size_table []
static unsigned objects_per_page_table [NUM_ORDERS]
static size_t object_size_table [NUM_ORDERS]
type {
   size_t   mult
   unsigned int   shift
inverse_table [NUM_ORDERS]
static struct globals G
struct alloc_zonertl_zone = NULL
struct alloc_zonetree_zone = NULL
struct alloc_zonegarbage_zone = NULL
static unsigned char size_lookup [257]


Define Documentation

#define BITMAP_SIZE ( Num_objects   )     (CEIL ((Num_objects), HOST_BITS_PER_LONG) * sizeof(long))

Definition at line 455 of file ggc-page.c.

#define DIV_MULT ( ORDER   )     inverse_table[ORDER].mult

Definition at line 167 of file ggc-page.c.

#define DIV_SHIFT ( ORDER   )     inverse_table[ORDER].shift

Definition at line 168 of file ggc-page.c.

#define GGC_DEBUG_LEVEL   (0)

Definition at line 113 of file ggc-page.c.

#define GGC_QUIRE_SIZE   16

Definition at line 467 of file ggc-page.c.

#define HOST_BITS_PER_PTR   HOST_BITS_PER_LONG

Definition at line 116 of file ggc-page.c.

#define INITIAL_PTE_COUNT   128

Definition at line 472 of file ggc-page.c.

#define LOOKUP_L1 ( p   )     (((size_t) (p) >> (32 - PAGE_L1_BITS)) & ((1 << PAGE_L1_BITS) - 1))

Definition at line 147 of file ggc-page.c.

#define LOOKUP_L2 ( p   )     (((size_t) (p) >> G.lg_pagesize) & ((1 << PAGE_L2_BITS) - 1))

Definition at line 150 of file ggc-page.c.

#define MAX_ALIGNMENT   (offsetof (struct max_alignment, u))

Definition at line 214 of file ggc-page.c.

#define NUM_EXTRA_ORDERS   ARRAY_SIZE (extra_order_size_table)

Definition at line 175 of file ggc-page.c.

#define NUM_ORDERS   (HOST_BITS_PER_PTR + NUM_EXTRA_ORDERS)

Definition at line 198 of file ggc-page.c.

#define OBJECT_SIZE ( ORDER   )     object_size_table[ORDER]

Definition at line 161 of file ggc-page.c.

#define OBJECTS_IN_PAGE ( P   )     ((P)->bytes / OBJECT_SIZE ((P)->order))

#define OBJECTS_PER_PAGE ( ORDER   )     objects_per_page_table[ORDER]

Definition at line 155 of file ggc-page.c.

#define OFFSET_TO_BIT ( OFFSET,
ORDER   )     (((OFFSET) * DIV_MULT (ORDER)) >> DIV_SHIFT (ORDER))

Definition at line 169 of file ggc-page.c.

#define PAGE_L1_BITS   (8)

Definition at line 142 of file ggc-page.c.

#define PAGE_L1_SIZE   ((size_t) 1 << PAGE_L1_BITS)

Definition at line 144 of file ggc-page.c.

#define PAGE_L2_BITS   (32 - PAGE_L1_BITS - G.lg_pagesize)

Definition at line 143 of file ggc-page.c.

#define PAGE_L2_SIZE   ((size_t) 1 << PAGE_L2_BITS)

Definition at line 145 of file ggc-page.c.

 
#define poison_pages (  ) 

Definition at line 1904 of file ggc-page.c.

Referenced by ggc_collect(), and ggc_pch_read().

#define prefetch ( X   )     ((void) X)

Definition at line 533 of file ggc-page.c.

#define ROUND_UP ( x,
f   )     (CEIL (x, f) * (f))

Definition at line 223 of file ggc-page.c.

#define ROUND_UP_VALUE ( x,
f   )     ((f) - 1 - ((f) - 1 + (x)) % (f))

Definition at line 219 of file ggc-page.c.

Referenced by ggc_pch_write_object().

#define RTL_SIZE ( NSLOTS   )     (RTX_HDR_SIZE + (NSLOTS) * sizeof (rtunion))

Definition at line 177 of file ggc-page.c.

#define save_in_use_p ( __p   )     (save_in_use_p_i (__p->index_by_depth))

Definition at line 540 of file ggc-page.c.

#define save_in_use_p_i ( __i   )     (G.save_in_use[__i])

Definition at line 538 of file ggc-page.c.

#define SCALE (  ) 

Value:

((unsigned long) ((x) < 1024*10 \
      ? (x) \
      : ((x) < 1024*1024*10 \
         ? (x) / 1024 \
         : (x) / (1024*1024))))

Definition at line 2000 of file ggc-page.c.

#define STAT_LABEL (  )     ((x) < 1024*10 ? ' ' : ((x) < 1024*1024*10 ? 'k' : 'M'))

Definition at line 2005 of file ggc-page.c.

Referenced by ggc_print_statistics().

#define TREE_EXP_SIZE ( OPS   )     (sizeof (struct tree_exp) + ((OPS) - 1) * sizeof (tree))

Definition at line 180 of file ggc-page.c.

#define USING_MALLOC_PAGE_GROUPS

Definition at line 75 of file ggc-page.c.

#define VALGRIND_DISCARD (  ) 

Definition at line 45 of file ggc-page.c.

 
#define validate_free_objects (  ) 

Definition at line 1944 of file ggc-page.c.

Referenced by ggc_collect().


Typedef Documentation

typedef page_entry** page_table[PAGE_L1_SIZE]

Definition at line 314 of file ggc-page.c.


Function Documentation

static void adjust_depth ( void   )  [inline, static]

Definition at line 900 of file ggc-page.c.

References page_entry::context_depth, G, and top.

static struct page_entry * alloc_page ( unsigned  order  )  [static, read]

static void clear_marks ( void   )  [static]

static void clear_page_group_in_use ( page_group group,
char *  page 
) [inline, static]

Definition at line 707 of file ggc-page.c.

References page_group::allocation, page_group::in_use, and page_group_index().

static void compute_inverse ( unsigned  order  )  [static]

Definition at line 1421 of file ggc-page.c.

References DIV_MULT, DIV_SHIFT, and OBJECT_SIZE.

void debug_print_page_list ( int  order  ) 

Definition at line 571 of file ggc-page.c.

void destroy_ggc_zone ( struct alloc_zone *zone  ATTRIBUTE_UNUSED  ) 

Definition at line 1545 of file ggc-page.c.

static void free_page ( struct page_entry entry  )  [static]

void* ggc_alloc_stat ( size_t size  MEM_STAT_DECL  ) 

void* ggc_alloc_typed_stat ( enum gt_types_enum type  ATTRIBUTE_UNUSED,
size_t size  MEM_STAT_DECL 
)

Definition at line 1049 of file ggc-page.c.

References ggc_alloc_stat(), and PASS_MEM_STAT.

void* ggc_alloc_zone_stat ( size_t  size,
struct alloc_zone *zone ATTRIBUTE_UNUSED  MEM_STAT_DECL 
)

Definition at line 1058 of file ggc-page.c.

References ggc_alloc_stat(), and PASS_MEM_STAT.

static int ggc_allocated_p ( const void p  )  [inline, static]

Definition at line 546 of file ggc-page.c.

References base, G, L1, LOOKUP_L1, LOOKUP_L2, NULL, and size_t.

void ggc_collect ( void   ) 

void ggc_free ( void p  ) 

size_t ggc_get_size ( const void p  ) 

Definition at line 1318 of file ggc-page.c.

int ggc_marked_p ( const void p  ) 

Definition at line 1295 of file ggc-page.c.

char* ggc_pch_alloc_object ( struct ggc_pch_data d,
void *x  ATTRIBUTE_UNUSED,
size_t  size,
bool is_string  ATTRIBUTE_UNUSED 
)

Definition at line 2164 of file ggc-page.c.

References ggc_pch_data::base, OBJECT_SIZE, and result.

Referenced by call_alloc().

void ggc_pch_count_object ( struct ggc_pch_data d,
void *x  ATTRIBUTE_UNUSED,
size_t  size,
bool is_string  ATTRIBUTE_UNUSED 
)

Definition at line 2121 of file ggc-page.c.

References ggc_pch_data::d, OBJECT_SIZE, and ggc_pch_data::ggc_pch_ondisk::totals.

Referenced by call_count().

void ggc_pch_finish ( struct ggc_pch_data d,
FILE f 
)

Definition at line 2244 of file ggc-page.c.

Referenced by gt_pch_save().

void ggc_pch_prepare_write ( struct ggc_pch_data *d  ATTRIBUTE_UNUSED,
FILE *f  ATTRIBUTE_UNUSED 
)

Definition at line 2185 of file ggc-page.c.

Referenced by gt_pch_save().

void ggc_pch_read ( FILE f,
void addr 
)

Definition at line 2302 of file ggc-page.c.

Referenced by gt_pch_restore().

void ggc_pch_this_base ( struct ggc_pch_data d,
void base 
)

Definition at line 2150 of file ggc-page.c.

Referenced by gt_pch_save().

size_t ggc_pch_total_size ( struct ggc_pch_data d  ) 

Definition at line 2139 of file ggc-page.c.

Referenced by gt_pch_save().

void ggc_pch_write_object ( struct ggc_pch_data *d  ATTRIBUTE_UNUSED,
FILE f,
void x,
void *newx  ATTRIBUTE_UNUSED,
size_t  size,
bool is_string  ATTRIBUTE_UNUSED 
)

Definition at line 2192 of file ggc-page.c.

References d, fatal_error(), fseek, fwrite, G, OBJECT_SIZE, ROUND_UP_VALUE, and SEEK_CUR.

Referenced by gt_pch_save().

void ggc_pop_context ( void   ) 

void ggc_print_statistics ( void   ) 

void ggc_push_context ( void   ) 

Definition at line 1553 of file ggc-page.c.

References G, gcc_assert, and HOST_BITS_PER_LONG.

static void ggc_recalculate_in_use_p ( page_entry p  )  [static]

int ggc_set_mark ( const void p  ) 

Definition at line 1259 of file ggc-page.c.

void init_ggc ( void   ) 

struct ggc_pch_data* init_ggc_pch ( void   )  [read]

Definition at line 2115 of file ggc-page.c.

Referenced by gt_pch_save().

static page_entry * lookup_page_table_entry ( const void p  )  [inline, static]

Definition at line 578 of file ggc-page.c.

References base, G, L1, LOOKUP_L1, LOOKUP_L2, and size_t.

static void move_ptes_to_front ( int  count_old_page_tables,
int  count_new_page_tables 
) [static]

Definition at line 2255 of file ggc-page.c.

References free(), G, page_entry::index_by_depth, memcpy, push_depth(), and xmalloc().

Referenced by ggc_pch_read().

struct alloc_zone* new_ggc_zone ( const char *name  ATTRIBUTE_UNUSED  )  [read]

Definition at line 1538 of file ggc-page.c.

References NULL.

Referenced by ggc_pch_read(), and init_ggc().

static size_t page_group_index ( char *  allocation,
char *  page 
) [inline, static]

Definition at line 693 of file ggc-page.c.

References G.

static void push_by_depth ( page_entry p,
unsigned long s 
) [inline, static]

Definition at line 518 of file ggc-page.c.

References G, and xrealloc().

static void push_depth ( unsigned int  i  )  [inline, static]

Definition at line 505 of file ggc-page.c.

References G, and xrealloc().

static void release_pages ( void   )  [static]

static void set_page_group_in_use ( page_group group,
char *  page 
) [inline, static]

Definition at line 701 of file ggc-page.c.

References page_group::allocation, page_group::in_use, and page_group_index().

static void set_page_table_entry ( void p,
page_entry entry 
) [static]

Definition at line 603 of file ggc-page.c.

References base, G, L1, LOOKUP_L1, LOOKUP_L2, NULL, PAGE_L2_SIZE, size_t, and xcalloc().

static void sweep_pages ( void   )  [static]


Variable Documentation

const size_t extra_order_size_table[] [static]

Initial value:

 {
  sizeof (struct stmt_ann_d),
  sizeof (struct tree_decl),
  sizeof (struct tree_list),
  TREE_EXP_SIZE (2),
  RTL_SIZE (2),     
  RTL_SIZE (9),     
}

Definition at line 187 of file ggc-page.c.

struct globals G [static]

Definition at line 500 of file ggc-page.c.

struct { ... } inverse_table[NUM_ORDERS] [static]

Definition at line 239 of file ggc-page.c.

size_t object_size_table[NUM_ORDERS] [static]

Definition at line 231 of file ggc-page.c.

unsigned objects_per_page_table[NUM_ORDERS] [static]

Definition at line 227 of file ggc-page.c.

Definition at line 498 of file ggc-page.c.

unsigned int shift

Definition at line 240 of file ggc-page.c.

unsigned char size_lookup[257] [static]

Initial value:

{
  3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4,
  4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
  5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
  6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
  6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
  7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
  7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
  8
}

Definition at line 1025 of file ggc-page.c.


Generated on Wed Apr 8 15:34:35 2009 for Open64 by  doxygen 1.5.6