Author: zoltan
Date: 2005-04-17 13:46:58 -0400 (Sun, 17 Apr 2005)
New Revision: 43149

Modified:
   branches/vargaz/mini-xp-local-regalloc/mono/ChangeLog
   branches/vargaz/mini-xp-local-regalloc/mono/Makefile.am
   branches/vargaz/mini-xp-local-regalloc/mono/configure.in
   branches/vargaz/mini-xp-local-regalloc/mono/libgc/ChangeLog
   branches/vargaz/mini-xp-local-regalloc/mono/libgc/configure.in
   branches/vargaz/mini-xp-local-regalloc/mono/mono/Makefile.am
   branches/vargaz/mini-xp-local-regalloc/mono/mono/dis/main.c
   branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/ChangeLog
   branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/collection.c
   branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/handles-private.h
   branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/handles.c
   branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/io.c
   branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/processes.c
   branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/sockets.c
   branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/wapi-private.h
   branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/ChangeLog
   branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/icall.c
   
branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/mono-debug-debugger.c
   
branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/mono-debug-debugger.h
   branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/mono-debug.c
   branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/object-internals.h
   branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/reflection.c
   branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/reflection.h
   branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/socket-io.h
   branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/threadpool.c
   branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/ChangeLog
   branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/aot.c
   branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/cpu-amd64.md
   branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/cpu-pentium.md
   branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/iltests.il
   branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/inssel-long.brg
   branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/mini-exceptions.c
   branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/mini-x86.c
Log:
Merge from HEAD.


Modified: branches/vargaz/mini-xp-local-regalloc/mono/ChangeLog
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/ChangeLog       2005-04-17 
17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/ChangeLog       2005-04-17 
17:46:58 UTC (rev 43149)
@@ -1,3 +1,22 @@
+2005-04-16  Miguel de Icaza  <[EMAIL PROTECTED]>
+
+       * configure.in (PTHREAD_POINTER_ID): Patch from Jonathan Pryor to
+       fix the Mono build on Solaris (bug #72818)
+
+2005-04-16  Bill Middleton  <[EMAIL PROTECTED]>
+
+       * configure.in (PREVIEW): Allow --without-preview to work.
+       From #74615.
+
+2005-04-15  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * configure.in: Applied another freebsd patch from Bill Middleton 
([EMAIL PROTECTED]).
+
+2005-04-14  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * mono/Makefile.am (DIST_SUBDIRS): Add 'handles' directory.
+       * configure.in (AC_OUTPUT): Add back 'mono/handles' directory.
+
 2005-04-13  Raja R Harinath  <[EMAIL PROTECTED]>
 
        * configure.in (AC_OUTPUT): Remove 'mono/handles' directory.
@@ -71,7 +90,6 @@
        * runtime/Makefile.am (wrapper-config): Override location of
        libgdiplus if requested.
 
->>>>>>> .merge-right.r42701
 2005-03-14  Raja R Harinath  <[EMAIL PROTECTED]>
 
        * runtime/Makefile.am (clean_profiles): Remove.

Modified: branches/vargaz/mini-xp-local-regalloc/mono/Makefile.am
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/Makefile.am     2005-04-17 
17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/Makefile.am     2005-04-17 
17:46:58 UTC (rev 43149)
@@ -38,9 +38,18 @@
        $(MAKE) all
        $(MAKE) mcs-do-compiler-tests
 
+compiler-tests-net_2_0:
+       cd $(mcs_topdir) && $(MAKE) PROFILE=net_2_0_bootstrap clean
+       cd $(mcs_topdir) && $(MAKE) PROFILE=net_2_0 clean
+       $(MAKE) all
+       $(MAKE) build_profiles=net_2_0 mcs-do-compiler-tests
+
 bootstrap-world: compiler-tests
        $(MAKE) install
 
+bootstrap-world-net_2_0: compiler-tests-net_2_0
+       $(MAKE) install
+
 # internal targets
 mcs-do-clean:
        cd runtime && $(MAKE) clean-local

Modified: branches/vargaz/mini-xp-local-regalloc/mono/configure.in
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/configure.in    2005-04-17 
17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/configure.in    2005-04-17 
17:46:58 UTC (rev 43149)
@@ -6,7 +6,7 @@
 m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
 
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(mono,1.1.7)
+AM_INIT_AUTOMAKE(mono,1.1.6.5)
 AM_MAINTAINER_MODE
 
 AC_PROG_LN_S
@@ -114,8 +114,8 @@
                        libmono_cflags="$PTHREAD_CFLAGS"
                fi
                if test "x$PTHREAD_LIBS" = "x"; then
-                       LDFLAGS="$LDFLAGS -lpthread"
-                       libmono_ldflags="-lpthread"
+                       LDFLAGS="$LDFLAGS -lthr"
+                       libmono_ldflags="-lthr"
                else
                        LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
                        libmono_ldflags="$PTHREAD_LIBS"
@@ -123,11 +123,11 @@
                need_link_unlink=yes
                AC_DEFINE(PTHREAD_POINTER_ID)
                libdl=
+               with_sigaltstack=yes
                libgc_threads=pthreads
 # TLS is only partially implemented on 5-STABLE (compiler support
 # but NOT library support)
 #
-               with_nptl=no
                with_tls=pthread
                ;;
        *-*-*freebsd6*)
@@ -136,37 +136,12 @@
                        CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS"
                        libmono_cflags=
                else
-                       CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS 
-DGC_FREEBSD_THREADS"
-                       libmono_cflags="$PTHREAD_CFLAGS"
-               fi
-               if test "x$PTHREAD_LIBS" = "x"; then
-                       LDFLAGS="$LDFLAGS -pthread"
-                       libmono_ldflags="-pthread"
-               else
-                       LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
-                       libmono_ldflags="$PTHREAD_LIBS"
-               fi
-               need_link_unlink=yes
-               AC_DEFINE(PTHREAD_POINTER_ID)
-               libdl=
-               libgc_threads=pthreads
-# TLS is only partially implemented on -CURRENT (compiler support
-# but NOT library support)
-#
-               with_tls=pthread
-               ;;
-       *-*-*freebsd6*)
-               platform_win32=no
-               if test "x$PTHREAD_CFLAGS" = "x"; then
-                       CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS"
-                       libmono_cflags=
-               else
                        CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS 
-DGC_FREEBSD_THREADS"
                        libmono_cflags="$PTHREAD_CFLAGS"
                fi
                if test "x$PTHREAD_LIBS" = "x"; then
-                       LDFLAGS="$LDFLAGS -lpthread"
-                       libmono_ldflags="-lpthread"
+                       LDFLAGS="$LDFLAGS -lthr"
+                       libmono_ldflags="-lthr"
                else
                        LDFLAGS="$LDFLAGS $PTHREAD_LIBS"
                        libmono_ldflags="$PTHREAD_LIBS"
@@ -212,7 +187,7 @@
                 ;;
        *-*-solaris*)
                platform_win32=no
-               CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS 
-D_REENTRANT"
+               CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS 
-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS"
                need_link_unlink=yes
                libmono_cflags="-D_REENTRANT"
                libgc_threads=pthreads
@@ -866,6 +841,14 @@
                *-*-*freebsd4*)
                        AC_CHECK_LIB(pthread, main, LIBS="$LIBS -pthread")
                ;;
+               *-*-*freebsd5*)
+                       # libthr is preferrable on CURRENT 
+                       AC_CHECK_LIB(thr, main, LIBS="$LIBS -lthr")
+               ;;
+               *-*-*freebsd6*)
+                       # libthr is preferrable on CURRENT 
+                       AC_CHECK_LIB(thr, main, LIBS="$LIBS -lthr")
+               ;;
                *)
                        AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
                ;;
@@ -1616,8 +1599,8 @@
 
 PREVIEW=yes
 AC_ARG_WITH(preview, [ --with-preview=yes,no     If you want to install the 
2.0 FX preview],[
-       if test x$with_preview = xyes; then
-             PREVIEW=yes
+       if test x$with_preview = xno; then
+             PREVIEW=no
        fi
 ])
 
@@ -1729,6 +1712,7 @@
 mono/monograph/Makefile
 mono/io-layer/Makefile
 mono/mini/Makefile
