< prev index next >
src/hotspot/share/gc/shared/barrierSetNMethod.cpp
Print this page
rev 58823 : [mq]: aarch64-jdk-nmethod-barriers-3.patch
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2020, Oracle and/or its affiliates. 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.
@@ -60,10 +60,20 @@
}
assert(!nm->is_osr_method(), "Should not reach here");
// Called upon first entry after being armed
bool may_enter = bs_nm->nmethod_entry_barrier(nm);
+
+ // Diagnostic option to force deoptimization 1 in 3 times. It is otherwise
+ // a very rare event.
+ if (DeoptimizeNMethodBarriersALot) {
+ static volatile uint32_t counter=0;
+ if (Atomic::add(&counter, 1u) % 3 == 0) {
+ may_enter = false;
+ }
+ }
+
if (!may_enter) {
log_trace(nmethod, barrier)("Deoptimizing nmethod: " PTR_FORMAT, p2i(nm));
bs_nm->deoptimize(nm, return_address_ptr);
}
return may_enter ? 0 : 1;
< prev index next >