/* * Copyright (c) 2020, 2022, 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. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
if (last_frame.is_safepoint_blob_frame()) {
last_frame = last_frame.sender(®ister_map);
}
ResourceMark rm; if (_deopt != NULL && last_frame.is_compiled_frame() && last_frame.can_be_deoptimized()) {
CloseScopedMemoryFindOopClosure cl(_deopt);
CompiledMethod* cm = last_frame.cb()->as_compiled_method();
/* FIXME: this doesn't work if reachability fences are violated by C2 last_frame.oops_do(&cl, NULL, ®ister_map); if (cl.found()) { //Found the deopt oop in a compiled method; deoptimize. Deoptimization::deoptimize(jt, last_frame); }
so... we unconditionally deoptimize, for now: */
Deoptimization::deoptimize(jt, last_frame);
}
constint max_critical_stack_depth = 10; int depth = 0; for (vframeStream stream(jt); !stream.at_end(); stream.next()) {
Method* m = stream.method(); if (m->is_scoped()) {
StackValueCollection* locals = stream.asJavaVFrame()->locals(); for (int i = 0; i < locals->size(); i++) {
StackValue* var = locals->at(i); if (var->type() == T_OBJECT) { if (var->get_obj() == JNIHandles::resolve(_deopt)) {
assert(depth < max_critical_stack_depth, "can't have more than %d critical frames", max_critical_stack_depth);
_found = true; return;
}
}
} break;
}
depth++; #ifndef ASSERT if (depth >= max_critical_stack_depth) { break;
} #endif
}
}
};
/* * This function performs a thread-local handshake against all threads running at the time * the given session (deopt) was closed. If the handshake for a given thread is processed while * one or more threads is found inside a scoped method (that is, a method inside the ScopedMemoryAccess * class annotated with the '@Scoped' annotation), and whose local variables mention the session being * closed (deopt), this method returns false, signalling that the session cannot be closed safely.
*/
JVM_ENTRY(jboolean, ScopedMemoryAccess_closeScope(JNIEnv *env, jobject receiver, jobject deopt, jobject exception))
CloseScopedMemoryClosure cl(deopt, exception);
Handshake::execute(&cl); return !cl._found;
JVM_END
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.