Remove one of never used icalls
authorMarek Safar <marek.safar@gmail.com>
Fri, 9 Mar 2012 14:41:05 +0000 (14:41 +0000)
committerMarek Safar <marek.safar@gmail.com>
Fri, 9 Mar 2012 14:41:05 +0000 (14:41 +0000)
mcs/class/corlib/System/String.cs
mono/metadata/icall-def.h
mono/metadata/string-icalls.c
mono/metadata/string-icalls.h

index 4a509210f4e96ad46ebfb2998f45670b00a6ace7..2e7256dd6d6648eac2e61db57f65f7aa7197202a 100644 (file)
@@ -3127,9 +3127,6 @@ namespace System
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                public extern String (char c, int count);
 
-               //[MethodImplAttribute (MethodImplOptions.InternalCall)]
-               //private extern String[] InternalSplit (char[] separator, int count, int options);
-
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
                internal extern static String InternalAllocateStr (int length);
 
index a619c2d0b4fc688d02c13266d9baf3e85ea281f2..57157938d9f72b11eb4f4ba6eb42edff9b5749d0 100644 (file)
@@ -805,7 +805,6 @@ ICALL(STRING_8a, "GetLOSLimit", ves_icall_System_String_GetLOSLimit)
 ICALL(STRING_9, "InternalAllocateStr", ves_icall_System_String_InternalAllocateStr)
 ICALL(STRING_10, "InternalIntern", ves_icall_System_String_InternalIntern)
 ICALL(STRING_11, "InternalIsInterned", ves_icall_System_String_InternalIsInterned)
-ICALL(STRING_12, "InternalSplit", ves_icall_System_String_InternalSplit)
 
 ICALL_TYPE(TENC, "System.Text.Encoding", TENC_1)
 ICALL(TENC_1, "InternalCodePage", ves_icall_System_Text_Encoding_InternalCodePage)
index 8fef67ec101817c0b75d74e81734a11b43e60aed..b0eeb32585b15e4c2880499ee691b79deb6dec55 100644 (file)
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/gc-internal.h>
 
-/* Internal helper methods */
-
-static gboolean
-string_icall_is_in_array (MonoArray *chars, gint32 arraylength, gunichar2 chr);
-
 /* This function is redirected to String.CreateString ()
    by mono_marshal_get_native_wrapper () */
 void
@@ -39,174 +34,6 @@ ves_icall_System_String_ctor_RedirectToCreateString (void)
        g_assert_not_reached ();
 }
 
