*/
#include <config.h>
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
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 *));
* 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 (class->byval_arg.type && class->byval_arg.type != type->type)
return FALSE;
- }
break;
}
case MONO_TYPE_SZARRAY: {
const char *ptr;
guint32 len;
MonoType *type, *type2;
- MonoType stack_type;
mono_loader_lock ();
len = mono_metadata_decode_value (ptr, &ptr);
- type = &stack_type;
- memset (type, 0, MONO_SIZEOF_TYPE);
-
- if (*ptr == MONO_TYPE_BYREF) {
- type->byref = 1;
- ptr++;
- }
-
- if (!do_mono_metadata_parse_type (type, image, NULL, FALSE, ptr, &ptr)) {
+ type = mono_metadata_parse_type_internal (image, NULL, MONO_PARSE_TYPE, 0, TRUE, ptr, &ptr);
+ if (!type) {
mono_loader_unlock ();
return NULL;
}
return type2;
}
- type2 = mono_image_alloc (image, MONO_SIZEOF_TYPE);
- memcpy (type2, type, MONO_SIZEOF_TYPE);
+ type2 = mono_metadata_type_dup (image, type);
g_hash_table_insert (image->typespec_cache, GUINT_TO_POINTER (type_spec), type2);
+ mono_metadata_free_type (type);
mono_loader_unlock ();
}
*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;