X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Freflection.c;h=09903644eda911f6ff7caaa00febe1d200abe71b;hb=86ea70695089e3a2abd48259da93fd55a09b15d0;hp=23ccc85b8de6a26e6570052d82851040aafb39bc;hpb=473eab83669db36b66b42115b8c13084031f1094;p=mono.git diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c index 23ccc85b8de..09903644eda 100644 --- a/mono/metadata/reflection.c +++ b/mono/metadata/reflection.c @@ -6037,6 +6037,10 @@ mono_type_get_object (MonoDomain *domain, MonoType *type) */ type = klass->byval_arg.byref == type->byref ? &klass->byval_arg : &klass->this_arg; + /* void is very common */ + if (type->type == MONO_TYPE_VOID && domain->typeof_void) + return (MonoReflectionType*)domain->typeof_void; + /* * If the vtable of the given class was already created, we can use * the MonoType from there and avoid all locking and hash table lookups. @@ -6088,6 +6092,10 @@ mono_type_get_object (MonoDomain *domain, MonoType *type) #endif res->type = type; mono_g_hash_table_insert (domain->type_hash, type, res); + + if (type->type == MONO_TYPE_VOID) + MONO_OBJECT_SETREF (domain, typeof_void, res); + mono_domain_unlock (domain); return res; } @@ -6741,6 +6749,8 @@ _mono_reflection_parse_type (char *name, char **endptr, gboolean is_recursed, /* last_point separates the namespace from the name */ last_point = NULL; + /* Skips spaces */ + while (*p == ' ') p++, start++, w++, name++; while (*p) { switch (*p) {