diff options
author | mikedn <onemihaid@hotmail.com> | 2017-01-21 19:30:10 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2017-01-21 19:30:10 +0300 |
commit | 55aec2695031ea3b172bb4cfb1e60c2cdbd70c27 (patch) | |
tree | 8cdab268d85d4750c1056eb7426d8e40ead0eb09 | |
parent | b580dd08744ee43d22b1adb59b674dafbb2f0e30 (diff) |
Don't fall through endfinally and others (#2560)
endfinally, endfilter and rethrow were treated as fallthrough capable when they are not. endfinally was also failing to clear the stack.
-rw-r--r-- | src/Common/src/TypeSystem/IL/ILImporter.cs | 6 | ||||
-rw-r--r-- | src/ILCompiler.Compiler/src/Compiler/LibraryInitializers.cs | 10 | ||||
-rw-r--r-- | src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/Common/src/TypeSystem/IL/ILImporter.cs b/src/Common/src/TypeSystem/IL/ILImporter.cs index 5240cfb6c..6b9c2efd9 100644 --- a/src/Common/src/TypeSystem/IL/ILImporter.cs +++ b/src/Common/src/TypeSystem/IL/ILImporter.cs @@ -778,7 +778,7 @@ namespace Internal.IL break; case ILOpcode.endfinally: ImportEndFinally(); - break; + return; case ILOpcode.leave: { int delta = (int)ReadILUInt32(); @@ -837,7 +837,7 @@ namespace Internal.IL break; case ILOpcode.endfilter: ImportEndFilter(); - break; + return; case ILOpcode.unaligned: ImportUnalignedPrefix(ReadILByte()); continue; @@ -864,7 +864,7 @@ namespace Internal.IL continue; case ILOpcode.rethrow: ImportRethrow(); - break; + return; case ILOpcode.sizeof_: ImportSizeOf(ReadILToken()); break; diff --git a/src/ILCompiler.Compiler/src/Compiler/LibraryInitializers.cs b/src/ILCompiler.Compiler/src/Compiler/LibraryInitializers.cs index 42b942ce2..ab872cf17 100644 --- a/src/ILCompiler.Compiler/src/Compiler/LibraryInitializers.cs +++ b/src/ILCompiler.Compiler/src/Compiler/LibraryInitializers.cs @@ -25,8 +25,8 @@ namespace ILCompiler 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"), }; @@ -39,10 +39,8 @@ namespace ILCompiler { _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; } diff --git a/src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs b/src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs index b2b5d0bda..03133ce93 100644 --- a/src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs +++ b/src/ILCompiler.Compiler/src/CppCodeGen/ILToCppImporter.cs @@ -2164,6 +2164,8 @@ namespace Internal.IL private void ImportEndFinally() { + _stack.Clear(); + int finallyIndex = FindNearestFinally(_currentOffset - 1); AppendLine(); |