private static unsafe void EnsureClassConstructorRun(ref StaticClassConstructionContext context) { // Very simplified class constructor runner. In real world, the class constructor runner // would need to be able to deal with potentially multiple threads racing to initialize // a single class, and would need to be able to deal with potential deadlocks // between class constructors. if (context.initialized == 1) { return; } context.initialized = 1; // Run the class constructor. Call <int>(context.cctorMethodAddress); }
private static unsafe IntPtr CheckStaticClassConstructionReturnNonGCStaticBase(ref StaticClassConstructionContext context, IntPtr nonGcStaticBase) { EnsureClassConstructorRun(ref context); return(nonGcStaticBase); }
private static unsafe object CheckStaticClassConstructionReturnGCStaticBase(ref StaticClassConstructionContext context, object gcStaticBase) { CheckStaticClassConstruction(ref context); return(gcStaticBase); }