< prev index next >

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

Print this page
rev 54697 : imported patch 8221734-v2-merge
rev 54698 : imported patch 8221734-v2
   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  */


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


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


< prev index next >