{
// Loading a static valuetype field usually will cause a JitHelper to be called
// for the static base. This will bloat the code.
- compInlineResult->Note(InlineObservation::CALLEE_LDFLD_STATIC_VALUECLASS);
- if (compInlineResult->IsFailure())
+ // Make an exception - small getters (6 bytes of IL) returning initialized fields, e.g.:
+ //
+ // static DateTime Foo { get; } = DateTime.Now;
+ //
+ bool isInitedFld = (opcode == CEE_LDSFLD) && (info.compILCodeSize <= 6) &&
+ (fieldInfo.fieldFlags & CORINFO_FLG_FIELD_FINAL);
+ if (!isInitedFld)
{
- return;
+ compInlineResult->Note(InlineObservation::CALLEE_LDFLD_STATIC_VALUECLASS);
+ if (compInlineResult->IsFailure())
+ {
+ return;
+ }
}
}
}