+mono/handles/Makefile
 mono/profiler/Makefile
 ikvm-native/Makefile
 scripts/Makefile

Modified: branches/vargaz/mini-xp-local-regalloc/mono/libgc/ChangeLog
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/libgc/ChangeLog 2005-04-17 
17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/libgc/ChangeLog 2005-04-17 
17:46:58 UTC (rev 43149)
@@ -1,3 +1,7 @@
+2005-04-15  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * configure.in: Applied another freebsd patch from Bill Middleton 
([EMAIL PROTECTED]).
+
 2005-04-11  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * include/private/gcconfig.h configure.in os_dep.c dyn_load.c: 

Modified: branches/vargaz/mini-xp-local-regalloc/mono/libgc/configure.in
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/libgc/configure.in      
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/libgc/configure.in      
2005-04-17 17:46:58 UTC (rev 43149)
@@ -119,7 +119,7 @@
                INCLUDES="$INCLUDES $PTHREAD_CFLAGS"
        fi
        if test "x$PTHREAD_LIBS" = "x"; then
-               THREADLIBS=-lpthread
+               THREADLIBS=-lthr
        else
                THREADLIBS="$PTHREAD_LIBS"
        fi
@@ -130,7 +130,7 @@
                INCLUDES="$INCLUDES $PTHREAD_CFLAGS"
        fi
        if test "x$PTHREAD_LIBS" = "x"; then
-               THREADLIBS=-lpthread
+               THREADLIBS=-lthr
        else
                THREADLIBS="$PTHREAD_LIBS"
        fi

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/Makefile.am
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/Makefile.am        
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/Makefile.am        
2005-04-17 17:46:58 UTC (rev 43149)
@@ -4,4 +4,4 @@
 endif
 
 SUBDIRS = utils io-layer monoburg os cil metadata \
-      arch interpreter mini dis monograph tests benchmark profiler
+      arch interpreter mini dis monograph tests benchmark $(HANDLES) profiler

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/dis/main.c
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/dis/main.c 2005-04-17 
17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/dis/main.c 2005-04-17 
17:46:58 UTC (rev 43149)
@@ -1617,6 +1617,7 @@
        }
        g_string_append (args, "[--forward-decls]\n[--mresources]");
        fprintf (stderr,
+                "monodis -- Mono Common Intermediate Language Dissassembler\n" 
                 "Usage is: monodis %s file ..\n", args->str);
        exit (1);
 }

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/ChangeLog
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/ChangeLog 
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/ChangeLog 
2005-04-17 17:46:58 UTC (rev 43149)
@@ -1,4 +1,11 @@
+2005-04-15  Dick Porter  <[EMAIL PROTECTED]>
 
+       * collection.c: FreeBSD needs more than PTHREAD_STACK_MIN
+
+2005-04-14  Raja R Harinath  <[EMAIL PROTECTED]>
+
+       * wapi-private.h: Remove reference to 'daemon-private.h'.
+
 Wed Apr 13 13:12:33 EDT 2005 Paolo Molaro <[EMAIL PROTECTED]>
 
        * atomic.h: applied patch from [EMAIL PROTECTED] (David Waite)

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/collection.c
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/collection.c      
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/collection.c      
2005-04-17 17:46:58 UTC (rev 43149)
@@ -53,7 +53,11 @@
        g_assert (ret == 0);
        
 #ifdef HAVE_PTHREAD_ATTR_SETSTACKSIZE
+#ifdef __FreeBSD__
+       ret = pthread_attr_setstacksize (&attr, 65536);
+#else
        ret = pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
+#endif
        g_assert (ret == 0);
 #endif
 

Modified: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/handles-private.h
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/handles-private.h 
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/handles-private.h 
2005-04-17 17:46:58 UTC (rev 43149)
@@ -20,9 +20,13 @@
 #include <mono/io-layer/misc-private.h>
 #include <mono/io-layer/collection.h>
 
+#define _WAPI_PRIVATE_MAX_SLOTS                1024
+#define _WAPI_PRIVATE_HANDLES(x) (_wapi_private_handles [x / 
_WAPI_HANDLE_INITIAL_COUNT][x % _WAPI_HANDLE_INITIAL_COUNT])
+#define _WAPI_PRIVATE_HAVE_SLOT(x) ((GPOINTER_TO_UINT (x) / 
_WAPI_PRIVATE_MAX_SLOTS) < _WAPI_PRIVATE_MAX_SLOTS && \
+                                       _wapi_private_handles [GPOINTER_TO_UINT 
(x) / _WAPI_HANDLE_INITIAL_COUNT] != NULL)
 #undef DEBUG
 
-extern struct _WapiHandleUnshared *_wapi_private_handles;
+extern struct _WapiHandleUnshared *_wapi_private_handles [];
 extern struct _WapiHandleSharedLayout *_wapi_shared_layout;
 extern struct _WapiFileShareLayout *_wapi_fileshare_layout;
 
@@ -94,20 +98,20 @@
 /* This is OK to use for atomic writes of individual struct members, as they
  * are independent
  */
-#define WAPI_SHARED_HANDLE_METADATA(handle) 
_wapi_shared_layout->metadata[_wapi_private_handles[GPOINTER_TO_UINT((handle))].u.shared.offset]
+#define WAPI_SHARED_HANDLE_METADATA(handle) 
_wapi_shared_layout->metadata[_WAPI_PRIVATE_HANDLES(GPOINTER_TO_UINT((handle))).u.shared.offset]
 
 /* Use this for read-only accesses to shared handle structs, so that
  * if a handle is updated we always look at the latest copy.  For
  * write access, use handle_copy/handle_replace so that all the
  * handle-type-specific data is updated atomically.
  */
-#define WAPI_SHARED_HANDLE_TYPED_DATA(handle, type) 
_wapi_shared_layout->handles[_wapi_shared_layout->metadata[_wapi_private_handles[GPOINTER_TO_UINT((handle))].u.shared.offset].offset].u.type
+#define WAPI_SHARED_HANDLE_TYPED_DATA(handle, type) 
_wapi_shared_layout->handles[_wapi_shared_layout->metadata[_WAPI_PRIVATE_HANDLES(GPOINTER_TO_UINT((handle))).u.shared.offset].offset].u.type
 
 static inline WapiHandleType _wapi_handle_type (gpointer handle)
 {
        guint32 idx = GPOINTER_TO_UINT(handle);
        
-       return(_wapi_private_handles[idx].type);
+       return(_WAPI_PRIVATE_HANDLES(idx).type);
 }
 
 static inline void _wapi_handle_set_signal_state (gpointer handle,
@@ -120,7 +124,7 @@
 
        g_assert (!_WAPI_SHARED_HANDLE(_wapi_handle_type (handle)));
        
-       handle_data = &_wapi_private_handles[idx];
+       handle_data = &_WAPI_PRIVATE_HANDLES(idx);
        
 #ifdef DEBUG
        g_message ("%s: setting state of %p to %s (broadcast %s)", __func__,
@@ -171,7 +175,7 @@
        
        g_assert (_WAPI_SHARED_HANDLE(_wapi_handle_type (handle)));
        
-       handle_data = &_wapi_private_handles[idx];
+       handle_data = &_WAPI_PRIVATE_HANDLES(idx);
        
        ref = &handle_data->u.shared;
        shared_meta = &_wapi_shared_layout->metadata[ref->offset];
@@ -192,7 +196,7 @@
        if (_WAPI_SHARED_HANDLE(_wapi_handle_type (handle))) {
                return(WAPI_SHARED_HANDLE_METADATA(handle).signalled);
        } else {
-               return(_wapi_private_handles[idx].signalled);
+               return(_WAPI_PRIVATE_HANDLES(idx).signalled);
        }
 }
 
@@ -229,7 +233,7 @@
                return(0);
        }
        
-       return(mono_mutex_lock (&_wapi_private_handles[idx].signal_mutex));
+       return(mono_mutex_lock (&_WAPI_PRIVATE_HANDLES(idx).signal_mutex));
 }
 
 static inline int _wapi_handle_trylock_handle (gpointer handle)
@@ -246,7 +250,7 @@
                return(0);
        }
 
-       return(mono_mutex_trylock (&_wapi_private_handles[idx].signal_mutex));
+       return(mono_mutex_trylock (&_WAPI_PRIVATE_HANDLES(idx).signal_mutex));
 }
 
 static inline int _wapi_handle_unlock_handle (gpointer handle)
