565 assert(map.is_same(map2), "could be");
566 }
567
568 {
569 BitMap map(BITMAP_SIZE, in_resource_area);
570 map.resize(BITMAP_SIZE, in_resource_area);
571 fillBitMap(map);
572
573 BitMap map2(BITMAP_SIZE, in_resource_area);
574 fillBitMap(map2);
575 assert(map.is_same(map2), "could be");
576 }
577 }
578
579 static void testResizeResource() {
580 ResourceMark rm;
581 testResize(true);
582 }
583
584 static void testResizeNonResource() {
585 testResize(false);
586 {
587 uintx bitmap_bytes = BITMAP_SIZE / BitsPerByte;
588 UIntFlagSetting fs(ArrayAllocatorMallocLimit, bitmap_bytes / 4);
589 testResize(false);
590 }
591 }
592
593 public:
594 static void test() {
595 testResizeResource();
596 testResizeNonResource();
597 }
598
599 };
600
601 void TestBitMap_test() {
602 TestBitMap::test();
603 }
604 #endif
605
606
607 BitMap2D::BitMap2D(bm_word_t* map, idx_t size_in_slots, idx_t bits_per_slot)
|
565 assert(map.is_same(map2), "could be");
566 }
567
568 {
569 BitMap map(BITMAP_SIZE, in_resource_area);
570 map.resize(BITMAP_SIZE, in_resource_area);
571 fillBitMap(map);
572
573 BitMap map2(BITMAP_SIZE, in_resource_area);
574 fillBitMap(map2);
575 assert(map.is_same(map2), "could be");
576 }
577 }
578
579 static void testResizeResource() {
580 ResourceMark rm;
581 testResize(true);
582 }
583
584 static void testResizeNonResource() {
585 const uintx bitmap_bytes = BITMAP_SIZE / BitsPerByte;
586
587 // Test the default behavior
588 testResize(false);
589
590 {
591 // Make sure that AllocatorMallocLimit is larger than our allocation request
592 // forcing it to call standard malloc()
593 UIntFlagSetting fs(ArrayAllocatorMallocLimit, bitmap_bytes * 4);
594 testResize(false);
595 }
596 {
597 // Make sure that AllocatorMallocLimit is smaller than our allocation request
598 // forcing it to call mmap() (or equivalent)
599 UIntFlagSetting fs(ArrayAllocatorMallocLimit, bitmap_bytes / 4);
600 testResize(false);
601 }
602 }
603
604 public:
605 static void test() {
606 testResizeResource();
607 testResizeNonResource();
608 }
609
610 };
611
612 void TestBitMap_test() {
613 TestBitMap::test();
614 }
615 #endif
616
617
618 BitMap2D::BitMap2D(bm_word_t* map, idx_t size_in_slots, idx_t bits_per_slot)
|