提交 86125c3e 编写于 作者: N never

6968367: can_post_on_exceptions is still using VM_DeoptimizeFrame in some places

Reviewed-by: kvn, twisti
上级 31c60d0d
......@@ -107,7 +107,6 @@ static void deopt_caller() {
RegisterMap reg_map(thread, false);
frame runtime_frame = thread->last_frame();
frame caller_frame = runtime_frame.sender(&reg_map);
// bypass VM_DeoptimizeFrame and deoptimize the frame directly
Deoptimization::deoptimize_frame(thread, caller_frame.id());
assert(caller_is_deopted(), "Must be deoptimized");
}
......@@ -368,8 +367,7 @@ JRT_BLOCK_ENTRY(address, Runtime1::counter_overflow(JavaThread* thread, int bci,
if (osr_nm != NULL) {
RegisterMap map(thread, false);
frame fr = thread->last_frame().sender(&map);
VM_DeoptimizeFrame deopt(thread, fr.id());
VMThread::execute(&deopt);
Deoptimization::deoptimize_frame(thread, fr.id());
}
JRT_BLOCK_END
return NULL;
......@@ -441,8 +439,8 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* t
// We don't really want to deoptimize the nmethod itself since we
// can actually continue in the exception handler ourselves but I
// don't see an easy way to have the desired effect.
VM_DeoptimizeFrame deopt(thread, caller_frame.id());
VMThread::execute(&deopt);
Deoptimization::deoptimize_frame(thread, caller_frame.id());
assert(caller_is_deopted(), "Must be deoptimized");
return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls();
}
......@@ -835,8 +833,7 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i
nm->make_not_entrant();
}
VM_DeoptimizeFrame deopt(thread, caller_frame.id());
VMThread::execute(&deopt);
Deoptimization::deoptimize_frame(thread, caller_frame.id());
// Return to the now deoptimized frame.
}
......
......@@ -154,6 +154,7 @@ jvmtiExtensions.hpp allocation.hpp
jvmtiExtensions.hpp jvmti.h
jvmtiExtensions.hpp jvmtiEnv.hpp
jvmtiImpl.cpp deoptimization.hpp
jvmtiImpl.cpp exceptions.hpp
jvmtiImpl.cpp handles.hpp
jvmtiImpl.cpp handles.inline.hpp
......
......@@ -87,6 +87,7 @@ jvmtiEnv.cpp vmThread.hpp
jvmtiEnv.hpp jvmtiEnvBase.hpp
jvmtiEnvBase.cpp biasedLocking.hpp
jvmtiEnvBase.cpp deoptimization.hpp
jvmtiEnvBase.cpp interfaceSupport.hpp
jvmtiEnvBase.cpp jfieldIDWorkaround.hpp
jvmtiEnvBase.cpp jvmtiEnv.hpp
......
......@@ -1407,8 +1407,7 @@ JvmtiEnv::PopFrame(JavaThread* java_thread) {
// If any of the top 2 frames is a compiled one, need to deoptimize it
for (int i = 0; i < 2; i++) {
if (!is_interpreted[i]) {
VM_DeoptimizeFrame op(java_thread, frame_sp[i]);
VMThread::execute(&op);
Deoptimization::deoptimize_frame(java_thread, frame_sp[i]);
}
}
......
......@@ -1322,8 +1322,7 @@ JvmtiEnvBase::check_top_frame(JavaThread* current_thread, JavaThread* java_threa
if (!vf->fr().can_be_deoptimized()) {
return JVMTI_ERROR_OPAQUE_FRAME;
}
VM_DeoptimizeFrame deopt(java_thread, jvf->fr().id());
VMThread::execute(&deopt);
Deoptimization::deoptimize_frame(java_thread, jvf->fr().id());
}
// Get information about method return type
......
......@@ -799,8 +799,7 @@ void VM_GetOrSetLocal::doit() {
// Schedule deoptimization so that eventually the local
// update will be written to an interpreter frame.
VM_DeoptimizeFrame deopt(_jvf->thread(), _jvf->fr().id());
VMThread::execute(&deopt);
Deoptimization::deoptimize_frame(_jvf->thread(), _jvf->fr().id());
// Now store a new value for the local which will be applied
// once deoptimization occurs. Note however that while this
......
......@@ -1065,7 +1065,9 @@ void Deoptimization::deoptimize(JavaThread* thread, frame fr, RegisterMap *map)
}
void Deoptimization::deoptimize_frame(JavaThread* thread, intptr_t* id) {
void Deoptimization::deoptimize_frame_internal(JavaThread* thread, intptr_t* id) {
assert(thread == Thread::current() || SafepointSynchronize::is_at_safepoint(),
"can only deoptimize other thread at a safepoint");
// Compute frame and register map based on thread and sp.
RegisterMap reg_map(thread, UseBiasedLocking);
frame fr = thread->last_frame();
......@@ -1076,6 +1078,16 @@ void Deoptimization::deoptimize_frame(JavaThread* thread, intptr_t* id) {
}
void Deoptimization::deoptimize_frame(JavaThread* thread, intptr_t* id) {
if (thread == Thread::current()) {
Deoptimization::deoptimize_frame_internal(thread, id);
} else {
VM_DeoptimizeFrame deopt(thread, id);
VMThread::execute(&deopt);
}
}
// JVMTI PopFrame support
JRT_LEAF(void, Deoptimization::popframe_preserve_args(JavaThread* thread, int bytes_to_save, void* start_address))
{
......
......@@ -216,6 +216,10 @@ class Deoptimization : AllStatic {
// Only called from VMDeoptimizeFrame
// @argument thread. Thread where stub_frame resides.
// @argument id. id of frame that should be deoptimized.
static void deoptimize_frame_internal(JavaThread* thread, intptr_t* id);
// If thread is not the current thread then execute
// VM_DeoptimizeFrame otherwise deoptimize directly.
static void deoptimize_frame(JavaThread* thread, intptr_t* id);
// Statistics
......
......@@ -940,8 +940,7 @@ void ThreadSafepointState::handle_polling_page_exception() {
// as otherwise we may never deliver it.
if (thread()->has_async_condition()) {
ThreadInVMfromJavaNoAsyncException __tiv(thread());
VM_DeoptimizeFrame deopt(thread(), caller_fr.id());
VMThread::execute(&deopt);
Deoptimization::deoptimize_frame(thread(), caller_fr.id());
}
// If an exception has been installed we must check for a pending deoptimization
......
......@@ -100,7 +100,7 @@ VM_DeoptimizeFrame::VM_DeoptimizeFrame(JavaThread* thread, intptr_t* id) {
void VM_DeoptimizeFrame::doit() {
Deoptimization::deoptimize_frame(_thread, _id);
Deoptimization::deoptimize_frame_internal(_thread, _id);
}
......
......@@ -231,12 +231,18 @@ class VM_Deoptimize: public VM_Operation {
bool allow_nested_vm_operations() const { return true; }
};
// Deopt helper that can deoptimize frames in threads other than the
// current thread. Only used through Deoptimization::deoptimize_frame.
class VM_DeoptimizeFrame: public VM_Operation {
friend class Deoptimization;
private:
JavaThread* _thread;
intptr_t* _id;
public:
VM_DeoptimizeFrame(JavaThread* thread, intptr_t* id);
public:
VMOp_Type type() const { return VMOp_DeoptimizeFrame; }
void doit();
bool allow_nested_vm_operations() const { return true; }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册