Mercurial > hg > graal-compiler
comparison src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp @ 6197:d2a62e0f25eb
6995781: Native Memory Tracking (Phase 1)
7151532: DCmd for hotspot native memory tracking
Summary: Implementation of native memory tracking phase 1, which tracks VM native memory usage, and related DCmd
Reviewed-by: acorn, coleenp, fparain
author | zgu |
---|---|
date | Thu, 28 Jun 2012 17:03:16 -0400 |
parents | 5c8bd7c16119 |
children | 24b9c7f4cae6 |
comparison
equal
deleted
inserted
replaced
6174:74533f63b116 | 6197:d2a62e0f25eb |
---|---|
37 | 37 |
38 #define PRT_COUNT_OCCUPIED 1 | 38 #define PRT_COUNT_OCCUPIED 1 |
39 | 39 |
40 // OtherRegionsTable | 40 // OtherRegionsTable |
41 | 41 |
42 class PerRegionTable: public CHeapObj { | 42 class PerRegionTable: public CHeapObj<mtGC> { |
43 friend class OtherRegionsTable; | 43 friend class OtherRegionsTable; |
44 friend class HeapRegionRemSetIterator; | 44 friend class HeapRegionRemSetIterator; |
45 | 45 |
46 HeapRegion* _hr; | 46 HeapRegion* _hr; |
47 BitMap _bm; | 47 BitMap _bm; |
280 } | 280 } |
281 #if PRT_COUNT_OCCUPIED | 281 #if PRT_COUNT_OCCUPIED |
282 // We must recount the "occupied." | 282 // We must recount the "occupied." |
283 recount_occupied(); | 283 recount_occupied(); |
284 #endif | 284 #endif |
285 FREE_C_HEAP_ARRAY(PerRegionTable*, _par_tables); | 285 FREE_C_HEAP_ARRAY(PerRegionTable*, _par_tables, mtGC); |
286 _par_tables = NULL; | 286 _par_tables = NULL; |
287 #if COUNT_PAR_EXPANDS | 287 #if COUNT_PAR_EXPANDS |
288 Atomic::inc(&n_par_contracts); | 288 Atomic::inc(&n_par_contracts); |
289 Atomic::dec(&par_expand_list_len); | 289 Atomic::dec(&par_expand_list_len); |
290 #endif | 290 #endif |
383 Atomic::cmpxchg_ptr((PerRegionTable*)ReserveParTableExpansion, | 383 Atomic::cmpxchg_ptr((PerRegionTable*)ReserveParTableExpansion, |
384 &_par_tables, NULL); | 384 &_par_tables, NULL); |
385 if (res != NULL) return; | 385 if (res != NULL) return; |
386 // Otherwise, we reserved the right to do the expansion. | 386 // Otherwise, we reserved the right to do the expansion. |
387 | 387 |
388 PerRegionTable** ptables = NEW_C_HEAP_ARRAY(PerRegionTable*, n); | 388 PerRegionTable** ptables = NEW_C_HEAP_ARRAY(PerRegionTable*, n, mtGC); |
389 for (int i = 0; i < n; i++) { | 389 for (int i = 0; i < n; i++) { |
390 PerRegionTable* ptable = PerRegionTable::alloc(hr()); | 390 PerRegionTable* ptable = PerRegionTable::alloc(hr()); |
391 ptables[i] = ptable; | 391 ptables[i] = ptable; |
392 } | 392 } |
393 // Here we do not need an atomic. | 393 // Here we do not need an atomic. |
544 | 544 |
545 void OtherRegionsTable::init_from_card_cache(size_t max_regions) { | 545 void OtherRegionsTable::init_from_card_cache(size_t max_regions) { |
546 _from_card_cache_max_regions = max_regions; | 546 _from_card_cache_max_regions = max_regions; |
547 | 547 |
548 int n_par_rs = HeapRegionRemSet::num_par_rem_sets(); | 548 int n_par_rs = HeapRegionRemSet::num_par_rem_sets(); |
549 _from_card_cache = NEW_C_HEAP_ARRAY(int*, n_par_rs); | 549 _from_card_cache = NEW_C_HEAP_ARRAY(int*, n_par_rs, mtGC); |
550 for (int i = 0; i < n_par_rs; i++) { | 550 for (int i = 0; i < n_par_rs; i++) { |
551 _from_card_cache[i] = NEW_C_HEAP_ARRAY(int, max_regions); | 551 _from_card_cache[i] = NEW_C_HEAP_ARRAY(int, max_regions, mtGC); |
552 for (size_t j = 0; j < max_regions; j++) { | 552 for (size_t j = 0; j < max_regions; j++) { |
553 _from_card_cache[i][j] = -1; // An invalid value. | 553 _from_card_cache[i][j] = -1; // An invalid value. |
554 } | 554 } |
555 } | 555 } |
556 _from_card_cache_mem_size = n_par_rs * max_regions * sizeof(int); | 556 _from_card_cache_mem_size = n_par_rs * max_regions * sizeof(int); |
1331 if (_recorded_oops == NULL) { | 1331 if (_recorded_oops == NULL) { |
1332 assert(_n_recorded == 0 | 1332 assert(_n_recorded == 0 |
1333 && _recorded_cards == NULL | 1333 && _recorded_cards == NULL |
1334 && _recorded_regions == NULL, | 1334 && _recorded_regions == NULL, |
1335 "Inv"); | 1335 "Inv"); |
1336 _recorded_oops = NEW_C_HEAP_ARRAY(OopOrNarrowOopStar, MaxRecorded); | 1336 _recorded_oops = NEW_C_HEAP_ARRAY(OopOrNarrowOopStar, MaxRecorded, mtGC); |
1337 _recorded_cards = NEW_C_HEAP_ARRAY(HeapWord*, MaxRecorded); | 1337 _recorded_cards = NEW_C_HEAP_ARRAY(HeapWord*, MaxRecorded, mtGC); |
1338 _recorded_regions = NEW_C_HEAP_ARRAY(HeapRegion*, MaxRecorded); | 1338 _recorded_regions = NEW_C_HEAP_ARRAY(HeapRegion*, MaxRecorded, mtGC); |
1339 } | 1339 } |
1340 if (_n_recorded == MaxRecorded) { | 1340 if (_n_recorded == MaxRecorded) { |
1341 gclog_or_tty->print_cr("Filled up 'recorded' (%d).", MaxRecorded); | 1341 gclog_or_tty->print_cr("Filled up 'recorded' (%d).", MaxRecorded); |
1342 } else { | 1342 } else { |
1343 _recorded_cards[_n_recorded] = | 1343 _recorded_cards[_n_recorded] = |
1354 | 1354 |
1355 if (_recorded_events == NULL) { | 1355 if (_recorded_events == NULL) { |
1356 assert(_n_recorded_events == 0 | 1356 assert(_n_recorded_events == 0 |
1357 && _recorded_event_index == NULL, | 1357 && _recorded_event_index == NULL, |
1358 "Inv"); | 1358 "Inv"); |
1359 _recorded_events = NEW_C_HEAP_ARRAY(Event, MaxRecordedEvents); | 1359 _recorded_events = NEW_C_HEAP_ARRAY(Event, MaxRecordedEvents, mtGC); |
1360 _recorded_event_index = NEW_C_HEAP_ARRAY(int, MaxRecordedEvents); | 1360 _recorded_event_index = NEW_C_HEAP_ARRAY(int, MaxRecordedEvents, mtGC); |
1361 } | 1361 } |
1362 if (_n_recorded_events == MaxRecordedEvents) { | 1362 if (_n_recorded_events == MaxRecordedEvents) { |
1363 gclog_or_tty->print_cr("Filled up 'recorded_events' (%d).", MaxRecordedEvents); | 1363 gclog_or_tty->print_cr("Filled up 'recorded_events' (%d).", MaxRecordedEvents); |
1364 } else { | 1364 } else { |
1365 _recorded_events[_n_recorded_events] = evnt; | 1365 _recorded_events[_n_recorded_events] = evnt; |