Improper usage of CHECK macros generates unreachable code

John Rose John.Rose at Sun.COM
Wed Oct 7 22:01:11 PDT 2009


On Oct 7, 2009, at 9:31 PM, David Holmes - Sun Microsystems wrote:

> The assumption was that the functionality performed by CHECK was  
> actually necessary, hence the variables would not be useless nor the  
> test duplicated.

OK, I missed that. I was working from Volker's initial example, of  
create_string_variable, where the CHECK is not necessary, since it has  
the same TRAPS contract with its caller that its caller has with it.   
(That is, all callers of create_string_variable also use the CHECK  
macro, which contains a duplicable test.)  Your example of  
ObjectSynchronizer::complete_exit is similar.  In those cases, if the  
middle function uses CHECK, as well as the outer function, there is a  
duplicated test (for an exception posted to the thread object by the  
inner function).

-- John


More information about the hotspot-dev mailing list