73 Commits
Author SHA1 Message Date
ds5678 3a13d5a698 Allow explicit null termination character 2025-02-22 11:35:12 +01:00
Siegfried Pammer 38cdf6d50a Avoid transforming sub pattern of cpblk stackalloc initializer 2025-02-22 11:12:49 +01:00
Siegfried Pammer bd0fd8db1f Small refactorings:
- extract common code
- reduce nesting
2025-02-22 11:12:49 +01:00
ds5678 b0d6fa2276 Add support for array initialization based on RuntimeHelpers.CreateSpan<T> 2025-02-22 11:12:49 +01:00
Siegfried Pammer dab256ceb0 Update stackalloc initializer patterns for Roslyn 4.10.0. 2024-07-20 07:03:14 +02:00
Siegfried Pammer ca78d4a14d Use MetadataFile instead of PEFile in TypeSystem. 2024-03-24 15:35:13 +01:00
Daniel Grunwald f568123704 Add support for UTF8 string literals 2023-05-30 11:20:20 +02:00
ElektroKill 760a6a653e Reduce allocations in TransformArrayInitializers
DecodeArrayInitializer - Instead of relying on the Add method of a list to expand the underlying array when necessary, the code now allocates a big enough array to fit all the elements removing the need for the Add method to expand the array several times.

