このページを編集する際は,編集に関する方針に従ってください.[]
概要[]
- gcc-4.1.0/gcc/ggc-zone.c, gcc-4.1.0/gcc/ggc-page.cにて定義
- 配分ページの状態を記録
実装[]
ggc-zone.c[]
- page_entryは、配分ページの状態を記録する。
- これは、全3種類のページの間の一般のデータ(small, large, PCH)。
235 /* A page_entry records the status of an allocation page. This is the
236 common data between all three kinds of pages - small, large, and
237 PCH. */
238 typedef struct page_entry
239 {
- 割り当てられたメモリのアドレス
240 /* The address at which the memory is allocated. */
241 char *page;
242
- このページエントリが含まれているゾーン
243 /* The zone that this page entry belongs to. */
244 struct alloc_zone *zone;
245
246 #ifdef GATHER_STATISTICS
- 生き残っている数
247 /* How many collections we've survived. */
248 size_t survived;
249 #endif
250
- このページはsmallオブジェクトに含まれるかlargeオブジェクトに含まれるか
251 /* Does this page contain small objects, or one large object? */
252 bool large_p;
253
- ロード済みのPCHの一部か
254 /* Is this page part of the loaded PCH? */
255 bool pch_p;
256 } page_entry;
ggc-page.c[]
247 /* A page_entry records the status of an allocation page. This
248 structure is dynamically sized to fit the bitmap in_use_p. */
249 typedef struct page_entry
250 {
251 /* The next page-entry with objects of the same size, or NULL if
252 this is the last page-entry. */
253 struct page_entry *next;
254
255 /* The previous page-entry with objects of the same size, or NULL if
256 this is the first page-entry. The PREV pointer exists solely to
257 keep the cost of ggc_free manageable. */
258 struct page_entry *prev;
259
260 /* The number of bytes allocated. (This will always be a multiple
261 of the host system page size.) */
262 size_t bytes;
263
264 /* The address at which the memory is allocated. */
265 char *page;
266
267 #ifdef USING_MALLOC_PAGE_GROUPS
268 /* Back pointer to the page group this page came from. */
269 struct page_group *group;
270 #endif
271
272 /* This is the index in the by_depth varray where this page table
273 can be found. */
274 unsigned long index_by_depth;
275
276 /* Context depth of this page. */
277 unsigned short context_depth;
278
279 /* The number of free objects remaining on this page. */
280 unsigned short num_free_objects;
281
282 /* A likely candidate for the bit position of a free object for the
283 next allocation from this page. */
284 unsigned short next_bit_hint;
285
286 /* The lg of size of objects allocated from this page. */
287 unsigned char order;
288
289 /* A bit vector indicating whether or not objects are in use. The
290 Nth bit is one if the Nth object on this page is allocated. This
291 array is dynamically sized. */
292 unsigned long in_use_p[1];
293 } page_entry;