[runtime] Add init_locals field to MonoMethodBuilder to make it easy to get it set...
[mono.git] / mono / metadata / method-builder.c
index 23f8d5990952d0a176d19cbb1e26e1a0f305114a..3b04c246494af2d77121e5cbbb55fbade2bb2d3b 100644 (file)
@@ -68,6 +68,7 @@ mono_mb_new_base (MonoClass *klass, MonoWrapperType type)
 #ifndef DISABLE_JIT
        mb->code_size = 40;
        mb->code = (unsigned char *)g_malloc (mb->code_size);
+       mb->init_locals = TRUE;
 #endif
        /* placeholder for the wrapper always at index 1 */
        mono_mb_add_data (mb, NULL);
@@ -189,7 +190,7 @@ mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, in
 
        header->code_size = mb->pos;
        header->num_locals = mb->locals;
-       header->init_locals = TRUE;
+       header->init_locals = mb->init_locals;
 
        header->num_clauses = mb->num_clauses;
        header->clauses = mb->clauses;
@@ -550,7 +551,7 @@ mono_mb_emit_exception_full (MonoMethodBuilder *mb, const char *exc_nspace, cons
 {
        MonoMethod *ctor = NULL;
 
-       MonoClass *mme = mono_class_from_name (mono_defaults.corlib, exc_nspace, exc_name);
+       MonoClass *mme = mono_class_load_from_name (mono_defaults.corlib, exc_nspace, exc_name);
        mono_class_init (mme);
        ctor = mono_class_get_method_from_name (mme, ".ctor", 0);
        g_assert (ctor);