RFR: 8151439: Inline the BitMap constructor

Stefan Karlsson stefan.karlsson at oracle.com
Wed Mar 9 11:37:40 UTC 2016


On 2016-03-08 20:39, Kim Barrett wrote:
>> On Mar 8, 2016, at 5:52 AM, Stefan Karlsson <stefan.karlsson at oracle.com> wrote:
>>
>> Hi all,
>>
>> Please review this patch to inline the BitMap constructor. This will allow us to efficiently use temporary, stack-allocated BitMaps.
>>
>> http://cr.openjdk.java.net/~stefank/8151439/webrev.00/
>> https://bugs.openjdk.java.net/browse/JDK-8151439
>>
>> A code example of why we want to inline the BitMap constructor:
>> void MyClass::set_bit(idx_t x) {
>>     BitMap(&_bits, BitsPerWord).par_set_bit(x).
>> }
>>
>> We could have used an instance of a BitMap in MyClass, but that would store both a bm_word_t* and the size of the bitmap storage in MyClass. Since the size is a compile-time constant, we can use the above construct to only store a bm_word_t field in MyClass, and thereby reduce the size of MyClass. By inlining the constructor, we get rid of the extra overhead of creating a BitMap.
>>
>> Thanks,
>> StefanK
> Looks good.

Thanks.

>
> ------------------------------------------------------------------------------
> src/share/vm/utilities/bitMap.cpp
>    37   assert(sizeof(bm_word_t) == BytesPerWord, "Implementation assumption.");
>
> This assert can be removed too, due to the new STATIC_ASSERT.
>
> ------------------------------------------------------------------------------
>
I'll remove this before pushing.

StefanK


More information about the hotspot-dev mailing list