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 .
1 year ago
ElektroKill
915c0310c4
Add support for MSC 2.6.4 pinned region with string variable
2 years ago
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.
3 years ago
Siegfried Pammer
f98012ec16
DetectPinnedRegions: Support special case where pinned pointer is unused and the compiler optimized out the StopGCTracking-conversion.
3 years ago
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 .
4 years ago
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
4 years ago
Daniel Grunwald
eec24ee6bb
Fix #2311 : Handle additional `comp` instruction in `IsNullSafeArrayToPointerNotNullBlock`
4 years ago
Daniel Grunwald
0e1c24464f
Fix #2148 : Don't attempt to detect `fixed` statement for pinned value types
5 years ago
dotnet format
0d9f871a4f
#2128 : Reformat the whole code base.
5 years ago
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.
5 years ago
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.
5 years ago
Daniel Grunwald
bd4e565b93
Ensure all pinned regions variables are converted to VariableKind.PinnedRegionLocal
5 years ago
Daniel Grunwald
ddff831cf0
#1292 : Fix some more problems with pinned locals.
...
Let's distinguish between the original pinned locals and the PinnedRegion locals.
The format need declarations if any are left over after transformations; the latter don't.
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
Siegfried Pammer
8925b4ff7b
Inline variable declarations/modernize parts of our code base.
5 years ago
Daniel Grunwald
65fe59e393
#1918 : Fix a bunch of issues with pinned region detection.
...
Not every pinned region has a clean `P = null` assignment to mark its end.
If a second pinned region starts with the same variable `P`, consider that to mark the end of the previous pinned region for that variable.
Also, fix a bunch of special cases with empty pinned regions.
5 years ago
Daniel Grunwald
f0292808b3
#1852 : Handle fixed statement with null-safe GetPinnableReference call
6 years ago
Daniel Grunwald
bbb2397083
Fix #1853 : Detect pinning of multi-dimensional array
6 years ago
Daniel Grunwald
eb2a9e6b94
#1852 : Rename array.to.pointer opcode to get.pinnable.reference.
6 years ago
Daniel Grunwald
752f0de978
Further adjustments to transforms now that copy propagation no longer runs.
6 years ago
Siegfried Pammer
c1fca21e8a
Make ILRange field private - introduce public API for IL range manipulation.
6 years ago
Daniel Grunwald
f6aae1f97d
Fix #1386 : MoveArrayToPointerToPinnedRegionInit: Only consider the pinned variable uses within the PinnedRegion
...
This also makes CleanUpTryFinallyAroundPinnedRegion() redundant as it is no longer necessary to trigger the array-to-pointer transform; so the normal elimination of pinned variable resets is sufficient.
6 years ago
Daniel Grunwald
1ab11ba7ce
DetectPinnedRegions: also add debug step for failed CreatePinnedRegion() calls
6 years ago
Daniel Grunwald
da5693e605
Fix #1339 : fixed statement not decompiled correctly when pinned variable is reset in finally block
6 years ago
Chicken-Bones
e9b766d708
Improve persistence of IL offsets through various transforms.
7 years ago
Daniel Grunwald
ba0a3af3c4
#1195 : Fix several issues decompiling SharpSvn.dll (C++/CLI)
7 years ago
Daniel Grunwald
d8c8a75c2e
Fix #1154 : Decompilation of fixed statement when pointer variable is unused
7 years ago
Daniel Grunwald
7b8389dca5
Fix #1078 : Eliminate redundant variable in fixed statements.
7 years ago
Daniel Grunwald
ae45665ff7
Improve pinned region detection to also handle the case where the pinned variable has array type. ( #1078 )
7 years ago
Daniel Grunwald
568b3e2d91
Fix DetectPinnedRegions introducing stack type inconsistencies.
8 years ago
Daniel Grunwald
02db362838
Ensure that StLoc.Value.ResultType == StLoc.Variable.StackType
...
This introduce a new explicit conversion (StartGCTracking) when converting unmanaged pointers to managed references.
8 years ago
Daniel Grunwald
8c5de98a39
Move UnsafeCode tests to pretty-tests (except for those that are not yet successful).
8 years ago
Daniel Grunwald
2207ab40f7
Check the CancellationToken a bit more frequently.
8 years ago
Daniel Grunwald
fe84ea9730
WIP: yield return decompiler
9 years ago
Siegfried Pammer
0970b95d5f
Rename ILVariable.Scope to Function and introduce BlockContainer CaptureScope
9 years ago
Siegfried Pammer
840ec04fde
Namespace adjustments for Syntax classes
9 years ago
Christoph Wille
1ce8349dd9
Adjust namespaces
9 years ago
Siegfried Pammer
3a89500e0c
Merge binary arithmetic instructions into one class.
9 years ago
Daniel Grunwald
449bbe2043
Move transforms to transforms namespace
9 years ago
Daniel Grunwald
cfd638e413
Fix fixed statement
9 years ago
Daniel Grunwald
20aec66815
Initial support for decompiling fixed statements
9 years ago
Daniel Grunwald
e1930e9170
Adjust comp.unsigned(ldlen array > ldc.i4 0) transforms to explicit i4->i conversions.
9 years ago
Daniel Grunwald
9678c692ad
Fix NullReferenceException in DetectPinRegions
9 years ago
Daniel Grunwald
7e50076671
Introduce array.to.pointer instruction.
...
This is necessary to construct pinned regions in all cases.
9 years ago
Daniel Grunwald
275a147224
First attempt at pinned regions.
9 years ago