*/
#include <config.h>
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* The gclass itself is allocated from the image set mempool */
if (gclass->is_dynamic)
mono_reflection_free_dynamic_generic_class (gclass);
+ if (gclass->cached_class && gclass->cached_class->interface_id)
+ mono_unload_interface_id (gclass->cached_class);
}
static void
break;
is_open = (i < type_argc);
- ginst = alloca (size);
-#ifndef MONO_SMALL_CONFIG
- ginst->id = 0;
-#endif
+ ginst = g_alloca (size);
+ memset (ginst, 0, sizeof (MonoGenericInst));
ginst->is_open = is_open;
ginst->type_argc = type_argc;
memcpy (ginst->type_argv, type_argv, type_argc * sizeof (MonoType *));
return NULL;
}
+static gboolean
+compare_type_literals (int class_type, int type_type)
+{
+ /* byval_arg.type can be zero if we're decoding a type that references a class been loading.
+ * See mcs/test/gtest-440. and #650936.
+ * FIXME This better be moved to the metadata verifier as it can catch more cases.
+ */
+ if (!class_type)
+ return TRUE;
+ /* NET 1.1 assemblies might encode string and object in a denormalized way.
+ * See #675464.
+ */
+ if (type_type == MONO_TYPE_CLASS && (class_type == MONO_TYPE_STRING || class_type == MONO_TYPE_OBJECT))
+ return TRUE;
+ return class_type == type_type;
+}
+
/*
* do_mono_metadata_parse_type:
* @type: MonoType to be filled in with the return value
type->data.klass = class;
if (!class)
return FALSE;
- /* byval_arg.type can be zero if we're decoding a type that references a class been loading.
- * See mcs/test/gtest-440. and #650936.
- * FIXME This better be moved to the metadata verifier as it can catch more cases.
- */
- if (class->byval_arg.type && class->byval_arg.type != type->type) {
- printf ("me [%x] it [%x] -- '%s'\n", type->type, type->data.klass->byval_arg.type, mono_type_full_name (type));
+ if (!compare_type_literals (class->byval_arg.type, type->type))
return FALSE;
- }
break;
}
case MONO_TYPE_SZARRAY: {
}
*conv = MONO_MARSHAL_CONV_BOOL_I4;
return MONO_NATIVE_BOOLEAN;
- case MONO_TYPE_CHAR: return unicode ? MONO_NATIVE_U2 : MONO_NATIVE_U1;
+ case MONO_TYPE_CHAR:
+ if (mspec) {
+ switch (mspec->native) {
+ case MONO_NATIVE_U2:
+ case MONO_NATIVE_U1:
+ return mspec->native;
+ default:
+ g_error ("cant marshal char to native type %02x", mspec->native);
+ }
+ }
+ return unicode ? MONO_NATIVE_U2 : MONO_NATIVE_U1;
case MONO_TYPE_I1: return MONO_NATIVE_I1;
case MONO_TYPE_U1: return MONO_NATIVE_U1;
case MONO_TYPE_I2: return MONO_NATIVE_I2;