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

Coleen Phillimore coleen.phillimore at oracle.com
Thu Jan 8 14:02:55 UTC 2015

This change looks good to me.  Pending changing "vmassert" in the 
message back to "assert".  I'm not sure what compatibility risk this has 
but it would be safe.   Can you find one of the internal tests that uses 
assert and change to use vmassert as a test?

I think when we do the full change from assert -> vmassert that with the 
compatibility line, changes should export cleanly to 8u-dev.   They'll 
just look like we changes vmassert too.   It would be useful to try this 
as an experiment though.

Thanks for moving this forward.  There's another thread about C++11 use 
and it's only a matter of time before this really bites us.

On 12/30/14, 7:47 PM, 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,
> 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