44 ShenandoahReentrantLock* lock = ShenandoahNMethod::lock_for_nmethod(nm);
45 assert(lock != nullptr, "Must be");
46 ShenandoahReentrantLocker locker(lock);
47
48 if (!is_armed(nm)) {
49 // Some other thread managed to complete while we were
50 // waiting for lock. No need to continue.
51 return true;
52 }
53
54 MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, Thread::current());)
55
56 if (nm->is_unloading()) {
57 // We don't need to take the lock when unlinking nmethods from
58 // the Method, because it is only concurrently unlinked by
59 // the entry barrier, which acquires the per nmethod lock.
60 nm->unlink_from_method();
61
62 // We can end up calling nmethods that are unloading
63 // since we clear compiled ICs lazily. Returning false
64 // will re-resovle the call and update the compiled IC.
65 return false;
66 }
67
68 // Heal oops
69 ShenandoahNMethod::heal_nmethod(nm);
70
71 // CodeCache unloading support
72 nm->mark_as_maybe_on_stack();
73
74 // Disarm
75 ShenandoahNMethod::disarm_nmethod(nm);
76 return true;
77 }
|
44 ShenandoahReentrantLock* lock = ShenandoahNMethod::lock_for_nmethod(nm);
45 assert(lock != nullptr, "Must be");
46 ShenandoahReentrantLocker locker(lock);
47
48 if (!is_armed(nm)) {
49 // Some other thread managed to complete while we were
50 // waiting for lock. No need to continue.
51 return true;
52 }
53
54 MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXWrite, Thread::current());)
55
56 if (nm->is_unloading()) {
57 // We don't need to take the lock when unlinking nmethods from
58 // the Method, because it is only concurrently unlinked by
59 // the entry barrier, which acquires the per nmethod lock.
60 nm->unlink_from_method();
61
62 // We can end up calling nmethods that are unloading
63 // since we clear compiled ICs lazily. Returning false
64 // will re-resolve the call and update the compiled IC.
65 return false;
66 }
67
68 // Heal oops
69 ShenandoahNMethod::heal_nmethod(nm);
70
71 // CodeCache unloading support
72 nm->mark_as_maybe_on_stack();
73
74 // Disarm
75 ShenandoahNMethod::disarm_nmethod(nm);
76 return true;
77 }
|