< prev index next >
src/hotspot/share/gc/shenandoah/shenandoahBarrierSetNMethod.cpp
Print this page
rev 58162 : 8239926: Shenandoah: Shenandoah needs to mark nmethod's metadata
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
+ * Copyright (c) 2019, 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -22,10 +22,11 @@
*
*/
#include "precompiled.hpp"
+#include "gc/shenandoah/shenandoahBarrierSet.hpp"
#include "gc/shenandoah/shenandoahBarrierSetNMethod.hpp"
#include "gc/shenandoah/shenandoahClosures.inline.hpp"
#include "gc/shenandoah/shenandoahCodeRoots.hpp"
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
#include "gc/shenandoah/shenandoahLock.hpp"
@@ -43,10 +44,20 @@
// Some other thread got here first and healed the oops
// and disarmed the nmethod.
return true;
}
+ // Mark phase nmethod barrier, keep the nmethod metadata alive
+ if (ShenandoahHeap::heap()->is_concurrent_mark_in_progress()) {
+ ShenandoahNMethod::keep_metadata_alive(nm);
+ ShenandoahNMethod::disarm_nmethod(nm);
+ return true;
+ }
+
+ ShenandoahHeap* const heap = ShenandoahHeap::heap();
+
+ assert(heap->is_concurrent_root_in_progress(), "What else?");
if (nm->is_unloading()) {
// We don't need to take the lock when unlinking nmethods from
// the Method, because it is only concurrently unlinked by
// the entry barrier, which acquires the per nmethod lock.
nm->unlink_from_method();
< prev index next >