< prev index next >

src/hotspot/share/gc/z/zNMethod.cpp

Print this page
rev 54936 : imported patch 8221734-v3
   1 /*
   2  * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 268 
 269   virtual void do_nmethod(nmethod* nm) {
 270     if (failed()) {
 271       return;
 272     }
 273 
 274     if (!nm->is_alive()) {
 275       return;
 276     }
 277 
 278     ZLocker<ZReentrantLock> locker(ZNMethod::lock_for_nmethod(nm));
 279 
 280     if (nm->is_unloading()) {
 281       // Unlinking of the dependencies must happen before the
 282       // handshake separating unlink and purge.
 283       nm->flush_dependencies(false /* delete_immediately */);
 284 
 285       // We don't need to take the lock when unlinking nmethods from
 286       // the Method, because it is only concurrently unlinked by
 287       // the entry barrier, which acquires the per nmethod lock.
 288       nm->unlink_from_method(false /* acquire_lock */);
 289       return;
 290     }
 291 
 292     // Heal oops and disarm
 293     ZNMethodOopClosure cl;
 294     ZNMethod::nmethod_oops_do(nm, &cl);
 295     ZNMethod::disarm_nmethod(nm);
 296 
 297     // Clear compiled ICs and exception caches
 298     if (!nm->unload_nmethod_caches(_unloading_occurred)) {
 299       set_failed();
 300     }
 301   }
 302 
 303   bool failed() const {
 304     return Atomic::load(&_failed);
 305   }
 306 };
 307 
 308 class ZNMethodUnlinkTask : public ZTask {


   1 /*
   2  * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 268 
 269   virtual void do_nmethod(nmethod* nm) {
 270     if (failed()) {
 271       return;
 272     }
 273 
 274     if (!nm->is_alive()) {
 275       return;
 276     }
 277 
 278     ZLocker<ZReentrantLock> locker(ZNMethod::lock_for_nmethod(nm));
 279 
 280     if (nm->is_unloading()) {
 281       // Unlinking of the dependencies must happen before the
 282       // handshake separating unlink and purge.
 283       nm->flush_dependencies(false /* delete_immediately */);
 284 
 285       // We don't need to take the lock when unlinking nmethods from
 286       // the Method, because it is only concurrently unlinked by
 287       // the entry barrier, which acquires the per nmethod lock.
 288       nm->unlink_from_method();
 289       return;
 290     }
 291 
 292     // Heal oops and disarm
 293     ZNMethodOopClosure cl;
 294     ZNMethod::nmethod_oops_do(nm, &cl);
 295     ZNMethod::disarm_nmethod(nm);
 296 
 297     // Clear compiled ICs and exception caches
 298     if (!nm->unload_nmethod_caches(_unloading_occurred)) {
 299       set_failed();
 300     }
 301   }
 302 
 303   bool failed() const {
 304     return Atomic::load(&_failed);
 305   }
 306 };
 307 
 308 class ZNMethodUnlinkTask : public ZTask {


< prev index next >