Merge pull request #2881 from alexrp/gc-sample-managed-alloc
[mono.git] / mono / mini / aot-runtime.c
index 7407fecdf579b37975e3621fbc60b97ba2010a8b..21468cc25cd6fdb1adf30df2cfbdad1b2b9e7890 100644 (file)
@@ -930,8 +930,11 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
 #endif
                case MONO_WRAPPER_ALLOC: {
                        int atype = decode_value (p, &p);
+                       ManagedAllocatorVariant variant =
+                               mono_profiler_get_events () & MONO_PROFILE_ALLOCATIONS ?
+                               MANAGED_ALLOCATOR_SLOW_PATH : MANAGED_ALLOCATOR_REGULAR;
 
-                       ref->method = mono_gc_get_managed_allocator_by_type (atype, !!(mono_profiler_get_events () & MONO_PROFILE_ALLOCATIONS));
+                       ref->method = mono_gc_get_managed_allocator_by_type (atype, variant);
                        if (!ref->method) {
                                mono_error_set_bad_image_name (error, module->aot_name, "Error: No managed allocator, but we need one for AOT.\nAre you using non-standard GC options?\n");
                                return FALSE;
@@ -4602,7 +4605,7 @@ mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
 
        gpointer res = mono_aot_get_method_checked (domain, method, &error);
        /* This is external only, so its ok to raise here */
-       mono_error_raise_exception (&error);
+       mono_error_raise_exception (&error); /* OK to throw, external only without a good alternative */
        return res;
 }