@@ -52,15 +52,13 @@ module ColdTasks =
5252
5353 let inline yieldOnBindLimit () =
5454 ColdTaskCode( fun sm ->
55- if Trampoline.Current.Check () then
55+ if Trampoline.IncrementBindCount () then
5656 let __stack_yield_fin = ResumableCode.Yield() .Invoke(& sm)
5757
5858 if not __ stack_ yield_ fin then
59- let mutable __stack_awaiter = Trampoline.Current
60-
6159 MethodBuilder.AwaitUnsafeOnCompleted(
6260 & sm.Data.MethodBuilder,
63- &__ stack _ awaiter ,
61+ Trampoline.AwaiterRef ,
6462 & sm
6563 )
6664
@@ -322,10 +320,10 @@ module ColdTasks =
322320 | InitialYield ->
323321 state <- Running
324322
325- if Trampoline.Current.Check () then
323+ if Trampoline.IncrementBindCount () then
326324 MethodBuilder.AwaitUnsafeOnCompleted(
327325 & sm.Data.MethodBuilder,
328- Trampoline.Current. AwaiterRef,
326+ Trampoline.AwaiterRef,
329327 & sm
330328 )
331329
@@ -338,11 +336,11 @@ module ColdTasks =
338336 if step then
339337 state <- SetResult
340338
341- if Trampoline.Current.Check () then
339+ if Trampoline.IncrementBindCount () then
342340 // Yield before setting result to prevent stack overflow.
343341 MethodBuilder.AwaitUnsafeOnCompleted(
344342 & sm.Data.MethodBuilder,
345- Trampoline.Current. AwaiterRef,
343+ Trampoline.AwaiterRef,
346344 & sm
347345 )
348346
@@ -362,11 +360,11 @@ module ColdTasks =
362360 with exn ->
363361 state <- SetException( ExceptionCache.CaptureOrRetrieve exn)
364362
365- if Trampoline.Current.Check () then
363+ if Trampoline.IncrementBindCount () then
366364 // Yield before setting exception to prevent stack overflow.
367365 MethodBuilder.AwaitUnsafeOnCompleted(
368366 & sm.Data.MethodBuilder,
369- Trampoline.Current. AwaiterRef,
367+ Trampoline.AwaiterRef,
370368 & sm
371369 )
372370
0 commit comments