You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JIT: Avoid TLS access when restoring async contexts (#127889)
Avoid TLS access when restoring async contexts in the synchronous case
at the end of runtime async functions by saving the `Thread` object used
when we captured them in a local.
NativeAOT test sizes show a minor size regression from initializing the
prolog slot and from passing an extra argument, but this transformation
is important to be able to optimize the `Thread` accesses in the future.
Copy file name to clipboardExpand all lines: docs/design/coreclr/botr/clr-abi.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -542,7 +542,7 @@ EnC is supported for adding and editing generic methods and methods on generic t
542
542
543
543
## Async methods
544
544
545
-
The JIT saves the current `ExecutionContext` and `SynchronizationContext` in runtime async methods and these must be preserved during remap. The new GC encoder includes the state in the EnC frame header size, while for JIT32 the EE expects this state to exist when `CORINFO_ASYNC_SAVE_CONTEXTS` was reported to the JIT from `getMethodInfo`.
545
+
The JIT saves the current `Thread`, `ExecutionContext` and `SynchronizationContext` in runtime async methods and these must be preserved during remap. The new GC encoder includes the state in the EnC frame header size, while for JIT32 the EE expects this state to exist when `CORINFO_ASYNC_SAVE_CONTEXTS` was reported to the JIT from `getMethodInfo`.
Copy file name to clipboardExpand all lines: src/coreclr/interpreter/compiler.h
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -893,6 +893,7 @@ class InterpCompiler
893
893
int32_t m_synchronizedOrAsyncRetValVarIndex = -1; // If the method is synchronized, ret instructions are replaced with a store to this var and a leave to an epilog instruction.
894
894
int32_t m_synchronizedFinallyStartOffset = -1; // If the method is synchronized, this is the offset of the start of the finally epilog
895
895
896
+
int32_t m_threadObjVarIndex = -1; // If the method is async, this is the var index of the Thread local
896
897
int32_t m_execContextVarIndex = -1; // If the method is async, this is the var index of the ExecutionContext local
897
898
int32_t m_syncContextVarIndex = -1; // If the method is async, this is the var index of the SynchronizationContext local
0 commit comments