[SRE] Remove more unused icall declarations.
[mono.git] / mono / metadata / sre-encode.c
index 048b7259b981eaced10b9ca1d67c1cbd58e47386..93ccd119bbab5c0a6498fd021b5944d2701e647d 100644 (file)
@@ -36,6 +36,12 @@ static guint32 mono_image_typedef_or_ref (MonoDynamicImage *assembly, MonoType *
 
 #define mono_type_array_get_and_resolve(array, index, error) mono_reflection_type_get_handle ((MonoReflectionType*)mono_array_get (array, gpointer, index), error)
 
+static guint32
+mono_image_add_stream_data (MonoDynamicStream *stream, const char *data, guint32 len)
+{
+       return mono_dynstream_add_data (stream, data, len);
+}
+
 static void
 alloc_table (MonoDynamicTable *table, guint nrows)
 {
@@ -438,6 +444,52 @@ mono_dynimage_encode_locals (MonoDynamicImage *assembly, MonoReflectionILGen *il
 }
 
 
+/*
+ * Copy len * nelem bytes from val to dest, swapping bytes to LE if necessary.
+ * dest may be misaligned.
+ */
+static void
+swap_with_size (char *dest, const char* val, int len, int nelem) {
+       MONO_REQ_GC_NEUTRAL_MODE;
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+       int elem;
+
+       for (elem = 0; elem < nelem; ++elem) {
+               switch (len) {
+               case 1:
+                       *dest = *val;
+                       break;
+               case 2:
+                       dest [0] = val [1];
+                       dest [1] = val [0];
+                       break;
+               case 4:
+                       dest [0] = val [3];
+                       dest [1] = val [2];
+                       dest [2] = val [1];
+                       dest [3] = val [0];
+                       break;
+               case 8:
+                       dest [0] = val [7];
+                       dest [1] = val [6];
+                       dest [2] = val [5];
+                       dest [3] = val [4];
+                       dest [4] = val [3];
+                       dest [5] = val [2];
+                       dest [6] = val [1];
+                       dest [7] = val [0];
+                       break;
+               default:
+                       g_assert_not_reached ();
+               }
+               dest += len;
+               val += len;
+       }
+#else
+       memcpy (dest, val, len * nelem);
+#endif
+}
+
 
 guint32
 mono_dynimage_encode_constant (MonoDynamicImage *assembly, MonoObject *val, MonoTypeEnum *ret_type)
@@ -539,7 +591,6 @@ handle_enum:
        return idx;
 }
 
-
 guint32
 mono_dynimage_encode_field_signature (MonoDynamicImage *assembly, MonoReflectionFieldBuilder *fb, MonoError *error)
 {
@@ -553,9 +604,6 @@ mono_dynimage_encode_field_signature (MonoDynamicImage *assembly, MonoReflection
        MonoType *type;
        MonoClass *klass;
 
-       mono_reflection_init_type_builder_generics (fb->type, error);
-       return_val_if_nok (error, 0);
-
        type = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
        return_val_if_nok (error, 0);
        klass = mono_class_from_mono_type (type);
@@ -976,9 +1024,6 @@ reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig, MonoErro
 
        mono_error_init (error);
 
-       mono_reflection_check_array_for_usertypes (sig->arguments, error);
-       return_val_if_nok (error, NULL);
-
        sigbuffer_init (&buf, 32);
 
        sigbuffer_add_value (&buf, 0x07);
@@ -1013,9 +1058,6 @@ reflection_sighelper_get_signature_field (MonoReflectionSigHelper *sig, MonoErro
 
        mono_error_init (error);
 
-       mono_reflection_check_array_for_usertypes (sig->arguments, error);
-       return_val_if_nok (error, NULL);
-
        sigbuffer_init (&buf, 32);
 
        sigbuffer_add_value (&buf, 0x06);