RFR(XS) 8009026: [parfait] Null pointer deference in hotspot/src/share/vm/code/nmethod.cpp

Nils Eliasson nils.eliasson at oracle.com
Wed Apr 10 04:45:20 PDT 2013


Hi,

I know I am a bit late to the game, but I think I should raise the issue 
with false positives in Parfait. By fixing non-bugs we risk introducing 
new bugs into otherwise perfectly fine code by introducing unnecessary 
complexity.

In this bug (8009026) Parfait complains about 'this' being null in the 
constructor of nmethod. For non-throwing new that isn't a problem. If 
the allocation fails the constructor isn't run (Section 5.3.4 (13) of 
the C++03 standard). The fix unfortunately introduces a dependence 
between heap::allocate and codecache::has_space. If the allocate code is 
changed (as I was just about to do) without also fixing the 
codecache::has_space(), it may succeed while heap::allocate still 
returns null - and then we will fail the guarantee(), aborting the VM, 
instead of just skipping the compile as we used to. Also in the current 
implementation has_space() is more conservative than allocate() - so we 
will fail some compiles that would have worked before the fix.

If something should have been fixed, it should possibly been to have 
added an empty throw() to the new overloading, making it explicit that 
we want the empty exception-specification variant of new().

//Nils





More information about the hotspot-compiler-dev mailing list