Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/7.0] [mono][interp] Fix an issue with deopt and interpreter tiering. #77059

Merged
merged 2 commits into from
Nov 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions src/mono/mono/mini/interp/interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ struct FrameClauseArgs {
const guint16 *end_at_ip;
/* Frame that is executing this clause */
InterpFrame *exec_frame;
gboolean run_until_end;
};

/*
Expand Down Expand Up @@ -3595,6 +3596,13 @@ interp_exec_method (InterpFrame *frame, ThreadContext *context, FrameClauseArgs

INIT_INTERP_STATE (frame, clause_args);

if (clause_args && clause_args->run_until_end)
/*
* Called from run_with_il_state to run the method until the end.
* Clear this out so it doesn't confuse the rest of the code.
*/
clause_args = NULL;

#ifdef ENABLE_EXPERIMENT_TIERED
mini_tiered_inc (frame->imethod->method, &frame->imethod->tiered_counter, 0);
#endif
Expand Down Expand Up @@ -7067,15 +7075,15 @@ MINT_IN_CASE(MINT_BRTRUE_I8_SP) ZEROP_SP(gint64, !=); MINT_IN_BREAK;

MINT_IN_CASE(MINT_TIER_ENTER_METHOD) {
frame->imethod->entry_count++;
if (frame->imethod->entry_count > INTERP_TIER_ENTRY_LIMIT)
if (frame->imethod->entry_count > INTERP_TIER_ENTRY_LIMIT && !clause_args)
ip = mono_interp_tier_up_frame_enter (frame, context);
else
ip++;
MINT_IN_BREAK;
}
MINT_IN_CASE(MINT_TIER_PATCHPOINT) {
frame->imethod->entry_count++;
if (frame->imethod->entry_count > INTERP_TIER_ENTRY_LIMIT)
if (frame->imethod->entry_count > INTERP_TIER_ENTRY_LIMIT && !clause_args)
ip = mono_interp_tier_up_frame_patchpoint (frame, context, ip [1]);
else
ip += 2;
Expand Down Expand Up @@ -7656,10 +7664,13 @@ interp_run_clause_with_il_state (gpointer il_state_ptr, int clause_index, MonoOb
clause_args.start_with_ip = (const guint16*)ei->data.filter;
else
clause_args.start_with_ip = (const guint16*)ei->handler_start;
if (clause_type == MONO_EXCEPTION_CLAUSE_NONE || clause_type == MONO_EXCEPTION_CLAUSE_FILTER)
clause_args.end_at_ip = (const guint16*)clause_args.start_with_ip + 0xffffff;
else
if (clause_type == MONO_EXCEPTION_CLAUSE_NONE || clause_type == MONO_EXCEPTION_CLAUSE_FILTER) {
/* Run until the end */
clause_args.end_at_ip = NULL;
clause_args.run_until_end = TRUE;
} else {
clause_args.end_at_ip = (const guint16*)ei->data.handler_end;
}
clause_args.exec_frame = &frame;

if (clause_type == MONO_EXCEPTION_CLAUSE_NONE || clause_type == MONO_EXCEPTION_CLAUSE_FILTER)
Expand Down