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