Skip to content

Commit

Permalink
Scan throw helper for unsupported EH (#1037)
Browse files Browse the repository at this point in the history
Fixes #991.
  • Loading branch information
MichalStrehovsky authored Apr 29, 2021
1 parent 28ddf89 commit 4a94374
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/coreclr/tools/aot/ILCompiler.Compiler/IL/ILImporter.Scanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,17 @@ private void StartImportingBasicBlock(BasicBlock basicBlock)
MarkBasicBlock(_basicBlocks[region.HandlerOffset]);
if (region.Kind == ILExceptionRegionKind.Filter)
MarkBasicBlock(_basicBlocks[region.FilterOffset]);

// Once https://github.com/dotnet/corert/issues/3460 is done, this should be deleted.
// Throwing InvalidProgram is not great, but we want to do *something* if this happens
// because doing nothing means problems at runtime. This is not worth piping a
// a new exception with a fancy message for.
if (region.Kind == ILExceptionRegionKind.Catch)
{
TypeDesc catchType = (TypeDesc)_methodIL.GetObject(region.ClassToken);
if (catchType.IsRuntimeDeterminedSubtype)
_dependencies.Add(_factory.MethodEntrypoint(_factory.TypeSystemContext.GetHelperEntryPoint("ThrowHelpers", "ThrowInvalidProgramException")), "Unsupported EH");
}
}
}

Expand Down

0 comments on commit 4a94374

Please sign in to comment.