Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
eea11615
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
eea11615
编写于
4月 08, 2019
作者:
C
Charles Stoner
提交者:
GitHub
4月 08, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Avoid optimizing goto in SyntheticBoundNodeFactory.Switch() (#34791)
上级
59e21bf2
变更
15
展开全部
隐藏空白更改
内联
并排
Showing
15 changed file
with
4367 addition
and
3899 deletion
+4367
-3899
src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs
...ers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs
+3
-12
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncEHTests.cs
...Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncEHTests.cs
+181
-182
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncIteratorTests.cs
...ers/CSharp/Test/Emit/CodeGen/CodeGenAsyncIteratorTests.cs
+110
-108
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncLocalsTests.cs
...ilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncLocalsTests.cs
+358
-362
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncMainTests.cs
...mpilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncMainTests.cs
+434
-0
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncSpillTests.cs
...pilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncSpillTests.cs
+116
-115
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncTests.cs
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncTests.cs
+158
-165
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAwaitForeachTests.cs
...lers/CSharp/Test/Emit/CodeGen/CodeGenAwaitForeachTests.cs
+368
-363
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAwaitUsingTests.cs
...pilers/CSharp/Test/Emit/CodeGen/CodeGenAwaitUsingTests.cs
+241
-241
src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.cs
.../Emit/EditAndContinue/EditAndContinueStateMachineTests.cs
+1559
-1520
src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/LocalSlotMappingTests.cs
...p/Test/Emit/Emit/EditAndContinue/LocalSlotMappingTests.cs
+149
-146
src/Compilers/CSharp/Test/Emit/PDB/PDBAsyncTests.cs
src/Compilers/CSharp/Test/Emit/PDB/PDBAsyncTests.cs
+443
-440
src/Compilers/CSharp/Test/Emit/PDB/PDBConstantTests.cs
src/Compilers/CSharp/Test/Emit/PDB/PDBConstantTests.cs
+15
-15
src/Compilers/CSharp/Test/Emit/PDB/PDBIteratorTests.cs
src/Compilers/CSharp/Test/Emit/PDB/PDBIteratorTests.cs
+217
-215
src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs
src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs
+15
-15
未找到文件。
src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs
浏览文件 @
eea11615
...
...
@@ -884,18 +884,9 @@ public BoundStatement Switch(BoundExpression ex, ImmutableArray<SyntheticSwitchS
statements
.
Add
(
null
);
// placeholder at statements[0] for the dispatch
foreach
(
var
section
in
sections
)
{
LabelSymbol
sectionLabel
;
// If the section only contains a goto statement, use that label.
if
(
section
.
Statements
.
Length
==
1
&&
section
.
Statements
[
0
]
is
BoundGotoStatement
bgoto
)
{
sectionLabel
=
bgoto
.
Label
;
}
else
{
sectionLabel
=
new
GeneratedLabelSymbol
(
"case "
+
section
.
Values
[
0
]);
statements
.
Add
(
Label
(
sectionLabel
));
statements
.
AddRange
(
section
.
Statements
);
}
LabelSymbol
sectionLabel
=
new
GeneratedLabelSymbol
(
"case "
+
section
.
Values
[
0
]);
statements
.
Add
(
Label
(
sectionLabel
));
statements
.
AddRange
(
section
.
Statements
);
foreach
(
var
value
in
section
.
Values
)
{
...
...
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncEHTests.cs
浏览文件 @
eea11615
...
...
@@ -3,8 +3,6 @@
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading
;
using
Microsoft.CodeAnalysis.CSharp.Symbols
;
using
Microsoft.CodeAnalysis.CSharp.Test.Utilities
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
using
Roslyn.Test.Utilities
;
...
...
@@ -896,7 +894,6 @@ public static void Main()
CompileAndVerify
(
source
,
expectedOutput
:
expected
);
}
[
ConditionalFact
(
typeof
(
WindowsOnly
),
Reason
=
ConditionalSkipReason
.
NativePdbRequiresDesktop
)]
public
void
AsyncInFinally003
()
{
...
...
@@ -978,9 +975,9 @@ public static void Main()
</symbols>
"
);
v
.
VerifyIL
(
"Test.<G>d__1.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext"
,
@"
{
// Code size 4
55 (0x1c7
)
v
.
VerifyIL
(
"Test.<G>d__1.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext"
,
@"
{
// Code size 4
61 (0x1cd
)
.maxstack 3
.locals init (int V_0,
int V_1,
...
...
@@ -996,194 +993,197 @@ .maxstack 3
.try
{
~IL_0007: ldloc.0
IL_0008: brfalse.s IL_00
2b
IL_0008: brfalse.s IL_00
12
IL_000a: br.s IL_000c
IL_000c: ldloc.0
IL_000d: ldc.i4.1
IL_000e: beq IL_010f
IL_0013: br.s IL_0015
-IL_0015: nop
-IL_0016: ldarg.0
IL_0017: ldc.i4.0
IL_0018: stfld ""int Test.<G>d__1.<x>5__1""
~IL_001d: ldarg.0
IL_001e: ldnull
IL_001f: stfld ""object Test.<G>d__1.<>s__2""
IL_0024: ldarg.0
IL_0025: ldc.i4.0
IL_0026: stfld ""int Test.<G>d__1.<>s__3""
~IL_002b: nop
IL_000e: beq.s IL_0014
IL_0010: br.s IL_0019
IL_0012: br.s IL_002f
IL_0014: br IL_0115
-IL_0019: nop
-IL_001a: ldarg.0
IL_001b: ldc.i4.0
IL_001c: stfld ""int Test.<G>d__1.<x>5__1""
~IL_0021: ldarg.0
IL_0022: ldnull
IL_0023: stfld ""object Test.<G>d__1.<>s__2""
IL_0028: ldarg.0
IL_0029: ldc.i4.0
IL_002a: stfld ""int Test.<G>d__1.<>s__3""
~IL_002f: nop
.try
{
~IL_002c: ldloc.0
IL_002d: brfalse.s IL_006d
IL_002f: br.s IL_0031
-IL_0031: nop
-IL_0032: call ""System.Threading.Tasks.Task<int> Test.F()""
IL_0037: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_003c: stloc.2
~IL_003d: ldloca.s V_2
IL_003f: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_0044: brtrue.s IL_0089
IL_0046: ldarg.0
IL_0047: ldc.i4.0
IL_0048: dup
IL_0049: stloc.0
IL_004a: stfld ""int Test.<G>d__1.<>1__state""
<IL_004f: ldarg.0
IL_0050: ldloc.2
IL_0051: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_0056: ldarg.0
IL_0057: stloc.3
IL_0058: ldarg.0
IL_0059: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_005e: ldloca.s V_2
IL_0060: ldloca.s V_3
IL_0062: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<G>d__1>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<G>d__1)""
IL_0067: nop
IL_0068: leave IL_01c6
>IL_006d: ldarg.0
IL_006e: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_0073: stloc.2
IL_0074: ldarg.0
IL_0075: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_007a: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0080: ldarg.0
IL_0081: ldc.i4.m1
IL_0082: dup
IL_0083: stloc.0
IL_0084: stfld ""int Test.<G>d__1.<>1__state""
IL_0089: ldarg.0
IL_008a: ldloca.s V_2
IL_008c: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_0091: stfld ""int Test.<G>d__1.<>s__5""
IL_0096: ldarg.0
IL_0097: ldarg.0
IL_0098: ldfld ""int Test.<G>d__1.<>s__5""
IL_009d: stfld ""int Test.<G>d__1.<x>5__1""
-IL_00a2: ldarg.0
IL_00a3: ldarg.0
IL_00a4: ldfld ""int Test.<G>d__1.<x>5__1""
IL_00a9: stfld ""int Test.<G>d__1.<>s__4""
IL_00ae: br.s IL_00b0
IL_00b0: ldarg.0
IL_00b1: ldc.i4.1
IL_00b2: stfld ""int Test.<G>d__1.<>s__3""
IL_00b7: leave.s IL_00c5
~IL_0030: ldloc.0
IL_0031: brfalse.s IL_0035
IL_0033: br.s IL_0037
IL_0035: br.s IL_0073
-IL_0037: nop
-IL_0038: call ""System.Threading.Tasks.Task<int> Test.F()""
IL_003d: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_0042: stloc.2
~IL_0043: ldloca.s V_2
IL_0045: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_004a: brtrue.s IL_008f
IL_004c: ldarg.0
IL_004d: ldc.i4.0
IL_004e: dup
IL_004f: stloc.0
IL_0050: stfld ""int Test.<G>d__1.<>1__state""
<IL_0055: ldarg.0
IL_0056: ldloc.2
IL_0057: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_005c: ldarg.0
IL_005d: stloc.3
IL_005e: ldarg.0
IL_005f: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_0064: ldloca.s V_2
IL_0066: ldloca.s V_3
IL_0068: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<G>d__1>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<G>d__1)""
IL_006d: nop
IL_006e: leave IL_01cc
>IL_0073: ldarg.0
IL_0074: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_0079: stloc.2
IL_007a: ldarg.0
IL_007b: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_0080: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0086: ldarg.0
IL_0087: ldc.i4.m1
IL_0088: dup
IL_0089: stloc.0
IL_008a: stfld ""int Test.<G>d__1.<>1__state""
IL_008f: ldarg.0
IL_0090: ldloca.s V_2
IL_0092: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_0097: stfld ""int Test.<G>d__1.<>s__5""
IL_009c: ldarg.0
IL_009d: ldarg.0
IL_009e: ldfld ""int Test.<G>d__1.<>s__5""
IL_00a3: stfld ""int Test.<G>d__1.<x>5__1""
-IL_00a8: ldarg.0
IL_00a9: ldarg.0
IL_00aa: ldfld ""int Test.<G>d__1.<x>5__1""
IL_00af: stfld ""int Test.<G>d__1.<>s__4""
IL_00b4: br.s IL_00b6
IL_00b6: ldarg.0
IL_00b7: ldc.i4.1
IL_00b8: stfld ""int Test.<G>d__1.<>s__3""
IL_00bd: leave.s IL_00cb
}
catch object
{
~IL_00b9: stloc.s V_4
IL_00bb: ldarg.0
IL_00bc: ldloc.s V_4
IL_00be: stfld ""object Test.<G>d__1.<>s__2""
IL_00c3: leave.s IL_00c5
}
-IL_00c5: nop
-IL_00c6: ldarg.0
IL_00c7: ldarg.0
IL_00c8: ldfld ""int Test.<G>d__1.<x>5__1""
IL_00cd: stfld ""int Test.<G>d__1.<>s__6""
IL_00d2: call ""System.Threading.Tasks.Task<int> Test.F()""
IL_00d7: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_00dc: stloc.s V_5
~IL_00de: ldloca.s V_5
IL_00e0: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_00e5: brtrue.s IL_012c
IL_00e7: ldarg.0
IL_00e8: ldc.i4.1
IL_00e9: dup
IL_00ea: stloc.0
IL_00eb: stfld ""int Test.<G>d__1.<>1__state""
<IL_00f0: ldarg.0
IL_00f1: ldloc.s V_5
IL_00f3: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_00f8: ldarg.0
IL_00f9: stloc.3
IL_00fa: ldarg.0
IL_00fb: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_0100: ldloca.s V_5
IL_0102: ldloca.s V_3
IL_0104: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<G>d__1>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<G>d__1)""
IL_0109: nop
IL_010a: leave IL_01c6
>IL_010f: ldarg.0
IL_0110: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_0115: stloc.s V_5
IL_0117: ldarg.0
IL_0118: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_011d: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0123: ldarg.0
IL_0124: ldc.i4.m1
IL_0125: dup
IL_0126: stloc.0
IL_0127: stfld ""int Test.<G>d__1.<>1__state""
IL_012c: ldarg.0
IL_012d: ldloca.s V_5
IL_012f: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_0134: stfld ""int Test.<G>d__1.<>s__7""
IL_0139: ldarg.0
IL_013a: ldarg.0
IL_013b: ldfld ""int Test.<G>d__1.<>s__6""
~IL_00bf: stloc.s V_4
IL_00c1: ldarg.0
IL_00c2: ldloc.s V_4
IL_00c4: stfld ""object Test.<G>d__1.<>s__2""
IL_00c9: leave.s IL_00cb
}
-IL_00cb: nop
-IL_00cc: ldarg.0
IL_00cd: ldarg.0
IL_00ce: ldfld ""int Test.<G>d__1.<x>5__1""
IL_00d3: stfld ""int Test.<G>d__1.<>s__6""
IL_00d8: call ""System.Threading.Tasks.Task<int> Test.F()""
IL_00dd: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_00e2: stloc.s V_5
~IL_00e4: ldloca.s V_5
IL_00e6: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_00eb: brtrue.s IL_0132
IL_00ed: ldarg.0
IL_00ee: ldc.i4.1
IL_00ef: dup
IL_00f0: stloc.0
IL_00f1: stfld ""int Test.<G>d__1.<>1__state""
<IL_00f6: ldarg.0
IL_00f7: ldloc.s V_5
IL_00f9: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_00fe: ldarg.0
IL_00ff: stloc.3
IL_0100: ldarg.0
IL_0101: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_0106: ldloca.s V_5
IL_0108: ldloca.s V_3
IL_010a: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<G>d__1>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<G>d__1)""
IL_010f: nop
IL_0110: leave IL_01cc
>IL_0115: ldarg.0
IL_0116: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_011b: stloc.s V_5
IL_011d: ldarg.0
IL_011e: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<G>d__1.<>u__1""
IL_0123: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0129: ldarg.0
IL_012a: ldc.i4.m1
IL_012b: dup
IL_012c: stloc.0
IL_012d: stfld ""int Test.<G>d__1.<>1__state""
IL_0132: ldarg.0
IL_0133: ldloca.s V_5
IL_0135: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_013a: stfld ""int Test.<G>d__1.<>s__7""
IL_013f: ldarg.0
IL_0140: ldarg.0
IL_0141: ldfld ""int Test.<G>d__1.<>s__7""
IL_0146: add
IL_0147: stfld ""int Test.<G>d__1.<x>5__1""
-IL_014c: nop
~IL_014d: ldarg.0
IL_014e: ldfld ""object Test.<G>d__1.<>s__2""
IL_0153: stloc.s V_4
IL_0155: ldloc.s V_4
IL_0157: brfalse.s IL_0176
IL_0159: ldloc.s V_4
IL_015b: isinst ""System.Exception""
IL_0160: stloc.s V_6
IL_0162: ldloc.s V_6
IL_0164: brtrue.s IL_0169
IL_0166: ldloc.s V_4
IL_0168: throw
IL_0169: ldloc.s V_6
IL_016b: call ""System.Runtime.ExceptionServices.ExceptionDispatchInfo System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(System.Exception)""
IL_0170: callvirt ""void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()""
IL_0175: nop
IL_0176: ldarg.0
IL_0177: ldfld ""int Test.<G>d__1.<>s__3""
IL_017c: stloc.s V_7
IL_017e: ldloc.s V_7
IL_0180: ldc.i4.1
IL_0181: beq.s IL_0185
IL_0183: br.s IL_018e
IL_0185: ldarg.0
IL_0186: ldfld ""int Test.<G>d__1.<>s__4""
IL_018b: stloc.1
IL_018c: leave.s IL_01b1
IL_018e: ldarg.0
IL_018f: ldnull
IL_0190: stfld ""object Test.<G>d__1.<>s__2""
IL_0195: leave.s IL_01b1
IL_0141: ldfld ""int Test.<G>d__1.<>s__6""
IL_0146: ldarg.0
IL_0147: ldfld ""int Test.<G>d__1.<>s__7""
IL_014c: add
IL_014d: stfld ""int Test.<G>d__1.<x>5__1""
-IL_0152: nop
~IL_0153: ldarg.0
IL_0154: ldfld ""object Test.<G>d__1.<>s__2""
IL_0159: stloc.s V_4
IL_015b: ldloc.s V_4
IL_015d: brfalse.s IL_017c
IL_015f: ldloc.s V_4
IL_0161: isinst ""System.Exception""
IL_0166: stloc.s V_6
IL_0168: ldloc.s V_6
IL_016a: brtrue.s IL_016f
IL_016c: ldloc.s V_4
IL_016e: throw
IL_016f: ldloc.s V_6
IL_0171: call ""System.Runtime.ExceptionServices.ExceptionDispatchInfo System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(System.Exception)""
IL_0176: callvirt ""void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()""
IL_017b: nop
IL_017c: ldarg.0
IL_017d: ldfld ""int Test.<G>d__1.<>s__3""
IL_0182: stloc.s V_7
IL_0184: ldloc.s V_7
IL_0186: ldc.i4.1
IL_0187: beq.s IL_018b
IL_0189: br.s IL_0194
IL_018b: ldarg.0
IL_018c: ldfld ""int Test.<G>d__1.<>s__4""
IL_0191: stloc.1
IL_0192: leave.s IL_01b7
IL_0194: ldarg.0
IL_0195: ldnull
IL_0196: stfld ""object Test.<G>d__1.<>s__2""
IL_019b: leave.s IL_01b7
}
catch System.Exception
{
~IL_019
7
: stloc.s V_6
IL_019
9
: ldarg.0
IL_01
9a
: ldc.i4.s -2
IL_01
9c
: stfld ""int Test.<G>d__1.<>1__state""
IL_01a
1
: ldarg.0
IL_01a
2
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_01a
7
: ldloc.s V_6
IL_01a
9
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_01
ae
: nop
IL_01
af: leave.s IL_01c6
~IL_019
d
: stloc.s V_6
IL_019
f
: ldarg.0
IL_01
a0
: ldc.i4.s -2
IL_01
a2
: stfld ""int Test.<G>d__1.<>1__state""
IL_01a
7
: ldarg.0
IL_01a
8
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_01a
d
: ldloc.s V_6
IL_01a
f
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_01
b4
: nop
IL_01
b5: leave.s IL_01cc
}
-IL_01b
1
: ldarg.0
IL_01b
2
: ldc.i4.s -2
IL_01b
4
: stfld ""int Test.<G>d__1.<>1__state""
~IL_01b
9
: ldarg.0
IL_01
ba
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_01
bf
: ldloc.1
IL_01c
0
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_01c
5
: nop
IL_01c
6
: ret
-IL_01b
7
: ldarg.0
IL_01b
8
: ldc.i4.s -2
IL_01b
a
: stfld ""int Test.<G>d__1.<>1__state""
~IL_01b
f
: ldarg.0
IL_01
c0
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__1.<>t__builder""
IL_01
c5
: ldloc.1
IL_01c
6
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_01c
b
: nop
IL_01c
c
: ret
}"
,
sequencePoints
:
"Test+<G>d__1.MoveNext"
);
}
...
...
@@ -1786,7 +1786,6 @@ public static void Main()
CompileAndVerify
(
source
,
expectedOutput
:
expected
);
}
[
Fact
]
public
void
AsyncInCatchFilter
()
{
...
...
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncIteratorTests.cs
浏览文件 @
eea11615
...
...
@@ -2054,9 +2054,9 @@ .maxstack 5
}"
);
if
(
options
==
TestOptions
.
DebugExe
)
{
verifier
.
VerifyIL
(
"C.<M>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()"
,
@"
{
// Code size 2
89 (0x121
)
verifier
.
VerifyIL
(
"C.<M>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()"
,
@"
{
// Code size 2
98 (0x12a
)
.maxstack 3
.locals init (int V_0,
System.Runtime.CompilerServices.TaskAwaiter V_1,
...
...
@@ -2073,131 +2073,133 @@ .maxstack 3
IL_0008: ldc.i4.s -4
IL_000a: sub
IL_000b: switch (
IL_00c5,
IL_0026,
IL_0026,
IL_0026,
IL_0083)
IL_0024: br.s IL_0026
IL_0026: ldarg.0
IL_0027: ldfld ""bool C.<M>d__0.<>w__disposeMode""
IL_002c: brfalse.s IL_0033
IL_002e: leave IL_00fd
IL_0033: ldarg.0
IL_0034: ldc.i4.m1
IL_0035: dup
IL_0036: stloc.0
IL_0037: stfld ""int C.<M>d__0.<>1__state""
IL_002b,
IL_002f,
IL_002f,
IL_002d)
IL_0024: br.s IL_002f
IL_0026: br IL_00ce
IL_002b: br.s IL_002f
IL_002d: br.s IL_008c
IL_002f: ldarg.0
IL_0030: ldfld ""bool C.<M>d__0.<>w__disposeMode""
IL_0035: brfalse.s IL_003c
IL_0037: leave IL_0106
IL_003c: ldarg.0
IL_003d: ldc.i4.m1
IL_003e: dup
IL_003f: stloc.0
IL_0040: stfld ""int C.<M>d__0.<>1__state""
// sequence point: {
IL_00
3c
: nop
IL_00
45
: nop
// sequence point: Write(""1 "");
IL_00
3d
: ldstr ""1 ""
IL_004
2
: call ""void System.Console.Write(string)""
IL_00
47
: nop
IL_00
46
: ldstr ""1 ""
IL_004
b
: call ""void System.Console.Write(string)""
IL_00
50
: nop
// sequence point: await System.Threading.Tasks.Task.CompletedTask;
IL_00
48
: call ""System.Threading.Tasks.Task System.Threading.Tasks.Task.CompletedTask.get""
IL_00
4d
: callvirt ""System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()""
IL_005
2
: stloc.1
IL_00
51
: call ""System.Threading.Tasks.Task System.Threading.Tasks.Task.CompletedTask.get""
IL_00
56
: callvirt ""System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()""
IL_005
b
: stloc.1
// sequence point: <hidden>
IL_0053: ldloca.s V_1
IL_0055: call ""bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get""
IL_005a: brtrue.s IL_009f
IL_005c: ldarg.0
IL_005d: ldc.i4.0
IL_005e: dup
IL_005f: stloc.0
IL_0060: stfld ""int C.<M>d__0.<>1__state""
// async: yield
IL_005c: ldloca.s V_1
IL_005e: call ""bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get""
IL_0063: brtrue.s IL_00a8
IL_0065: ldarg.0
IL_0066: ldloc.1
IL_0067: stfld ""System.Runtime.CompilerServices.TaskAwaiter C.<M>d__0.<>u__1""
IL_006c: ldarg.0
IL_006d: stloc.2
IL_0066: ldc.i4.0
IL_0067: dup
IL_0068: stloc.0
IL_0069: stfld ""int C.<M>d__0.<>1__state""
// async: yield
IL_006e: ldarg.0
IL_006f: ldflda ""System.Runtime.CompilerServices.AsyncIteratorMethodBuilder C.<M>d__0.<>t__builder""
IL_0074: ldloca.s V_1
IL_0076: ldloca.s V_2
IL_0078: call ""void System.Runtime.CompilerServices.AsyncIteratorMethodBuilder.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter, C.<M>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter, ref C.<M>d__0)""
IL_007d: nop
IL_007e: leave IL_0120
IL_006f: ldloc.1
IL_0070: stfld ""System.Runtime.CompilerServices.TaskAwaiter C.<M>d__0.<>u__1""
IL_0075: ldarg.0
IL_0076: stloc.2
IL_0077: ldarg.0
IL_0078: ldflda ""System.Runtime.CompilerServices.AsyncIteratorMethodBuilder C.<M>d__0.<>t__builder""
IL_007d: ldloca.s V_1
IL_007f: ldloca.s V_2
IL_0081: call ""void System.Runtime.CompilerServices.AsyncIteratorMethodBuilder.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter, C.<M>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter, ref C.<M>d__0)""
IL_0086: nop
IL_0087: leave IL_0129
// async: resume
IL_008
3
: ldarg.0
IL_008
4
: ldfld ""System.Runtime.CompilerServices.TaskAwaiter C.<M>d__0.<>u__1""
IL_00
89
: stloc.1
IL_00
8a
: ldarg.0
IL_00
8b
: ldflda ""System.Runtime.CompilerServices.TaskAwaiter C.<M>d__0.<>u__1""
IL_009
0
: initobj ""System.Runtime.CompilerServices.TaskAwaiter""
IL_009
6
: ldarg.0
IL_00
97
: ldc.i4.m1
IL_00
98
: dup
IL_00
99
: stloc.0
IL_00
9a
: stfld ""int C.<M>d__0.<>1__state""
IL_00
9f
: ldloca.s V_1
IL_00a
1
: call ""void System.Runtime.CompilerServices.TaskAwaiter.GetResult()""
IL_00a
6
: nop
IL_008
c
: ldarg.0
IL_008
d
: ldfld ""System.Runtime.CompilerServices.TaskAwaiter C.<M>d__0.<>u__1""
IL_00
92
: stloc.1
IL_00
93
: ldarg.0
IL_00
94
: ldflda ""System.Runtime.CompilerServices.TaskAwaiter C.<M>d__0.<>u__1""
IL_009
9
: initobj ""System.Runtime.CompilerServices.TaskAwaiter""
IL_009
f
: ldarg.0
IL_00
a0
: ldc.i4.m1
IL_00
a1
: dup
IL_00
a2
: stloc.0
IL_00
a3
: stfld ""int C.<M>d__0.<>1__state""
IL_00
a8
: ldloca.s V_1
IL_00a
a
: call ""void System.Runtime.CompilerServices.TaskAwaiter.GetResult()""
IL_00a
f
: nop
// sequence point: Write(""2 "");
IL_00
a7
: ldstr ""2 ""
IL_00
ac
: call ""void System.Console.Write(string)""
IL_00b
1
: nop
IL_00
b0
: ldstr ""2 ""
IL_00
b5
: call ""void System.Console.Write(string)""
IL_00b
a
: nop
// sequence point: yield return 3;
IL_00b
2
: ldarg.0
IL_00b
3
: ldc.i4.3
IL_00b
4
: stfld ""int C.<M>d__0.<>2__current""
IL_00
b9
: ldarg.0
IL_00
ba
: ldc.i4.s -4
IL_00
bc
: dup
IL_00
bd
: stloc.0
IL_00
be
: stfld ""int C.<M>d__0.<>1__state""
IL_00c
3: leave.s IL_0113
IL_00b
b
: ldarg.0
IL_00b
c
: ldc.i4.3
IL_00b
d
: stfld ""int C.<M>d__0.<>2__current""
IL_00
c2
: ldarg.0
IL_00
c3
: ldc.i4.s -4
IL_00
c5
: dup
IL_00
c6
: stloc.0
IL_00
c7
: stfld ""int C.<M>d__0.<>1__state""
IL_00c
c: leave.s IL_011c
// sequence point: <hidden>
IL_00c5: ldarg.0
IL_00c6: ldc.i4.m1
IL_00c7: dup
IL_00c8: stloc.0
IL_00c9: stfld ""int C.<M>d__0.<>1__state""
IL_00ce: ldarg.0
IL_00cf: ldfld ""bool C.<M>d__0.<>w__disposeMode""
IL_00d4: brfalse.s IL_00d8
IL_00d6: leave.s IL_00fd
IL_00cf: ldc.i4.m1
IL_00d0: dup
IL_00d1: stloc.0
IL_00d2: stfld ""int C.<M>d__0.<>1__state""
IL_00d7: ldarg.0
IL_00d8: ldfld ""bool C.<M>d__0.<>w__disposeMode""
IL_00dd: brfalse.s IL_00e1
IL_00df: leave.s IL_0106
// sequence point: Write("" 4 "");
IL_00
d8
: ldstr "" 4 ""
IL_00
dd
: call ""void System.Console.Write(string)""
IL_00e
2
: nop
IL_00e
3: leave.s IL_00fd
IL_00
e1
: ldstr "" 4 ""
IL_00
e6
: call ""void System.Console.Write(string)""
IL_00e
b
: nop
IL_00e
c: leave.s IL_0106
}
catch System.Exception
{
// sequence point: <hidden>
IL_00e
5
: stloc.3
IL_00e
6
: ldarg.0
IL_00
e7
: ldc.i4.s -2
IL_00
e9
: stfld ""int C.<M>d__0.<>1__state""
IL_00
ee
: ldarg.0
IL_00
ef
: ldflda ""System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool> C.<M>d__0.<>v__promiseOfValueOrEnd""
IL_00f
4
: ldloc.3
IL_00f
5
: call ""void System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool>.SetException(System.Exception)""
IL_0
0fa
: nop
IL_0
0fb: leave.s IL_0120
IL_00e
e
: stloc.3
IL_00e
f
: ldarg.0
IL_00
f0
: ldc.i4.s -2
IL_00
f2
: stfld ""int C.<M>d__0.<>1__state""
IL_00
f7
: ldarg.0
IL_00
f8
: ldflda ""System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool> C.<M>d__0.<>v__promiseOfValueOrEnd""
IL_00f
d
: ldloc.3
IL_00f
e
: call ""void System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool>.SetException(System.Exception)""
IL_0
103
: nop
IL_0
104: leave.s IL_0129
}
// sequence point: }
IL_0
0fd
: ldarg.0
IL_0
0fe
: ldc.i4.s -2
IL_010
0
: stfld ""int C.<M>d__0.<>1__state""
IL_0
106
: ldarg.0
IL_0
107
: ldc.i4.s -2
IL_010
9
: stfld ""int C.<M>d__0.<>1__state""
// sequence point: <hidden>
IL_0105: ldarg.0
IL_0106: ldflda ""System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool> C.<M>d__0.<>v__promiseOfValueOrEnd""
IL_010b: ldc.i4.0
IL_010c: call ""void System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool>.SetResult(bool)""
IL_0111: nop
IL_0112: ret
IL_0113: ldarg.0
IL_0114: ldflda ""System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool> C.<M>d__0.<>v__promiseOfValueOrEnd""
IL_0119: ldc.i4.1
IL_011a: call ""void System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool>.SetResult(bool)""
IL_011f: nop
IL_0120: ret
}
"
,
sequencePoints
:
"C+<M>d__0.MoveNext"
,
source
:
source
);
IL_010e: ldarg.0
IL_010f: ldflda ""System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool> C.<M>d__0.<>v__promiseOfValueOrEnd""
IL_0114: ldc.i4.0
IL_0115: call ""void System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool>.SetResult(bool)""
IL_011a: nop
IL_011b: ret
IL_011c: ldarg.0
IL_011d: ldflda ""System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool> C.<M>d__0.<>v__promiseOfValueOrEnd""
IL_0122: ldc.i4.1
IL_0123: call ""void System.Threading.Tasks.Sources.ManualResetValueTaskSourceCore<bool>.SetResult(bool)""
IL_0128: nop
IL_0129: ret
}"
,
sequencePoints
:
"C+<M>d__0.MoveNext"
,
source
:
source
);
}
else
{
...
...
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncLocalsTests.cs
浏览文件 @
eea11615
此差异已折叠。
点击以展开。
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncMainTests.cs
浏览文件 @
eea11615
...
...
@@ -1479,5 +1479,439 @@ static class Program {
// static Task Main() {
Diagnostic
(
ErrorCode
.
ERR_DeprecatedSymbolStr
,
"Task"
).
WithArguments
(
"MyExtensions.GetAwaiter(System.Threading.Tasks.Task)"
,
"test"
).
WithLocation
(
31
,
12
));
}
[
Fact
]
[
WorkItem
(
33542
,
"https://github.com/dotnet/roslyn/issues/33542"
)]
public
void
AwaitInFinallyInNestedTry_01
()
{
string
source
=
@"using System.Threading.Tasks;
class Program
{
static async Task Main()
{
try
{
try
{
return;
}
finally
{
await Task.CompletedTask;
}
}
catch
{
}
finally
{
await Task.CompletedTask;
}
}
}"
;
var
comp
=
CreateCompilation
(
source
,
options
:
TestOptions
.
ReleaseExe
.
WithOptimizationLevel
(
OptimizationLevel
.
Release
));
var
verifier
=
CompileAndVerify
(
comp
,
expectedOutput
:
""
);
verifier
.
VerifyIL
(
"Program.<Main>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()"
,
@"{
// Code size 426 (0x1aa)
.maxstack 3
.locals init (int V_0,
object V_1,
System.Runtime.CompilerServices.TaskAwaiter V_2,
int V_3,
System.Exception V_4)
IL_0000: ldarg.0
IL_0001: ldfld ""int Program.<Main>d__0.<>1__state""
IL_0006: stloc.0
.try
{
IL_0007: ldloc.0
IL_0008: brfalse.s IL_001f
IL_000a: ldloc.0
IL_000b: ldc.i4.1
IL_000c: beq IL_0125
IL_0011: ldarg.0
IL_0012: ldnull
IL_0013: stfld ""object Program.<Main>d__0.<>7__wrap1""
IL_0018: ldarg.0
IL_0019: ldc.i4.0
IL_001a: stfld ""int Program.<Main>d__0.<>7__wrap2""
IL_001f: nop
.try
{
IL_0020: ldloc.0
IL_0021: pop
IL_0022: nop
.try
{
IL_0023: ldloc.0
IL_0024: brfalse.s IL_007e
IL_0026: ldarg.0
IL_0027: ldnull
IL_0028: stfld ""object Program.<Main>d__0.<>7__wrap3""
IL_002d: ldarg.0
IL_002e: ldc.i4.0
IL_002f: stfld ""int Program.<Main>d__0.<>7__wrap4""
.try
{
IL_0034: ldarg.0
IL_0035: ldc.i4.1
IL_0036: stfld ""int Program.<Main>d__0.<>7__wrap4""
IL_003b: leave.s IL_0047
}
catch object
{
IL_003d: stloc.1
IL_003e: ldarg.0
IL_003f: ldloc.1
IL_0040: stfld ""object Program.<Main>d__0.<>7__wrap3""
IL_0045: leave.s IL_0047
}
IL_0047: call ""System.Threading.Tasks.Task System.Threading.Tasks.Task.CompletedTask.get""
IL_004c: callvirt ""System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()""
IL_0051: stloc.2
IL_0052: ldloca.s V_2
IL_0054: call ""bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get""
IL_0059: brtrue.s IL_009a
IL_005b: ldarg.0
IL_005c: ldc.i4.0
IL_005d: dup
IL_005e: stloc.0
IL_005f: stfld ""int Program.<Main>d__0.<>1__state""
IL_0064: ldarg.0
IL_0065: ldloc.2
IL_0066: stfld ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_006b: ldarg.0
IL_006c: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.<Main>d__0.<>t__builder""
IL_0071: ldloca.s V_2
IL_0073: ldarg.0
IL_0074: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter, Program.<Main>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter, ref Program.<Main>d__0)""
IL_0079: leave IL_01a9
IL_007e: ldarg.0
IL_007f: ldfld ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_0084: stloc.2
IL_0085: ldarg.0
IL_0086: ldflda ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_008b: initobj ""System.Runtime.CompilerServices.TaskAwaiter""
IL_0091: ldarg.0
IL_0092: ldc.i4.m1
IL_0093: dup
IL_0094: stloc.0
IL_0095: stfld ""int Program.<Main>d__0.<>1__state""
IL_009a: ldloca.s V_2
IL_009c: call ""void System.Runtime.CompilerServices.TaskAwaiter.GetResult()""
IL_00a1: ldarg.0
IL_00a2: ldfld ""object Program.<Main>d__0.<>7__wrap3""
IL_00a7: stloc.1
IL_00a8: ldloc.1
IL_00a9: brfalse.s IL_00c0
IL_00ab: ldloc.1
IL_00ac: isinst ""System.Exception""
IL_00b1: dup
IL_00b2: brtrue.s IL_00b6
IL_00b4: ldloc.1
IL_00b5: throw
IL_00b6: call ""System.Runtime.ExceptionServices.ExceptionDispatchInfo System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(System.Exception)""
IL_00bb: callvirt ""void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()""
IL_00c0: ldarg.0
IL_00c1: ldfld ""int Program.<Main>d__0.<>7__wrap4""
IL_00c6: stloc.3
IL_00c7: ldloc.3
IL_00c8: ldc.i4.1
IL_00c9: bne.un.s IL_00cd
IL_00cb: leave.s IL_00db
IL_00cd: ldarg.0
IL_00ce: ldnull
IL_00cf: stfld ""object Program.<Main>d__0.<>7__wrap3""
IL_00d4: leave.s IL_00d9
}
catch object
{
IL_00d6: pop
IL_00d7: leave.s IL_00d9
}
IL_00d9: leave.s IL_00ee
IL_00db: ldarg.0
IL_00dc: ldc.i4.1
IL_00dd: stfld ""int Program.<Main>d__0.<>7__wrap2""
IL_00e2: leave.s IL_00ee
}
catch object
{
IL_00e4: stloc.1
IL_00e5: ldarg.0
IL_00e6: ldloc.1
IL_00e7: stfld ""object Program.<Main>d__0.<>7__wrap1""
IL_00ec: leave.s IL_00ee
}
IL_00ee: call ""System.Threading.Tasks.Task System.Threading.Tasks.Task.CompletedTask.get""
IL_00f3: callvirt ""System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()""
IL_00f8: stloc.2
IL_00f9: ldloca.s V_2
IL_00fb: call ""bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get""
IL_0100: brtrue.s IL_0141
IL_0102: ldarg.0
IL_0103: ldc.i4.1
IL_0104: dup
IL_0105: stloc.0
IL_0106: stfld ""int Program.<Main>d__0.<>1__state""
IL_010b: ldarg.0
IL_010c: ldloc.2
IL_010d: stfld ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_0112: ldarg.0
IL_0113: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.<Main>d__0.<>t__builder""
IL_0118: ldloca.s V_2
IL_011a: ldarg.0
IL_011b: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter, Program.<Main>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter, ref Program.<Main>d__0)""
IL_0120: leave IL_01a9
IL_0125: ldarg.0
IL_0126: ldfld ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_012b: stloc.2
IL_012c: ldarg.0
IL_012d: ldflda ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_0132: initobj ""System.Runtime.CompilerServices.TaskAwaiter""
IL_0138: ldarg.0
IL_0139: ldc.i4.m1
IL_013a: dup
IL_013b: stloc.0
IL_013c: stfld ""int Program.<Main>d__0.<>1__state""
IL_0141: ldloca.s V_2
IL_0143: call ""void System.Runtime.CompilerServices.TaskAwaiter.GetResult()""
IL_0148: ldarg.0
IL_0149: ldfld ""object Program.<Main>d__0.<>7__wrap1""
IL_014e: stloc.1
IL_014f: ldloc.1
IL_0150: brfalse.s IL_0167
IL_0152: ldloc.1
IL_0153: isinst ""System.Exception""
IL_0158: dup
IL_0159: brtrue.s IL_015d
IL_015b: ldloc.1
IL_015c: throw
IL_015d: call ""System.Runtime.ExceptionServices.ExceptionDispatchInfo System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(System.Exception)""
IL_0162: callvirt ""void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()""
IL_0167: ldarg.0
IL_0168: ldfld ""int Program.<Main>d__0.<>7__wrap2""
IL_016d: stloc.3
IL_016e: ldloc.3
IL_016f: ldc.i4.1
IL_0170: bne.un.s IL_0174
IL_0172: leave.s IL_0196
IL_0174: ldarg.0
IL_0175: ldnull
IL_0176: stfld ""object Program.<Main>d__0.<>7__wrap1""
IL_017b: leave.s IL_0196
}
catch System.Exception
{
IL_017d: stloc.s V_4
IL_017f: ldarg.0
IL_0180: ldc.i4.s -2
IL_0182: stfld ""int Program.<Main>d__0.<>1__state""
IL_0187: ldarg.0
IL_0188: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.<Main>d__0.<>t__builder""
IL_018d: ldloc.s V_4
IL_018f: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetException(System.Exception)""
IL_0194: leave.s IL_01a9
}
IL_0196: ldarg.0
IL_0197: ldc.i4.s -2
IL_0199: stfld ""int Program.<Main>d__0.<>1__state""
IL_019e: ldarg.0
IL_019f: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.<Main>d__0.<>t__builder""
IL_01a4: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()""
IL_01a9: ret
}"
);
}
[
Fact
]
[
WorkItem
(
34720
,
"https://github.com/dotnet/roslyn/issues/34720"
)]
public
void
AwaitInFinallyInNestedTry_02
()
{
string
source
=
@"using System.IO;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
for (int i = 0; i < 5; i++)
{
using (new MemoryStream())
{
try
{
continue;
}
finally
{
await Task.Delay(1);
}
}
}
}
}"
;
var
comp
=
CreateCompilation
(
source
,
options
:
TestOptions
.
ReleaseExe
.
WithOptimizationLevel
(
OptimizationLevel
.
Release
));
var
verifier
=
CompileAndVerify
(
comp
,
expectedOutput
:
""
);
verifier
.
VerifyIL
(
"Program.<Main>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()"
,
@"{
// Code size 320 (0x140)
.maxstack 3
.locals init (int V_0,
object V_1,
System.Runtime.CompilerServices.TaskAwaiter V_2,
int V_3,
System.Exception V_4)
IL_0000: ldarg.0
IL_0001: ldfld ""int Program.<Main>d__0.<>1__state""
IL_0006: stloc.0
.try
{
IL_0007: ldloc.0
IL_0008: brfalse.s IL_0021
IL_000a: ldarg.0
IL_000b: ldc.i4.0
IL_000c: stfld ""int Program.<Main>d__0.<i>5__2""
IL_0011: br IL_0105
IL_0016: ldarg.0
IL_0017: newobj ""System.IO.MemoryStream..ctor()""
IL_001c: stfld ""System.IO.MemoryStream Program.<Main>d__0.<>7__wrap2""
IL_0021: nop
.try
{
IL_0022: ldloc.0
IL_0023: brfalse.s IL_007e
IL_0025: ldarg.0
IL_0026: ldnull
IL_0027: stfld ""object Program.<Main>d__0.<>7__wrap3""
IL_002c: ldarg.0
IL_002d: ldc.i4.0
IL_002e: stfld ""int Program.<Main>d__0.<>7__wrap4""
.try
{
IL_0033: ldarg.0
IL_0034: ldc.i4.1
IL_0035: stfld ""int Program.<Main>d__0.<>7__wrap4""
IL_003a: leave.s IL_0046
}
catch object
{
IL_003c: stloc.1
IL_003d: ldarg.0
IL_003e: ldloc.1
IL_003f: stfld ""object Program.<Main>d__0.<>7__wrap3""
IL_0044: leave.s IL_0046
}
IL_0046: ldc.i4.1
IL_0047: call ""System.Threading.Tasks.Task System.Threading.Tasks.Task.Delay(int)""
IL_004c: callvirt ""System.Runtime.CompilerServices.TaskAwaiter System.Threading.Tasks.Task.GetAwaiter()""
IL_0051: stloc.2
IL_0052: ldloca.s V_2
IL_0054: call ""bool System.Runtime.CompilerServices.TaskAwaiter.IsCompleted.get""
IL_0059: brtrue.s IL_009a
IL_005b: ldarg.0
IL_005c: ldc.i4.0
IL_005d: dup
IL_005e: stloc.0
IL_005f: stfld ""int Program.<Main>d__0.<>1__state""
IL_0064: ldarg.0
IL_0065: ldloc.2
IL_0066: stfld ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_006b: ldarg.0
IL_006c: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.<Main>d__0.<>t__builder""
IL_0071: ldloca.s V_2
IL_0073: ldarg.0
IL_0074: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter, Program.<Main>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter, ref Program.<Main>d__0)""
IL_0079: leave IL_013f
IL_007e: ldarg.0
IL_007f: ldfld ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_0084: stloc.2
IL_0085: ldarg.0
IL_0086: ldflda ""System.Runtime.CompilerServices.TaskAwaiter Program.<Main>d__0.<>u__1""
IL_008b: initobj ""System.Runtime.CompilerServices.TaskAwaiter""
IL_0091: ldarg.0
IL_0092: ldc.i4.m1
IL_0093: dup
IL_0094: stloc.0
IL_0095: stfld ""int Program.<Main>d__0.<>1__state""
IL_009a: ldloca.s V_2
IL_009c: call ""void System.Runtime.CompilerServices.TaskAwaiter.GetResult()""
IL_00a1: ldarg.0
IL_00a2: ldfld ""object Program.<Main>d__0.<>7__wrap3""
IL_00a7: stloc.1
IL_00a8: ldloc.1
IL_00a9: brfalse.s IL_00c0
IL_00ab: ldloc.1
IL_00ac: isinst ""System.Exception""
IL_00b1: dup
IL_00b2: brtrue.s IL_00b6
IL_00b4: ldloc.1
IL_00b5: throw
IL_00b6: call ""System.Runtime.ExceptionServices.ExceptionDispatchInfo System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(System.Exception)""
IL_00bb: callvirt ""void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()""
IL_00c0: ldarg.0
IL_00c1: ldfld ""int Program.<Main>d__0.<>7__wrap4""
IL_00c6: stloc.3
IL_00c7: ldloc.3
IL_00c8: ldc.i4.1
IL_00c9: bne.un.s IL_00cd
IL_00cb: leave.s IL_00f5
IL_00cd: ldarg.0
IL_00ce: ldnull
IL_00cf: stfld ""object Program.<Main>d__0.<>7__wrap3""
IL_00d4: leave.s IL_00ee
}
finally
{
IL_00d6: ldloc.0
IL_00d7: ldc.i4.0
IL_00d8: bge.s IL_00ed
IL_00da: ldarg.0
IL_00db: ldfld ""System.IO.MemoryStream Program.<Main>d__0.<>7__wrap2""
IL_00e0: brfalse.s IL_00ed
IL_00e2: ldarg.0
IL_00e3: ldfld ""System.IO.MemoryStream Program.<Main>d__0.<>7__wrap2""
IL_00e8: callvirt ""void System.IDisposable.Dispose()""
IL_00ed: endfinally
}
IL_00ee: ldarg.0
IL_00ef: ldnull
IL_00f0: stfld ""System.IO.MemoryStream Program.<Main>d__0.<>7__wrap2""
IL_00f5: ldarg.0
IL_00f6: ldfld ""int Program.<Main>d__0.<i>5__2""
IL_00fb: stloc.3
IL_00fc: ldarg.0
IL_00fd: ldloc.3
IL_00fe: ldc.i4.1
IL_00ff: add
IL_0100: stfld ""int Program.<Main>d__0.<i>5__2""
IL_0105: ldarg.0
IL_0106: ldfld ""int Program.<Main>d__0.<i>5__2""
IL_010b: ldc.i4.5
IL_010c: blt IL_0016
IL_0111: leave.s IL_012c
}
catch System.Exception
{
IL_0113: stloc.s V_4
IL_0115: ldarg.0
IL_0116: ldc.i4.s -2
IL_0118: stfld ""int Program.<Main>d__0.<>1__state""
IL_011d: ldarg.0
IL_011e: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.<Main>d__0.<>t__builder""
IL_0123: ldloc.s V_4
IL_0125: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetException(System.Exception)""
IL_012a: leave.s IL_013f
}
IL_012c: ldarg.0
IL_012d: ldc.i4.s -2
IL_012f: stfld ""int Program.<Main>d__0.<>1__state""
IL_0134: ldarg.0
IL_0135: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder Program.<Main>d__0.<>t__builder""
IL_013a: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.SetResult()""
IL_013f: ret
}"
);
}
}
}
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncSpillTests.cs
浏览文件 @
eea11615
...
...
@@ -594,9 +594,9 @@ public static async Task<int> F(int[] array)
"
;
var
v
=
CompileAndVerify
(
source
,
options
:
TestOptions
.
DebugDll
);
v
.
VerifyIL
(
"Test.<F>d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext"
,
@"
{
// Code size 27
1 (0x10f
)
v
.
VerifyIL
(
"Test.<F>d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext"
,
@"
{
// Code size 27
3 (0x111
)
.maxstack 5
.locals init (int V_0,
int V_1,
...
...
@@ -610,122 +610,123 @@ .maxstack 5
.try
{
~IL_0007: ldloc.0
IL_0008: brfalse.s IL_0086
IL_000a: br.s IL_000c
-IL_000c: nop
-IL_000d: ldarg.0
IL_000e: ldarg.0
IL_000f: ldfld ""int[] Test.<F>d__2.array""
IL_0014: ldc.i4.1
IL_0015: ldelema ""int""
IL_001a: dup
IL_001b: ldind.i4
IL_001c: ldc.i4.2
IL_001d: add
IL_001e: dup
IL_001f: stloc.2
IL_0020: stind.i4
IL_0021: ldloc.2
IL_0022: stfld ""int Test.<F>d__2.<>s__1""
IL_0027: ldarg.0
IL_0028: ldarg.0
IL_0029: ldfld ""int[] Test.<F>d__2.array""
IL_002e: stfld ""int[] Test.<F>d__2.<>s__4""
IL_0033: ldarg.0
IL_0034: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_0039: ldc.i4.3
IL_003a: ldelem.i4
IL_003b: pop
IL_003c: ldarg.0
IL_003d: ldarg.0
IL_003e: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_0043: ldc.i4.3
IL_0044: ldelem.i4
IL_0045: stfld ""int Test.<F>d__2.<>s__2""
IL_004a: call ""System.Threading.Tasks.Task<int> Test.G()""
IL_004f: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_0054: stloc.3
~IL_0055: ldloca.s V_3
IL_0057: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_005c: brtrue.s IL_00a2
IL_005e: ldarg.0
IL_005f: ldc.i4.0
IL_0060: dup
IL_0061: stloc.0
IL_0062: stfld ""int Test.<F>d__2.<>1__state""
<IL_0067: ldarg.0
IL_0068: ldloc.3
IL_0069: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_006e: ldarg.0
IL_006f: stloc.s V_4
IL_0071: ldarg.0
IL_0072: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_0077: ldloca.s V_3
IL_0079: ldloca.s V_4
IL_007b: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__2>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__2)""
IL_0080: nop
IL_0081: leave IL_010e
>IL_0086: ldarg.0
IL_0087: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_008c: stloc.3
IL_008d: ldarg.0
IL_008e: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0093: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0099: ldarg.0
IL_009a: ldc.i4.m1
IL_009b: dup
IL_009c: stloc.0
IL_009d: stfld ""int Test.<F>d__2.<>1__state""
IL_00a2: ldarg.0
IL_00a3: ldloca.s V_3
IL_00a5: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_00aa: stfld ""int Test.<F>d__2.<>s__3""
IL_00af: ldarg.0
IL_00b0: ldfld ""int Test.<F>d__2.<>s__1""
IL_00b5: ldarg.0
IL_00b6: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_00bb: ldc.i4.3
IL_00bc: ldarg.0
IL_00bd: ldfld ""int Test.<F>d__2.<>s__2""
IL_00c2: ldarg.0
IL_00c3: ldfld ""int Test.<F>d__2.<>s__3""
IL_00c8: add
IL_00c9: dup
IL_00ca: stloc.2
IL_00cb: stelem.i4
IL_00cc: ldloc.2
IL_00cd: ldc.i4.4
IL_00ce: call ""int Test.H(int, int, int)""
IL_00d3: pop
IL_00d4: ldarg.0
IL_00d5: ldnull
IL_00d6: stfld ""int[] Test.<F>d__2.<>s__4""
-IL_00db: ldc.i4.1
IL_00dc: stloc.1
IL_00dd: leave.s IL_00f9
IL_0008: brfalse.s IL_000c
IL_000a: br.s IL_000e
IL_000c: br.s IL_0088
-IL_000e: nop
-IL_000f: ldarg.0
IL_0010: ldarg.0
IL_0011: ldfld ""int[] Test.<F>d__2.array""
IL_0016: ldc.i4.1
IL_0017: ldelema ""int""
IL_001c: dup
IL_001d: ldind.i4
IL_001e: ldc.i4.2
IL_001f: add
IL_0020: dup
IL_0021: stloc.2
IL_0022: stind.i4
IL_0023: ldloc.2
IL_0024: stfld ""int Test.<F>d__2.<>s__1""
IL_0029: ldarg.0
IL_002a: ldarg.0
IL_002b: ldfld ""int[] Test.<F>d__2.array""
IL_0030: stfld ""int[] Test.<F>d__2.<>s__4""
IL_0035: ldarg.0
IL_0036: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_003b: ldc.i4.3
IL_003c: ldelem.i4
IL_003d: pop
IL_003e: ldarg.0
IL_003f: ldarg.0
IL_0040: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_0045: ldc.i4.3
IL_0046: ldelem.i4
IL_0047: stfld ""int Test.<F>d__2.<>s__2""
IL_004c: call ""System.Threading.Tasks.Task<int> Test.G()""
IL_0051: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_0056: stloc.3
~IL_0057: ldloca.s V_3
IL_0059: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_005e: brtrue.s IL_00a4
IL_0060: ldarg.0
IL_0061: ldc.i4.0
IL_0062: dup
IL_0063: stloc.0
IL_0064: stfld ""int Test.<F>d__2.<>1__state""
<IL_0069: ldarg.0
IL_006a: ldloc.3
IL_006b: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0070: ldarg.0
IL_0071: stloc.s V_4
IL_0073: ldarg.0
IL_0074: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_0079: ldloca.s V_3
IL_007b: ldloca.s V_4
IL_007d: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__2>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__2)""
IL_0082: nop
IL_0083: leave IL_0110
>IL_0088: ldarg.0
IL_0089: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_008e: stloc.3
IL_008f: ldarg.0
IL_0090: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0095: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_009b: ldarg.0
IL_009c: ldc.i4.m1
IL_009d: dup
IL_009e: stloc.0
IL_009f: stfld ""int Test.<F>d__2.<>1__state""
IL_00a4: ldarg.0
IL_00a5: ldloca.s V_3
IL_00a7: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_00ac: stfld ""int Test.<F>d__2.<>s__3""
IL_00b1: ldarg.0
IL_00b2: ldfld ""int Test.<F>d__2.<>s__1""
IL_00b7: ldarg.0
IL_00b8: ldfld ""int[] Test.<F>d__2.<>s__4""
IL_00bd: ldc.i4.3
IL_00be: ldarg.0
IL_00bf: ldfld ""int Test.<F>d__2.<>s__2""
IL_00c4: ldarg.0
IL_00c5: ldfld ""int Test.<F>d__2.<>s__3""
IL_00ca: add
IL_00cb: dup
IL_00cc: stloc.2
IL_00cd: stelem.i4
IL_00ce: ldloc.2
IL_00cf: ldc.i4.4
IL_00d0: call ""int Test.H(int, int, int)""
IL_00d5: pop
IL_00d6: ldarg.0
IL_00d7: ldnull
IL_00d8: stfld ""int[] Test.<F>d__2.<>s__4""
-IL_00dd: ldc.i4.1
IL_00de: stloc.1
IL_00df: leave.s IL_00fb
}
catch System.Exception
{
~IL_00
df
: stloc.s V_5
IL_00e
1
: ldarg.0
IL_00e
2
: ldc.i4.s -2
IL_00e
4
: stfld ""int Test.<F>d__2.<>1__state""
IL_00e
9
: ldarg.0
IL_00e
a
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00
ef
: ldloc.s V_5
IL_00f
1
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00f
6
: nop
IL_00f
7: leave.s IL_010e
~IL_00
e1
: stloc.s V_5
IL_00e
3
: ldarg.0
IL_00e
4
: ldc.i4.s -2
IL_00e
6
: stfld ""int Test.<F>d__2.<>1__state""
IL_00e
b
: ldarg.0
IL_00e
c
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00
f1
: ldloc.s V_5
IL_00f
3
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00f
8
: nop
IL_00f
9: leave.s IL_0110
}
-IL_00f
9
: ldarg.0
IL_00f
a
: ldc.i4.s -2
IL_00f
c
: stfld ""int Test.<F>d__2.<>1__state""
~IL_010
1
: ldarg.0
IL_010
2
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_010
7
: ldloc.1
IL_010
8
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_010
d
: nop
IL_01
0e
: ret
-IL_00f
b
: ldarg.0
IL_00f
c
: ldc.i4.s -2
IL_00f
e
: stfld ""int Test.<F>d__2.<>1__state""
~IL_010
3
: ldarg.0
IL_010
4
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_010
9
: ldloc.1
IL_010
a
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_010
f
: nop
IL_01
10
: ret
}"
,
sequencePoints
:
"Test+<F>d__2.MoveNext"
);
}
...
...
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncTests.cs
浏览文件 @
eea11615
...
...
@@ -2,7 +2,6 @@
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading
;
using
Microsoft.CodeAnalysis.CSharp.Symbols
;
using
Microsoft.CodeAnalysis.CSharp.Test.Utilities
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
...
...
@@ -598,7 +597,6 @@ static async void Qux<T>(Func<Task<T>> x)
if ((int)(object)y == 1)
count++;
}
}
class Driver
...
...
@@ -783,7 +781,6 @@ public async void Run()
Driver.CompleteSignal.Set();
}
}
}
class Driver
...
...
@@ -2259,7 +2256,6 @@ .maxstack 2
"
);
}
[
Fact
]
public
void
AsyncStateMachineIL_Class_TaskT
()
{
...
...
@@ -2315,7 +2311,7 @@ .maxstack 2
c
.
VerifyIL
(
"Test.<F>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext"
,
@"
{
// Code size 20
3 (0xcb
)
// Code size 20
5 (0xcd
)
.maxstack 3
.locals init (int V_0,
int V_1,
...
...
@@ -2328,84 +2324,85 @@ .maxstack 3
.try
{
~IL_0007: ldloc.0
IL_0008: brfalse.s IL_0069
IL_000a: br.s IL_000c
-IL_000c: nop
-IL_000d: call ""System.Threading.Tasks.TaskFactory System.Threading.Tasks.Task.Factory.get""
IL_0012: ldsfld ""System.Func<int> Test.<>c.<>9__0_0""
IL_0017: dup
IL_0018: brtrue.s IL_0031
IL_001a: pop
IL_001b: ldsfld ""Test.<>c Test.<>c.<>9""
IL_0020: ldftn ""int Test.<>c.<F>b__0_0()""
IL_0026: newobj ""System.Func<int>..ctor(object, System.IntPtr)""
IL_002b: dup
IL_002c: stsfld ""System.Func<int> Test.<>c.<>9__0_0""
IL_0031: callvirt ""System.Threading.Tasks.Task<int> System.Threading.Tasks.TaskFactory.StartNew<int>(System.Func<int>)""
IL_0036: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_003b: stloc.2
~IL_003c: ldloca.s V_2
IL_003e: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_0043: brtrue.s IL_0085
IL_0045: ldarg.0
IL_0046: ldc.i4.0
IL_0047: dup
IL_0048: stloc.0
IL_0049: stfld ""int Test.<F>d__0.<>1__state""
<IL_004e: ldarg.0
IL_004f: ldloc.2
IL_0050: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__0.<>u__1""
IL_0055: ldarg.0
IL_0056: stloc.3
IL_0008: brfalse.s IL_000c
IL_000a: br.s IL_000e
IL_000c: br.s IL_006b
-IL_000e: nop
-IL_000f: call ""System.Threading.Tasks.TaskFactory System.Threading.Tasks.Task.Factory.get""
IL_0014: ldsfld ""System.Func<int> Test.<>c.<>9__0_0""
IL_0019: dup
IL_001a: brtrue.s IL_0033
IL_001c: pop
IL_001d: ldsfld ""Test.<>c Test.<>c.<>9""
IL_0022: ldftn ""int Test.<>c.<F>b__0_0()""
IL_0028: newobj ""System.Func<int>..ctor(object, System.IntPtr)""
IL_002d: dup
IL_002e: stsfld ""System.Func<int> Test.<>c.<>9__0_0""
IL_0033: callvirt ""System.Threading.Tasks.Task<int> System.Threading.Tasks.TaskFactory.StartNew<int>(System.Func<int>)""
IL_0038: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_003d: stloc.2
~IL_003e: ldloca.s V_2
IL_0040: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_0045: brtrue.s IL_0087
IL_0047: ldarg.0
IL_0048: ldc.i4.0
IL_0049: dup
IL_004a: stloc.0
IL_004b: stfld ""int Test.<F>d__0.<>1__state""
<IL_0050: ldarg.0
IL_0051: ldloc.2
IL_0052: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__0.<>u__1""
IL_0057: ldarg.0
IL_0058: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__0.<>t__builder""
IL_005d: ldloca.s V_2
IL_005f: ldloca.s V_3
IL_0061: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__0)""
IL_0066: nop
IL_0067: leave.s IL_00ca
>IL_0069: ldarg.0
IL_006a: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__0.<>u__1""
IL_006f: stloc.2
IL_0070: ldarg.0
IL_0071: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__0.<>u__1""
IL_0076: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_007c: ldarg.0
IL_007d: ldc.i4.m1
IL_007e: dup
IL_007f: stloc.0
IL_0080: stfld ""int Test.<F>d__0.<>1__state""
IL_0085: ldarg.0
IL_0086: ldloca.s V_2
IL_0088: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_008d: stfld ""int Test.<F>d__0.<>s__1""
IL_0092: ldarg.0
IL_0093: ldfld ""int Test.<F>d__0.<>s__1""
IL_0098: stloc.1
IL_0099: leave.s IL_00b5
IL_0058: stloc.3
IL_0059: ldarg.0
IL_005a: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__0.<>t__builder""
IL_005f: ldloca.s V_2
IL_0061: ldloca.s V_3
IL_0063: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__0)""
IL_0068: nop
IL_0069: leave.s IL_00cc
>IL_006b: ldarg.0
IL_006c: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__0.<>u__1""
IL_0071: stloc.2
IL_0072: ldarg.0
IL_0073: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__0.<>u__1""
IL_0078: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_007e: ldarg.0
IL_007f: ldc.i4.m1
IL_0080: dup
IL_0081: stloc.0
IL_0082: stfld ""int Test.<F>d__0.<>1__state""
IL_0087: ldarg.0
IL_0088: ldloca.s V_2
IL_008a: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_008f: stfld ""int Test.<F>d__0.<>s__1""
IL_0094: ldarg.0
IL_0095: ldfld ""int Test.<F>d__0.<>s__1""
IL_009a: stloc.1
IL_009b: leave.s IL_00b7
}
catch System.Exception
{
~IL_009
b
: stloc.s V_4
IL_009
d
: ldarg.0
IL_00
9e
: ldc.i4.s -2
IL_00a
0
: stfld ""int Test.<F>d__0.<>1__state""
IL_00a
5
: ldarg.0
IL_00a
6
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__0.<>t__builder""
IL_00a
b
: ldloc.s V_4
IL_00a
d
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00b
2
: nop
IL_00b
3: leave.s IL_00ca
~IL_009
d
: stloc.s V_4
IL_009
f
: ldarg.0
IL_00
a0
: ldc.i4.s -2
IL_00a
2
: stfld ""int Test.<F>d__0.<>1__state""
IL_00a
7
: ldarg.0
IL_00a
8
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__0.<>t__builder""
IL_00a
d
: ldloc.s V_4
IL_00a
f
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00b
4
: nop
IL_00b
5: leave.s IL_00cc
}
-IL_00b
5
: ldarg.0
IL_00b
6
: ldc.i4.s -2
IL_00b
8
: stfld ""int Test.<F>d__0.<>1__state""
~IL_00b
d
: ldarg.0
IL_00
be
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__0.<>t__builder""
IL_00c
3
: ldloc.1
IL_00c
4
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_00c
9
: nop
IL_00c
a
: ret
-IL_00b
7
: ldarg.0
IL_00b
8
: ldc.i4.s -2
IL_00b
a
: stfld ""int Test.<F>d__0.<>1__state""
~IL_00b
f
: ldarg.0
IL_00
c0
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__0.<>t__builder""
IL_00c
5
: ldloc.1
IL_00c
6
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_00c
b
: nop
IL_00c
c
: ret
}"
,
sequencePoints
:
"Test+<F>d__0.MoveNext"
);
c
.
VerifyIL
(
"Test.<F>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.SetStateMachine"
,
@"
...
...
@@ -3431,7 +3428,6 @@ namespace System.Runtime.CompilerServices { class AsyncMethodBuilderAttribute :
);
}
[
Fact
]
public
void
AsyncTasklikeBadAttributeArgument2
()
{
...
...
@@ -3546,7 +3542,6 @@ class Program {
);
}
[
Fact
]
public
void
AsyncTasklikeCreateMethod
()
{
...
...
@@ -3646,7 +3641,6 @@ namespace System.Runtime.CompilerServices {{ class AsyncMethodBuilderAttribute :
);
}
[
Fact
]
public
void
AsyncTasklikeBuilderAccessibility
()
{
...
...
@@ -3686,7 +3680,6 @@ namespace System.Runtime.CompilerServices {{ class AsyncMethodBuilderAttribute :
);
}
[
Fact
]
public
void
AsyncTasklikeLambdaOverloads
()
{
...
...
@@ -4048,7 +4041,7 @@ public static async Task<int> F()
v
.
VerifyIL
(
"Test.<F>d__2.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()"
,
@"
{
// Code size 22
2 (0xde
)
// Code size 22
4 (0xe0
)
.maxstack 3
.locals init (int V_0,
int V_1,
...
...
@@ -4061,92 +4054,93 @@ .maxstack 3
.try
{
~IL_0007: ldloc.0
IL_0008: brfalse.s IL_006b
IL_000a: br.s IL_000c
-IL_000c: nop
-IL_000d: ldarg.0
IL_000e: ldc.i4.s 10
IL_0010: newarr ""S""
IL_0015: stfld ""S[] Test.<F>d__2.<array>5__1""
-IL_001a: ldarg.0
IL_001b: ldarg.0
IL_001c: ldfld ""S[] Test.<F>d__2.<array>5__1""
IL_0021: stfld ""S[] Test.<F>d__2.<>s__3""
IL_0026: ldarg.0
IL_0027: ldfld ""S[] Test.<F>d__2.<>s__3""
IL_002c: ldc.i4.1
IL_002d: ldelema ""S""
IL_0032: pop
IL_0033: call ""System.Threading.Tasks.Task<int> Test.G()""
IL_0038: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_003d: stloc.2
~IL_003e: ldloca.s V_2
IL_0040: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_0045: brtrue.s IL_0087
IL_0047: ldarg.0
IL_0048: ldc.i4.0
IL_0049: dup
IL_004a: stloc.0
IL_004b: stfld ""int Test.<F>d__2.<>1__state""
<IL_0050: ldarg.0
IL_0051: ldloc.2
IL_0052: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0057: ldarg.0
IL_0058: stloc.3
IL_0008: brfalse.s IL_000c
IL_000a: br.s IL_000e
IL_000c: br.s IL_006d
-IL_000e: nop
-IL_000f: ldarg.0
IL_0010: ldc.i4.s 10
IL_0012: newarr ""S""
IL_0017: stfld ""S[] Test.<F>d__2.<array>5__1""
-IL_001c: ldarg.0
IL_001d: ldarg.0
IL_001e: ldfld ""S[] Test.<F>d__2.<array>5__1""
IL_0023: stfld ""S[] Test.<F>d__2.<>s__3""
IL_0028: ldarg.0
IL_0029: ldfld ""S[] Test.<F>d__2.<>s__3""
IL_002e: ldc.i4.1
IL_002f: ldelema ""S""
IL_0034: pop
IL_0035: call ""System.Threading.Tasks.Task<int> Test.G()""
IL_003a: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_003f: stloc.2
~IL_0040: ldloca.s V_2
IL_0042: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_0047: brtrue.s IL_0089
IL_0049: ldarg.0
IL_004a: ldc.i4.0
IL_004b: dup
IL_004c: stloc.0
IL_004d: stfld ""int Test.<F>d__2.<>1__state""
<IL_0052: ldarg.0
IL_0053: ldloc.2
IL_0054: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0059: ldarg.0
IL_005a: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_005f: ldloca.s V_2
IL_0061: ldloca.s V_3
IL_0063: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__2>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__2)""
IL_0068: nop
IL_0069: leave.s IL_00dd
>IL_006b: ldarg.0
IL_006c: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0071: stloc.2
IL_0072: ldarg.0
IL_0073: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0078: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_007e: ldarg.0
IL_007f: ldc.i4.m1
IL_0080: dup
IL_0081: stloc.0
IL_0082: stfld ""int Test.<F>d__2.<>1__state""
IL_0087: ldarg.0
IL_0088: ldloca.s V_2
IL_008a: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_008f: stfld ""int Test.<F>d__2.<>s__2""
IL_0094: ldarg.0
IL_0095: ldfld ""S[] Test.<F>d__2.<>s__3""
IL_009a: ldc.i4.1
IL_009b: ldelema ""S""
IL_00a0: ldarg.0
IL_00a1: ldfld ""int Test.<F>d__2.<>s__2""
IL_00a6: call ""int S.Mutate(int)""
IL_00ab: stloc.1
IL_00ac: leave.s IL_00c8
IL_005a: stloc.3
IL_005b: ldarg.0
IL_005c: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_0061: ldloca.s V_2
IL_0063: ldloca.s V_3
IL_0065: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, Test.<F>d__2>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref Test.<F>d__2)""
IL_006a: nop
IL_006b: leave.s IL_00df
>IL_006d: ldarg.0
IL_006e: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_0073: stloc.2
IL_0074: ldarg.0
IL_0075: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> Test.<F>d__2.<>u__1""
IL_007a: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_0080: ldarg.0
IL_0081: ldc.i4.m1
IL_0082: dup
IL_0083: stloc.0
IL_0084: stfld ""int Test.<F>d__2.<>1__state""
IL_0089: ldarg.0
IL_008a: ldloca.s V_2
IL_008c: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_0091: stfld ""int Test.<F>d__2.<>s__2""
IL_0096: ldarg.0
IL_0097: ldfld ""S[] Test.<F>d__2.<>s__3""
IL_009c: ldc.i4.1
IL_009d: ldelema ""S""
IL_00a2: ldarg.0
IL_00a3: ldfld ""int Test.<F>d__2.<>s__2""
IL_00a8: call ""int S.Mutate(int)""
IL_00ad: stloc.1
IL_00ae: leave.s IL_00ca
}
catch System.Exception
{
~IL_00
ae
: stloc.s V_4
IL_00b
0
: ldarg.0
IL_00b
1
: ldc.i4.s -2
IL_00b
3
: stfld ""int Test.<F>d__2.<>1__state""
IL_00b
8
: ldarg.0
IL_00b
9
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00
be
: ldloc.s V_4
IL_00c
0
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00c
5
: nop
IL_00c
6: leave.s IL_00dd
~IL_00
b0
: stloc.s V_4
IL_00b
2
: ldarg.0
IL_00b
3
: ldc.i4.s -2
IL_00b
5
: stfld ""int Test.<F>d__2.<>1__state""
IL_00b
a
: ldarg.0
IL_00b
b
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00
c0
: ldloc.s V_4
IL_00c
2
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00c
7
: nop
IL_00c
8: leave.s IL_00df
}
-IL_00c
8
: ldarg.0
IL_00c
9
: ldc.i4.s -2
IL_00c
b
: stfld ""int Test.<F>d__2.<>1__state""
~IL_00d
0
: ldarg.0
IL_00d
1
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00d
6
: ldloc.1
IL_00d
7
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_00d
c
: nop
IL_00d
d
: ret
-IL_00c
a
: ldarg.0
IL_00c
b
: ldc.i4.s -2
IL_00c
d
: stfld ""int Test.<F>d__2.<>1__state""
~IL_00d
2
: ldarg.0
IL_00d
3
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<F>d__2.<>t__builder""
IL_00d
8
: ldloc.1
IL_00d
9
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_00d
e
: nop
IL_00d
f
: ret
}"
,
sequencePoints
:
"Test+<F>d__2.MoveNext"
);
}
...
...
@@ -4800,7 +4794,6 @@ class C
Diagnostic
(
ErrorCode
.
ERR_MissingPredefinedMember
,
"{ await task; }"
).
WithArguments
(
"System.Runtime.CompilerServices.IAsyncStateMachine"
,
"SetStateMachine"
).
WithLocation
(
62
,
37
));
}
[
Fact
,
WorkItem
(
16531
,
"https://github.com/dotnet/roslyn/issues/16531"
)]
public
void
ArityMismatch
()
{
...
...
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAwaitForeachTests.cs
浏览文件 @
eea11615
此差异已折叠。
点击以展开。
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAwaitUsingTests.cs
浏览文件 @
eea11615
此差异已折叠。
点击以展开。
src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueStateMachineTests.cs
浏览文件 @
eea11615
此差异已折叠。
点击以展开。
src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/LocalSlotMappingTests.cs
浏览文件 @
eea11615
...
...
@@ -3263,72 +3263,74 @@ public IEnumerable<int> F()
v0
.
VerifyIL
(
"C.<F>d__0.System.Collections.IEnumerator.MoveNext"
,
@"
{
// Code size 1
27 (0x7f
)
// Code size 1
31 (0x83
)
.maxstack 2
.locals init (int V_0)
IL_0000: ldarg.0
IL_0001: ldfld ""int C.<F>d__0.<>1__state""
IL_0006: stloc.0
IL_0007: ldloc.0
IL_0008: brfalse.s IL_001
4
IL_0008: brfalse.s IL_001
2
IL_000a: br.s IL_000c
IL_000c: ldloc.0
IL_000d: ldc.i4.1
IL_000e: beq.s IL_0076
IL_0010: br.s IL_0012
IL_0012: ldc.i4.0
IL_0013: ret
IL_0014: ldarg.0
IL_0015: ldc.i4.m1
IL_0016: stfld ""int C.<F>d__0.<>1__state""
IL_001b: nop
IL_001c: ldarg.0
IL_001d: ldarg.0
IL_001e: ldfld ""C C.<F>d__0.<>4__this""
IL_0023: call ""System.Collections.Generic.IEnumerable<int> C.F()""
IL_0028: stfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_002d: ldarg.0
IL_002e: ldc.i4.0
IL_002f: stfld ""bool C.<F>d__0.<>s__2""
IL_000e: beq.s IL_0014
IL_0010: br.s IL_0016
IL_0012: br.s IL_0018
IL_0014: br.s IL_007a
IL_0016: ldc.i4.0
IL_0017: ret
IL_0018: ldarg.0
IL_0019: ldc.i4.m1
IL_001a: stfld ""int C.<F>d__0.<>1__state""
IL_001f: nop
IL_0020: ldarg.0
IL_0021: ldarg.0
IL_0022: ldfld ""C C.<F>d__0.<>4__this""
IL_0027: call ""System.Collections.Generic.IEnumerable<int> C.F()""
IL_002c: stfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_0031: ldarg.0
IL_0032: ldc.i4.0
IL_0033: stfld ""bool C.<F>d__0.<>s__2""
.try
{
IL_003
4
: ldarg.0
IL_003
5
: ldfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_003
a
: ldarg.0
IL_003
b
: ldflda ""bool C.<F>d__0.<>s__2""
IL_004
0
: call ""void System.Threading.Monitor.Enter(object, ref bool)""
IL_004
5
: nop
IL_004
6
: nop
IL_004
7
: nop
IL_004
8: leave.s IL_005f
IL_003
8
: ldarg.0
IL_003
9
: ldfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_003
e
: ldarg.0
IL_003
f
: ldflda ""bool C.<F>d__0.<>s__2""
IL_004
4
: call ""void System.Threading.Monitor.Enter(object, ref bool)""
IL_004
9
: nop
IL_004
a
: nop
IL_004
b
: nop
IL_004
c: leave.s IL_0063
}
finally
{
IL_004
a
: ldarg.0
IL_004
b
: ldfld ""bool C.<F>d__0.<>s__2""
IL_005
0: brfalse.s IL_005e
IL_005
2
: ldarg.0
IL_005
3
: ldfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_005
8
: call ""void System.Threading.Monitor.Exit(object)""
IL_00
5d
: nop
IL_00
5e
: endfinally
IL_004
e
: ldarg.0
IL_004
f
: ldfld ""bool C.<F>d__0.<>s__2""
IL_005
4: brfalse.s IL_0062
IL_005
6
: ldarg.0
IL_005
7
: ldfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_005
c
: call ""void System.Threading.Monitor.Exit(object)""
IL_00
61
: nop
IL_00
62
: endfinally
}
IL_00
5f
: ldarg.0
IL_006
0
: ldnull
IL_006
1
: stfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_006
6
: ldarg.0
IL_006
7
: ldc.i4.1
IL_006
8
: stfld ""int C.<F>d__0.<>2__current""
IL_00
6d
: ldarg.0
IL_00
6e
: ldc.i4.1
IL_00
6f
: stfld ""int C.<F>d__0.<>1__state""
IL_007
4
: ldc.i4.1
IL_007
5
: ret
IL_007
6
: ldarg.0
IL_007
7
: ldc.i4.m1
IL_007
8
: stfld ""int C.<F>d__0.<>1__state""
IL_00
7d
: ldc.i4.0
IL_00
7e
: ret
IL_00
63
: ldarg.0
IL_006
4
: ldnull
IL_006
5
: stfld ""System.Collections.Generic.IEnumerable<int> C.<F>d__0.<>s__1""
IL_006
a
: ldarg.0
IL_006
b
: ldc.i4.1
IL_006
c
: stfld ""int C.<F>d__0.<>2__current""
IL_00
71
: ldarg.0
IL_00
72
: ldc.i4.1
IL_00
73
: stfld ""int C.<F>d__0.<>1__state""
IL_007
8
: ldc.i4.1
IL_007
9
: ret
IL_007
a
: ldarg.0
IL_007
b
: ldc.i4.m1
IL_007
c
: stfld ""int C.<F>d__0.<>1__state""
IL_00
81
: ldc.i4.0
IL_00
82
: ret
}"
);
#if TODO
...
...
@@ -3370,7 +3372,7 @@ public async Task<int> F()
v0
.
VerifyIL
(
"C.<F>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext"
,
@"
{
// Code size 24
4 (0xf4
)
// Code size 24
6 (0xf6
)
.maxstack 3
.locals init (int V_0,
int V_1,
...
...
@@ -3383,111 +3385,112 @@ .maxstack 3
.try
{
~IL_0007: ldloc.0
IL_0008: brfalse IL_009c
IL_000d: br.s IL_000f
-IL_000f: nop
-IL_0010: ldarg.0
IL_0011: ldarg.0
IL_0012: ldfld ""C C.<F>d__0.<>4__this""
IL_0017: call ""System.Threading.Tasks.Task<int> C.F()""
IL_001c: stfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
IL_0021: ldarg.0
IL_0022: ldc.i4.0
IL_0023: stfld ""bool C.<F>d__0.<>s__2""
IL_0008: brfalse.s IL_000c
IL_000a: br.s IL_0011
IL_000c: br IL_009e
-IL_0011: nop
-IL_0012: ldarg.0
IL_0013: ldarg.0
IL_0014: ldfld ""C C.<F>d__0.<>4__this""
IL_0019: call ""System.Threading.Tasks.Task<int> C.F()""
IL_001e: stfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
IL_0023: ldarg.0
IL_0024: ldc.i4.0
IL_0025: stfld ""bool C.<F>d__0.<>s__2""
.try
{
IL_002
8
: ldarg.0
IL_002
9
: ldfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
IL_00
2e
: ldarg.0
IL_00
2f
: ldflda ""bool C.<F>d__0.<>s__2""
IL_003
4
: call ""void System.Threading.Monitor.Enter(object, ref bool)""
IL_003
9
: nop
-IL_003
a
: nop
-IL_003
b
: nop
IL_003
c: leave.s IL_0057
IL_002
a
: ldarg.0
IL_002
b
: ldfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
IL_00
30
: ldarg.0
IL_00
31
: ldflda ""bool C.<F>d__0.<>s__2""
IL_003
6
: call ""void System.Threading.Monitor.Enter(object, ref bool)""
IL_003
b
: nop
-IL_003
c
: nop
-IL_003
d
: nop
IL_003
e: leave.s IL_0059
}
finally
{
~IL_00
3e
: ldloc.0
IL_00
3f
: ldc.i4.0
IL_004
0: bge.s IL_0056
IL_004
2
: ldarg.0
IL_004
3
: ldfld ""bool C.<F>d__0.<>s__2""
IL_004
8: brfalse.s IL_0056
IL_004
a
: ldarg.0
IL_004
b
: ldfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
IL_005
0
: call ""void System.Threading.Monitor.Exit(object)""
IL_005
5
: nop
~IL_005
6
: endfinally
~IL_00
40
: ldloc.0
IL_00
41
: ldc.i4.0
IL_004
2: bge.s IL_0058
IL_004
4
: ldarg.0
IL_004
5
: ldfld ""bool C.<F>d__0.<>s__2""
IL_004
a: brfalse.s IL_0058
IL_004
c
: ldarg.0
IL_004
d
: ldfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
IL_005
2
: call ""void System.Threading.Monitor.Exit(object)""
IL_005
7
: nop
~IL_005
8
: endfinally
}
~IL_0057: ldarg.0
IL_0058: ldnull
IL_0059: stfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
-IL_005e: ldarg.0
IL_005f: ldfld ""C C.<F>d__0.<>4__this""
IL_0064: call ""System.Threading.Tasks.Task<int> C.F()""
IL_0069: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_006e: stloc.2
~IL_006f: ldloca.s V_2
IL_0071: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_0076: brtrue.s IL_00b8
IL_0078: ldarg.0
IL_0079: ldc.i4.0
IL_007a: dup
IL_007b: stloc.0
IL_007c: stfld ""int C.<F>d__0.<>1__state""
<IL_0081: ldarg.0
IL_0082: ldloc.2
IL_0083: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> C.<F>d__0.<>u__1""
IL_0088: ldarg.0
IL_0089: stloc.3
~IL_0059: ldarg.0
IL_005a: ldnull
IL_005b: stfld ""System.Threading.Tasks.Task<int> C.<F>d__0.<>s__1""
-IL_0060: ldarg.0
IL_0061: ldfld ""C C.<F>d__0.<>4__this""
IL_0066: call ""System.Threading.Tasks.Task<int> C.F()""
IL_006b: callvirt ""System.Runtime.CompilerServices.TaskAwaiter<int> System.Threading.Tasks.Task<int>.GetAwaiter()""
IL_0070: stloc.2
~IL_0071: ldloca.s V_2
IL_0073: call ""bool System.Runtime.CompilerServices.TaskAwaiter<int>.IsCompleted.get""
IL_0078: brtrue.s IL_00ba
IL_007a: ldarg.0
IL_007b: ldc.i4.0
IL_007c: dup
IL_007d: stloc.0
IL_007e: stfld ""int C.<F>d__0.<>1__state""
<IL_0083: ldarg.0
IL_0084: ldloc.2
IL_0085: stfld ""System.Runtime.CompilerServices.TaskAwaiter<int> C.<F>d__0.<>u__1""
IL_008a: ldarg.0
IL_008b: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> C.<F>d__0.<>t__builder""
IL_0090: ldloca.s V_2
IL_0092: ldloca.s V_3
IL_0094: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, C.<F>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref C.<F>d__0)""
IL_0099: nop
IL_009a: leave.s IL_00f3
>IL_009c: ldarg.0
IL_009d: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> C.<F>d__0.<>u__1""
IL_00a2: stloc.2
IL_00a3: ldarg.0
IL_00a4: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> C.<F>d__0.<>u__1""
IL_00a9: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_00af: ldarg.0
IL_00b0: ldc.i4.m1
IL_00b1: dup
IL_00b2: stloc.0
IL_00b3: stfld ""int C.<F>d__0.<>1__state""
IL_00b8: ldloca.s V_2
IL_00ba: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_00bf: pop
-IL_00c0: ldc.i4.1
IL_00c1: stloc.1
IL_00c2: leave.s IL_00de
IL_008b: stloc.3
IL_008c: ldarg.0
IL_008d: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> C.<F>d__0.<>t__builder""
IL_0092: ldloca.s V_2
IL_0094: ldloca.s V_3
IL_0096: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.TaskAwaiter<int>, C.<F>d__0>(ref System.Runtime.CompilerServices.TaskAwaiter<int>, ref C.<F>d__0)""
IL_009b: nop
IL_009c: leave.s IL_00f5
>IL_009e: ldarg.0
IL_009f: ldfld ""System.Runtime.CompilerServices.TaskAwaiter<int> C.<F>d__0.<>u__1""
IL_00a4: stloc.2
IL_00a5: ldarg.0
IL_00a6: ldflda ""System.Runtime.CompilerServices.TaskAwaiter<int> C.<F>d__0.<>u__1""
IL_00ab: initobj ""System.Runtime.CompilerServices.TaskAwaiter<int>""
IL_00b1: ldarg.0
IL_00b2: ldc.i4.m1
IL_00b3: dup
IL_00b4: stloc.0
IL_00b5: stfld ""int C.<F>d__0.<>1__state""
IL_00ba: ldloca.s V_2
IL_00bc: call ""int System.Runtime.CompilerServices.TaskAwaiter<int>.GetResult()""
IL_00c1: pop
-IL_00c2: ldc.i4.1
IL_00c3: stloc.1
IL_00c4: leave.s IL_00e0
}
catch System.Exception
{
~IL_00c
4
: stloc.s V_4
IL_00c
6
: ldarg.0
IL_00c
7
: ldc.i4.s -2
IL_00c
9
: stfld ""int C.<F>d__0.<>1__state""
IL_00
ce
: ldarg.0
IL_00
cf
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> C.<F>d__0.<>t__builder""
IL_00d
4
: ldloc.s V_4
IL_00d
6
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00d
b
: nop
IL_00d
c: leave.s IL_00f3
~IL_00c
6
: stloc.s V_4
IL_00c
8
: ldarg.0
IL_00c
9
: ldc.i4.s -2
IL_00c
b
: stfld ""int C.<F>d__0.<>1__state""
IL_00
d0
: ldarg.0
IL_00
d1
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> C.<F>d__0.<>t__builder""
IL_00d
6
: ldloc.s V_4
IL_00d
8
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
IL_00d
d
: nop
IL_00d
e: leave.s IL_00f5
}
-IL_00
de
: ldarg.0
IL_00
df
: ldc.i4.s -2
IL_00e
1
: stfld ""int C.<F>d__0.<>1__state""
~IL_00e
6
: ldarg.0
IL_00e
7
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> C.<F>d__0.<>t__builder""
IL_00e
c
: ldloc.1
IL_00e
d
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_00f
2
: nop
IL_00f
3
: ret
-IL_00
e0
: ldarg.0
IL_00
e1
: ldc.i4.s -2
IL_00e
3
: stfld ""int C.<F>d__0.<>1__state""
~IL_00e
8
: ldarg.0
IL_00e
9
: ldflda ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> C.<F>d__0.<>t__builder""
IL_00e
e
: ldloc.1
IL_00e
f
: call ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
IL_00f
4
: nop
IL_00f
5
: ret
}"
,
sequencePoints
:
"C+<F>d__0.MoveNext"
);
#if TODO
...
...
src/Compilers/CSharp/Test/Emit/PDB/PDBAsyncTests.cs
浏览文件 @
eea11615
此差异已折叠。
点击以展开。
src/Compilers/CSharp/Test/Emit/PDB/PDBConstantTests.cs
浏览文件 @
eea11615
...
...
@@ -426,7 +426,7 @@ IEnumerable<int> M()
<namespace usingCount=""1"" />
</using>
<hoistedLocalScopes>
<slot startOffset=""0x
1c"" endOffset=""0x63
"" />
<slot startOffset=""0x
20"" endOffset=""0x67
"" />
</hoistedLocalScopes>
<encLocalSlotMap>
<slot kind=""27"" offset=""0"" />
...
...
@@ -436,23 +436,23 @@ IEnumerable<int> M()
</customDebugInfo>
<sequencePoints>
<entry offset=""0x0"" hidden=""true"" document=""1"" />
<entry offset=""0x1
b
"" startLine=""7"" startColumn=""5"" endLine=""7"" endColumn=""6"" document=""1"" />
<entry offset=""0x
1c
"" startLine=""9"" startColumn=""14"" endLine=""9"" endColumn=""23"" document=""1"" />
<entry offset=""0x2
3
"" hidden=""true"" document=""1"" />
<entry offset=""0x2
5
"" startLine=""10"" startColumn=""9"" endLine=""10"" endColumn=""10"" document=""1"" />
<entry offset=""0x2
6
"" startLine=""12"" startColumn=""13"" endLine=""12"" endColumn=""36"" document=""1"" />
<entry offset=""0x
3d
"" hidden=""true"" document=""1"" />
<entry offset=""0x4
4
"" startLine=""13"" startColumn=""9"" endLine=""13"" endColumn=""10"" document=""1"" />
<entry offset=""0x4
5
"" startLine=""9"" startColumn=""33"" endLine=""9"" endColumn=""36"" document=""1"" />
<entry offset=""0x5
5
"" startLine=""9"" startColumn=""25"" endLine=""9"" endColumn=""31"" document=""1"" />
<entry offset=""0x6
0
"" hidden=""true"" document=""1"" />
<entry offset=""0x6
3
"" startLine=""14"" startColumn=""5"" endLine=""14"" endColumn=""6"" document=""1"" />
<entry offset=""0x1
f
"" startLine=""7"" startColumn=""5"" endLine=""7"" endColumn=""6"" document=""1"" />
<entry offset=""0x
20
"" startLine=""9"" startColumn=""14"" endLine=""9"" endColumn=""23"" document=""1"" />
<entry offset=""0x2
7
"" hidden=""true"" document=""1"" />
<entry offset=""0x2
9
"" startLine=""10"" startColumn=""9"" endLine=""10"" endColumn=""10"" document=""1"" />
<entry offset=""0x2
a
"" startLine=""12"" startColumn=""13"" endLine=""12"" endColumn=""36"" document=""1"" />
<entry offset=""0x
41
"" hidden=""true"" document=""1"" />
<entry offset=""0x4
8
"" startLine=""13"" startColumn=""9"" endLine=""13"" endColumn=""10"" document=""1"" />
<entry offset=""0x4
9
"" startLine=""9"" startColumn=""33"" endLine=""9"" endColumn=""36"" document=""1"" />
<entry offset=""0x5
9
"" startLine=""9"" startColumn=""25"" endLine=""9"" endColumn=""31"" document=""1"" />
<entry offset=""0x6
4
"" hidden=""true"" document=""1"" />
<entry offset=""0x6
7
"" startLine=""14"" startColumn=""5"" endLine=""14"" endColumn=""6"" document=""1"" />
</sequencePoints>
<scope startOffset=""0x0"" endOffset=""0x6
5
"">
<scope startOffset=""0x0"" endOffset=""0x6
9
"">
<namespace name=""System.Collections.Generic"" />
<scope startOffset=""0x1
b"" endOffset=""0x65
"">
<scope startOffset=""0x1
f"" endOffset=""0x69
"">
<constant name=""x"" value=""1"" type=""Int32"" />
<scope startOffset=""0x2
5"" endOffset=""0x45
"">
<scope startOffset=""0x2
9"" endOffset=""0x49
"">
<constant name=""y"" value=""2"" type=""Int32"" />
</scope>
</scope>
...
...
src/Compilers/CSharp/Test/Emit/PDB/PDBIteratorTests.cs
浏览文件 @
eea11615
此差异已折叠。
点击以展开。
src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs
浏览文件 @
eea11615
...
...
@@ -7135,9 +7135,9 @@ static IEnumerable<object> F()
<customDebugInfo>
<forward declaringType=""C+<>c"" methodName=""<F>b__0_0"" parameterNames=""i"" />
<hoistedLocalScopes>
<slot startOffset=""0x2
3"" endOffset=""0xd1
"" />
<slot startOffset=""0x2
7"" endOffset=""0xd5
"" />
<slot />
<slot startOffset=""0x7
b"" endOffset=""0xb2
"" />
<slot startOffset=""0x7
f"" endOffset=""0xb6
"" />
</hoistedLocalScopes>
<encLocalSlotMap>
<slot kind=""temp"" />
...
...
@@ -7146,19 +7146,19 @@ static IEnumerable<object> F()
</customDebugInfo>
<sequencePoints>
<entry offset=""0x0"" hidden=""true"" document=""1"" />
<entry offset=""0x2
3
"" startLine=""6"" startColumn=""5"" endLine=""6"" endColumn=""6"" document=""1"" />
<entry offset=""0x2
4
"" startLine=""7"" startColumn=""9"" endLine=""7"" endColumn=""35"" document=""1"" />
<entry offset=""0x3
b
"" startLine=""8"" startColumn=""9"" endLine=""8"" endColumn=""16"" document=""1"" />
<entry offset=""0x
3c
"" startLine=""8"" startColumn=""27"" endLine=""8"" endColumn=""43"" document=""1"" />
<entry offset=""0x7
9
"" hidden=""true"" document=""1"" />
<entry offset=""0x7
b
"" startLine=""8"" startColumn=""18"" endLine=""8"" endColumn=""23"" document=""1"" />
<entry offset=""0x
8c
"" startLine=""9"" startColumn=""9"" endLine=""9"" endColumn=""10"" document=""1"" />
<entry offset=""0x
8d
"" startLine=""10"" startColumn=""13"" endLine=""10"" endColumn=""28"" document=""1"" />
<entry offset=""0xa
9
"" hidden=""true"" document=""1"" />
<entry offset=""0xb
1
"" startLine=""11"" startColumn=""9"" endLine=""11"" endColumn=""10"" document=""1"" />
<entry offset=""0xb
2
"" startLine=""8"" startColumn=""24"" endLine=""8"" endColumn=""26"" document=""1"" />
<entry offset=""0x
cd
"" startLine=""12"" startColumn=""5"" endLine=""12"" endColumn=""6"" document=""1"" />
<entry offset=""0xd
1
"" hidden=""true"" document=""1"" />
<entry offset=""0x2
7
"" startLine=""6"" startColumn=""5"" endLine=""6"" endColumn=""6"" document=""1"" />
<entry offset=""0x2
8
"" startLine=""7"" startColumn=""9"" endLine=""7"" endColumn=""35"" document=""1"" />
<entry offset=""0x3
f
"" startLine=""8"" startColumn=""9"" endLine=""8"" endColumn=""16"" document=""1"" />
<entry offset=""0x
40
"" startLine=""8"" startColumn=""27"" endLine=""8"" endColumn=""43"" document=""1"" />
<entry offset=""0x7
d
"" hidden=""true"" document=""1"" />
<entry offset=""0x7
f
"" startLine=""8"" startColumn=""18"" endLine=""8"" endColumn=""23"" document=""1"" />
<entry offset=""0x
90
"" startLine=""9"" startColumn=""9"" endLine=""9"" endColumn=""10"" document=""1"" />
<entry offset=""0x
91
"" startLine=""10"" startColumn=""13"" endLine=""10"" endColumn=""28"" document=""1"" />
<entry offset=""0xa
d
"" hidden=""true"" document=""1"" />
<entry offset=""0xb
5
"" startLine=""11"" startColumn=""9"" endLine=""11"" endColumn=""10"" document=""1"" />
<entry offset=""0xb
6
"" startLine=""8"" startColumn=""24"" endLine=""8"" endColumn=""26"" document=""1"" />
<entry offset=""0x
d1
"" startLine=""12"" startColumn=""5"" endLine=""12"" endColumn=""6"" document=""1"" />
<entry offset=""0xd
5
"" hidden=""true"" document=""1"" />
</sequencePoints>
</method>
</methods>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录