@@ -263,7 +267,7 @@
                return(0);
        }
        
-       ret = mono_mutex_unlock (&_wapi_private_handles[idx].signal_mutex);
+       ret = mono_mutex_unlock (&_WAPI_PRIVATE_HANDLES(idx).signal_mutex);
 
        _wapi_handle_unref (handle);
        

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/handles.c
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/handles.c 
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/handles.c 
2005-04-17 17:46:58 UTC (rev 43149)
@@ -82,7 +82,14 @@
        "Error!!"
 };
 
-struct _WapiHandleUnshared *_wapi_private_handles = NULL;
+/*
+ * We can hold _WAPI_PRIVATE_MAX_SLOTS * _WAPI_HANDLE_INITIAL_COUNT handles.
+ * If 4M handles are not enough... Oh, well... we will crash.
+ */
+#define SLOT_INDEX(x)  (x / _WAPI_HANDLE_INITIAL_COUNT)
+#define SLOT_OFFSET(x) (x % _WAPI_HANDLE_INITIAL_COUNT)
+
+struct _WapiHandleUnshared *_wapi_private_handles [_WAPI_PRIVATE_MAX_SLOTS];
 static guint32 _wapi_private_handle_count = 0;
 
 struct _WapiHandleSharedLayout *_wapi_shared_layout = NULL;
