Description
GcStress currently tries to instrument NGEN precompiled methods twice: once during Module::Initialize
(with a twist for the core library) and a second time during MethodDesc::PrepareILBasedCode
(with a twist for prejitted IL stubs).
R2R precompiled methods are never instrumented, currently.
Seems like we should have only one strategy and it should apply to all cases of prejitted code.
Early instrumentation during module load is nice because it avoids race conditions that can plague on-demand instrumentation. But there is an upfront cost as potentially thousands of methods need to be instrumented but only a few of them will ever be executed.
Late instrumentation is more pay for play but must be done carefully so that no thread can see a partially instrumented method.