304 Commits
Author SHA1 Message Date
Siegfried Pammer 51522c4487 Fix #3190: NRE in YieldReturnDecompiler 2025-03-22 10:14:11 +01:00
Siegfried Pammer 03aecf047d Add VariableScope and rework AssignVariableNames step to support renaming parameters of nested ILFunctions in the future. 2025-03-21 08:34:44 +01:00
Siegfried Pammer f0f95efa05 Fix StateRangeAnalysis to handle changes in yield return codegen in Roslyn 4.13. 2025-03-08 19:55:19 +01:00
Siegfried Pammer 6cee0cdc4b Fix #3258: Move GraphVizGraph and friends to ILSpy and remove InternalsVisibleTo. 2024-08-13 11:43:04 +02:00
Daniel Grunwald 38e7ab4373 Fix #3110: Add support for MCS 2.6.4 pinned region with array variable
* Added additional code to remove the conv instruction present in the initialization part of the pinned region.
* Extended the code responsible for removing the unpin stloc to correctly match the inverted condition found in MCS 2.6.4 compiled code.
* Enabled already present correctness test to run for MCS 2.6.4.

This is a more generalized version of the fix on PR #3110 proposed by @ElektroKill.
2024-04-01 15:06:30 +02:00
Siegfried Pammer afbc65d14d Merge pull request #3187 from icsharpcode/feature/roslyn492
Update to Roslyn 4.9.2
2024-03-30 10:12:18 +01:00
Siegfried Pammer 969e3e546a Add support for switch on (ReadOnly)Span<char> using a compiler-generated hash function. 2024-03-29 21:20:58 +01:00
Siegfried Pammer ca78d4a14d Use MetadataFile instead of PEFile in TypeSystem. 2024-03-24 15:35:13 +01:00
Daniel Grunwald 5a5be026d0 Avoid reference count temporarily dropping to zero while ConditionDetection moves instructions to other blocks.
This avoids recursively un-registering e.g. all LdLocs from their ILVariable.LoadInstructions, etc. (all the ILInstruction.Disconnected logic). This speeds up the example from #1193 by another factor 2.
2023-10-14 23:16:57 +02:00
Siegfried Pammer 0a2037ae1f #3075: Avoid processing already-transformed blocks by introducing BlockTransformContext.IndexOfFirstAlreadyTransformedInstruction, which allows us to track already transformed instructions after a block has been merged into another by ConditionDetection. 2023-10-09 00:23:16 +02:00
Siegfried Pammer 4ca9fddd6f Fix #3069: Reuse SwitchAnalysis instead of MatchIfElseOnCharBlock 2023-09-03 22:13:02 +02:00
ElektroKill 915c0310c4 Add support for MSC 2.6.4 pinned region with string variable 2023-06-18 14:18:15 +02:00
Daniel Grunwald b9ce8490f5 Remove hack that prevented inlining of the first instruction in each block.
Now that ILReader already creates the basic blocks and BlockBuilder only arranges them in containers, this code is no longer necessary.
2023-06-01 14:13:01 +02:00
ElektroKill 8a1e8e3c6b Make return duplication in ControlFlowSimplification less aggressive 2023-04-22 14:51:38 +02:00
ElektroKill 0cbd9a4faa Add Visual Basic symbolic execution option which ignores overflow checks 2023-04-01 13:43:23 +02:00
ElektroKill 29eb31354b Fix formatting 2023-03-26 14:16:29 +02:00
ElektroKill b110d5c2dc Implement support for Visual Basic yield return state machines 2023-03-26 14:16:29 +02:00
ElektroKill 341074aa58 Extend VBPretty Async test code 2022-11-26 20:19:55 +01:00
ElektroKill 5d3f9d3a6f Add support for Visual Basic async await state machine decompilation 2022-11-26 19:07:09 +01:00
Siegfried Pammer 6766ad0c59 #2823: Introduce IType.GetDefinitionOrUnknown() to allow better detection of async state-machines involving unknown types. 2022-11-02 08:00:00 +01:00
Daniel Grunwald 503048b314 Prevent the early ILInlining pass from creating addressof instructions 2022-09-06 21:38:19 +02:00
Daniel Grunwald 3c847b56a2 Fix decompilation of async streams compiled with Roslyn 4.2 2022-07-16 12:20:12 +02:00
Siegfried Pammer 4c1931d5c6 Fix NRT warning in GetBlockStateSetMappingForLeave. 2022-04-10 23:03:47 +02:00
Siegfried Pammer a4e2bd7f8f Handle leave instructions in state-range analysis. 2022-04-10 22:18:44 +02:00
Siegfried Pammer 84c15bb24f Fix #2652: AwaitInFinallyTransform: ILAst must form a tree 2022-04-10 21:06:15 +02:00
Siegfried Pammer 3c2e52854e DetectPinnedRegions: Inline the stack-slot involved in CustomRefPinPattern so that the following ProcessPinnedRegion call can reuse existing unmanaged pointer variables instead of being forced to create a new variable. 2022-03-07 09:19:26 +01:00
Siegfried Pammer f98012ec16 DetectPinnedRegions: Support special case where pinned pointer is unused and the compiler optimized out the StopGCTracking-conversion. 2022-03-07 09:19:26 +01:00
Daniel Grunwald 787621fb51 Revert "Use Nop instead of InvalidExpression to hold the "goto from catch-block to try-block" comment"
This reverts commit 77dcbbee86.
2021-12-01 01:00:00 +01:00
Daniel Grunwald cedd8a6bf6 Fix #2480: Avoid yield-return decompilation if there are unrecognized state assignments in a finally method. 2021-11-30 21:06:38 +01:00
Daniel Grunwald 77dcbbee86 Use Nop instead of InvalidExpression to hold the "goto from catch-block to try-block" comment 2021-11-30 20:55:21 +01:00
Siegfried Pammer 1826ac031d #2539: Add support for yield state machine pattern used by mcs 5.x 2021-11-17 22:24:54 +01:00
Daniel Grunwald df339e72fb Fix DetectPinnedRegions.SplitBlocksAtWritesToPinnedLocals creating blocks without ILRange.
These blocks could trigger assertions if LoopDetection was creating a loop BlockContainer from them (BlockContainers have an assertion requiring an ILRange).

