Daniel Grunwald
d8e837ef47
Fix #1772 : Support EnumeratorCancellationAttribute
...
With this change, the async decompiler no longer gets confused by the logic disposing `this.<>x__combinedTokens`.
5 years ago
Siegfried Pammer
761c3fef14
Adapt TransformExpressionTrees to ILAst changes.
5 years ago
Siegfried Pammer
68e4d7dfa6
Adapt TransformArrayInitializers to ILAst changes.
5 years ago
Daniel Grunwald
925a4e1e65
#2050 : Don't put ldflda/ldelema with immediate exceptions into StObj.TargetSlot.
...
The C# translation of StObj will always apply delayed exceptions in these two cases, so putting an instruction with delayed exceptions in that slot would change program semantics.
5 years ago
Daniel Grunwald
a0b144d332
Use `Unsafe.AsPointer()` for `ConversionKind.StopGCTracking`.
5 years ago
Daniel Grunwald
2c0554f129
Fix #1963 : Support decompiling `calli` instructions into C# 9 function pointer syntax.
5 years ago
Daniel Grunwald
1f2d1660c8
#2023 : If blocks are reachable both from within the pinned region and from outside it, clone those blocks.
...
This removes an error condition where pinned variables could remain after DetectPinnedRegions, resulting in invalid C#.
The downside is that it's possible for the code size to increase exponentially when given sufficiently evil IL code.
5 years ago
Daniel Grunwald
15f638af9a
Fix decompilation of switch where default section is a leave instruction.
5 years ago
Daniel Grunwald
a6e23d1f98
Fix "case null" handling in switch(string) with current Roslyn version (3.7.0-2.final).
5 years ago
Daniel Grunwald
30da0b7525
Add some missing checks to MatchRoslynSwitchOnString
5 years ago
Daniel Grunwald
4f4ca482be
Fix #1950 : Fix crash when finallyMethod cannot be found.
...
This seems to be possible due to a C# compiler bug.
5 years ago
Siegfried Pammer
d2abce2a7b
Fix possible NRE in TransformExpressionTrees.MatchGetTypeFromHandle and related methods
5 years ago
Daniel Grunwald
80063e3c15
Fix TDCU's version of copy propagation being too aggressive.
5 years ago
Chicken-Bones
da905acc6d
Fix logic error in last commit, and ignore fault clauses in ReduceNestingTransform
5 years ago
Chicken-Bones
abd9af29c6
Fix failed assertion when encountering a finally block with an unreachable endpoint in ReduceNestingTransform.
5 years ago
Chicken-Bones
e0e26a0e77
Fix ReduceNestingTransform when extracting default block of switch in a try container
5 years ago
Siegfried Pammer
fcc910cb4d
Cleanup and refactoring after code review
5 years ago
Siegfried Pammer
0b8824ca84
Fix two small bugs in TDCU
5 years ago
Siegfried Pammer
bcd7219535
Adjust CapturedVariables collection in ReplaceDelegateTargetVisitor and in TransformExpressionTrees
5 years ago
Siegfried Pammer
101aba3362
Validate uses of display-class variable copies before removing them
5 years ago
Siegfried Pammer
3436ac3246
Fix #2018 : Improve tooltips in IL/IL with C#/R2R view to show full member signatures
5 years ago
Siegfried Pammer
0fa04a5248
Fix build.
5 years ago
Siegfried Pammer
d4fd92bf0f
Fix initializer block detection of display structs.
5 years ago
Siegfried Pammer
1c7d9705da
Add Validation of delegate target instructions.
5 years ago
Siegfried Pammer
6042819117
Implement Block.CheckInvariant for BlockKind.ArrayInitializer, BlockKind.CollectionInitializer and BlockKind.ObjectInitializer
5 years ago
Siegfried Pammer
ab336cdc94
Fix build.
5 years ago
Siegfried Pammer
d457ef38f4
Make ValidateConstructor safe
5 years ago
Siegfried Pammer
f1cbc7c8db
Add AggressiveScalarReplacementOfAggregates option
5 years ago
Siegfried Pammer
53c593af0b
Fixed all TDCU related tests.
5 years ago
Siegfried Pammer
4f7ca65408
Fix #1913 : Make sure to declare local variables captured by local functions before the first invocation of the local function.
5 years ago
Siegfried Pammer
83e8049114
Add ILVariable.IsDead property
5 years ago
Siegfried Pammer
b6259b7dca
Fix #1981 : Ensure correctness of TDCU
5 years ago
Siegfried Pammer
0d1b6203df
#1981 : Refactor LocalFunctionDecompiler: Propagate closure parameter arguments, so that all arguments can be stripped from use-sites.
5 years ago
Siegfried Pammer
5711185832
Make sure that the code and the pattern described in the comment above are in sync.
5 years ago
Daniel Grunwald
7d8b9fee1e
Remove redundant code.
5 years ago
Siegfried Pammer
b114734128
Add Mode.UnconstrainedType and implement TransformNullPropagationOnUnconstrainedGenericExpression using TryNullPropagation.
5 years ago
Siegfried Pammer
2601d17919
Add clarifying comment to ExceptionSpecifierILRange
5 years ago
Siegfried Pammer
9c8df1d949
Fix assignment of ILRanges in ExpressionTransforms.TransformCatchVariable
5 years ago
Siegfried Pammer
effc49c479
Move TransformNullPropagationOnUnconstrainedGenericExpression into NullPropagationTransform and make use of IsValidAccessChain
5 years ago
Siegfried Pammer
1303c54086
Exactly match load, store and address counts of defaultTemporary.
5 years ago
Daniel Grunwald
9659be0d55
#1946 : Fix IsBranchToReturnBlock() [was broken in c1265ad830
]
5 years ago
Siegfried Pammer
b92a4b956c
#1940 : Ignore nullability in ETs
5 years ago
Siegfried Pammer
c676665a61
#1940 : Refactor TransformExpressionTrees to support rolling back all changes if the transform fails.
5 years ago
Daniel Grunwald
c1265ad830
Fix #1946 : Don't move `return` into `try` block when doing so changes the semantics of a `finally` block.
5 years ago
Daniel Grunwald
2da513eb24
Fix #1988 : handle Roslyn 3.6 task creation pattern in async/await decompiler.
...
Roslyn 3.6 no longer makes a redundant copy of the `AsyncTaskMethodBuilder`, but directly calls `stateMachine.<>t__builder.Start(ref stateMachine);`
5 years ago
Daniel Grunwald
1926756cfa
Handle the special cases where the range does not have a start or endpoint.
5 years ago
Daniel Grunwald
0dd75d6852
Add support for slicing using C# 8 ranges.
5 years ago
Daniel Grunwald
dd54dbc144
Disable IndexRangeTransform if the "C# 8 ranges" setting is disabled.
5 years ago
Daniel Grunwald
dc38355e12
Support `list[^idx]`.
...
Here the C# compiler does not actually create a `System.Index` instance, but instead compiles to `list[list.Count - idx]`.
5 years ago
Daniel Grunwald
060830dd64
Variable splitting: support cases where a ref is passed through a ref-returning method, and then used.
...
From `IndexRangeTest.UseIndexForRef`:
```
stloc V_4(call GetSpan())
stloc S_19(ldloca V_4)
stloc V_2(call get_Length(ldloc S_19))
stloc V_3(call GetOffset(addressof System.Index(call GetIndex(ldc.i4 0)), ldloc V_2))
call UseRef(call get_Item(ldloc S_19, ldloc V_3))
stloc V_4(call GetSpan())
stloc S_30(ldloca V_4)
stloc V_2(binary.sub.i4(call get_Length(ldloc S_30), call GetInt(ldc.i4 0)))
call UseRef(call get_Item(ldloc S_30, ldloc V_2))
```
Due to `Span.get_Item` being a ref-return, it's possible that `ref V_4` is returned and passed into the `UseRef` method (this can't actually happen given Span's implementation, but it's a possible implementation of the get_Item type signature).
But we still need to split `V_4` -- it's a compiler-generated variable and needs to be inlined.
I think we can do this relatively simply by continuing to go up the ancestor instructions when we hit a ref-returning call. The recursive `DetermineAddressUse` call will check that there are no stores to `V_4` between the `get_Item` call and the point where the returned reference is used. Thus we still ensure that we don't split a variable while there is a live reference to it.
5 years ago