Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Don't fall through endfinally and others #2560

Merged
merged 1 commit into from
Jan 21, 2017
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions src/Common/src/TypeSystem/IL/ILImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ private void ImportBasicBlock(BasicBlock basicBlock)
break;
case ILOpcode.endfinally:
ImportEndFinally();
break;
return;
case ILOpcode.leave:
{
int delta = (int)ReadILUInt32();
Expand Down Expand Up @@ -837,7 +837,7 @@ private void ImportBasicBlock(BasicBlock basicBlock)
break;
case ILOpcode.endfilter:
ImportEndFilter();
break;
return;
case ILOpcode.unaligned:
ImportUnalignedPrefix(ReadILByte());
continue;
Expand All @@ -864,7 +864,7 @@ private void ImportBasicBlock(BasicBlock basicBlock)
continue;
case ILOpcode.rethrow:
ImportRethrow();
break;
return;
case ILOpcode.sizeof_:
ImportSizeOf(ReadILToken());
break;
Expand Down
10 changes: 4 additions & 6 deletions src/ILCompiler.Compiler/src/Compiler/LibraryInitializers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public sealed class LibraryInitializers
private static readonly LibraryInitializerInfo[] s_assembliesWithLibraryInitializers =
{
new LibraryInitializerInfo(ClassLibraryPlaceHolderString),
new LibraryInitializerInfo("System.Private.TypeLoader", false),
new LibraryInitializerInfo("System.Private.Reflection.Execution", false),
new LibraryInitializerInfo("System.Private.TypeLoader"),
new LibraryInitializerInfo("System.Private.Reflection.Execution"),
new LibraryInitializerInfo("System.Private.DeveloperExperience.Console"),
};

Expand All @@ -39,10 +39,8 @@ public LibraryInitializers(TypeSystemContext context, bool isCppCodeGen)
{
_context = context;
//
// We should not care which code-gen is being used, however currently CppCodeGen cannot
// handle code pulled in by all explicit cctors.
//
// See https://github.com/dotnet/corert/issues/2518
// We should not care which code-gen is being used but for the time being
// this can be useful to workaround CppCodeGen bugs.
//
_isCppCodeGen = isCppCodeGen;
}
Expand Down
2 changes: 2 additions & 0 deletions src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2164,6 +2164,8 @@ private int FindNearestFinally(int offset)

private void ImportEndFinally()
{
_stack.Clear();

int finallyIndex = FindNearestFinally(_currentOffset - 1);

AppendLine();
Expand Down