}
}
+ /*
+ * Methods with AggressiveInline flag could be inlined even if the class has a cctor.
+ * This might create a branch so emit it in the first code bblock instead of into initlocals_bb.
+ */
+ if (ip - header->code == 0 && cfg->method != method && cfg->compile_aot && (method->iflags & METHOD_IMPL_ATTRIBUTE_AGGRESSIVE_INLINING) && mono_class_needs_cctor_run (method->klass, method)) {
+ emit_class_init (cfg, method->klass);
+ }
+
if (skip_dead_blocks) {
int ip_offset = ip - header->code;
var old = System.Threading.Interlocked.CompareExchange(ref variable_with_constant_address, 1, 0);
return old == 0 && variable_with_constant_address == 1 ? 0 : 1;
}
+
+ static bool cctor_called;
+
+ class ClassAggressiveInline {
+ static ClassAggressiveInline () {
+ cctor_called = true;
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static void inlined () {
+ }
+ }
+
+ public static int test_0_aggressive_inline_cctor () {
+ ClassAggressiveInline.inlined ();
+ return cctor_called ? 0 : 1;
+ }
}
#if __MOBILE__