summaryrefslogtreecommitdiff
path: root/src/jit/utils.h
diff options
context:
space:
mode:
authorStephen Toub <stoub@microsoft.com>2016-05-20 14:50:38 -0600
committerJan Kotas <jkotas@microsoft.com>2016-05-20 13:50:38 -0700
commitce3ff76234bf199b4498a5d31f05af6eb43073f6 (patch)
treeb8f45e9b5d176af11c0e241cee6f4de76cf57a7a /src/jit/utils.h
parent18110e9a2ecf2f036953f398925ceef51375c2d9 (diff)
downloadcoreclr-ce3ff76234bf199b4498a5d31f05af6eb43073f6.tar.gz
coreclr-ce3ff76234bf199b4498a5d31f05af6eb43073f6.tar.bz2
coreclr-ce3ff76234bf199b4498a5d31f05af6eb43073f6.zip
Shrink AsyncMethodBuilder.MoveNextRunner by a field in common case (#5131)
When an async method yields for the first time, there are several allocations, including a "MoveNextRunner" object that used to store the state machine and an ExecutionContext. However, for the common case where a default ExecutionContext is being used, we can avoid needing that field. For the simplest async method, this can reduce the total size of the allocations by ~4%. (It would be nice in this case to be able to get rid of the MoveNextRunner entirely. However, the Action delegate that gets created needs to be stored into the builder before the builder is boxed to the heap, so that the cached delegate gets boxed with it; otherwise, the second yield in the async method will end up needing to reallocate the delegate. Since delegates are immutable, if the delegate was to point directly to a method on the boxed object, we would need to first have the object, a catch-22. So the MoveNextRunner serves as an intermediary that lets us create the delegate, store it into the struct builder, then box the builder, and then store the boxed object into the runner.)
Diffstat (limited to 'src/jit/utils.h')
0 files changed, 0 insertions, 0 deletions