Skip to content

Commit f384649

Browse files
committed
use stack
1 parent 354324a commit f384649

13 files changed

+62
-70
lines changed

src/IcedTasks/CancellablePoolingValueTask.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ module CancellablePoolingValueTasks =
6565
| InitialYield ->
6666
state <- Running
6767

68-
if BindDepthCounter.Check() then
68+
if Trampoline.Current.Check() then
6969
MethodBuilder.AwaitUnsafeOnCompleted(
7070
&sm.Data.MethodBuilder,
7171
Trampoline.Current.AwaiterRef,
@@ -80,7 +80,7 @@ module CancellablePoolingValueTasks =
8080
if step then
8181
state <- SetResult
8282

83-
if BindDepthCounter.Check() then
83+
if Trampoline.Current.Check() then
8484
// Yield before setting result to prevent stack overflow.
8585
MethodBuilder.AwaitUnsafeOnCompleted(
8686
&sm.Data.MethodBuilder,
@@ -103,7 +103,7 @@ module CancellablePoolingValueTasks =
103103
with exn ->
104104
state <- SetException(ExceptionCache.CaptureOrRetrieve exn)
105105

106-
if BindDepthCounter.Check() then
106+
if Trampoline.Current.Check() then
107107
// Yield before setting exception to prevent stack overflow.
108108
MethodBuilder.AwaitUnsafeOnCompleted(
109109
&sm.Data.MethodBuilder,

src/IcedTasks/CancellableTask.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ module CancellableTasks =
6363
| InitialYield ->
6464
state <- Running
6565

66-
if BindDepthCounter.Check() then
66+
if Trampoline.Current.Check() then
6767
MethodBuilder.AwaitUnsafeOnCompleted(
6868
&sm.Data.MethodBuilder,
6969
Trampoline.Current.AwaiterRef,
@@ -79,7 +79,7 @@ module CancellableTasks =
7979
if step then
8080
state <- SetResult
8181

82-
if BindDepthCounter.Check() then
82+
if Trampoline.Current.Check() then
8383
// Yield before setting result to prevent stack overflow.
8484
MethodBuilder.AwaitUnsafeOnCompleted(
8585
&sm.Data.MethodBuilder,
@@ -103,7 +103,7 @@ module CancellableTasks =
103103
with exn ->
104104
state <- SetException(ExceptionCache.CaptureOrRetrieve exn)
105105

106-
if BindDepthCounter.Check() then
106+
if Trampoline.Current.Check() then
107107
// Yield before setting exception to prevent stack overflow.
108108
MethodBuilder.AwaitUnsafeOnCompleted(
109109
&sm.Data.MethodBuilder,

src/IcedTasks/CancellableTaskBuilderBase.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ module CancellableTaskBase =
5151

5252
let inline yieldOnBindLimit () =
5353
CancellableTaskBaseCode(fun sm ->
54-
if BindDepthCounter.Check() then
54+
if Trampoline.Current.Check() then
5555
let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm)
5656

5757
if not __stack_yield_fin then

src/IcedTasks/CancellableValueTask.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ module CancellableValueTasks =
6565
| InitialYield ->
6666
state <- Running
6767

68-
if BindDepthCounter.Check() then
68+
if Trampoline.Current.Check() then
6969
MethodBuilder.AwaitUnsafeOnCompleted(
7070
&sm.Data.MethodBuilder,
7171
Trampoline.Current.AwaiterRef,
@@ -80,7 +80,7 @@ module CancellableValueTasks =
8080
if step then
8181
state <- SetResult
8282

83-
if BindDepthCounter.Check() then
83+
if Trampoline.Current.Check() then
8484
MethodBuilder.AwaitUnsafeOnCompleted(
8585
&sm.Data.MethodBuilder,
8686
Trampoline.Current.AwaiterRef,
@@ -102,7 +102,7 @@ module CancellableValueTasks =
102102
with exn ->
103103
state <- SetException(ExceptionCache.CaptureOrRetrieve exn)
104104

105-
if BindDepthCounter.Check() then
105+
if Trampoline.Current.Check() then
106106
MethodBuilder.AwaitUnsafeOnCompleted(
107107
&sm.Data.MethodBuilder,
108108
Trampoline.Current.AwaiterRef,

src/IcedTasks/ColdTask.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ module ColdTasks =
5252

5353
let inline yieldOnBindLimit () =
5454
ColdTaskCode(fun sm ->
55-
if BindDepthCounter.Check() then
55+
if Trampoline.Current.Check() then
5656
let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm)
5757

5858
if not __stack_yield_fin then
@@ -322,7 +322,7 @@ module ColdTasks =
322322
| InitialYield ->
323323
state <- Running
324324

325-
if BindDepthCounter.Check() then
325+
if Trampoline.Current.Check() then
326326
MethodBuilder.AwaitUnsafeOnCompleted(
327327
&sm.Data.MethodBuilder,
328328
Trampoline.Current.AwaiterRef,
@@ -338,7 +338,7 @@ module ColdTasks =
338338
if step then
339339
state <- SetResult
340340

341-
if BindDepthCounter.Check() then
341+
if Trampoline.Current.Check() then
342342
// Yield before setting result to prevent stack overflow.
343343
MethodBuilder.AwaitUnsafeOnCompleted(
344344
&sm.Data.MethodBuilder,
@@ -362,7 +362,7 @@ module ColdTasks =
362362
with exn ->
363363
state <- SetException(ExceptionCache.CaptureOrRetrieve exn)
364364

365-
if BindDepthCounter.Check() then
365+
if Trampoline.Current.Check() then
366366
// Yield before setting exception to prevent stack overflow.
367367
MethodBuilder.AwaitUnsafeOnCompleted(
368368
&sm.Data.MethodBuilder,

src/IcedTasks/Nullness.fs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
namespace IcedTasks
22

33
open System
4-
open System.Runtime.ExceptionServices
54

6-
type ExceptionDispatchInfoNull =
5+
type ExceptionNull =
76
#if NULLABLE
8-
ExceptionDispatchInfo | null
7+
Exception | null
98
#else
10-
ExceptionDispatchInfo
9+
Exception
1110
#endif
1211

1312
type IDisposableNull =

src/IcedTasks/PoolingValueTask.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ module PoolingValueTasks =
5959
| InitialYield ->
6060
state <- Running
6161

62-
if BindDepthCounter.Check() then
62+
if Trampoline.Current.Check() then
6363
MethodBuilder.AwaitUnsafeOnCompleted(
6464
&sm.Data.MethodBuilder,
6565
Trampoline.Current.AwaiterRef,
@@ -74,7 +74,7 @@ module PoolingValueTasks =
7474
if step then
7575
state <- SetResult
7676

77-
if BindDepthCounter.Check() then
77+
if Trampoline.Current.Check() then
7878
// Yield before setting result to prevent stack overflow.
7979
MethodBuilder.AwaitUnsafeOnCompleted(
8080
&sm.Data.MethodBuilder,
@@ -97,7 +97,7 @@ module PoolingValueTasks =
9797
with exn ->
9898
state <- SetException(ExceptionCache.CaptureOrRetrieve exn)
9999

100-
if BindDepthCounter.Check() then
100+
if Trampoline.Current.Check() then
101101
// Yield before setting exception to prevent stack overflow.
102102
MethodBuilder.AwaitUnsafeOnCompleted(
103103
&sm.Data.MethodBuilder,

src/IcedTasks/Task.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ module Tasks =
6363
| InitialYield ->
6464
state <- Running
6565

66-
if BindDepthCounter.Check() then
66+
if Trampoline.Current.Check() then
6767
MethodBuilder.AwaitUnsafeOnCompleted(
6868
&sm.Data.MethodBuilder,
6969
Trampoline.Current.AwaiterRef,
@@ -78,7 +78,7 @@ module Tasks =
7878
if step then
7979
state <- SetResult
8080

81-
if BindDepthCounter.Check() then
81+
if Trampoline.Current.Check() then
8282
// Yield before setting result to prevent stack overflow.
8383
MethodBuilder.AwaitUnsafeOnCompleted(
8484
&sm.Data.MethodBuilder,
@@ -101,7 +101,7 @@ module Tasks =
101101
with exn ->
102102
state <- SetException(ExceptionCache.CaptureOrRetrieve exn)
103103

104-
if BindDepthCounter.Check() then
104+
if Trampoline.Current.Check() then
105105
// Yield before setting exception to prevent stack overflow.
106106
MethodBuilder.AwaitUnsafeOnCompleted(
107107
&sm.Data.MethodBuilder,

src/IcedTasks/TaskBuilderBase.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module TaskBase =
4242

4343
let inline yieldOnBindLimit () =
4444
TaskBaseCode(fun sm ->
45-
if BindDepthCounter.Check() then
45+
if Trampoline.Current.Check() then
4646
let __stack_yield_fin = ResumableCode.Yield().Invoke(&sm)
4747

4848
if not __stack_yield_fin then

src/IcedTasks/TaskUnit.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ module TasksUnit =
5959
| InitialYield ->
6060
state <- Running
6161

62-
if BindDepthCounter.Check() then
62+
if Trampoline.Current.Check() then
6363
MethodBuilder.AwaitUnsafeOnCompleted(
6464
&sm.Data.MethodBuilder,
6565
Trampoline.Current.AwaiterRef,
@@ -74,7 +74,7 @@ module TasksUnit =
7474
if step then
7575
state <- SetResult
7676

77-
if BindDepthCounter.Check() then
77+
if Trampoline.Current.Check() then
7878
// Yield before setting result to prevent stack overflow.
7979
MethodBuilder.AwaitUnsafeOnCompleted(
8080
&sm.Data.MethodBuilder,
@@ -97,7 +97,7 @@ module TasksUnit =
9797
with exn ->
9898
state <- SetException(ExceptionCache.CaptureOrRetrieve exn)
9999

100-
if BindDepthCounter.Check() then
100+
if Trampoline.Current.Check() then
101101
// Yield before setting exception to prevent stack overflow.
102102
MethodBuilder.AwaitUnsafeOnCompleted(
103103
&sm.Data.MethodBuilder,

0 commit comments

Comments
 (0)