-
Couldn't load subscription status.
- Fork 5.2k
Description
The JIT has an optimization for MinOpts compilations where we do not bother reporting call sites at all:
runtime/src/coreclr/jit/gcencode.cpp
Lines 4497 to 4500 in 71ab8f1
| if (noTrackedGCSlots && regMask == 0) | |
| { | |
| // No live GC refs in regs at the call -> don't record the call. | |
| } |
This optimization is conditioned on noTrackedGCSlots:
runtime/src/coreclr/jit/gcencode.cpp
Lines 4068 to 4070 in 71ab8f1
| const bool noTrackedGCSlots = | |
| (compiler->opts.MinOpts() && !compiler->opts.jitFlags->IsSet(JitFlags::JIT_FLAG_PREJIT) && | |
| !JitConfig.JitMinOptsTrackGCrefs()); |
Note that JitMinOptsTrackGCrefs is 0 for xarch but 1 everywhere else, so the optimization only kicks in for xarch:
runtime/src/coreclr/jit/jitconfigvalues.h
Lines 525 to 530 in b79c57e
| #if defined(TARGET_AMD64) || defined(TARGET_X86) | |
| #define JitMinOptsTrackGCrefs_Default 0 // Not tracking GC refs in MinOpts is new behavior | |
| #else | |
| #define JitMinOptsTrackGCrefs_Default 1 | |
| #endif | |
| RELEASE_CONFIG_INTEGER(JitMinOptsTrackGCrefs, W("JitMinOptsTrackGCrefs"), JitMinOptsTrackGCrefs_Default) |
From my measurements the optimization saves around 23% on GC info size reported by MinOpts contexts. As a downside it does not allow for the suspension on return addresses that @VSadov implemented recently. We should decide whether we want to enable it generally or not.