RFR: 8155638: Resource allocated BitMaps are often cleared twice

Stefan Karlsson stefan.karlsson at oracle.com
Fri May 6 10:46:57 UTC 2016

Hi all,

Please review this patch to remove some redundant clearing of bitmaps.


It used to be the case that Resource allocated bitmaps were _not_ 
cleared in the constructor, and that explicit calls to clear() were 
needed. However, when G1 was open sourced all the Resource allocated 
bitmaps were always cleared in the BitMap constructor:


It's apparent that the lazy clearing of bitmaps was used to skip 
clearing when it wasn't necessary.

See, for example:

where _requires_phi_function is cleared even when all bits are going to 
be set to 1.


in MethodLiveness::BasicBlock::get_liveness_at

1010   ResourceBitMap g(_gen.size()); g.set_from(_gen);
1011   ResourceBitMap k(_kill.size()); k.set_from(_kill);

where we first clear the bitmap, then copy all bits with set_from. 
Before G1 was introduced, the unnecessary clearing was not done.

I've created a new CR for these kind of issues:

https://bugs.openjdk.java.net/browse/JDK-8156207 - Resource allocated 
BitMaps are often cleared unnecessarily

During the review of "8141501: Problems with BitMap buffer management", 
I got the request do the following change:


I tried it, but felt that the change didn't fit the surrounding code, 
where shallow-copying was used for other bitmaps. It would be great if 
reviewers of this patch could decide if I should change the code as 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20160506/bdd2b6b2/attachment-0001.html>

More information about the hotspot-compiler-dev mailing list