BlockFromInitializer now reuses a single instance of List<ILInstruction> instead of reallocating a new one every time and clears it when necessary. The same pre-allocation approach mentioned above has been implemented here too.
2022-07-01 18:45:46 +02:00
Siegfried Pammer 6a3bb2bbf1 Fix #2655: TranslateArrayInitializer crashes with out of order array init 2022-04-19 16:16:37 +02:00
Siegfried Pammer d98ff730a0 Fix build. 2022-01-26 19:41:31 +01:00
Siegfried Pammer 4aa7f5fc38 Fix #2612 decompilation of newarr with int.MaxValue causes OOME in decompiler. 2022-01-26 00:24:06 +01:00
Daniel Grunwald 0414e7f8e9 Fix potential NRE in ILFunction.RegisterVariable() 2021-06-05 16:32:24 +02:00
Siegfried Pammer 67be41a998 #2294: Fix potential NRE: finalStore is accessed before null check. 2021-02-16 20:15:58 +01:00
Daniel Grunwald 5bd8c69a48 Disable transform for Span<T> initialization from field with RVA if "ArrayInitializers" setting is disabled.
https://github.com/ashmind/SharpLab/issues/542
2020-09-02 22:43:05 +02:00
dotnet format 0d9f871a4f #2128: Reformat the whole code base. 2020-08-28 01:05:38 +02:00
Siegfried Pammer 7ed4a736f3 Fix #2103: Support for Stackalloc initializers not working for byte 2020-08-22 23:00:48 +02:00
Siegfried Pammer 68e4d7dfa6 Adapt TransformArrayInitializers to ILAst changes. 2020-06-27 08:25:12 +02:00
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.
2020-06-26 23:42:10 +02:00
Siegfried Pammer 587f61be19 Fix #1280: Transform RuntimeHelpersInitializeArray calls without receiving assignments. 2019-08-10 23:34:16 +02:00
Daniel Grunwald 961923f4fd #1499, #1240: Translate pointer arithmetic on managed pointers (ref T) using the System.Runtime.CompilerServices.Unsafe intrinsics 2019-04-28 20:22:48 +02:00
Siegfried Pammer b03aa488aa Performance: Cache ChainedConstructorCallILOffset in ILFunction to avoid having to scan the method body in every inlining step. Take a shortcut for static ctors, as there cannot be chained ctor calls in static ctors. 2019-04-03 22:28:31 +02:00
Siegfried Pammer 94cd891609 Add support for ReadOnlySpan<T> initialization pattern. 2019-02-23 23:01:35 +01:00
Siegfried Pammer 3d5b300602 Improve TransformArrayInitializers: allow default entries at the end of a dimension > 0. 2019-01-07 17:43:18 +01:00
Siegfried Pammer 46b56f8482 Fix #1382: Do not reuse index instructions in TransformArrayInitializers 2019-01-07 16:33:05 +01:00
Siegfried Pammer 37a8156dab Fix #1383: NRE in TransformArrayInitializers. 2019-01-07 14:56:27 +01:00
Siegfried Pammer 859872ba8c Fix #1377: Fix IndexOutOfRangeException in TransformArrayInitializers 2019-01-05 19:01:19 +01:00
Siegfried Pammer 64686b9547 Fix #1336: multi-dimensional array initializers with custom objects not detected. 2019-01-04 17:07:35 +01:00
Siegfried Pammer ab8c73b2f7 #1336: Add limit in HandleSimpleArrayInitializer. 2019-01-04 17:07:31 +01:00
Siegfried Pammer 0dac55d584 Add transformation for stackalloc to Span<T>. 2018-12-08 22:31:17 +01:00
Siegfried Pammer 08af55aa57 Avoid ITypeDefinition.FullName. Use Name and Namespace separately to avoid string allocation. Reorder checks to improve performance on pattern mismatch. 2018-08-06 17:15:03 +02:00
Siegfried Pammer ebbe25fba7 Apply suggested refactorings on TransformArrayInitializers.cs 2018-08-06 17:04:03 +02:00
Siegfried Pammer 772b529d16 Add support for stackalloc initializer pattern that uses initblk. 2018-08-06 16:31:15 +02:00
Siegfried Pammer 057ab82534 Add basic stackalloc initializer transforms. 2018-08-06 08:02:56 +02:00
Siegfried Pammer 2a537fcecb Reorder code in TransformArrayInitializers.cs 2018-08-04 22:18:36 +02:00
Daniel Grunwald 1f3916d554 Use the resolve methods in MetadataModule, and remove the wrappers in DecompilerTypeSystem. 2018-07-14 16:12:03 +02:00
Siegfried Pammer 68123fc6b3 Fix build. 2018-07-11 17:52:11 +02:00
Siegfried Pammer d20c1969ed Merge branch 'master' of https://github.com/icsharpcode/ILSpy into srm 2018-06-28 21:20:39 +02:00
Daniel Grunwald 9a74f018b5 Decode metadata signatures directly into IType; without going through ITypeReference. 2018-06-17 19:58:32 +02:00
Daniel Grunwald 4e654cff38 Merge branch 'master' into srm 2018-06-02 10:58:23 +02:00
Siegfried Pammer 5e4b571a62 Add DynamicCallSiteTransform 2018-05-31 19:00:03 +02:00
Daniel Grunwald 5c0c492c1f Merge pull request #1134 from icsharpcode/tuple
C# 7.0 tuples
2018-05-29 18:25:55 +02:00
Siegfried Pammer bd15d69ada Add test cases for #1138 2018-05-17 20:00:55 +02:00
Siegfried Pammer 5290677f80 Fix #1138: Array-index out of bounds crash in TransformArrayInitializers.HandleSimpleArrayInitializer 2018-05-17 13:15:14 +02:00
Daniel Grunwald 469501210c Add support for C# 7 tuple types:
* Use tuple literals instead of calling 'new ValueTuple<..>' constructor
 * Where available, use element names for field access
 * Make CallBuilder aware of tuple-name/dynamic type erasure, to avoid introducing casts when the types differ only in the tuple element names.
 * Make CallBuilder provide a ResolveResult with the correct C# return type for the resulting expression.
   Previously we were using the type-erased return type from the IL.
 * Fix a bug that caused us to introduce returning casts when accessing an indexer.
2018-05-13 18:16:35 +02:00
Siegfried Pammer b311ba5a44 Port DelegateConstruction and TransformArrayInitializers 2018-03-28 03:00:32 +02:00
Andrey Shchekin 6ba6b8c8f6 Added support for ArrayInitializers=false to suppress prettifier over array initializers (used by SharpLab). 2018-02-05 01:41:46 +13:00
Siegfried Pammer 701513fd00 Fix build. 2017-12-11 12:48:19 +01:00
Siegfried Pammer 7ad556e0bf Do not detect array initializer if element type and store type do not match. 2017-12-11 00:42:29 +01:00
Siegfried Pammer 33c5e2d3ed Add StackType.F4 and StackType.F8, and instructions LdcF4 and LdcF8. 2017-12-01 00:06:20 +01:00
Siegfried Pammer 349183544a Rename BlockType to BlockKind 2017-11-04 22:53:34 +01:00