100 // now the choice is easy, since we have only one working |
100 // now the choice is easy, since we have only one working |
101 // implementation, namely, the simple binary tree (splaying |
101 // implementation, namely, the simple binary tree (splaying |
102 // temporarily disabled). |
102 // temporarily disabled). |
103 switch (dictionaryChoice) { |
103 switch (dictionaryChoice) { |
104 case FreeBlockDictionary<FreeChunk>::dictionaryBinaryTree: |
104 case FreeBlockDictionary<FreeChunk>::dictionaryBinaryTree: |
105 _dictionary = new BinaryTreeDictionary<FreeChunk, AdaptiveFreeList>(mr); |
105 _dictionary = new AFLBinaryTreeDictionary(mr); |
106 break; |
106 break; |
107 case FreeBlockDictionary<FreeChunk>::dictionarySplayTree: |
107 case FreeBlockDictionary<FreeChunk>::dictionarySplayTree: |
108 case FreeBlockDictionary<FreeChunk>::dictionarySkipList: |
108 case FreeBlockDictionary<FreeChunk>::dictionarySkipList: |
109 default: |
109 default: |
110 warning("dictionaryChoice: selected option not understood; using" |
110 warning("dictionaryChoice: selected option not understood; using" |
120 // has to have the klass's klassKlass allocated at a lower |
120 // has to have the klass's klassKlass allocated at a lower |
121 // address in the heap than the klass so that the klassKlass is |
121 // address in the heap than the klass so that the klassKlass is |
122 // moved to its new location before the klass is moved. |
122 // moved to its new location before the klass is moved. |
123 // Set the _refillSize for the linear allocation blocks |
123 // Set the _refillSize for the linear allocation blocks |
124 if (!use_adaptive_freelists) { |
124 if (!use_adaptive_freelists) { |
125 FreeChunk* fc = _dictionary->get_chunk(mr.word_size()); |
125 FreeChunk* fc = _dictionary->get_chunk(mr.word_size(), |
|
126 FreeBlockDictionary<FreeChunk>::atLeast); |
126 // The small linAB initially has all the space and will allocate |
127 // The small linAB initially has all the space and will allocate |
127 // a chunk of any size. |
128 // a chunk of any size. |
128 HeapWord* addr = (HeapWord*) fc; |
129 HeapWord* addr = (HeapWord*) fc; |
129 _smallLinearAllocBlock.set(addr, fc->size() , |
130 _smallLinearAllocBlock.set(addr, fc->size() , |
130 1024*SmallForLinearAlloc, fc->size()); |
131 1024*SmallForLinearAlloc, fc->size()); |
1645 } |
1646 } |
1646 |
1647 |
1647 FreeChunk* |
1648 FreeChunk* |
1648 CompactibleFreeListSpace::getChunkFromDictionary(size_t size) { |
1649 CompactibleFreeListSpace::getChunkFromDictionary(size_t size) { |
1649 assert_locked(); |
1650 assert_locked(); |
1650 FreeChunk* fc = _dictionary->get_chunk(size); |
1651 FreeChunk* fc = _dictionary->get_chunk(size, |
|
1652 FreeBlockDictionary<FreeChunk>::atLeast); |
1651 if (fc == NULL) { |
1653 if (fc == NULL) { |
1652 return NULL; |
1654 return NULL; |
1653 } |
1655 } |
1654 _bt.allocated((HeapWord*)fc, fc->size()); |
1656 _bt.allocated((HeapWord*)fc, fc->size()); |
1655 if (fc->size() >= size + MinChunkSize) { |
1657 if (fc->size() >= size + MinChunkSize) { |
1662 } |
1664 } |
1663 |
1665 |
1664 FreeChunk* |
1666 FreeChunk* |
1665 CompactibleFreeListSpace::getChunkFromDictionaryExact(size_t size) { |
1667 CompactibleFreeListSpace::getChunkFromDictionaryExact(size_t size) { |
1666 assert_locked(); |
1668 assert_locked(); |
1667 FreeChunk* fc = _dictionary->get_chunk(size); |
1669 FreeChunk* fc = _dictionary->get_chunk(size, |
|
1670 FreeBlockDictionary<FreeChunk>::atLeast); |
1668 if (fc == NULL) { |
1671 if (fc == NULL) { |
1669 return fc; |
1672 return fc; |
1670 } |
1673 } |
1671 _bt.allocated((HeapWord*)fc, fc->size()); |
1674 _bt.allocated((HeapWord*)fc, fc->size()); |
1672 if (fc->size() == size) { |
1675 if (fc->size() == size) { |
1675 } |
1678 } |
1676 assert(fc->size() > size, "get_chunk() guarantee"); |
1679 assert(fc->size() > size, "get_chunk() guarantee"); |
1677 if (fc->size() < size + MinChunkSize) { |
1680 if (fc->size() < size + MinChunkSize) { |
1678 // Return the chunk to the dictionary and go get a bigger one. |
1681 // Return the chunk to the dictionary and go get a bigger one. |
1679 returnChunkToDictionary(fc); |
1682 returnChunkToDictionary(fc); |
1680 fc = _dictionary->get_chunk(size + MinChunkSize); |
1683 fc = _dictionary->get_chunk(size + MinChunkSize, |
|
1684 FreeBlockDictionary<FreeChunk>::atLeast); |
1681 if (fc == NULL) { |
1685 if (fc == NULL) { |
1682 return NULL; |
1686 return NULL; |
1683 } |
1687 } |
1684 _bt.allocated((HeapWord*)fc, fc->size()); |
1688 _bt.allocated((HeapWord*)fc, fc->size()); |
1685 } |
1689 } |