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

[mono][interpreter] Throw when basic blocks after branch are not created #79246

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
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
Next Next commit
throw when last BB is dead
  • Loading branch information
kotlarmilos committed Dec 5, 2022
commit 30d3f6dbc2d32a7c3fd3df6287239f532426f442
7 changes: 7 additions & 0 deletions src/mono/mono/mini/interp/transform.c
Original file line number Diff line number Diff line change
@@ -4385,6 +4385,7 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header,
int num_args = signature->hasthis + signature->param_count;
int arglist_local = -1;
int call_handler_count = 0;
int start_new_bblock = 0;
gboolean ret = TRUE;
gboolean emitted_funccall_seq_point = FALSE;
guint32 *arg_locals = NULL;
@@ -4572,6 +4573,7 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header,

InterpBasicBlock *new_bb = td->offset_to_bb [in_offset];
if (new_bb != NULL && td->cbb != new_bb) {
start_new_bblock = 0;
/* We are starting a new basic block. Change cbb and link them together */
if (link_bblocks) {
/*
@@ -4625,6 +4627,7 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header,
continue;
}

start_new_bblock = 1;
if (td->verbose_level > 1) {
g_print ("IL_%04lx %-10s, sp %ld, %s %-12s\n",
td->ip - td->il_code,
@@ -7701,6 +7704,10 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header,
}

g_assert (td->ip == end);
if (start_new_bblock != 1) {
mono_error_set_generic_error (error, "System", "InvalidProgramException", "Invalid IL code");
goto exit;
}

if (inlining) {
// When inlining, all return points branch to this bblock. Code generation inside the caller
6 changes: 0 additions & 6 deletions src/tests/issues.targets
Original file line number Diff line number Diff line change
@@ -2210,12 +2210,6 @@
<ExcludeList Include = "$(XunitTestBinBase)/JIT/jit64/localloc/ehverify/eh07_large/**">
<Issue>https://github.com/dotnet/runtime/issues/54395</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/JIT/jit64/verif/sniff/fg/ver_fg_13/**">
<Issue>https://github.com/dotnet/runtime/issues/54396</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/Loader/classloader/Statics/Misc/LiteralStatic/**">
<Issue>https://github.com/dotnet/runtime/issues/54560</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/JIT/Regression/CLR-x86-JIT/V1-M12-Beta2/b59952/b59952/**">
<Issue>needs triage</Issue>
</ExcludeList>