page.h File Reference

Page-oriented bit maps. More...

#include "util/bitset.h"
Include dependency graph for page.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define tm_ptr_is_aligned_to_block(ptr)   !(((unsigned long) ptr) % tm_block_SIZE)
 True if ptr is aligned to a tm_block.
#define tm_ptr_is_aligned_to_page(ptr)   !(((unsigned long) ptr) % tm_page_SIZE)
 True if ptr is aligned to a OS page.
#define tm_page_index(X)   (((unsigned long) X) / tm_page_SIZE)
 Returns the index of a ptr into page-orientated bit map.

Functions

static __inline int _tm_page_in_use (void *ptr)
 Is page at ptr in use?
static __inline void _tm_page_mark_used (void *ptr)
 Mark page at ptr in use.
static __inline void _tm_page_mark_unused (void *ptr)
 Mark page at ptr unused.
static __inline void _tm_page_mark_used_range (void *ptr, size_t size)
 Mark freed pages at ptr for size bytes as used.
static __inline void _tm_page_mark_unused_range (void *ptr, size_t size)
 Mark freed pages at ptr for size bytes as unused.

Detailed Description

Page-oriented bit maps.

Definition in file page.h.


Define Documentation

#define tm_page_index (  )     (((unsigned long) X) / tm_page_SIZE)

Returns the index of a ptr into page-orientated bit map.

Definition at line 20 of file page.h.

Referenced by _tm_page_in_use(), _tm_page_mark_unused(), and _tm_page_mark_used().

#define tm_ptr_is_aligned_to_block ( ptr   )     !(((unsigned long) ptr) % tm_block_SIZE)

True if ptr is aligned to a tm_block.

Definition at line 11 of file page.h.

Referenced by _tm_os_alloc_aligned(), _tm_os_free_aligned(), and tm_ptr_to_node().

#define tm_ptr_is_aligned_to_page ( ptr   )     !(((unsigned long) ptr) % tm_page_SIZE)

True if ptr is aligned to a OS page.

Definition at line 13 of file page.h.

Referenced by _tm_os_free(), _tm_page_mark_unused_range(), and _tm_page_mark_used_range().


Function Documentation

static __inline int _tm_page_in_use ( void *  ptr  )  [static]

Is page at ptr in use?

Definition at line 27 of file page.h.

References tm_data::page_in_use, tm, and tm_page_index.

Referenced by __tm_write_barrier_root(), and tm_ptr_to_node().

00028 {
00029   size_t i = tm_page_index(ptr);
00030   return bitset_get(tm.page_in_use, i);
00031 }

Here is the caller graph for this function:

static __inline void _tm_page_mark_unused ( void *  ptr  )  [static]

Mark page at ptr unused.

Definition at line 48 of file page.h.

References tm_data::page_in_use, tm, and tm_page_index.

Referenced by _tm_page_mark_unused_range().

00049 {
00050   size_t i = tm_page_index(ptr);
00051   bitset_clr(tm.page_in_use, i);
00052 }

Here is the caller graph for this function:

static __inline void _tm_page_mark_unused_range ( void *  ptr,
size_t  size 
) [static]

Mark freed pages at ptr for size bytes as unused.

Definition at line 76 of file page.h.

References _tm_page_mark_unused(), tm_assert_test, tm_page_SIZE, and tm_ptr_is_aligned_to_page.

Referenced by _tm_block_reclaim(), and _tm_os_free().

00077 {
00078   tm_assert_test(tm_ptr_is_aligned_to_page(ptr));
00079   tm_assert_test(tm_ptr_is_aligned_to_page(size));
00080 
00081   while ( size > 0 ) {
00082     _tm_page_mark_unused(ptr);
00083     ptr += tm_page_SIZE;
00084     size -= tm_page_SIZE;
00085   }
00086 }

Here is the call graph for this function:

Here is the caller graph for this function:

static __inline void _tm_page_mark_used ( void *  ptr  )  [static]

Mark page at ptr in use.

Definition at line 37 of file page.h.

References tm_data::page_in_use, tm, and tm_page_index.

Referenced by _tm_page_mark_used_range(), and _tm_type_alloc_node_from_free_list().

00038 {
00039   size_t i = tm_page_index(ptr);
00040   bitset_set(tm.page_in_use, i);
00041 }

Here is the caller graph for this function:

static __inline void _tm_page_mark_used_range ( void *  ptr,
size_t  size 
) [static]

Mark freed pages at ptr for size bytes as used.

Definition at line 59 of file page.h.

References _tm_page_mark_used(), tm_assert_test, tm_page_SIZE, and tm_ptr_is_aligned_to_page.

00060 {
00061   tm_assert_test(tm_ptr_is_aligned_to_page(ptr));
00062   tm_assert_test(tm_ptr_is_aligned_to_page(size));
00063 
00064   while ( size > 0 ) {
00065     _tm_page_mark_used(ptr);
00066     ptr += tm_page_SIZE;
00067     size -= tm_page_SIZE;
00068   }
00069 }

Here is the call graph for this function:


Generated on Mon Jan 25 06:33:12 2010 for TM(tredmill) by  doxygen 1.6.1