Closes #2533 and #2457.
2021-11-13 22:03:26 +01:00
Daniel Grunwald 583771e012 #2533: Fix bug in CreatePinnedRegion that could cause pinned regions to be created with the wrong entry point if the original IL had blocks in an unusual order 2021-11-13 20:42:35 +01:00
Siegfried Pammer e1ca4db851 Fix #2527: Support skip locals init 2021-10-29 00:16:33 +02:00
Siegfried Pammer 9d99ee86db Fix #2503: Move correct branch in the case of swapped jump-table conditions. 2021-10-02 13:17:09 +02:00
Daniel Grunwald 109b6d073a Allow detecting exit points across multiple levels of containers. 2021-06-03 19:47:47 +02:00
Daniel Grunwald a716828065 Remove redundant code from RemoveRedundantReturn.cs 2021-06-03 18:33:59 +02:00
Daniel Grunwald 685a79dc31 DetectExitPoints: introduce exit points for loops+switch
This allows reverting the changes to HighLevelLoopTransform+ReduceNestingTransform from the previous commit, which fixes a bug in loop detection (the previous commit did not handle loops where the loop BlockContainer didn't have a Block as parent).
2021-06-03 16:53:56 +02:00
Daniel Grunwald 6757295b3b Fix #2379: Keep return statements around in original form for ConditionDetection, only transform to fall-through block-exit at the end of the transform pipeline.
This fixes an issue where `return` statements within try-blocks could turn into `goto` statements.
2021-06-02 22:40:28 +02:00
Daniel Grunwald 407ec6be5b Adjust AsyncAwaitDecompiler to Roslyn 3.9.0. 2021-05-26 19:41:51 +02:00
Siegfried Pammer 7211587b45 Fix #2366: NRE in AwaitInCatchTransform.MatchAwaitCatchHandler() and pattern errors when dealing with a switch-based jump table in AwaitInCatchTransform 2021-04-12 18:42:10 +02:00
Siegfried Pammer 76227af89d Fix #1749, fix #2339, fix #2353: Add support for rethrow in async exception handlers, fix await catch/finally patterns for complex methods. 2021-04-07 13:12:49 +02:00
Daniel Grunwald eec24ee6bb Fix #2311: Handle additional comp instruction in IsNullSafeArrayToPointerNotNullBlock 2021-02-23 21:55:27 +01:00
Daniel Grunwald 0e1c24464f Fix #2148: Don't attempt to detect fixed statement for pinned value types 2020-09-06 22:24:36 +02:00
Daniel Grunwald 3d10509b1b Add SparseIntegerSwitch option. 2020-09-02 23:12:26 +02:00
Daniel Grunwald b035ec1960 Fix #2129: be more flexible about the initialization order for the async state machine. 2020-09-02 20:23:55 +02:00
dotnet format 0d9f871a4f #2128: Reformat the whole code base. 2020-08-28 01:05:38 +02:00
Siegfried Pammer a6bbccae8d Fix #2123: switch on string detection:
1) Do not remove switchValueVar, if it is used elsewhere.
2) Support empty case blocks in SimplifyCascadingIfStatements transform
2020-08-27 16:11:17 +02:00
Daniel Grunwald f5409ebe31 Fix re-pinning getting confused about which variant of the pinned local to use when the new re-pinned reference depends on the old pinned reference. 2020-08-10 21:34:35 +02:00
Daniel Grunwald 4b716e2db5 Fix #2056: "remove branch into body" must be executed before the clone cleanup
Otherwise the to-be-removed branch could keep an soon-to-be-unreachable block alive outside the pinned region.
2020-08-08 23:47:12 +02:00