Daniel Grunwald
bdea1950a8
Add `#if !NETCORE` around extension methods that are included with .NET Core 3
5 years ago
Daniel Grunwald
fc51dd17a5
Remove outdated comment. The `PickExitPoint` heuristic is no longer using "amount of code" but the IL block order.
5 years ago
Siegfried Pammer
4f8c588c7b
Fix #2068 : ILSpy can't find referenced library even though it's open
5 years ago
Daniel Grunwald
c647016bfb
#2070 : Allow `PickExitPoint` heuristic to choose a `return;`/`yield break;` that is part of a condition block.
5 years ago
Daniel Grunwald
2acc4339df
#2058 : Mark most transforms as public to help users that use the ILAst directly without decompiling to C#.
5 years ago
Daniel Grunwald
bd059dfb59
Fix #2075 : IndexOutOfRange exception in PEFile.GetRuntime()
5 years ago
Daniel Grunwald
3409ffca25
Fix #2073 : Ensure the startOffsetVar actually appears in the expected instruction, not somewhere else.
5 years ago
Siegfried Pammer
95f2ae7aef
Add ILAst base for Deconstruction and Pattern Matching
5 years ago
Siegfried Pammer
3dc75b9366
Add additional C# AST nodes used for deconstruction.
5 years ago
Siegfried Pammer
5459d6b022
#2064 : Improve performance of RequiredNamespaceCollector by skipping repeated IType.GetAllBaseTypes() calls.
5 years ago
Daniel Grunwald
e0fd0bba32
Allow inlining constants into expression trees.
5 years ago
Daniel Grunwald
c63e14e805
Move some special cases from ILInlining.FindLoadInNext to the individual ILInstructions.
5 years ago
Daniel Grunwald
fe2143b41f
Validate code movement performed by IndexRangeTransform.
5 years ago
Daniel Grunwald
f93ea325d4
Remove redundant StatementTransform pass.
...
This duplicate pass only made sense back when we ran CopyPropagation as part of the BlockILTransform.
5 years ago
Daniel Grunwald
7d3dfc3b81
Remove the hack where IndexRangeTransform looks at instructions prior to startPos.
...
Instead we now perform a partial transformation which we can then later extend.
This means we no longer need to rely on the previous instruction (prior to startPos) being already inlined.
This way the IndexRangeTransform also works without the duplicate StatementTransform pass.
5 years ago
Daniel Grunwald
1b2874eb5d
Use `nint` type for local IntPtr variables if arithmetic is performed on them.
5 years ago
Siegfried Pammer
5da3b87845
Fix #2060 : Add support for alternate code patterns in TransformDisplayClassUsage.ValidateConstructor
5 years ago
Daniel Grunwald
1d684102ac
Support compound assignment for native integers.
5 years ago
Daniel Grunwald
59be020dea
Fix pointer arithmetic with `nint*`/`nuint*`.
5 years ago
Daniel Grunwald
8f6bf3b45b
Simplify TranslateArrayIndex.
5 years ago
Daniel Grunwald
dc3dd193c8
Support unary operators on native integers.
5 years ago
Daniel Grunwald
a7826e399e
Fix native integer shifts.
5 years ago
Daniel Grunwald
3a4db502bc
Add support for arithmetic using C# 9 native integer types.
5 years ago
Daniel Grunwald
5a8cfc25ba
Add some tests for native integers.
...
The conversion roundtrip tests are disabled due to https://github.com/dotnet/roslyn/issues/45929
5 years ago
Daniel Grunwald
156b1d0e75
Fix void*->IntPtr conversion in checked context. Also fix a stack overflow for certain forms of conversions involving `nint`.
5 years ago
Daniel Grunwald
2c9b84a1e1
If possible, use nint/nuint for conversions to/from IntPtr.
5 years ago
Daniel Grunwald
c9e41d0582
Add support for decoding `NativeIntegerAttribute`.
5 years ago
Daniel Grunwald
450fae49e3
Introduce nint/nuint types and their conversions in the type system
5 years ago
Daniel Grunwald
12094a8376
Support extraction out of control-flow IfInstruction even if it isn't using a Block as TrueInst/FalseInst.
5 years ago
Daniel Grunwald
417a2c3391
Revert the InvertIf change; it causes too many issues for the following transforms.
5 years ago
Daniel Grunwald
e083d43fb9
Fix ReduceNestingTransform
5 years ago
Daniel Grunwald
016d9f8f4d
Fix #1903 : un-inline argument of unsupported `isinst` instructions.
5 years ago
Daniel Grunwald
696fdca923
Always create a block when inverting an if.
...
This keeps the ILAst more uniform and ensures extraction is possible for the code in the then statement.
5 years ago
Daniel Grunwald
b18ed89b67
#2050 : Add assertion to check that no transform uses StObj.TargetSlot incorrectly.
5 years ago
Daniel Grunwald
81d9eda332
I just discovered that we do have un-inlining implemented... let's mention it where it's more likely to be found in the future.
5 years ago
Daniel Grunwald
ef47a8bdf6
#2058 : Avoid NullReferenceException when DecompileRun is not provided.
5 years ago
Daniel Grunwald
62fcab8d99
#2050 : Allow inlining into the StObj target slot when this is possible without changing the program semantics.
5 years ago
Siegfried Pammer
74101ff0dc
Fix #2053 : Assert and NRE in LocalFunctionDecompiler
5 years ago
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
Daniel Grunwald
c0b1119fab
Use C# 8.0 to build ILSpy.
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
94a8190861
#2049 : Delete old NRefactory node types that were never supported for output.
5 years ago
Daniel Grunwald
a0b144d332
Use `Unsafe.AsPointer()` for `ConversionKind.StopGCTracking`.
5 years ago
Daniel Grunwald
35c405b973
Translate the initializer of a `fixed` statement as managed reference and only apply the ref-to-pointer conversion at the end.
...
This way we create compilable code when the pinned variable type does not match the initializer type.
5 years ago
Daniel Grunwald
a9d643b208
Emit a call to `ref Unsafe.As<TFrom, TTo>(ref TFrom)` when the IL code contains a mismatch of managed reference types.
...
The previously emitted `ref *(TTo*)(&source)` only compiles when `source` is a local variable; otherwise C# complains about the memory not being pinned.
Note that we special-case local variables to keep the previous behavior around; this avoids pulling in `System.Runtime.CompilerServices.Unsafe.dll` when it's unnecessary.
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