RFR: 8068396: Rename assert() to vmassert()

David Holmes david.holmes at oracle.com
Wed Dec 31 01:22:18 UTC 2014

Hi Kim,

On 31/12/2014 10:47 AM, Kim Barrett wrote:
> Please review this change to rename the assert macro to vmassert, as a
> step toward eliminating the name clash between the VM's assert() macro
> and the standard (<assert.h> / <cassert>) assert() macro.
> [Coleen has volunteered sponsorship, since she's been prodding me to
> make this change for months. Changes are based on jdk9/hs-rt repo.]
> CR:
> https://bugs.openjdk.java.net/browse/JDK-8068396
> Webrev:
> http://cr.openjdk.java.net/~kbarrett/8068396/webrev
> Testing:
> jprt. Also manually verified asserts occur as expected in fastdebug
> build and not in release build.
> Details of the changes are:
> * Renamed the assert macro to vmassert. Also renamed the assert_status
> macro to vmassert_status, for name consistency.
> * Added temporary synonym macros of assert => vmassert and
> assert_status => vmassert_status, for backward compatibility. This
> change does not modify the (18K+) occurrences of the old macro names
> to use the new names. The synonyms allow that renaming to occur
> incrementally, with removal of the synonyms once renaming is complete.
> * Simplified the definition of vmassert_status to just use vmassert,

But by doing that you are forcing evaluation of err_msg and strerror in 
all cases, rather than only when the assertion condition is false.


> rather than duplicating much of the implementation of vmassert. While
> I was at it, added back a comma in the message that was (probably
> accidentally) removed by 6888954: argument formatting for assert() and
> friends (hg:1410 4/22/2010).
> * Moved the assert_if_no_error macro to utilities/xmlstream.cpp, which
> is the only place it is used. Also simplified the definition to just
> use vmassert, rather than duplicating much of the implementation of
> vmassert.
> * Changed shark/llvmHeaders.hpp to just define assert as a synonym of
> vmassert, rather than duplicating the definition of [vm]assert. [This
> is an ugly hack, but still an improvement on what was there. This is a
> place that could quickly benefit from updating uses.]
> * Removed the non-product AssertRepeat option and the associated
> support by the [vm]assert macro. Support for this option has been
> broken since 6888954: argument formatting for assert() and friends
> (hg:1410 4/22/2010), due to a missing line continuation in the
> corresponding definition of the assert macro.  Since the feature
> doesn't look very interesting, has been broken for nearly 5 years, and
> can easily be resurrected if needed, I chose to simplify by removal.

More information about the hotspot-dev mailing list