Mercurial > hg > graal-jvmci-8
comparison src/share/vm/utilities/bitMap.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 | 2a0172480595 |
children | 7b835924c31c |
comparison
equal
deleted
inserted
replaced
6174:74533f63b116 | 6197:d2a62e0f25eb |
---|---|
63 _size = size_in_bits; | 63 _size = size_in_bits; |
64 idx_t new_size_in_words = size_in_words(); | 64 idx_t new_size_in_words = size_in_words(); |
65 if (in_resource_area) { | 65 if (in_resource_area) { |
66 _map = NEW_RESOURCE_ARRAY(bm_word_t, new_size_in_words); | 66 _map = NEW_RESOURCE_ARRAY(bm_word_t, new_size_in_words); |
67 } else { | 67 } else { |
68 if (old_map != NULL) FREE_C_HEAP_ARRAY(bm_word_t, _map); | 68 if (old_map != NULL) FREE_C_HEAP_ARRAY(bm_word_t, _map, mtInternal); |
69 _map = NEW_C_HEAP_ARRAY(bm_word_t, new_size_in_words); | 69 _map = NEW_C_HEAP_ARRAY(bm_word_t, new_size_in_words, mtInternal); |
70 } | 70 } |
71 Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) _map, | 71 Copy::disjoint_words((HeapWord*)old_map, (HeapWord*) _map, |
72 MIN2(old_size_in_words, new_size_in_words)); | 72 MIN2(old_size_in_words, new_size_in_words)); |
73 if (new_size_in_words > old_size_in_words) { | 73 if (new_size_in_words > old_size_in_words) { |
74 clear_range_of_words(old_size_in_words, size_in_words()); | 74 clear_range_of_words(old_size_in_words, size_in_words()); |
467 | 467 |
468 BitMap::idx_t* BitMap::_pop_count_table = NULL; | 468 BitMap::idx_t* BitMap::_pop_count_table = NULL; |
469 | 469 |
470 void BitMap::init_pop_count_table() { | 470 void BitMap::init_pop_count_table() { |
471 if (_pop_count_table == NULL) { | 471 if (_pop_count_table == NULL) { |
472 BitMap::idx_t *table = NEW_C_HEAP_ARRAY(idx_t, 256); | 472 BitMap::idx_t *table = NEW_C_HEAP_ARRAY(idx_t, 256, mtInternal); |
473 for (uint i = 0; i < 256; i++) { | 473 for (uint i = 0; i < 256; i++) { |
474 table[i] = num_set_bits(i); | 474 table[i] = num_set_bits(i); |
475 } | 475 } |
476 | 476 |
477 intptr_t res = Atomic::cmpxchg_ptr((intptr_t) table, | 477 intptr_t res = Atomic::cmpxchg_ptr((intptr_t) table, |
478 (intptr_t*) &_pop_count_table, | 478 (intptr_t*) &_pop_count_table, |
479 (intptr_t) NULL_WORD); | 479 (intptr_t) NULL_WORD); |
480 if (res != NULL_WORD) { | 480 if (res != NULL_WORD) { |
481 guarantee( _pop_count_table == (void*) res, "invariant" ); | 481 guarantee( _pop_count_table == (void*) res, "invariant" ); |
482 FREE_C_HEAP_ARRAY(bm_word_t, table); | 482 FREE_C_HEAP_ARRAY(bm_word_t, table, mtInternal); |
483 } | 483 } |
484 } | 484 } |
485 } | 485 } |
486 | 486 |
487 BitMap::idx_t BitMap::num_set_bits(bm_word_t w) { | 487 BitMap::idx_t BitMap::num_set_bits(bm_word_t w) { |