make_unloaded assert/if?

Krystal Mok rednaxelafx at gmail.com
Mon Mar 24 17:56:18 UTC 2014


Hi Eric,

Just looking at the code, the apparent difference is that an assert() only
does the checking when -DASSERT is defined, which means that check won't be
in product builds.

On the other hand, the explicit if() check will be available in product
builds.
But that piece of code is guarded with WizardMode which is only available
in debug builds, too...

So yeah, I think you're reading it right, that the later if() should never
happen.

- Kris


On Mon, Mar 24, 2014 at 9:15 AM, Eric Caspole <eric.caspole at amd.com> wrote:

> In nmethod::make_unloaded, at line 1214, it asserts is_gc_active().
> Then at line 1225 the print line is
>  if (!Universe::heap()->is_gc_active())
> so it will never happen? Am I reading this right?
>
>
> hotspot/src/share/vm/code/nmethod.cpp
>
> 1207 void nmethod::make_unloaded(BoolObjectClosure* is_alive, oop cause) {
> 1208
> 1209   post_compiled_method_unload();
> 1210
> 1211   // Since this nmethod is being unloaded, make sure that dependencies
> 1212   // recorded in instanceKlasses get flushed and pass non-NULL
> closure to
> 1213   // indicate that this work is being done during a GC.
> 1214   assert(Universe::heap()->is_gc_active(), "should only be called
> during gc");
> 1215   assert(is_alive != NULL, "Should be non-NULL");
> 1216   // A non-NULL is_alive closure indicates that this is being called
> during GC.
> 1217   flush_dependencies(is_alive);
> 1218
> 1219   // Break cycle between nmethod & method
> 1220   if (TraceClassUnloading && WizardMode) {
> 1221     tty->print_cr("[Class unloading: Making nmethod " INTPTR_FORMAT
> 1222                   " unloadable], Method*(" INTPTR_FORMAT
> 1223                   "), cause(" INTPTR_FORMAT ")",
> 1224                   this, (address)_method, (address)cause);
> 1225     if (!Universe::heap()->is_gc_active())
> 1226       cause->klass()->print();
> 1227   }
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20140324/3a8cfbdf/attachment-0001.html>


More information about the hotspot-compiler-dev mailing list