@@ -99,19 +106,17 @@
 static void shared_init (void)
 {
        int thr_ret;
+       int idx = 0;
        
        _wapi_fd_reserve = getdtablesize();
 
-       _wapi_private_handle_count = _WAPI_HANDLE_INITIAL_COUNT;
-       
-       while(_wapi_fd_reserve > _wapi_private_handle_count) {
+       do {
+               _wapi_private_handles [idx++] = g_new0 (struct 
_WapiHandleUnshared,
+                                                       
_WAPI_HANDLE_INITIAL_COUNT);
+
                _wapi_private_handle_count += _WAPI_HANDLE_INITIAL_COUNT;
-       }
+       } while(_wapi_fd_reserve > _wapi_private_handle_count);
        
-       _wapi_private_handles = g_new0 (struct _WapiHandleUnshared,
-                                       _wapi_private_handle_count);
-
-
        _wapi_shared_layout = _wapi_shm_attach ();
        g_assert (_wapi_shared_layout != NULL);
        
@@ -268,8 +273,9 @@
 static guint32 _wapi_handle_new_internal (WapiHandleType type,
                                          gpointer handle_specific)
 {
-       guint32 i;
+       guint32 i, k, count;
        static guint32 last = 0;
+       gboolean retry = FALSE;
        
        /* A linear scan should be fast enough.  Start from the last
         * allocation, assuming that handles are allocated more often
@@ -279,21 +285,27 @@
        
        if (last < _wapi_fd_reserve) {
                last = _wapi_fd_reserve;
+       } else {
+               retry = TRUE;
        }
-       
+
 again:
-       for(i = last; i <_wapi_private_handle_count; i++) {
-               struct _WapiHandleUnshared *handle = &_wapi_private_handles[i];
-               
-               if(handle->type == WAPI_HANDLE_UNUSED) {
-                       last = i + 1;
+       count = last;
+       for(i = SLOT_INDEX (count); _wapi_private_handles [i] != NULL; i++) {
+               for (k = SLOT_OFFSET (count); k < _WAPI_HANDLE_INITIAL_COUNT; 
k++) {
+                       struct _WapiHandleUnshared *handle = 
&_wapi_private_handles [i][k];
+
+                       if(handle->type == WAPI_HANDLE_UNUSED) {
+                               last = count + 1;
                        
-                       _wapi_handle_init (handle, type, handle_specific);
-                       return(i);
+                               _wapi_handle_init (handle, type, 
handle_specific);
+                               return (count);
+                       }
+                       count++;
                }
        }
 
-       if(last > _wapi_fd_reserve) {
+       if(retry && last > _wapi_fd_reserve) {
                /* Try again from the beginning */
                last = _wapi_fd_reserve;
                goto again;
@@ -326,16 +338,10 @@
                
        while ((handle_idx = _wapi_handle_new_internal (type, handle_specific)) 
== 0) {
                /* Try and expand the array, and have another go */
-               _wapi_private_handles = g_renew (struct _WapiHandleUnshared,
-                                                _wapi_private_handles,
-                                                _wapi_private_handle_count +
-                                                _WAPI_HANDLE_INITIAL_COUNT);
-               memset (_wapi_private_handles +
-                       (_wapi_private_handle_count *
-                        sizeof(struct _WapiHandleUnshared)), '\0',
-                       (_WAPI_HANDLE_INITIAL_COUNT *
-                        sizeof(struct _WapiHandleUnshared)));
-               
+               int idx = SLOT_INDEX (_wapi_private_handle_count);
+               _wapi_private_handles [idx] = g_new0 (struct 
_WapiHandleUnshared,
+                                               _WAPI_HANDLE_INITIAL_COUNT);
+
                _wapi_private_handle_count += _WAPI_HANDLE_INITIAL_COUNT;
        }
                
@@ -373,7 +379,7 @@
                        g_assert (ref != 0);
                }
                
-               _wapi_private_handles[handle_idx].u.shared.offset = ref;
+               _WAPI_PRIVATE_HANDLES(handle_idx).u.shared.offset = ref;
 #ifdef DEBUG
                g_message ("%s: New shared handle at offset 0x%x", __func__,
                           ref);
@@ -409,16 +415,10 @@
                
        while ((handle_idx = _wapi_handle_new_internal (type, handle_specific)) 
== 0) {
                /* Try and expand the array, and have another go */
-               _wapi_private_handles = g_renew (struct _WapiHandleUnshared,
-                                                _wapi_private_handles,
-                                                _wapi_private_handle_count +
-                                                _WAPI_HANDLE_INITIAL_COUNT);
-               memset (_wapi_private_handles +
-                       (_wapi_private_handle_count *
-                        sizeof(struct _WapiHandleUnshared)), '\0',
-                       (_WAPI_HANDLE_INITIAL_COUNT *
-                        sizeof(struct _WapiHandleUnshared)));
-               
+               int idx = SLOT_INDEX (_wapi_private_handle_count);
+               _wapi_private_handles [idx] = g_new0 (struct 
_WapiHandleUnshared,
+                                               _WAPI_HANDLE_INITIAL_COUNT);
+
                _wapi_private_handle_count += _WAPI_HANDLE_INITIAL_COUNT;
        }
                
@@ -431,7 +431,7 @@
        
        handle = GUINT_TO_POINTER (handle_idx);
                
-       _wapi_private_handles[handle_idx].u.shared.offset = offset;
+       _WAPI_PRIVATE_HANDLES(handle_idx).u.shared.offset = offset;
 
 #ifdef DEBUG
        g_message ("%s: Allocated new handle %p referencing 0x%x", __func__,
@@ -464,7 +464,7 @@
                return(GUINT_TO_POINTER (_WAPI_HANDLE_INVALID));
        }
 
-       handle = &_wapi_private_handles[fd];
+       handle = &_WAPI_PRIVATE_HANDLES(fd);
        
        if (handle->type != WAPI_HANDLE_UNUSED) {
 #ifdef DEBUG
@@ -508,17 +508,10 @@
        
        while ((handle_idx = _wapi_handle_new_internal (type, NULL)) == 0) {
                /* Try and expand the array, and have another go */
-               _wapi_private_handles = g_renew (struct _WapiHandleUnshared,
-                                                _wapi_private_handles,
-                                                _wapi_private_handle_count +
-                                                _WAPI_HANDLE_INITIAL_COUNT);
-                       
-               memset (_wapi_private_handles +
-                       (_wapi_private_handle_count *
-                        sizeof(struct _WapiHandleUnshared)), '\0',
-                       (_WAPI_HANDLE_INITIAL_COUNT *
-                        sizeof(struct _WapiHandleUnshared)));
-                       
+               int idx = SLOT_INDEX (_wapi_private_handle_count);
+               _wapi_private_handles [idx] = g_new0 (struct 
_WapiHandleUnshared,
+                                               _WAPI_HANDLE_INITIAL_COUNT);
+
                _wapi_private_handle_count += _WAPI_HANDLE_INITIAL_COUNT;
        }
 
@@ -529,7 +522,7 @@
        /* Make sure we left the space for fd mappings */
        g_assert (handle_idx >= _wapi_fd_reserve);
 
-       handle_data = &_wapi_private_handles[handle_idx];
+       handle_data = &_WAPI_PRIVATE_HANDLES(handle_idx);
        ref = &handle_data->u.shared;
        ref->offset = offset;
 
@@ -548,7 +541,7 @@
        struct _WapiHandleUnshared *handle_data;
        guint32 handle_idx = GPOINTER_TO_UINT(handle);
 
-       handle_data = &_wapi_private_handles[handle_idx];
+       handle_data = &_WAPI_PRIVATE_HANDLES(handle_idx);
        
        if (handle_data->type != type) {
                return(FALSE);
@@ -598,7 +591,7 @@
                   _wapi_handle_typename[type]);
 #endif
 
-       handle_data = &_wapi_private_handles[handle_idx];
+       handle_data = &_WAPI_PRIVATE_HANDLES(handle_idx);
        
        if(handle_data->type != type) {
 #ifdef DEBUG
@@ -650,9 +643,9 @@
 #endif
 
        g_assert(_WAPI_SHARED_HANDLE(type));
-       g_assert(_wapi_private_handles[handle_idx].type == type);
+       g_assert(_WAPI_PRIVATE_HANDLES(handle_idx).type == type);
        
-       ref = _wapi_private_handles[handle_idx].u.shared.offset;
+       ref = _WAPI_PRIVATE_HANDLES(handle_idx).u.shared.offset;
        shared_meta = &_wapi_shared_layout->metadata[ref];
        
        do {
@@ -700,9 +693,9 @@
 #endif
 
        g_assert(_WAPI_SHARED_HANDLE(type));
-       g_assert(_wapi_private_handles[handle_idx].type == type);
+       g_assert(_WAPI_PRIVATE_HANDLES(handle_idx).type == type);
        
-       ref = _wapi_private_handles[handle_idx].u.shared.offset;
+       ref = _WAPI_PRIVATE_HANDLES(handle_idx).u.shared.offset;
        shared_meta = &_wapi_shared_layout->metadata[ref];
        
        old_off = shared_meta->offset;
@@ -761,25 +754,29 @@
 {
        struct _WapiHandleUnshared *handle_data = NULL;
        gpointer ret = NULL;
-       guint32 i;
+       guint32 i, k;
+       gboolean found = FALSE;
 
        /* Unsafe, because we don't want the handle to vanish while
         * we're checking it
         */
        _WAPI_HANDLE_COLLECTION_UNSAFE;
 
-       for(i = 0; i < _wapi_private_handle_count; i++) {
-               handle_data = &_wapi_private_handles[i];
+       for(i = SLOT_INDEX (0); !found && _wapi_private_handles [i] != NULL; 
i++) {
+               for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
+                       handle_data = &_wapi_private_handles [i][k];
                
-               if(handle_data->type == type) {
-                       ret = GUINT_TO_POINTER (i);
-                       if(check (ret, user_data) == TRUE) {
-                               break;
+                       if(handle_data->type == type) {
+                               ret = GUINT_TO_POINTER (i);
+                               if(check (ret, user_data) == TRUE) {
+                                       found = TRUE;
+                                       break;
+                               }
                        }
                }
        }
 
-       if(i == _wapi_private_handle_count) {
+       if (!found) {
                goto done;
        }
        
@@ -913,11 +910,11 @@
 {
        guint32 idx = GPOINTER_TO_UINT(handle);
        
-       InterlockedIncrement (&_wapi_private_handles[idx].ref);
+       InterlockedIncrement (&_WAPI_PRIVATE_HANDLES(idx).ref);
        
 #ifdef DEBUG_REFS
        g_message ("%s: handle %p ref now %d", __func__, handle,
-                  _wapi_private_handles[idx].ref);
+                  _WAPI_PRIVATE_HANDLES(idx).ref);
 #endif
 }
 
@@ -933,15 +930,15 @@
         * could lock a mutex, but I'm not sure that allowing a handle
         * reference to reach 0 isn't an application bug anyway.
         */
-       destroy = (InterlockedDecrement (&_wapi_private_handles[idx].ref) ==0);
+       destroy = (InterlockedDecrement (&_WAPI_PRIVATE_HANDLES(idx).ref) ==0);
        
 #ifdef DEBUG_REFS
        g_message ("%s: handle %p ref now %d (destroy %s)", __func__, handle,
-                  _wapi_private_handles[idx].ref, destroy?"TRUE":"FALSE");
+                  _WAPI_PRIVATE_HANDLES(idx).ref, destroy?"TRUE":"FALSE");
 #endif
        
        if(destroy==TRUE) {
-               WapiHandleType type = _wapi_private_handles[idx].type;
+               WapiHandleType type = _WAPI_PRIVATE_HANDLES(idx).type;
 
 #ifdef DEBUG
                g_message ("%s: Destroying handle %p", __func__, handle);
@@ -949,10 +946,10 @@
                
                _wapi_handle_ops_close (handle);
 
-               memset (&_wapi_private_handles[idx].u, '\0',
-                       sizeof(_wapi_private_handles[idx].u));
+               memset (&_WAPI_PRIVATE_HANDLES(idx).u, '\0',
+                       sizeof(_WAPI_PRIVATE_HANDLES(idx).u));
 
-               _wapi_private_handles[idx].type = WAPI_HANDLE_UNUSED;
+               _WAPI_PRIVATE_HANDLES(idx).type = WAPI_HANDLE_UNUSED;
                
                if (!_WAPI_SHARED_HANDLE(type)) {
                        /* Destroy the mutex and cond var.  We hope nobody
@@ -960,10 +957,10 @@
                         * now, but pthreads doesn't have a
                         * "unlock_and_destroy" atomic function.
                         */
-                       thr_ret = mono_mutex_destroy 
(&_wapi_private_handles[idx].signal_mutex);
+                       thr_ret = mono_mutex_destroy 
(&_WAPI_PRIVATE_HANDLES(idx).signal_mutex);
                        g_assert (thr_ret == 0);
                                
-                       thr_ret = pthread_cond_destroy 
(&_wapi_private_handles[idx].signal_cond);
+                       thr_ret = pthread_cond_destroy 
(&_WAPI_PRIVATE_HANDLES(idx).signal_cond);
                        g_assert (thr_ret == 0);
                }
 
@@ -985,7 +982,7 @@
        guint32 idx = GPOINTER_TO_UINT(handle);
        WapiHandleType type;
 
-       type = _wapi_private_handles[idx].type;
+       type = _WAPI_PRIVATE_HANDLES(idx).type;
 
 #ifdef DEBUG
        g_message ("%s: testing 0x%x against 0x%x (%d)", __func__,
@@ -1000,7 +997,7 @@
        guint32 idx = GPOINTER_TO_UINT(handle);
        WapiHandleType type;
 
-       type = _wapi_private_handles[idx].type;
+       type = _WAPI_PRIVATE_HANDLES(idx).type;
 
        if (handle_ops[type] != NULL &&
            handle_ops[type]->close != NULL) {
@@ -1013,7 +1010,7 @@
        guint32 idx = GPOINTER_TO_UINT(handle);
        WapiHandleType type;
 
-       type = _wapi_private_handles[idx].type;
+       type = _WAPI_PRIVATE_HANDLES(idx).type;
 
        if (handle_ops[type] != NULL && handle_ops[type]->signal != NULL) {
                handle_ops[type]->signal (handle);
@@ -1025,7 +1022,7 @@
        guint32 idx = GPOINTER_TO_UINT(handle);
        WapiHandleType type;
        
-       type = _wapi_private_handles[idx].type;
+       type = _WAPI_PRIVATE_HANDLES(idx).type;
 
        if (handle_ops[type] != NULL && handle_ops[type]->own_handle != NULL) {
                return(handle_ops[type]->own_handle (handle));
@@ -1039,7 +1036,7 @@
        guint32 idx = GPOINTER_TO_UINT(handle);
        WapiHandleType type;
 
-       type = _wapi_private_handles[idx].type;
+       type = _WAPI_PRIVATE_HANDLES(idx).type;
 
        if (handle_ops[type] != NULL && handle_ops[type]->is_owned != NULL) {
                return(handle_ops[type]->is_owned (handle));
@@ -1053,7 +1050,7 @@
        guint32 idx = GPOINTER_TO_UINT(handle);
        WapiHandleType type;
        
-       type = _wapi_private_handles[idx].type;
+       type = _WAPI_PRIVATE_HANDLES(idx).type;
        
        if (handle_ops[type] != NULL &&
            handle_ops[type]->special_wait != NULL) {
@@ -1104,7 +1101,7 @@
                g_message ("%s: attempting to lock %p", __func__, handle);
 #endif
 
-               type = _wapi_private_handles[idx].type;
+               type = _WAPI_PRIVATE_HANDLES(idx).type;
 
                if (_WAPI_SHARED_HANDLE(type)) {
                        /* We don't lock shared handles, but we need
@@ -1183,7 +1180,7 @@
                gpointer handle = handles[i];
                guint32 idx = GPOINTER_TO_UINT(handle);
                
-               type = _wapi_private_handles[idx].type;
+               type = _WAPI_PRIVATE_HANDLES(idx).type;
 
                _wapi_handle_ref (handle);
                
@@ -1196,7 +1193,7 @@
                   (_WAPI_SHARED_HANDLE(type) &&
                    WAPI_SHARED_HANDLE_METADATA(handle).signalled == TRUE) ||
                   (!_WAPI_SHARED_HANDLE(type) &&
-                   _wapi_private_handles[idx].signalled == TRUE)) {
+                   _WAPI_PRIVATE_HANDLES(idx).signalled == TRUE)) {
                        count++;
                        
 #ifdef DEBUG
@@ -1237,7 +1234,7 @@
        for(i=0; i<numhandles; i++) {
                gpointer handle = handles[i];
                guint32 idx = GPOINTER_TO_UINT(handle);
-               WapiHandleType type = _wapi_private_handles[idx].type;
+               WapiHandleType type = _WAPI_PRIVATE_HANDLES(idx).type;
                
 #ifdef DEBUG
                g_message ("%s: unlocking handle %p", __func__, handle);
@@ -1246,7 +1243,7 @@
                if (_WAPI_SHARED_HANDLE(type)) {
                        WAPI_SHARED_HANDLE_METADATA(handle).checking = 0;
                } else {
-                       thr_ret = mono_mutex_unlock 
(&_wapi_private_handles[idx].signal_mutex);
+                       thr_ret = mono_mutex_unlock 
(&_WAPI_PRIVATE_HANDLES(idx).signal_mutex);
                        g_assert (thr_ret == 0);
                }
 
@@ -1408,8 +1405,8 @@
                        _wapi_handle_spin (100);
                }
        } else {
-               return(mono_cond_wait (&_wapi_private_handles[idx].signal_cond,
-                                      
&_wapi_private_handles[idx].signal_mutex));
+               return(mono_cond_wait (&_WAPI_PRIVATE_HANDLES(idx).signal_cond,
+                                      
&_WAPI_PRIVATE_HANDLES(idx).signal_mutex));
        }
 }
 
@@ -1452,7 +1449,7 @@
                        }
                }
        } else {
-               return(mono_cond_timedwait 
(&_wapi_private_handles[idx].signal_cond, 
&_wapi_private_handles[idx].signal_mutex, timeout));
+               return(mono_cond_timedwait 
(&_WAPI_PRIVATE_HANDLES(idx).signal_cond, 
&_WAPI_PRIVATE_HANDLES(idx).signal_mutex, timeout));
        }
 }
 
@@ -1660,20 +1657,22 @@
 void _wapi_handle_dump (void)
 {
        struct _WapiHandleUnshared *handle_data;
-       guint32 i;
+       guint32 i, k;
 
-       for (i = 0; i < _wapi_private_handle_count; i++) {
-               handle_data = &_wapi_private_handles[i];
+       for(i = SLOT_INDEX (0); _wapi_private_handles [i] != NULL; i++) {
+               for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
+                       handle_data = &_wapi_private_handles [i][k];
 
-               if (handle_data->type == WAPI_HANDLE_UNUSED) {
-                       continue;
+                       if (handle_data->type == WAPI_HANDLE_UNUSED) {
+                               continue;
+                       }
+               
+                       g_print ("%3x [%7s] %s %d ", i,
+                                _wapi_handle_typename[handle_data->type],
+                                handle_data->signalled?"Sg":"Un", 
handle_data->ref);
+                       handle_details[handle_data->type](&handle_data->u);
+                       g_print ("\n");
                }
-               
-               g_print ("%3x [%7s] %s %d ", i,
-                        _wapi_handle_typename[handle_data->type],
-                        handle_data->signalled?"Sg":"Un", handle_data->ref);
-               handle_details[handle_data->type](&handle_data->u);
-               g_print ("\n");
        }
 }
 
@@ -1686,7 +1685,7 @@
 
 void _wapi_handle_update_refs (void)
 {
-       guint32 i, lock_now;
+       guint32 i, k, lock_now;
        int thr_ret;
        
        _WAPI_HANDLE_COLLECTION_UNSAFE;
@@ -1703,44 +1702,46 @@
        } while (thr_ret == EBUSY);
        g_assert(thr_ret == 0);
 
-       for (i = 0; i < _wapi_private_handle_count; i++) {
-               struct _WapiHandleUnshared *handle = &_wapi_private_handles[i];
-               guint32 now = (guint32)(time (NULL) & 0xFFFFFFFF);
+       for(i = SLOT_INDEX (0); _wapi_private_handles [i] != NULL; i++) {
+               for (k = SLOT_OFFSET (0); k < _WAPI_HANDLE_INITIAL_COUNT; k++) {
+                       struct _WapiHandleUnshared *handle = 
&_wapi_private_handles [i][k];
+                       guint32 now = (guint32)(time (NULL) & 0xFFFFFFFF);
 
-               if (_WAPI_SHARED_HANDLE(handle->type)) {
-                       struct _WapiHandleSharedMetadata *shared_meta;
-                       
+                       if (_WAPI_SHARED_HANDLE(handle->type)) {
+                               struct _WapiHandleSharedMetadata *shared_meta;
+                               
 #ifdef DEBUG
-                       g_message ("%s: (%d) handle 0x%x is SHARED", __func__,
-                                  getpid (), i);
+                               g_message ("%s: (%d) handle 0x%x is SHARED", 
__func__,
+                                          getpid (), i);
 #endif
 
-                       shared_meta = 
&_wapi_shared_layout->metadata[handle->u.shared.offset];
+                               shared_meta = 
&_wapi_shared_layout->metadata[handle->u.shared.offset];
 
 #ifdef DEBUG
-                       g_message ("%s: (%d) Updating timstamp of handle 0x%x",
-                                  __func__, getpid(),
-                                  handle->u.shared.offset);
+                               g_message ("%s: (%d) Updating timstamp of 
handle 0x%x",
+                                          __func__, getpid(),
+                                          handle->u.shared.offset);
 #endif
 
-                       InterlockedExchange (&shared_meta->timestamp, now);
-               } else if (handle->type == WAPI_HANDLE_FILE) {
-                       struct _WapiHandle_file *file_handle = &handle->u.file;
-                       
+                               InterlockedExchange (&shared_meta->timestamp, 
now);
+                       } else if (handle->type == WAPI_HANDLE_FILE) {
+                               struct _WapiHandle_file *file_handle = 
&handle->u.file;
+                               
 #ifdef DEBUG
-                       g_message ("%s: (%d) handle 0x%x is FILE", __func__,
-                                  getpid (), i);
+                               g_message ("%s: (%d) handle 0x%x is FILE", 
__func__,
+                                          getpid (), i);
 #endif
-                       
-                       g_assert (file_handle->share_info != NULL);
+                               
+                               g_assert (file_handle->share_info != NULL);
 
 #ifdef DEBUG
-                       g_message ("%s: (%d) Inc refs on fileshare 0x%x",
-                                  __func__, getpid(),
-                                  (file_handle->share_info - 
&_wapi_fileshare_layout->share_info[0]) / sizeof(struct _WapiFileShare));
+                               g_message ("%s: (%d) Inc refs on fileshare 
0x%x",
+                                          __func__, getpid(),
+                                          (file_handle->share_info - 
&_wapi_fileshare_layout->share_info[0]) / sizeof(struct _WapiFileShare));
 #endif
 
-                       InterlockedExchange 
(&file_handle->share_info->timestamp, now);
+                               InterlockedExchange 
(&file_handle->share_info->timestamp, now);
+                       }
                }
        }
        

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/io.c
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/io.c      
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/io.c      
2005-04-17 17:46:58 UTC (rev 43149)
@@ -2182,6 +2182,11 @@
 {
        WapiHandleType type;
 
+       if (!_WAPI_PRIVATE_HAVE_SLOT (handle)) {
+               SetLastError (ERROR_INVALID_HANDLE);
+               return(FILE_TYPE_UNKNOWN);
+       }
+
        type = _wapi_handle_type (handle);
        
        if (io_ops[type].getfiletype == NULL) {

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/processes.c
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/processes.c       
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/processes.c       
2005-04-17 17:46:58 UTC (rev 43149)
@@ -532,7 +532,7 @@
                struct _WapiHandleUnshared *handle_data;
                struct _WapiHandle_shared_ref *ref;
                
-               handle_data = &_wapi_private_handles[GPOINTER_TO_UINT(handle)];
+               handle_data = &_WAPI_PRIVATE_HANDLES(GPOINTER_TO_UINT(handle));
                ref = &handle_data->u.shared;
                
                env_strings[env_count] = g_strdup_printf 
("_WAPI_PROCESS_HANDLE_OFFSET=%d", ref->offset);

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/sockets.c
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/sockets.c 
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/sockets.c 
2005-04-17 17:46:58 UTC (rev 43149)
@@ -856,9 +856,9 @@
                ret = fcntl (fd, F_GETFL, 0);
                if (ret != -1) {
                        if (*(gboolean *)arg) {
+                               ret |= O_NONBLOCK;
+                       } else {
                                ret &= ~O_NONBLOCK;
-                       } else {
-                               ret |= O_NONBLOCK;
                        }
                        ret = fcntl (fd, F_SETFL, ret);
                }

Modified: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/wapi-private.h
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/wapi-private.h    
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/io-layer/wapi-private.h    
2005-04-17 17:46:58 UTC (rev 43149)
@@ -15,7 +15,6 @@
 
 #include <mono/io-layer/handles.h>
 #include <mono/io-layer/io.h>
-#include <mono/io-layer/daemon-private.h>
 
 /* Catch this here rather than corrupt the shared data at runtime */
 #if MONO_SIZEOF_SUNPATH==0

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/ChangeLog
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/ChangeLog 
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/ChangeLog 
2005-04-17 17:46:58 UTC (rev 43149)
@@ -1,3 +1,40 @@
+2005-04-16  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * reflection.c reflection.h: Fix handling of parameter defaults in 
dynamic
+       methods. Also fixes handling of parameter attributes. Fixes #74609.
+
+       * mono-debug.c (mono_debug_close_image): Fix warning.
+
+2005-04-15 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * socket-io.h: replaced old unused field with new 'blocking'.
+       * threadpool.c: restore socket blocking state on windows(tm).
+
+2005-04-14  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * icall.c: don't return the codebase in the AssemblyName[] returned by
+       ves_icall_System_Reflection_Assembly_GetReferencedAssemblies.
+       * object-internals.h: Removed FIXME (fields were presents) and fixed
+       versioncompat declaration.
+
+2005-04-14 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * threadpool.c: sometimes we get EBADF from epoll but the epollfd is
+       not closed, so don't cleanup when it happens.
+
+2005-04-13  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * mono-debug-debugger.h: change prototype for
+       mono_debugger_lookup_type.
+
+       * mono-debug-debugger.c (mono_debugger_lookup_type): reinstate
+       this function, although it should probably be named
+       mono_debugger_init_type.
+
+2005-04-13 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
+
+       * threadpool.c: fix non-AIO case.
+
 2005-04-13  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * profiler.c (mono_profiler_install_simple): Add a 'jit' option to

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/icall.c
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/icall.c   
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/icall.c   
2005-04-17 17:46:58 UTC (rev 43149)
@@ -3511,7 +3511,6 @@
        for (i = 0; i < count; i++) {
                MonoAssembly *assem;
                MonoReflectionAssemblyName *aname;
-               char *codebase, *absolute;
 
                /* FIXME: There is no need to load the assemblies themselves */
                mono_assembly_load_reference (assembly->assembly->image, i);
@@ -3536,6 +3535,7 @@
                aname->revision = assem->aname.revision;
                aname->hashalg = assem->aname.hash_alg;
                aname->flags = assem->aname.flags;
+               aname->versioncompat = 1; /* SameMachine (default) */
 
                if (create_culture) {
                        gpointer args [1];
@@ -3555,11 +3555,9 @@
                /* public key token isn't copied - the class library will 
                   automatically generate it from the public key if required */
 
-               absolute = g_build_filename (assem->basedir, 
assem->image->module_name, NULL);
-               codebase = g_filename_to_uri (absolute, NULL, NULL);
-               aname->codebase = mono_string_new (domain, codebase);
-               g_free (codebase);
-               g_free (absolute);
+               /* note: this function doesn't return the codebase on purpose 
(i.e. it can
+                        be used under partial trust as path information isn't 
present). */
+
                mono_array_set (result, gpointer, i, aname);
        }
        return result;

Modified: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/mono-debug-debugger.c
===================================================================
--- 
branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/mono-debug-debugger.c 
    2005-04-17 17:29:23 UTC (rev 43148)
+++ 
branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/mono-debug-debugger.c 
    2005-04-17 17:46:58 UTC (rev 43149)
@@ -428,6 +428,36 @@
        return retval;
 }
 
+gboolean
+mono_debugger_lookup_type (const gchar *type_name)
+{
+       int i;
+       mono_debugger_lock ();
+
+       for (i = 0; i < mono_symbol_table->num_symbol_files; i++) {
+               MonoDebugHandle *symfile = mono_symbol_table->symbol_files [i];
+               MonoType *type;
+               MonoClass* klass;
+               gchar *name;
+
+               name = g_strdup (type_name);
+               type = mono_reflection_type_from_name (name, symfile->image);
+               g_free (name);
+               if (!type)
+                       continue;
+
+               klass = mono_class_from_mono_type (type);
+               if (klass)
+                       mono_class_init (klass);
+
+               mono_debugger_unlock ();
+               return TRUE;
+       }
+
+       mono_debugger_unlock ();
+       return FALSE;
+}
+
 gint32
 mono_debugger_lookup_assembly (const gchar *name)
 {

Modified: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/mono-debug-debugger.h
===================================================================
--- 
branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/mono-debug-debugger.h 
    2005-04-17 17:29:23 UTC (rev 43148)
+++ 
branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/mono-debug-debugger.h 
    2005-04-17 17:46:58 UTC (rev 43149)
@@ -101,7 +101,7 @@
 MonoObject     *mono_debugger_runtime_invoke              (MonoMethod *method, 
void *obj,
                                                           void **params, 
MonoObject **exc);
 
-guint32         mono_debugger_lookup_type                 (const gchar 
*type_name);
+gboolean        mono_debugger_lookup_type                 (const gchar 
*type_name);
 gint32          mono_debugger_lookup_assembly             (const gchar *name);
 gboolean        mono_debugger_unhandled_exception         (gpointer addr, 
gpointer stack, MonoObject *exc);
 void            mono_debugger_handle_exception            (gpointer addr, 
gpointer stack, MonoObject *exc);

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/mono-debug.c
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/mono-debug.c      
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/mono-debug.c      
2005-04-17 17:46:58 UTC (rev 43149)
@@ -183,7 +183,7 @@
                mono_debug_close_mono_symbol_file (handle->symfile);
        /* decrease the refcount added with mono_image_addref () */
        mono_image_close (handle->image);
-       g_free (handle->image_file);
+       g_free ((char*)handle->image_file);
        g_free (handle->_priv);
        g_free (handle);
 }

Modified: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/object-internals.h
===================================================================
--- 
branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/object-internals.h    
    2005-04-17 17:29:23 UTC (rev 43148)
+++ 
branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/object-internals.h    
    2005-04-17 17:46:58 UTC (rev 43149)
@@ -872,19 +872,13 @@
        MonoString *name;
        MonoString *codebase;
        gint32 major, minor, build, revision;
-       /* FIXME: add missing stuff */
-/*     CultureInfo cultureinfo;
-       AssemblyNameFlags flags;
-       AssemblyHashAlgorithm hashalg;
-       StrongNameKeyPair keypair;
-       AssemblyVersionCompatibility versioncompat;*/
        MonoObject  *cultureInfo;
        guint32     flags;
        guint32     hashalg;
        MonoObject  *keypair;
        MonoArray   *publicKey;
        MonoArray   *keyToken;
-       MonoObject  *versioncompat;
+       guint32     versioncompat;
 } MonoReflectionAssemblyName;
 
 typedef struct {

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/reflection.c
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/reflection.c      
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/reflection.c      
2005-04-17 17:46:58 UTC (rev 43149)
@@ -5757,8 +5757,10 @@
 
        if (klass->image->dynamic) {
                MonoReflectionMethodAux *aux = g_hash_table_lookup 
(((MonoDynamicImage*)method->klass->image)->method_aux_hash, method);
-               if (aux && aux->param_defaults)
+               if (aux && aux->param_defaults) {
                        memcpy (blobs, &(aux->param_defaults [1]), 
methodsig->param_count * sizeof (char*));
+                       memcpy (types, &(aux->param_default_types [1]), 
methodsig->param_count * sizeof (guint32));
+               }
                return;
        }
 
@@ -7868,8 +7870,11 @@
                for (i = 0; i <= m->signature->param_count; ++i) {
                        MonoReflectionParamBuilder *pb;
                        if ((pb = mono_array_get (rmb->pinfo, 
MonoReflectionParamBuilder*, i))) {
-                               if (i > 0)
+                               if ((i > 0) && (pb->attrs)) {
+                                       /* Make a copy since it might point to 
a shared type structure */
+                                       m->signature->params [i - 1] = g_memdup 
(m->signature->params [i - 1], sizeof (MonoType) + ((m->signature->params [i - 
1]->num_mods - MONO_ZERO_LEN_ARRAY) * sizeof (MonoCustomMod)));
                                        m->signature->params [i - 1]->attrs = 
pb->attrs;
+                               }
 
                                if (pb->def_value) {
                                        MonoDynamicImage *assembly;
@@ -7877,8 +7882,10 @@
                                        char *p;
                                        const char *p2;
 
-                                       if (!method_aux->param_defaults)
+                                       if (!method_aux->param_defaults) {
                                                method_aux->param_defaults = 
g_new0 (guint8*, m->signature->param_count + 1);
+                                               method_aux->param_default_types 
= g_new0 (guint32, m->signature->param_count + 1);
+                                       }
                                        assembly = 
(MonoDynamicImage*)klass->image;
                                        idx = encode_constant (assembly, 
pb->def_value, &def_type);
                                        /* Copy the data from the blob since it 
might get realloc-ed */
@@ -7886,6 +7893,7 @@
                                        len = mono_metadata_decode_blob_size 
(p, &p2);
                                        len += p2 - p;
                                        method_aux->param_defaults [i] = 
g_malloc (len);
+                                       method_aux->param_default_types [i] = 
def_type;
                                        memcpy 
((gpointer)method_aux->param_defaults [i], p, len);
                                }
 

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/reflection.h
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/reflection.h      
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/reflection.h      
2005-04-17 17:46:58 UTC (rev 43149)
@@ -35,6 +35,7 @@
        MonoMarshalSpec **param_marshall;
        MonoCustomAttrInfo **param_cattr;
        guint8** param_defaults;
+       guint32 *param_default_types;
        char *dllentry, *dll;
 } MonoReflectionMethodAux;
 

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/socket-io.h
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/socket-io.h       
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/socket-io.h       
2005-04-17 17:46:58 UTC (rev 43149)
@@ -155,7 +155,7 @@
        gint total;
        MonoBoolean completed_synch;
        MonoBoolean completed;
-       MonoDelegate *real_callback;
+       MonoBoolean blocking;
        gint error;
        gint operation;
        MonoAsyncResult *ares;

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/threadpool.c
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/threadpool.c      
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/metadata/threadpool.c      
2005-04-17 17:46:58 UTC (rev 43149)
@@ -48,6 +48,7 @@
 #include "threadpool.h"
 
 #undef EPOLL_DEBUG
+
 /* maximum number of worker threads */
 static int mono_max_worker_threads = THREADS_PER_CPU;
 static int mono_min_worker_threads = 0;
@@ -300,6 +301,13 @@
 #ifdef EPOLL_DEBUG
                g_print ("Dispatching event %d on socket %d\n", event, 
state->handle);
 #endif
+#ifdef PLATFORM_WIN32
+               {
+               int block;
+               block = state->blocking;
+               ioctlsocket (state->handle, FIONBIO, (gulong *) &block);
+               }
+#endif
                InterlockedIncrement (&pending_io_items);
                start_io_thread_or_queue (state->ares);
        }
@@ -506,7 +514,7 @@
 #ifdef EPOLL_DEBUG
                        {
                        int err = errno;
-                       g_print ("epoll_wait end with %d ready sockets.\n", 
ready);
+                       g_print ("epoll_wait end with %d ready sockets (%d 
%s).\n", ready, err, (err) ? g_strerror (err) : "");
                        errno = err;
                        }
 #endif
@@ -515,11 +523,10 @@
                if (ready == -1) {
                        int err = errno;
                        g_free (events);
-                       if (err != EBADF) {
+                       if (err != EBADF)
                                g_warning ("epoll_wait: %d %s\n", err, 
g_strerror (err));
-                       } else {
-                               close (epollfd);
-                       }
+
+                       close (epollfd);
                        return;
                }
 
@@ -558,26 +565,20 @@
                                g_print ("MOD %d to %d\n", fd, evt->events);
 #endif
                                if (epoll_ctl (epollfd, EPOLL_CTL_MOD, fd, 
evt)) {
-                                       int err = errno;
-                                       if (err == EBADF) {
-                                               g_free (events);
-                                               return; /* epollfd closed */
+                                       if (epoll_ctl (epollfd, EPOLL_CTL_ADD, 
fd, evt) == -1) {
+#ifdef EPOLL_DEBUG
+                                               int err = errno;
+                                               g_message ("epoll_ctl(MOD): %d 
%s fd: %d events: %d", err, g_strerror (err), fd, evt->events);
+                                               errno = err;
+#endif
                                        }
-                                       g_message ("epoll_ctl(MOD): %d %s fd: 
%d events: %d", err, g_strerror (err), fd, evt->events);
                                }
                        } else {
                                g_hash_table_remove (data->sock_to_state, 
GINT_TO_POINTER (fd));
 #ifdef EPOLL_DEBUG
                                g_print ("DEL %d\n", fd);
 #endif
-                               if (epoll_ctl (epollfd, EPOLL_CTL_DEL, fd, 
evt)) {
-                                       int err = errno;
-                                       if (err == EBADF) {
-                                               g_free (events);
-                                               return; /* epollfd closed */
-                                       }
-                                       g_message ("epoll_ctl(DEL): %d %s", 
err, g_strerror (err));
-                               }
+                               epoll_ctl (epollfd, EPOLL_CTL_DEL, fd, evt);
                        }
                }
                LeaveCriticalSection (&data->io_lock);
@@ -639,10 +640,12 @@
 #endif
 
 #ifndef PLATFORM_WIN32
-       if (data->epoll_disabled && pipe (data->pipe) != 0) {
-               int err = errno;
-               perror ("mono");
-               g_assert (err);
+       if (data->epoll_disabled) {
+               if (pipe (data->pipe) != 0) {
+                       int err = errno;
+                       perror ("mono");
+                       g_assert (err);
+               }
        } else {
                data->pipe [0] = -1;
                data->pipe [1] = -1;
@@ -758,10 +761,11 @@
 #endif
        if (epoll_ctl (data->epollfd, epoll_op, fd, &event) == -1) {
                int err = errno;
-               g_message ("epoll_ctl(ADD): %d %s\n", err, g_strerror (err));
-               epoll_op = EPOLL_CTL_MOD;
-               if (epoll_ctl (data->epollfd, epoll_op, fd, &event) == -1) {
-                       g_message ("epoll_ctl(MOD): %d %s\n", err, g_strerror 
(err));
+               if (epoll_op == EPOLL_CTL_ADD && err == EEXIST) {
+                       epoll_op = EPOLL_CTL_MOD;
+                       if (epoll_ctl (data->epollfd, epoll_op, fd, &event) == 
-1) {
+                               g_message ("epoll_ctl(MOD): %d %s\n", err, 
g_strerror (err));
+                       }
                }
        }
 

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/ChangeLog
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/ChangeLog     
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/ChangeLog     
2005-04-17 17:46:58 UTC (rev 43149)
@@ -1,9 +1,29 @@
 2005-04-17  Zoltan Varga  <[EMAIL PROTECTED]>
 
+       * mini-x86.c (mono_emit_stack_alloc): Initialize the whole allocated 
area not
+       just the last bytes.
+
+2005-04-17  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * aot.c (mono_compile_assembly): Fix warning.
+
+       * mini-exceptions.c (ves_icall_get_frame_info): Fix bug introduced
+       by the _MSC_VER stuff.
+
+2005-04-17  Zoltan Varga  <[EMAIL PROTECTED]>
+
        * mini-amd64.h (MONO_ARCH_INST_REGPAIR_REG2): Fix warning.
 
 2005-04-16  Zoltan Varga  <[EMAIL PROTECTED]>
        
+       * inssel-long.brg: Fix #74588.
+
+       * cpu-amd64.md: Fix #74591.
+
+       * iltests.il: Add new regression tests.
+
+2005-04-16  Zoltan Varga  <[EMAIL PROTECTED]>
+
        * mini-codegen.c (mono_local_regalloc): Fix handling of non-fixed 
register pairs.
 
        * mini-sparc.h cpu-sparc.md mini-sparc.c: Handle the return values of 
calls using

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/aot.c
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/aot.c 2005-04-17 
17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/aot.c 2005-04-17 
17:46:58 UTC (rev 43149)
@@ -2211,7 +2211,7 @@
        if (acfg->got_offset > 0)
                fprintf (tmpfp, ".skip %d\n", (int)(acfg->got_offset * sizeof 
(gpointer)));
 
-       printf ("GOT SIZE: %d\n", acfg->got_offset * sizeof (gpointer));
+       printf ("GOT SIZE: %d\n", (int)(acfg->got_offset * sizeof (gpointer)));
 
        symbol = g_strdup_printf ("got_addr");
        emit_section_change (tmpfp, ".data", 1);

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/cpu-amd64.md
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/cpu-amd64.md  
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/cpu-amd64.md  
2005-04-17 17:46:58 UTC (rev 43149)
@@ -399,9 +399,9 @@
 long_clt_un:
 long_conv_to_r_un: dest:f src1:i src2:i len:48 
 long_conv_to_u:
-long_shr_imm: dest:i src1:i len:11
-long_shr_un_imm: dest:i src1:i len:11
-long_shl_imm: dest:i src1:i len:11
+long_shr_imm: dest:i src1:i clob:1 len:11
+long_shr_un_imm: dest:i src1:i clob:1 len:11
+long_shl_imm: dest:i src1:i clob:1 len:11
 long_add_imm:
 long_sub_imm:
 long_beq:

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/cpu-pentium.md
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/cpu-pentium.md        
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/cpu-pentium.md        
2005-04-17 17:46:58 UTC (rev 43149)
@@ -269,7 +269,7 @@
 ldloc:
 ldloca:
 stloc:
-localloc: dest:i src1:i len:80
+localloc: dest:i src1:i len:120
 endfilter:
 unaligned.:
 volatile.:

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/iltests.il
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/iltests.il    
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/iltests.il    
2005-04-17 17:46:58 UTC (rev 43149)
@@ -698,4 +698,31 @@
                ret
        }
 
+       .method public static int32 test_7_conv_ovf_u8_un () {
+       .maxstack  2
+        .locals    init (unsigned int64)
+
+        ldc.i4.7
+        conv.ovf.u8.un
+        stloc.0
+               ldloc.0
+               conv.i4
+        ret
+       }
+
+       .method public static int32 test_1_bug_74591 () {
+               .maxstack 16
+               .locals init (int32)
+
+               ldc.i4.m1
+               stloc.0
+               ldloc.0
+               conv.ovf.i8
+               ldc.i4.m1
+               conv.ovf.i8
+               mul.ovf
+               conv.i4
+               ret
+       }
+
 }

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/inssel-long.brg
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/inssel-long.brg       
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/inssel-long.brg       
2005-04-17 17:46:58 UTC (rev 43149)
@@ -328,8 +328,9 @@
        MONO_EMIT_BIALU_IMM (s, tree, OP_LSHR_IMM, state->reg1, 
state->left->reg1, 0);
 }
 
-reg: CEE_CONV_OVF_I8_UN (reg) {
-       /* an unsigned 32 bit num always fits in a signed 64 bit one */
+reg: CEE_CONV_OVF_I8_UN (reg),
+reg: CEE_CONV_OVF_U8_UN (reg) {
+       /* an unsigned 32 bit num always fits in an (un)signed 64 bit one */
        /* Clean out the upper word */
        MONO_EMIT_BIALU_IMM (s, tree, OP_SHR_UN_IMM, state->reg1, 
state->left->reg1, 0);
 }
@@ -340,13 +341,6 @@
        MONO_EMIT_UNALU (s, tree, OP_MOVE, state->reg1, state->left->reg1);
 }
 
-reg: CEE_CONV_OVF_U8_UN (reg) {
-       g_assert_not_reached ();
-}
-
-
-
-
 reg: OP_LCALLVIRT (reg) {
        mini_emit_virtual_call (s, state, tree, OP_LCALL, OP_LCALL_MEMBASE);
 }

Modified: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/mini-exceptions.c
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/mini-exceptions.c     
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/mini-exceptions.c     
2005-04-17 17:46:58 UTC (rev 43149)
@@ -321,14 +321,14 @@
        MonoLMF *lmf = jit_tls->lmf;
        MonoJitInfo *ji, rji;
        MonoContext ctx, new_ctx;
-       unsigned int stackptr;
+       gssize stackptr;
 
        mono_arch_flush_register_windows ();
 
 #ifdef _MSC_VER
        __asm mov stackptr, ebp;
 #else
-       stackptr = (unsigned int) __builtin_frame_address (0);
+       stackptr = (gssize)__builtin_frame_address (0);
 #endif
 
        MONO_CONTEXT_SET_IP (&ctx, ves_icall_get_frame_info);

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/mini-x86.c
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/mini-x86.c    
2005-04-17 17:29:23 UTC (rev 43148)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/mini-x86.c    
2005-04-17 17:46:58 UTC (rev 43149)
@@ -1534,6 +1534,27 @@
                br[2] = code; /* loop */
                x86_alu_reg_imm (code, X86_SUB, X86_ESP, 0x1000);
                x86_test_membase_reg (code, X86_ESP, 0, X86_ESP);
+
+               /* 
+                * By the end of the loop, sreg2 is smaller than 0x1000, so the 
init routine
+                * that follows only initializes the last part of the area.
+                */
+               /* Same as the init code below with size==0x1000 */
+               if (tree->flags & MONO_INST_INIT) {
+                       x86_push_reg (code, X86_EAX);
+                       x86_push_reg (code, X86_ECX);
+                       x86_push_reg (code, X86_EDI);
+                       x86_mov_reg_imm (code, X86_ECX, (0x1000 >> 2));
+                       x86_alu_reg_reg (code, X86_XOR, X86_EAX, X86_EAX);      
                        
+                       x86_lea_membase (code, X86_EDI, X86_ESP, 12);
+                       x86_cld (code);
+                       x86_prefix (code, X86_REP_PREFIX);
+                       x86_stosl (code);
+                       x86_pop_reg (code, X86_EDI);
+                       x86_pop_reg (code, X86_ECX);
+                       x86_pop_reg (code, X86_EAX);
+               }
+
                x86_alu_reg_imm (code, X86_SUB, sreg, 0x1000);
                x86_alu_reg_imm (code, X86_CMP, sreg, 0x1000);
                br[3] = code; x86_branch8 (code, X86_CC_AE, 0, FALSE);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to