未验证 提交 ba0f8e13 编写于 作者: Z Zoltan Varga 提交者: GitHub

[mono][wasm] Store the exception object in a GC handle while it is being thrown. (#67121)

上级 cd5beb14
......@@ -2493,7 +2493,8 @@ mono_handle_exception_internal (MonoContext *ctx, MonoObject *obj, gboolean resu
* methods, then execute the clause and the rest of the method
* using the interpreter.
*/
jit_tls->resume_state.ex_obj = obj;
g_assert (!jit_tls->resume_state.ex_gchandle);
jit_tls->resume_state.ex_gchandle = mono_gchandle_new_internal ((MonoObject*)obj, TRUE);
jit_tls->resume_state.ji = ji;
jit_tls->resume_state.clause_index = i;
jit_tls->resume_state.il_state = frame.il_state;
......@@ -3579,13 +3580,17 @@ mini_llvmonly_resume_exception_il_state (MonoLMF *lmf, gpointer info)
}
jit_tls->resume_state.il_state = NULL;
MonoObject *ex_obj = mono_gchandle_get_target_internal (jit_tls->resume_state.ex_gchandle);
mono_gchandle_free_internal (jit_tls->resume_state.ex_gchandle);
jit_tls->resume_state.ex_gchandle = NULL;
/* Pop the LMF frame so the caller doesn't have to do it */
mono_set_lmf ((MonoLMF *)(((gsize)lmf->previous_lmf) & ~3));
MonoJitInfo *ji = jit_tls->resume_state.ji;
int clause_index = jit_tls->resume_state.clause_index;
MonoJitExceptionInfo *ei = &ji->clauses [clause_index];
gboolean r = mini_get_interp_callbacks ()->run_clause_with_il_state (il_state, clause_index, ei->handler_start, NULL, jit_tls->resume_state.ex_obj, NULL, MONO_EXCEPTION_CLAUSE_NONE);
gboolean r = mini_get_interp_callbacks ()->run_clause_with_il_state (il_state, clause_index, ei->handler_start, NULL, ex_obj, NULL, MONO_EXCEPTION_CLAUSE_NONE);
if (r)
/* Another exception thrown, continue unwinding */
mono_llvm_cpp_throw_exception ();
......
......@@ -130,6 +130,7 @@ typedef struct {
int first_filter_idx, filter_idx;
/* MonoMethodILState */
gpointer il_state;
MonoGCHandle ex_gchandle;
} ResumeState;
typedef void (*MonoAbortFunction)(MonoObject*);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册