-/* System.StringSplitOptions */
-typedef enum {
-       STRINGSPLITOPTIONS_NONE = 0,
-       STRINGSPLITOPTIONS_REMOVE_EMPTY_ENTRIES = 1
-} StringSplitOptions;
-
-MonoArray * 
-ves_icall_System_String_InternalSplit (MonoString *me, MonoArray *separator, gint32 count, gint32 options)
-{
-       static MonoClass *String_array;
-       MonoString * tmpstr;
-       MonoArray * retarr;
-       gunichar2 *src;
-       gint32 arrsize, srcsize, splitsize;
-       gint32 i, lastpos, arrpos;
-       gint32 tmpstrsize;
-       gint32 remempty;
-       gint32 flag;
-       gunichar2 *tmpstrptr;
-
-       remempty = options & STRINGSPLITOPTIONS_REMOVE_EMPTY_ENTRIES;
-       src = mono_string_chars (me);
-       srcsize = mono_string_length (me);
-       arrsize = mono_array_length (separator);
-
-       if (!String_array) {
-               MonoClass *klass = mono_array_class_get (mono_get_string_class (), 1);
-               mono_memory_barrier ();
-               String_array = klass;
-       }
-
-       splitsize = 1;
-       /* Count the number of elements we will return. Note that this operation
-        * guarantees that we will return exactly splitsize elements, and we will
-        * have enough data to fill each. This allows us to skip some checks later on.
-        */
-       if (remempty == 0) {
-               for (i = 0; i != srcsize && splitsize < count; i++) {
-                       if (string_icall_is_in_array (separator, arrsize, src [i]))
-                               splitsize++;
-               }
-       } else if (count > 1) {
-               /* Require pattern "Nondelim + Delim + Nondelim" to increment counter.
-                * Lastpos != 0 means first nondelim found.
-                * Flag = 0 means last char was delim.
-                * Efficient, though perhaps confusing.
-                */
-               lastpos = 0;
-               flag = 0;
-               for (i = 0; i != srcsize && splitsize < count; i++) {
-                       if (string_icall_is_in_array (separator, arrsize, src [i])) {
-                               flag = 0;
-                       } else if (flag == 0) {
-                               if (lastpos == 1)
-                                       splitsize++;
-                               flag = 1;
-                               lastpos = 1;
-                       }
-               }
-
-               /* Nothing but separators */
-               if (lastpos == 0) {
-                       retarr = mono_array_new_specific (mono_class_vtable (mono_domain_get (), String_array), 0);
-                       return retarr;
-               }
-       }
-
-       /* if no split chars found return the string */
-       if (splitsize == 1) {
-               if (remempty == 0 || count == 1) {
-                       /* Copy the whole string */
-                       retarr = mono_array_new_specific (mono_class_vtable (mono_domain_get (), String_array), 1);
-                       mono_array_setref (retarr, 0, me);
-               } else {
-                       /* otherwise we have to filter out leading & trailing delims */
-
-                       /* find first non-delim char */
-                       for (; srcsize != 0; srcsize--, src++) {
-                               if (!string_icall_is_in_array (separator, arrsize, src [0]))
-                                       break;
-                       }
-                       /* find last non-delim char */
-                       for (; srcsize != 0; srcsize--) {
-                               if (!string_icall_is_in_array (separator, arrsize, src [srcsize - 1]))
-                                       break;
-                       }
-                       tmpstr = mono_string_new_size (mono_domain_get (), srcsize);
-                       tmpstrptr = mono_string_chars (tmpstr);
-
-                       memcpy (tmpstrptr, src, srcsize * sizeof (gunichar2));
-                       retarr = mono_array_new_specific (mono_class_vtable (mono_domain_get (), String_array), 1);
-                       mono_array_setref (retarr, 0, tmpstr);
-               }
-               return retarr;
-       }
-
-       lastpos = 0;
-       arrpos = 0;
-       
-       retarr = mono_array_new_specific (mono_class_vtable (mono_domain_get (), String_array), splitsize);
-
-       for (i = 0; i != srcsize && arrpos != splitsize; i++) {
-               if (string_icall_is_in_array (separator, arrsize, src [i])) {
-                       
-                       if (lastpos != i || remempty == 0) {
-                               tmpstrsize = i - lastpos;
-                               tmpstr = mono_string_new_size (mono_domain_get (), tmpstrsize);
-                               tmpstrptr = mono_string_chars (tmpstr);
-
-                               memcpy (tmpstrptr, src + lastpos, tmpstrsize * sizeof (gunichar2));
-                               mono_array_setref (retarr, arrpos, tmpstr);
-                               arrpos++;
-
-                               if (arrpos == splitsize - 1) {
-                                       /* Shortcut the last array element */
-
-                                       lastpos = i + 1;
-                                       if (remempty != 0) {
-                                               /* Search for non-delim starting char (guaranteed to find one) Note that loop
-                                                * condition is only there for safety. It will never actually terminate the loop. */
-                                               for (; lastpos != srcsize ; lastpos++) {
-                                                       if (!string_icall_is_in_array (separator, arrsize, src [lastpos])) 
-                                                               break;
-                                               }
-                                               if (count > splitsize) {
-                                                       /* Since we have fewer results than our limit, we must remove
-                                                        * trailing delimiters as well. 
-                                                        */
-                                                       for (; srcsize != lastpos + 1 ; srcsize--) {
-                                                               if (!string_icall_is_in_array (separator, arrsize, src [srcsize - 1])) 
-                                                                       break;
-                                                       }
-                                               }
-                                       }
-
-                                       tmpstrsize = srcsize - lastpos;
-                                       tmpstr = mono_string_new_size (mono_domain_get (), tmpstrsize);
-                                       tmpstrptr = mono_string_chars (tmpstr);
-
-                                       memcpy (tmpstrptr, src + lastpos, tmpstrsize * sizeof (gunichar2));
-                                       mono_array_setref (retarr, arrpos, tmpstr);
-
-                                       /* Loop will ALWAYS end here. Test criteria in the FOR loop is technically unnecessary. */
-                                       break;
-                               }
-                       }
-                       lastpos = i + 1;
-               }
-       }
-
-       return retarr;
-}
-
-static gboolean
-string_icall_is_in_array (MonoArray *chars, gint32 arraylength, gunichar2 chr)
-{
-       gunichar2 cmpchar;
-       gint32 arrpos;
-
-       for (arrpos = 0; arrpos != arraylength; arrpos++) {
-               cmpchar = mono_array_get(chars, gunichar2, arrpos);
-               if (cmpchar == chr)
-                       return TRUE;
-       }
-       
-       return FALSE;
-}
-
 MonoString *
 ves_icall_System_String_InternalAllocateStr (gint32 length)
 {
index e4cd3c2fb195fe815597818b682e24b5cf351faf..a0889ebbf5837d886a69a5a5c44816b872be69e8 100644 (file)
@@ -17,9 +17,6 @@
 void
 ves_icall_System_String_ctor_RedirectToCreateString (void) MONO_INTERNAL;
 
-MonoArray * 
-ves_icall_System_String_InternalSplit (MonoString *me, MonoArray *separator, gint32 count, gint32 options) MONO_INTERNAL;
-
 MonoString *
 ves_icall_System_String_InternalAllocateStr (gint32 length) MONO_INTERNAL;