dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.95k stars 4.65k forks source link

Avoid unnecessary extra indirection in allocation helpers #99661

Closed jkotas closed 2 months ago

jkotas commented 6 months ago

Context: https://github.com/dotnet/runtime/issues/99552#issuecomment-1993382384

The allocation helpers in CoreCLR have an unnecessary extra indirection. The alloc_context can be thread static directly. The extra indirection via Thread is unnecessary. The allocation helpers in native AOT do not have this indirection. It would be nice to port the improvement to regular CoreCLR and unify how the allocation helpers work.

jkotas commented 6 months ago

@VSadov Are you interested in looking into this?

VSadov commented 6 months ago

@VSadov Are you interested in looking into this?

yes, NativeAOT approach is a lot simpler. I’d like try porting it.

mangod9 commented 6 months ago

assume the indirection isn't arm64 specific? But in theory it might help with cache locality?

jkotas commented 6 months ago

assume the indirection isn't arm64 specific? But in theory it might help with cache locality?

Right