Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mono
diff options
context:
space:
mode:
Diffstat (limited to 'mono')
-rw-r--r--mono/dis/get.c1
-rw-r--r--mono/interpreter/ChangeLog6
-rw-r--r--mono/interpreter/interp.c2
-rw-r--r--mono/interpreter/mintops.h10
-rw-r--r--mono/io-layer/ChangeLog34
-rw-r--r--mono/io-layer/daemon.c10
-rw-r--r--mono/io-layer/io.c35
-rw-r--r--mono/io-layer/mutexes.c20
-rw-r--r--mono/io-layer/threads.c12
-rw-r--r--mono/io-layer/timed-thread.c2
-rw-r--r--mono/io-layer/wait.c12
-rw-r--r--mono/metadata/ChangeLog92
-rw-r--r--mono/metadata/appdomain.c14
-rw-r--r--mono/metadata/class.c2
-rw-r--r--mono/metadata/debug-mono-symfile.c2
-rw-r--r--mono/metadata/gc.c70
-rw-r--r--mono/metadata/locales.c21
-rw-r--r--mono/metadata/marshal.c230
-rw-r--r--mono/metadata/metadata.c106
-rw-r--r--mono/metadata/object.c10
-rw-r--r--mono/metadata/object.h6
-rw-r--r--mono/metadata/process.c2
-rw-r--r--mono/metadata/reflection.c4
-rw-r--r--mono/metadata/socket-io.c52
-rw-r--r--mono/metadata/socket-io.h15
-rw-r--r--mono/mini/ChangeLog50
-rw-r--r--mono/mini/exceptions-x86.c6
-rw-r--r--mono/mini/inssel-ppc.brg20
-rw-r--r--mono/mini/inssel-x86.brg2
-rw-r--r--mono/mini/mini-ppc.c17
-rw-r--r--mono/mini/mini-s390.c2
-rw-r--r--mono/mini/mini-sparc.c1
-rw-r--r--mono/mini/mini-x86.c2
-rw-r--r--mono/mini/mini.c94
-rw-r--r--mono/mini/mini.h1
-rw-r--r--mono/tests/Makefile.am1
-rw-r--r--mono/tests/libtest.c40
-rwxr-xr-xmono/tests/pinvoke2.cs18
-rwxr-xr-xmono/tests/pinvoke3.cs14
-rw-r--r--mono/tests/typeof-ptr.cs20
40 files changed, 216 insertions, 842 deletions
diff --git a/mono/dis/get.c b/mono/dis/get.c
index 22dea4fa32a..43845cd6c19 100644
--- a/mono/dis/get.c
+++ b/mono/dis/get.c
@@ -197,7 +197,6 @@ get_typespec (MonoImage *m, guint32 idx)
if (s)
g_string_append (res, s);
}
- g_string_append (res, "*");
break;
case MONO_TYPE_FNPTR:
diff --git a/mono/interpreter/ChangeLog b/mono/interpreter/ChangeLog
index 088f0756976..2c2d176ef2f 100644
--- a/mono/interpreter/ChangeLog
+++ b/mono/interpreter/ChangeLog
@@ -1,9 +1,3 @@
-2004-07-05 Zoltan Varga <vargaz@freemail.hu>
-
- * mintops.h: Applied patch from Marcin Krzyzanowski (krzak@pld-linux.org). Add support for unaligned access on little endian machines.
-
- * interp.c:Applied patch from Marcin Krzyzanowski (krzak@pld-linux.org). Fix crash seen on amd64.
-
2004-06-24 David Waite <mass@akuma.org>
* interp.c: change to C90-style comments from C99/C++-style
diff --git a/mono/interpreter/interp.c b/mono/interpreter/interp.c
index 3f7ad24660d..872fad14aae 100644
--- a/mono/interpreter/interp.c
+++ b/mono/interpreter/interp.c
@@ -1164,7 +1164,7 @@ handle_enum:
}
}
- if (method->klass->valuetype && obj)
+ if (method->klass->valuetype)
/* Unbox the instance, since valuetype methods expect an interior pointer. */
obj = mono_object_unbox (obj);
diff --git a/mono/interpreter/mintops.h b/mono/interpreter/mintops.h
index e787526e2fe..ab559de7ac6 100644
--- a/mono/interpreter/mintops.h
+++ b/mono/interpreter/mintops.h
@@ -1,8 +1,6 @@
#ifndef __INTERPRETER_MINTOPS_H
#define __INTERPRETER_MINTOPS_H
-#include <glib.h>
-
typedef enum
{
MintOpNoArgs,
@@ -31,19 +29,11 @@ enum {
#undef OPDEF
#if NO_UNALIGNED_ACCESS
-# if G_BYTE_ORDER == G_LITTLE_ENDIAN
-#define READ32(x) (((guint16 *)(x)) [0] | ((guint16 *)(x)) [1] << 16)
-#define READ64(x) ((guint64)((guint16 *)(x)) [0] | \
- (guint64)((guint16 *)(x)) [1] << 16 | \
- (guint64)((guint16 *)(x)) [2] << 32 | \
- (guint64)((guint16 *)(x)) [3] << 48)
-# else
#define READ32(x) (((guint16 *)(x)) [0] << 16 | ((guint16 *)(x)) [1])
#define READ64(x) ((guint64)((guint16 *)(x)) [0] << 48 | \
(guint64)((guint16 *)(x)) [1] << 32 | \
(guint64)((guint16 *)(x)) [2] << 16 | \
(guint64)((guint16 *)(x)) [3])
-# endif
#else /* unaligned access OK */
#define READ32(x) (*(guint32 *)(x))
#define READ64(x) (*(guint64 *)(x))
diff --git a/mono/io-layer/ChangeLog b/mono/io-layer/ChangeLog
index fec9ca9fbe0..5b19c8ceadf 100644
--- a/mono/io-layer/ChangeLog
+++ b/mono/io-layer/ChangeLog
@@ -1,37 +1,3 @@
-2004-07-22 Dick Porter <dick@ximian.com>
-
- * timed-thread.c:
- * threads.c: Move the destruction of the internal thread data to
- after the thread has been joined. Fixes bug 61418.
-
-2004-07-14 Dick Porter <dick@ximian.com>
-
- * wait.c (test_and_own): When not waiting for all handles to
- become signalled, only own and return the lowest. All the
- documentation suggests that the old way was correct, but
- experimentation shows it actually works like this. Patch by
- Sébastien Robitaille
- (sebastien.robitaille@croesus.com), fixes bug 61511.
-
-2004-07-08 Dick Porter <dick@ximian.com>
-
- * io.c (file_seek): If there is a high 32bit offset part, make
- sure the low part isn't sign-extended. Set error codes when
- returning failure. Fixes bug 61131.
-
-2004-07-06 Dick Porter <dick@ximian.com>
-
- * io.c (file_setfiletime): Check for underflow when converting to
- time_t values. Set error codes when returning failure. Fixes bug
- 60970.
-
-2004-07-05 Dick Porter <dick@ximian.com>
-
- * mutexes.c (mutex_ops_init): Make the named mutex mutex sharable.
-
- * daemon.c (unref_handle): Only destroy a handle if all processes
- have released it, not just the current one. Fixes bug 60887.
-
2004-06-24 Dick Porter <dick@ximian.com>
* mutexes.c: Indicate when a named mutex was reused
diff --git a/mono/io-layer/daemon.c b/mono/io-layer/daemon.c
index 62aa75ce1f3..746fba49d17 100644
--- a/mono/io-layer/daemon.c
+++ b/mono/io-layer/daemon.c
@@ -340,14 +340,16 @@ static gboolean unref_handle (ChannelData *channel_data, guint32 handle)
channel_data->open_handles[handle]);
#endif
- if (_wapi_shared_data[segment]->handles[idx].ref == 0) {
+ if(channel_data->open_handles[handle]==0) {
+ /* This client has released the handle */
+ destroy=TRUE;
+ }
+
+ if(_wapi_shared_data[segment]->handles[idx].ref==0) {
gboolean was_file;
dev_t device = 0;
ino_t inode = 0;
- /* This client has released the handle */
- destroy=TRUE;
-
if (channel_data->open_handles[handle]!=0) {
g_warning (G_GNUC_PRETTY_FUNCTION ": per-process open_handles mismatch, set to %d, should be 0",
channel_data->open_handles[handle]);
diff --git a/mono/io-layer/io.c b/mono/io-layer/io.c
index cdc616743fa..e0436186ee0 100644
--- a/mono/io-layer/io.c
+++ b/mono/io-layer/io.c
@@ -617,7 +617,6 @@ static guint32 file_seek(gpointer handle, gint32 movedistance,
if(ok==FALSE) {
g_warning (G_GNUC_PRETTY_FUNCTION
": error looking up file handle %p", handle);
- SetLastError (ERROR_INVALID_HANDLE);
return(INVALID_SET_FILE_POINTER);
}
@@ -628,7 +627,6 @@ static guint32 file_seek(gpointer handle, gint32 movedistance,
g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_READ or GENERIC_WRITE access: %u", handle, file_private_handle->fd, file_handle->fileaccess);
#endif
- SetLastError (ERROR_ACCESS_DENIED);
return(INVALID_SET_FILE_POINTER);
}
@@ -648,7 +646,6 @@ static guint32 file_seek(gpointer handle, gint32 movedistance,
method);
#endif
- SetLastError (ERROR_INVALID_PARAMETER);
return(INVALID_SET_FILE_POINTER);
}
@@ -661,7 +658,7 @@ static guint32 file_seek(gpointer handle, gint32 movedistance,
movedistance);
#endif
} else {
- offset=((gint64) *highmovedistance << 32) | (unsigned long)movedistance;
+ offset=((gint64) *highmovedistance << 32) | movedistance;
#ifdef DEBUG
g_message(G_GNUC_PRETTY_FUNCTION ": setting offset to %lld 0x%llx (high %d 0x%x, low %d 0x%x)", offset, offset, *highmovedistance, *highmovedistance, movedistance, movedistance);
@@ -691,7 +688,6 @@ static guint32 file_seek(gpointer handle, gint32 movedistance,
handle, file_private_handle->fd, strerror(errno));
#endif
- _wapi_set_last_error_from_errno ();
return(INVALID_SET_FILE_POINTER);
}
@@ -990,7 +986,6 @@ static gboolean file_setfiletime(gpointer handle,
if(ok==FALSE) {
g_warning (G_GNUC_PRETTY_FUNCTION
": error looking up file handle %p", handle);
- SetLastError (ERROR_INVALID_HANDLE);
return(FALSE);
}
@@ -1000,7 +995,6 @@ static gboolean file_setfiletime(gpointer handle,
g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_WRITE access: %u", handle, file_private_handle->fd, file_handle->fileaccess);
#endif
- SetLastError (ERROR_ACCESS_DENIED);
return(FALSE);
}
@@ -1011,7 +1005,6 @@ static gboolean file_setfiletime(gpointer handle,
file_private_handle->fd);
#endif
- SetLastError (ERROR_INVALID_HANDLE);
return(FALSE);
}
@@ -1026,25 +1019,12 @@ static gboolean file_setfiletime(gpointer handle,
file_private_handle->fd, strerror(errno));
#endif
- SetLastError (ERROR_INVALID_PARAMETER);
return(FALSE);
}
if(last_access!=NULL) {
access_ticks=((guint64)last_access->dwHighDateTime << 32) +
last_access->dwLowDateTime;
- /* This is (time_t)0. We can actually go to INT_MIN,
- * but this will do for now.
- */
- if (access_ticks < 116444736000000000ULL) {
-#ifdef DEBUG
- g_message (G_GNUC_PRETTY_FUNCTION
- ": attempt to set access time too early");
-#endif
- SetLastError (ERROR_INVALID_PARAMETER);
- return(FALSE);
- }
-
utbuf.actime=(access_ticks - 116444736000000000ULL) / 10000000;
} else {
utbuf.actime=statbuf.st_atime;
@@ -1053,18 +1033,6 @@ static gboolean file_setfiletime(gpointer handle,
if(last_write!=NULL) {
write_ticks=((guint64)last_write->dwHighDateTime << 32) +
last_write->dwLowDateTime;
- /* This is (time_t)0. We can actually go to INT_MIN,
- * but this will do for now.
- */
- if (write_ticks < 116444736000000000ULL) {
-#ifdef DEBUG
- g_message (G_GNUC_PRETTY_FUNCTION
- ": attempt to set write time too early");
-#endif
- SetLastError (ERROR_INVALID_PARAMETER);
- return(FALSE);
- }
-
utbuf.modtime=(write_ticks - 116444736000000000ULL) / 10000000;
} else {
utbuf.modtime=statbuf.st_mtime;
@@ -1087,7 +1055,6 @@ static gboolean file_setfiletime(gpointer handle,
#endif
g_free (name);
- SetLastError (ERROR_INVALID_PARAMETER);
return(FALSE);
}
diff --git a/mono/io-layer/mutexes.c b/mono/io-layer/mutexes.c
index ee10921578a..ee736aac2c2 100644
--- a/mono/io-layer/mutexes.c
+++ b/mono/io-layer/mutexes.c
@@ -23,8 +23,9 @@
#undef DEBUG
/* This is used to serialise mutex creation when names are given
+ * (FIXME: make it process-shared)
*/
-static mono_mutex_t named_mutex_mutex;
+static mono_mutex_t named_mutex_mutex = MONO_MUTEX_INITIALIZER;
static void mutex_close_shared (gpointer handle);
static void mutex_signal(gpointer handle);
@@ -43,23 +44,6 @@ static mono_once_t mutex_ops_once=MONO_ONCE_INIT;
static void mutex_ops_init (void)
{
- int thr_ret;
-#if defined(_POSIX_THREAD_PROCESS_SHARED) && _POSIX_THREAD_PROCESS_SHARED != -1
- pthread_mutexattr_t mutex_shared_attr;
-
- thr_ret = mono_mutexattr_init (&mutex_shared_attr);
- g_assert (thr_ret == 0);
-
- thr_ret = mono_mutexattr_setpshared (&mutex_shared_attr,
- PTHREAD_PROCESS_SHARED);
- g_assert (thr_ret == 0);
-
- thr_ret = mono_mutex_init (&named_mutex_mutex, &mutex_shared_attr);
- g_assert (thr_ret == 0);
-#else
- thr_ret = mono_mutex_init (&named_mutex_mutex, NULL);
-#endif
-
_wapi_handle_register_capabilities (WAPI_HANDLE_MUTEX,
WAPI_HANDLE_CAP_WAIT |
WAPI_HANDLE_CAP_SIGNAL |
diff --git a/mono/io-layer/threads.c b/mono/io-layer/threads.c
index 31c1176a12c..b9ddc6aa3dc 100644
--- a/mono/io-layer/threads.c
+++ b/mono/io-layer/threads.c
@@ -99,7 +99,9 @@ static void thread_close_private (gpointer handle)
thread_handle->thread->id);
#endif
- thread_handle->thread=NULL;
+ if(thread_handle->thread!=NULL) {
+ _wapi_timed_thread_destroy (thread_handle->thread);
+ }
}
static void thread_own (gpointer handle)
@@ -626,10 +628,6 @@ guint32 ResumeThread(gpointer handle)
return(0xFFFFFFFF);
}
- if (thread_private_handle->thread == NULL) {
- return(0xFFFFFFFF);
- }
-
#ifdef WITH_INCLUDED_LIBGC
if (thread_private_handle->thread->suspend_count <= 1)
_wapi_timed_thread_resume (thread_private_handle->thread);
@@ -672,10 +670,6 @@ guint32 SuspendThread(gpointer handle)
return(0xFFFFFFFF);
}
- if (thread_private_handle->thread == NULL) {
- return(0xFFFFFFFF);
- }
-
if (!thread_private_handle->thread->suspend_count) {
if (handle == current)
_wapi_timed_thread_suspend (thread_private_handle->thread);
diff --git a/mono/io-layer/timed-thread.c b/mono/io-layer/timed-thread.c
index 6599e0660f3..c0d737862a2 100644
--- a/mono/io-layer/timed-thread.c
+++ b/mono/io-layer/timed-thread.c
@@ -254,8 +254,6 @@ int _wapi_timed_thread_join(TimedThread *thread, struct timespec *timeout,
if(exitstatus!=NULL) {
*exitstatus = thread->exitstatus;
}
-
- _wapi_timed_thread_destroy (thread);
}
return(result);
}
diff --git a/mono/io-layer/wait.c b/mono/io-layer/wait.c
index a236d17ed3e..e3d07b3a255 100644
--- a/mono/io-layer/wait.c
+++ b/mono/io-layer/wait.c
@@ -354,15 +354,9 @@ static gboolean test_and_own (guint32 numobjects, gpointer *handles,
done = _wapi_handle_count_signalled_handles (numobjects, handles,
waitall, count, lowest);
if (done == TRUE) {
- if (waitall == TRUE) {
- for (i = 0; i < numobjects; i++) {
- if (_wapi_handle_issignalled (handles[i])) {
- _wapi_handle_ops_own (handles[i]);
- }
- }
- } else {
- if (_wapi_handle_issignalled (handles[*lowest])) {
- _wapi_handle_ops_own (handles[*lowest]);
+ for (i = 0; i < numobjects; i++) {
+ if (_wapi_handle_issignalled (handles[i])) {
+ _wapi_handle_ops_own (handles[i]);
}
}
}
diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog
index 67b36e468db..03869d5b735 100644
--- a/mono/metadata/ChangeLog
+++ b/mono/metadata/ChangeLog
@@ -1,95 +1,3 @@
-2004-08-23 Zoltan Varga <vargaz@freemail.hu>
-
- * metadata.c (mono_metadata_parse_type): Alloc pinned, byref and
- custom modifiers to be in any order. Fixes #61990.
-
-Thu Aug 5 17:11:44 CEST 2004 Paolo Molaro <lupus@ximian.com>
-
- * reflection.c: fix to deal with object[] arrays in custom ctors
- (bug #62550).
-
-Tue Aug 3 17:54:17 CEST 2004 Paolo Molaro <lupus@ximian.com>
-
- * gc.c: make GC warning messages use the trace API, they are just
- noise to most of the users.
-
-Tue Aug 3 16:40:17 CEST 2004 Paolo Molaro <lupus@ximian.com>
-
- * gc.c, object.h: mono_gc_handle_*() interface and
- AddrOfPinnedObject fixes. GC handle support even without GC.
-
-Fri Jul 30 16:49:05 CEST 2004 Paolo Molaro <lupus@ximian.com>
-
- * object.c: always create an object if null is passed
- to Invoke() where a valuetype is expected.
-
-2004-07-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
-
- * appdomain.c: hack to build correctly the private bin path on windows.
- Fixes bug #61991.
-
-2004-07-28 Dick Porter <dick@ximian.com>
-
- * socket-io.c
- (ves_icall_System_Net_Sockets_Socket_RecvFrom_internal): Check
- returned sockaddr size before creating the remote address object.
- Patch by Nick Vaughan (dev@6wardlaw.freeserve.co.uk), fixes bug
- 61608.
-
-2004-07-28 Dick Porter <dick@ximian.com>
-
- * locales.c (string_invariant_compare_char): Fix invariant char
- compares between upper and lower cases. Fixes bug 61458.
-
-Tue Jul 27 15:58:19 CEST 2004 Paolo Molaro <lupus@ximian.com>
-
- * debug-mono-symfile.c: fix one more endianess issue, from a patch
- by Geoff Norton (<gnorton@customerdna.com>).
-
-Tue Jul 27 15:47:17 CEST 2004 Paolo Molaro <lupus@ximian.com>
-
- * class.c: fix class loads for pointer types (typeof(int) !=
- typeof(int*)).
-
-2004-07-24 Martin Baulig <martin@ximian.com>
-
- * reflection.c (mono_image_get_type_info): Only write a class
- layout entry if we actually have a size or a packing size.
-
-2004-07-13 Peter Williams <peter@newton.cx>
-
- * process.c (complete_path): Make sure we don't attempt to execute
- directories.
-
-2004-07-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
-
- * debug-helpers.c: undo my previous patch and fixed the real issue in
- ../mini/exceptions-x86.c
-
-2004-07-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
-
- * debug-helpers.c: prevent SIGSEGV. It happened running xsp on monodoc
- when no HOME env. variable was set and a NullRef was thrown in a .cctor
- called from other .cctors.
-
-2004-07-09 Dick Porter <dick@ximian.com>
-
- * locales.c (ves_icall_System_String_InternalReplace_Str_Comp):
- Don't do any more processing if the matched length was 0. It was
- increasing the size of the string before. Fixes bug 61167.
-
-2004-07-09 Dick Porter <dick@ximian.com>
-
- * socket-io.h:
- * socket-io.c
- (ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal):
- Add support for SO_PEERCRED if its available.
-
-2004-07-03 Zoltan Varga <vargaz@freemail.hu>
-
- * marshal.c: Fix managed->native stringbuilder marshalling. Implement
- marshalling of stringbuilder arrays. Fixes #59900.
-
2004-06-29 Martin Baulig <martin@ximian.com>
* mono-debug.c (mono_debug_add_method): Protect the whole function
diff --git a/mono/metadata/appdomain.c b/mono/metadata/appdomain.c
index af00a3510d2..a917a9ecd19 100644
--- a/mono/metadata/appdomain.c
+++ b/mono/metadata/appdomain.c
@@ -547,17 +547,9 @@ reduce_path (const gchar *dirname)
for (tmp = list; tmp; tmp = tmp->next) {
gchar *data = (gchar *) tmp->data;
- if (data && *data) {
-#ifdef PLATFORM_WIN32
- if (result->len == 0)
- g_string_append_printf (result, "%s\\", data);
- else if (result->str [result->len - 1] == '\\')
- g_string_append_printf (result, "%s", data);
- else
-#endif
- g_string_append_printf (result, "%c%s",
- G_DIR_SEPARATOR, data);
- }
+ if (data && *data)
+ g_string_append_printf (result, "%c%s", G_DIR_SEPARATOR,
+ (char *) tmp->data);
}
res = result->str;
diff --git a/mono/metadata/class.c b/mono/metadata/class.c
index 2814e47d255..7f434b5c734 100644
--- a/mono/metadata/class.c
+++ b/mono/metadata/class.c
@@ -2124,7 +2124,7 @@ mono_class_create_from_typespec (MonoImage *image, guint32 type_spec,
class = mono_array_class_get (type->data.klass, 1);
break;
case MONO_TYPE_PTR:
- class = mono_ptr_class_get (type->data.type);
+ class = mono_class_from_mono_type (type->data.type);
break;
case MONO_TYPE_GENERICINST:
g_assert (type->data.generic_inst->klass);
diff --git a/mono/metadata/debug-mono-symfile.c b/mono/metadata/debug-mono-symfile.c
index 612eb39babf..4f39e6827f1 100644
--- a/mono/metadata/debug-mono-symfile.c
+++ b/mono/metadata/debug-mono-symfile.c
@@ -136,7 +136,7 @@ mono_debug_close_mono_symbol_file (MonoSymbolFile *symfile)
static gchar *
read_string (const char *ptr)
{
- int len = read32 (ptr);
+ int len = *((guint32 *) ptr);
ptr += sizeof(guint32);
return g_filename_from_utf8 (ptr, len, NULL, NULL, NULL);
}
diff --git a/mono/metadata/gc.c b/mono/metadata/gc.c
index 73167d0e9dc..4695c8c1a2a 100644
--- a/mono/metadata/gc.c
+++ b/mono/metadata/gc.c
@@ -16,7 +16,6 @@
#include <mono/metadata/exception.h>
#include <mono/metadata/domain-internals.h>
#include <mono/metadata/class-internals.h>
-#include <mono/utils/mono-logger.h>
#define GC_I_HIDE_POINTERS
#include <mono/os/gc_wrapper.h>
@@ -348,17 +347,13 @@ ves_icall_System_GCHandle_GetTargetHandle (MonoObject *obj, guint32 handle, gint
/* Indexes start from 1 since 0 means the handle is not allocated */
idx = ++next_handle;
if (idx >= array_size) {
+#if HAVE_BOEHM_GC
gpointer *new_array;
guint8 *new_type_array;
if (!array_size)
array_size = 16;
-#if HAVE_BOEHM_GC
new_array = GC_MALLOC (sizeof (gpointer) * (array_size * 2));
new_type_array = GC_MALLOC (sizeof (guint8) * (array_size * 2));
-#else
- new_array = g_malloc0 (sizeof (gpointer) * (array_size * 2));
- new_type_array = g_malloc0 (sizeof (guint8) * (array_size * 2));
-#endif
if (gc_handles) {
int i;
memcpy (new_array, gc_handles, sizeof (gpointer) * array_size);
@@ -375,22 +370,20 @@ ves_icall_System_GCHandle_GetTargetHandle (MonoObject *obj, guint32 handle, gint
#else
if (((gulong)new_array [i]) & 0x1) {
#endif
-#if HAVE_BOEHM_GC
if (gc_handles [i] != (gpointer)-1)
GC_unregister_disappearing_link (&(gc_handles [i]));
if (new_array [i] != (gpointer)-1)
GC_GENERAL_REGISTER_DISAPPEARING_LINK (&(new_array [i]), REVEAL_POINTER (new_array [i]));
-#endif
}
}
}
array_size *= 2;
-#ifndef HAVE_BOEHM_GC
- g_free (gc_handles);
- g_free (gc_handle_types);
-#endif
gc_handles = new_array;
gc_handle_types = new_type_array;
+#else
+ LeaveCriticalSection (&handle_section);
+ mono_raise_exception (mono_get_exception_execution_engine ("No GCHandle support built-in"));
+#endif
}
/* resuse the type from the old target */
@@ -406,6 +399,9 @@ ves_icall_System_GCHandle_GetTargetHandle (MonoObject *obj, guint32 handle, gint
#if HAVE_BOEHM_GC
if (gc_handles [idx] != (gpointer)-1)
GC_GENERAL_REGISTER_DISAPPEARING_LINK (&(gc_handles [idx]), obj);
+#else
+ LeaveCriticalSection (&handle_section);
+ mono_raise_exception (mono_get_exception_execution_engine ("No weakref support"));
#endif
break;
default:
@@ -433,6 +429,9 @@ ves_icall_System_GCHandle_FreeHandle (guint32 handle)
if (gc_handles [idx] != (gpointer)-1)
GC_unregister_disappearing_link (&(gc_handles [idx]));
}
+#else
+ LeaveCriticalSection (&handle_section);
+ mono_raise_exception (mono_get_exception_execution_engine ("No GCHandle support"));
#endif
gc_handles [idx] = (gpointer)-1;
@@ -458,50 +457,11 @@ ves_icall_System_GCHandle_GetAddrOfPinnedObject (guint32 handle)
if (obj == (MonoObject *) -1)
return NULL;
}
- if (obj) {
- MonoClass *klass = mono_object_class (obj);
- if (klass == mono_defaults.string_class) {
- return mono_string_chars ((MonoString*)obj);
- } else if (klass->rank) {
- return mono_array_addr ((MonoArray*)obj, char, 0);
- } else {
- /* the C# code will check and throw the exception */
- /* FIXME: missing !klass->blittable test, see bug #61134,
- * disabled in 1.0 untill the blittable-using code is audited.
- if ((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_AUTO_LAYOUT)
- return (gpointer)-1; */
- return (char*)obj + sizeof (MonoObject);
- }
- }
+ return obj;
}
return NULL;
}
-guint32
-mono_gchandle_new (MonoObject *obj, gboolean pinned)
-{
- return ves_icall_System_GCHandle_GetTargetHandle (obj, 0, pinned? HANDLE_PINNED: HANDLE_NORMAL);
-}
-
-guint32
-mono_gchandle_new_weakref (MonoObject *obj, gboolean track_resurrection)
-{
- return ves_icall_System_GCHandle_GetTargetHandle (obj, 0, track_resurrection? HANDLE_WEAK_TRACK: HANDLE_WEAK);
-}
-
-/* This will return NULL for a collected object if using a weakref handle */
-MonoObject*
-mono_gchandle_get_target (guint32 gchandle)
-{
- return ves_icall_System_GCHandle_GetTarget (gchandle);
-}
-
-void
-mono_gchandle_free (guint32 gchandle)
-{
- ves_icall_System_GCHandle_FreeHandle (gchandle);
-}
-
#if HAVE_BOEHM_GC
static HANDLE finalizer_event;
@@ -646,12 +606,6 @@ static GCThreadFunctions mono_gc_thread_vtable = {
};
#endif /* WITH_INCLUDED_LIBGC */
-static void
-mono_gc_warning (char *msg, GC_word arg)
-{
- mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_GC, msg, (unsigned long)arg);
-}
-
void mono_gc_init (void)
{
InitializeCriticalSection (&handle_section);
diff --git a/mono/metadata/locales.c b/mono/metadata/locales.c
index 1210965a70a..7c10529f3f3 100644
--- a/mono/metadata/locales.c
+++ b/mono/metadata/locales.c
@@ -25,7 +25,7 @@
#include <locale.h>
-#undef DEBUG
+//#undef DEBUG
static gint32 string_invariant_compare_char (gunichar2 c1, gunichar2 c2,
gint32 options);
@@ -1431,11 +1431,6 @@ MonoString *ves_icall_System_String_InternalReplace_Str_Comp (MonoString *this,
* does match properly...
*/
match_len = usearch_getMatchedLength (search);
-
- if(match_len == 0) {
- continue;
- }
-
match=(UChar *)g_malloc0 (sizeof(UChar) * (match_len + 1));
usearch_getMatchedText (search, match, match_len, &ec);
@@ -1472,11 +1467,6 @@ MonoString *ves_icall_System_String_InternalReplace_Str_Comp (MonoString *this,
pos!=USEARCH_DONE;
pos=usearch_next (search, &ec)) {
match_len = usearch_getMatchedLength (search);
-
- if (match_len == 0) {
- continue;
- }
-
match=(UChar *)g_malloc0 (sizeof(UChar) * (match_len + 1));
usearch_getMatchedText (search, match, match_len, &ec);
@@ -1875,6 +1865,15 @@ static gint32 string_invariant_compare_char (gunichar2 c1, gunichar2 c2,
/* No options. Kana, symbol and spacing options don't
* apply to the invariant culture.
*/
+ if (c1type == G_UNICODE_UPPERCASE_LETTER &&
+ c2type == G_UNICODE_LOWERCASE_LETTER) {
+ return(1);
+ }
+
+ if (c1type == G_UNICODE_LOWERCASE_LETTER &&
+ c2type == G_UNICODE_UPPERCASE_LETTER) {
+ return(-1);
+ }
result = (gint32) c1 - c2;
}
diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c
index 2892d81e88b..e2f384734b9 100644
--- a/mono/metadata/marshal.c
+++ b/mono/metadata/marshal.c
@@ -45,6 +45,9 @@ struct _MonoMethodBuilder {
static void
emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object);
+static gint
+mono_marshal_runtime_glist_find_klass (gconstpointer a, gconstpointer b);
+
static MonoMethod *
mono_find_method_by_name (MonoClass *klass, const char *name, int param_count)
{
@@ -221,20 +224,17 @@ mono_string_builder_to_utf8 (MonoStringBuilder *sb)
{
GError *error = NULL;
glong *res;
- gchar *tmp;
if (!sb)
return NULL;
res = g_malloc0 (mono_stringbuilder_capacity (sb) + 1);
- tmp = g_utf16_to_utf8 (mono_string_chars (sb->str), sb->length, NULL, res, &error);
+ g_utf16_to_utf8 (mono_string_chars (sb->str), sb->length, NULL, res, &error);
if (error) {
g_error_free (error);
mono_raise_exception (mono_get_exception_execution_engine ("Failed to convert StringBuilder from utf16 to utf8"));
}
- else
- memcpy (res, tmp, sb->length + 1);
return res;
}
@@ -1270,52 +1270,6 @@ mono_marshal_get_string_encoding (MonoMethodPInvoke *piinfo, MonoMarshalSpec *sp
}
}
-static MonoMarshalNative
-mono_marshal_get_stringbuilder_to_ptr_encoding (MonoMethodPInvoke *piinfo, MonoMarshalSpec *spec)
-{
- MonoMarshalNative encoding = mono_marshal_get_string_encoding (piinfo, spec);
-
- switch (encoding) {
- case MONO_NATIVE_LPWSTR:
- return MONO_MARSHAL_CONV_SB_LPWSTR;
- break;
- case MONO_NATIVE_LPSTR:
- return MONO_MARSHAL_CONV_SB_LPSTR;
- break;
- case MONO_NATIVE_LPTSTR:
- return MONO_MARSHAL_CONV_SB_LPTSTR;
- break;
- default:
- return -1;
- }
-}
-
-static MonoMarshalNative
-mono_marshal_get_ptr_to_stringbuilder_encoding (MonoMethodPInvoke *piinfo, MonoMarshalSpec *spec, gboolean *need_free)
-{
- MonoMarshalNative encoding = mono_marshal_get_string_encoding (piinfo, spec);
-
- *need_free = TRUE;
-
- switch (encoding) {
- case MONO_NATIVE_LPWSTR:
- /*
- * mono_string_builder_to_utf16 does not allocate a
- * new buffer, so no need to free it.
- */
- *need_free = FALSE;
- return MONO_MARSHAL_CONV_LPWSTR_SB;
- case MONO_NATIVE_LPSTR:
- return MONO_MARSHAL_CONV_LPSTR_SB;
- break;
- case MONO_NATIVE_LPTSTR:
- return MONO_MARSHAL_CONV_LPTSTR_SB;
- break;
- default:
- return -1;
- }
-}
-
static inline MonoMethod*
mono_marshal_find_in_cache (GHashTable *cache, gpointer key)
{
@@ -1665,7 +1619,7 @@ mono_remoting_wrapper (MonoMethod *method, gpointer *params)
}
}
- return mono_runtime_invoke (method, method->klass->valuetype? mono_object_unbox ((MonoObject*)this): this, mparams, NULL);
+ return mono_runtime_invoke (method, method->klass->valuetype? mono_object_unbox (this): this, mparams, NULL);
}
msg = mono_method_call_message_new (method, params, NULL, NULL, NULL);
@@ -2622,14 +2576,6 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoObject *this, MonoMars
klass = sig->ret->data.klass;
- if (klass->delegate) {
- mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
- mono_mb_emit_byte (mb, CEE_MONO_FUNC1);
- mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_DEL_FTN);
- mono_mb_emit_byte (mb, CEE_STLOC_3);
- break;
- }
-
/* FIXME: Raise a MarshalDirectiveException here */
g_assert ((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) != TYPE_ATTRIBUTE_AUTO_LAYOUT);
@@ -3438,22 +3384,31 @@ mono_marshal_get_native_wrapper (MonoMethod *method)
mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_DEL_FTN);
mono_mb_emit_stloc (mb, tmp_locals [i]);
} else if (klass == mono_defaults.stringbuilder_class) {
- MonoMarshalNative encoding = mono_marshal_get_stringbuilder_to_ptr_encoding (piinfo, spec);
+ MonoMarshalNative encoding = mono_marshal_get_string_encoding (piinfo, spec);
g_assert (!t->byref);
mono_mb_emit_ldarg (mb, argnum);
mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
mono_mb_emit_byte (mb, CEE_MONO_FUNC1);
- if (encoding != -1)
- mono_mb_emit_byte (mb, encoding);
- else {
+ switch (encoding) {
+ case MONO_NATIVE_LPWSTR:
+ mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_SB_LPWSTR);
+ break;
+ case MONO_NATIVE_LPSTR:
+ mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_SB_LPSTR);
+ break;
+ case MONO_NATIVE_LPTSTR:
+ mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_SB_LPTSTR);
+ break;
+ default: {
char *msg = g_strdup_printf ("stringbuilder marshalling conversion %d not implemented", encoding);
MonoException *exc = mono_get_exception_not_implemented (msg);
g_warning (msg);
g_free (msg);
mono_raise_exception (exc);
}
+ }
mono_mb_emit_stloc (mb, tmp_locals [i]);
} else {
@@ -3549,13 +3504,10 @@ mono_marshal_get_native_wrapper (MonoMethod *method)
else {
MonoClass *eklass;
guint32 label1, label2, label3;
- int index_var, dest_ptr, esize;
- MonoMarshalNative encoding = mono_marshal_get_stringbuilder_to_ptr_encoding (piinfo, spec);
+ int index_var, dest_ptr;
dest_ptr = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
- eklass = klass->element_class;
-
/* Check null */
mono_mb_emit_ldarg (mb, argnum);
mono_mb_emit_stloc (mb, tmp_locals [i]);
@@ -3564,23 +3516,9 @@ mono_marshal_get_native_wrapper (MonoMethod *method)
label1 = mb->pos;
mono_mb_emit_i4 (mb, 0);
- if (eklass == mono_defaults.stringbuilder_class) {
- if (encoding == -1) {
- char *msg = g_strdup_printf ("stringbuilder marshalling conversion %d not implemented", encoding);
- MonoException *exc = mono_get_exception_not_implemented (msg);
- g_warning (msg);
- g_free (msg);
- mono_raise_exception (exc);
- }
- }
-
- if (eklass == mono_defaults.stringbuilder_class)
- esize = sizeof (gpointer);
- else
- esize = mono_class_native_size (eklass, NULL);
-
/* allocate space for the native struct and store the address */
- mono_mb_emit_icon (mb, esize);
+ eklass = klass->element_class;
+ mono_mb_emit_icon (mb, mono_class_native_size (eklass, NULL));
mono_mb_emit_ldarg (mb, argnum);
mono_mb_emit_byte (mb, CEE_LDLEN);
mono_mb_emit_byte (mb, CEE_MUL);
@@ -3605,34 +3543,22 @@ mono_marshal_get_native_wrapper (MonoMethod *method)
/* Emit marshalling code */
- if (eklass == mono_defaults.stringbuilder_class) {
- mono_mb_emit_ldloc (mb, dest_ptr);
- mono_mb_emit_ldarg (mb, argnum);
- mono_mb_emit_ldloc (mb, index_var);
- mono_mb_emit_byte (mb, CEE_LDELEM_REF);
- mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
- mono_mb_emit_byte (mb, CEE_MONO_FUNC1);
- mono_mb_emit_byte (mb, encoding);
- mono_mb_emit_byte (mb, CEE_STIND_I);
- }
- else {
- /* set the src_ptr */
- mono_mb_emit_ldarg (mb, argnum);
- mono_mb_emit_ldloc (mb, index_var);
- mono_mb_emit_byte (mb, CEE_LDELEMA);
- mono_mb_emit_i4 (mb, mono_mb_add_data (mb, eklass));
- mono_mb_emit_byte (mb, CEE_STLOC_0);
+ /* set the src_ptr */
+ mono_mb_emit_ldarg (mb, argnum);
+ mono_mb_emit_ldloc (mb, index_var);
+ mono_mb_emit_byte (mb, CEE_LDELEMA);
+ mono_mb_emit_i4 (mb, mono_mb_add_data (mb, eklass));
+ mono_mb_emit_byte (mb, CEE_STLOC_0);
- /* set dst_ptr */
- mono_mb_emit_ldloc (mb, dest_ptr);
- mono_mb_emit_byte (mb, CEE_STLOC_1);
+ /* set dst_ptr */
+ mono_mb_emit_ldloc (mb, dest_ptr);
+ mono_mb_emit_byte (mb, CEE_STLOC_1);
- /* emit valuetype conversion code */
- emit_struct_conv (mb, eklass, FALSE);
- }
+ /* emit valuetype conversion code */
+ emit_struct_conv (mb, eklass, FALSE);
mono_mb_emit_add_to_local (mb, index_var, 1);
- mono_mb_emit_add_to_local (mb, dest_ptr, esize);
+ mono_mb_emit_add_to_local (mb, dest_ptr, mono_class_native_size (eklass, NULL));
mono_mb_emit_byte (mb, CEE_BR);
mono_mb_emit_i4 (mb, label2 - (mb->pos + 4));
@@ -4059,20 +3985,33 @@ mono_marshal_get_native_wrapper (MonoMethod *method)
case MONO_TYPE_CLASS:
case MONO_TYPE_OBJECT:
if (t->data.klass == mono_defaults.stringbuilder_class) {
- gboolean need_free;
- MonoMarshalNative encoding;
-
- encoding = mono_marshal_get_ptr_to_stringbuilder_encoding (piinfo, spec, &need_free);
+ MonoMarshalNative encoding = mono_marshal_get_string_encoding (piinfo, spec);
+ gboolean need_free = TRUE;
g_assert (!t->byref);
- g_assert (encoding != -1);
-
mono_mb_emit_ldarg (mb, argnum);
mono_mb_emit_ldloc (mb, tmp_locals [i]);
mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
mono_mb_emit_byte (mb, CEE_MONO_PROC2);
- mono_mb_emit_byte (mb, encoding);
+ switch (encoding) {
+ case MONO_NATIVE_LPWSTR:
+ mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_LPWSTR_SB);
+ /*
+ * mono_string_builder_to_utf16 does not allocate a
+ * new buffer, so no need to free it.
+ */
+ need_free = FALSE;
+ break;
+ case MONO_NATIVE_LPSTR:
+ mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_LPSTR_SB);
+ break;
+ case MONO_NATIVE_LPTSTR:
+ mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_LPTSTR_SB);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
if (need_free) {
mono_mb_emit_ldloc (mb, tmp_locals [i]);
@@ -4187,17 +4126,13 @@ mono_marshal_get_native_wrapper (MonoMethod *method)
}
/* Character arrays are implicitly marshalled as [Out] */
- if ((klass->element_class == mono_defaults.char_class) || (klass->element_class == mono_defaults.stringbuilder_class) || (t->attrs & PARAM_ATTRIBUTE_OUT)) {
+ if ((klass->element_class == mono_defaults.char_class) || (t->attrs & PARAM_ATTRIBUTE_OUT)) {
/* FIXME: Optimize blittable case */
MonoClass *eklass;
guint32 label1, label2, label3;
- int index_var, src_ptr, esize;
+ int index_var, src_ptr;
eklass = klass->element_class;
- if (eklass == mono_defaults.stringbuilder_class)
- esize = sizeof (gpointer);
- else
- esize = mono_class_native_size (eklass, NULL);
src_ptr = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
/* Check null */
@@ -4223,53 +4158,22 @@ mono_marshal_get_native_wrapper (MonoMethod *method)
/* Emit marshalling code */
- if (eklass == mono_defaults.stringbuilder_class) {
- gboolean need_free;
- MonoMarshalNative encoding = mono_marshal_get_ptr_to_stringbuilder_encoding (piinfo, spec, &need_free);
-
- g_assert (encoding != -1);
-
- /* dest */
- mono_mb_emit_ldarg (mb, argnum);
- mono_mb_emit_ldloc (mb, index_var);
- mono_mb_emit_byte (mb, CEE_LDELEM_REF);
-
- /* src */
- mono_mb_emit_ldloc (mb, src_ptr);
- mono_mb_emit_byte (mb, CEE_LDIND_I);
-
- mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
- mono_mb_emit_byte (mb, CEE_MONO_PROC2);
-
- mono_mb_emit_byte (mb, encoding);
-
- if (need_free) {
- /* src */
- mono_mb_emit_ldloc (mb, src_ptr);
- mono_mb_emit_byte (mb, CEE_LDIND_I);
-
- mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX);
- mono_mb_emit_byte (mb, CEE_MONO_FREE);
- }
- }
- else {
- /* set the src_ptr */
- mono_mb_emit_ldloc (mb, src_ptr);
- mono_mb_emit_byte (mb, CEE_STLOC_0);
+ /* set the src_ptr */
+ mono_mb_emit_ldloc (mb, src_ptr);
+ mono_mb_emit_byte (mb, CEE_STLOC_0);
- /* set dst_ptr */
- mono_mb_emit_ldarg (mb, argnum);
- mono_mb_emit_ldloc (mb, index_var);
- mono_mb_emit_byte (mb, CEE_LDELEMA);
- mono_mb_emit_i4 (mb, mono_mb_add_data (mb, eklass));
- mono_mb_emit_byte (mb, CEE_STLOC_1);
+ /* set dst_ptr */
+ mono_mb_emit_ldarg (mb, argnum);
+ mono_mb_emit_ldloc (mb, index_var);
+ mono_mb_emit_byte (mb, CEE_LDELEMA);
+ mono_mb_emit_i4 (mb, mono_mb_add_data (mb, eklass));
+ mono_mb_emit_byte (mb, CEE_STLOC_1);
- /* emit valuetype conversion code */
- emit_struct_conv (mb, eklass, TRUE);
- }
+ /* emit valuetype conversion code */
+ emit_struct_conv (mb, eklass, TRUE);
mono_mb_emit_add_to_local (mb, index_var, 1);
- mono_mb_emit_add_to_local (mb, src_ptr, esize);
+ mono_mb_emit_add_to_local (mb, src_ptr, mono_class_native_size (eklass, NULL));
mono_mb_emit_byte (mb, CEE_BR);
mono_mb_emit_i4 (mb, label2 - (mb->pos + 4));
diff --git a/mono/metadata/metadata.c b/mono/metadata/metadata.c
index 3d44463cde9..88699f3e890 100644
--- a/mono/metadata/metadata.c
+++ b/mono/metadata/metadata.c
@@ -1203,10 +1203,6 @@ mono_metadata_parse_type (MonoImage *m, MonoParseTypeMode mode, short opt_attrs,
{
MonoType *type, *cached;
gboolean byref = FALSE;
- gboolean pinned = FALSE;
- const char *tmp_ptr;
- int count = 0;
- gboolean found;
/*
* According to the spec, custom modifiers should come before the byref
@@ -1216,70 +1212,70 @@ mono_metadata_parse_type (MonoImage *m, MonoParseTypeMode mode, short opt_attrs,
* Also, this type seems to be different from 'object & modopt(...)'. Maybe
* it would be better to treat byref as real type constructor instead of
* a modifier...
- * Also, pinned should come before anything else, but some MSV++ produced
- * assemblies violate this (#bug 61990).
*/
-
- /* Count the modifiers first */
- tmp_ptr = ptr;
- found = TRUE;
- while (found) {
- switch (*tmp_ptr) {
- case MONO_TYPE_PINNED:
- case MONO_TYPE_BYREF:
- ++tmp_ptr;
- break;
- case MONO_TYPE_CMOD_REQD:
- case MONO_TYPE_CMOD_OPT:
- count ++;
- mono_metadata_parse_custom_mod (m, NULL, tmp_ptr, &tmp_ptr);
- break;
- default:
- found = FALSE;
- }
+ if (*ptr == MONO_TYPE_BYREF) {
+ byref = TRUE;
+ ++ptr;
}
- if (count) {
- type = g_malloc0 (sizeof (MonoType) + ((gint32)count - MONO_ZERO_LEN_ARRAY) * sizeof (MonoCustomMod));
- type->num_mods = count;
- if (count > 64)
- g_warning ("got more than 64 modifiers in type");
+ switch (mode) {
+ case MONO_PARSE_MOD_TYPE:
+ case MONO_PARSE_PARAM:
+ case MONO_PARSE_RET:
+ case MONO_PARSE_LOCAL: /* should not have modifiers according to the spec, but ms tools disagree */
+ case MONO_PARSE_FIELD: {
+ /* count the modifiers */
+ const char *tmp_ptr = ptr;
+ int count = 0;
+ while (mono_metadata_parse_custom_mod (m, NULL, tmp_ptr, &tmp_ptr))
+ count++;
+ if (count) {
+ type = g_malloc0 (sizeof (MonoType) + ((gint32)count - MONO_ZERO_LEN_ARRAY) * sizeof (MonoCustomMod));
+ type->num_mods = count;
+ if (count > 64)
+ g_warning ("got more than 64 modifiers in type");
+ /* save them this time */
+ count = 0;
+ while (mono_metadata_parse_custom_mod (m, &(type->modifiers [count]), ptr, &ptr))
+ count++;
+ break;
+ } /* fall through */
}
- else
+ case MONO_PARSE_TYPE:
/*
* Later we can avoid doing this allocation.
*/
type = g_new0 (MonoType, 1);
-
- /* Parse pinned, byref and custom modifiers */
- found = TRUE;
- count = 0;
- while (found) {
- switch (*ptr) {
- case MONO_TYPE_PINNED:
- pinned = TRUE;
- ++ptr;
- break;
- case MONO_TYPE_BYREF:
- byref = TRUE;
- ++ptr;
- break;
- case MONO_TYPE_CMOD_REQD:
- case MONO_TYPE_CMOD_OPT:
- count ++;
- mono_metadata_parse_custom_mod (m, &(type->modifiers [count]), ptr, &ptr);
- break;
- default:
- found = FALSE;
- }
+ break;
+ default:
+ g_assert_not_reached ();
}
type->attrs = opt_attrs;
type->byref = byref;
- type->pinned = pinned ? 1 : 0;
-
- do_mono_metadata_parse_type (type, m, ptr, &ptr);
+ if (mode == MONO_PARSE_LOCAL) {
+ /*
+ * check for pinned flag
+ */
+ if (*ptr == MONO_TYPE_PINNED) {
+ type->pinned = 1;
+ ++ptr;
+ }
+ }
+ switch (*ptr) {
+ case MONO_TYPE_BYREF:
+ if (mode == MONO_PARSE_FIELD)
+ g_warning ("A field type cannot be byref");
+ type->byref = 1;
+ ptr++;
+ /* follow through */
+ default:
+ /*if (*ptr == MONO_TYPE_VOID && mode != MONO_PARSE_RET)
+ g_error ("void not allowed in param");*/
+ do_mono_metadata_parse_type (type, m, ptr, &ptr);
+ break;
+ }
if (rptr)
*rptr = ptr;
diff --git a/mono/metadata/object.c b/mono/metadata/object.c
index 65176ce2435..bdf832baa6d 100644
--- a/mono/metadata/object.c
+++ b/mono/metadata/object.c
@@ -1586,9 +1586,13 @@ mono_runtime_invoke_array (MonoMethod *method, void *obj, MonoArray *params,
case MONO_TYPE_R4:
case MONO_TYPE_R8:
case MONO_TYPE_VALUETYPE:
- /* MS seems to create the objects if a null is passed in */
- if (! ((gpointer *)params->vector)[i])
- ((gpointer*)params->vector)[i] = mono_object_new (mono_domain_get (), mono_class_from_mono_type (sig->params [i]));
+ if (sig->params [i]->byref) {
+ /* MS seems to create the objects if a null is passed in */
+ if (! ((gpointer *)params->vector)[i])
+ ((gpointer*)params->vector)[i] = mono_object_new (mono_domain_get (), mono_class_from_mono_type (sig->params [i]));
+ }
+ else
+ g_assert (((gpointer*)params->vector) [i]);
pa [i] = (char *)(((gpointer *)params->vector)[i]) + sizeof (MonoObject);
break;
case MONO_TYPE_STRING:
diff --git a/mono/metadata/object.h b/mono/metadata/object.h
index 2413cc7a346..c1ffc3c4c2d 100644
--- a/mono/metadata/object.h
+++ b/mono/metadata/object.h
@@ -252,11 +252,5 @@ mono_property_set_value (MonoProperty *prop, void *obj, void **params, MonoObjec
MonoObject*
mono_property_get_value (MonoProperty *prop, void *obj, void **params, MonoObject **exc);
-/* GC handles support */
-guint32 mono_gchandle_new (MonoObject *obj, gboolean pinned);
-guint32 mono_gchandle_new_weakref (MonoObject *obj, gboolean track_resurrection);
-MonoObject* mono_gchandle_get_target (guint32 gchandle);
-void mono_gchandle_free (guint32 gchandle);
-
#endif
diff --git a/mono/metadata/process.c b/mono/metadata/process.c
index 90edc4023e5..5e7cce9de7b 100644
--- a/mono/metadata/process.c
+++ b/mono/metadata/process.c
@@ -738,7 +738,7 @@ complete_path (const gunichar2 *appname, gunichar2 **completed)
return FALSE;
}
- if (g_file_test (utf8app, G_FILE_TEST_IS_EXECUTABLE) && !g_file_test (utf8app, G_FILE_TEST_IS_DIR)) {
+ if (g_file_test (utf8app, G_FILE_TEST_IS_EXECUTABLE)) {
g_free (utf8app);
return FALSE;
}
diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c
index c25ea98cd0d..9640136c0eb 100644
--- a/mono/metadata/reflection.c
+++ b/mono/metadata/reflection.c
@@ -2716,8 +2716,7 @@ mono_image_get_type_info (MonoDomain *domain, MonoReflectionTypeBuilder *tb, Mon
* if we have explicitlayout or sequentiallayouts, output data in the
* ClassLayout table.
*/
- if (((tb->attrs & TYPE_ATTRIBUTE_LAYOUT_MASK) != TYPE_ATTRIBUTE_AUTO_LAYOUT) &&
- ((tb->class_size > 0) || (tb->packing_size > 0))) {
+ if (((tb->attrs & TYPE_ATTRIBUTE_LAYOUT_MASK) != TYPE_ATTRIBUTE_AUTO_LAYOUT) && (tb->class_size != -1)) {
table = &assembly->tables [MONO_TABLE_CLASSLAYOUT];
table->rows++;
alloc_table (table, table->rows);
@@ -5869,7 +5868,6 @@ handle_type:
}
break;
case MONO_TYPE_CLASS:
- case MONO_TYPE_OBJECT:
case MONO_TYPE_STRING:
for (i = 0; i < alen; i++) {
MonoObject *item = load_cattr_value (image, &t->data.klass->byval_arg, p, &p);
diff --git a/mono/metadata/socket-io.c b/mono/metadata/socket-io.c
index 1ef49278ea9..c2b129984e7 100644
--- a/mono/metadata/socket-io.c
+++ b/mono/metadata/socket-io.c
@@ -330,11 +330,6 @@ static gint32 convert_sockopt_level_and_name(MonoSocketOptionLevel mono_level,
case SocketOptionName_Type:
*system_name = SO_TYPE;
break;
-#ifdef SO_PEERCRED
- case SocketOptionName_PeerCred:
- *system_name = SO_PEERCRED;
- break;
-#endif
case SocketOptionName_ExclusiveAddressUse:
case SocketOptionName_UseLoopback:
case SocketOptionName_MaxConnections:
@@ -1160,15 +1155,7 @@ gint32 ves_icall_System_Net_Sockets_Socket_RecvFrom_internal(SOCKET sock, MonoAr
return(0);
}
- /* If we didn't get a socket size, then we're probably a
- * connected connection-oriented socket and the stack hasn't
- * returned the remote address. All we can do is return null.
- */
- if ( sa_size != 0 )
- *sockaddr=create_object_from_sockaddr(sa, sa_size, error);
- else
- *sockaddr=NULL;
-
+ *sockaddr=create_object_from_sockaddr(sa, sa_size, error);
g_free(sa);
return(ret);
@@ -1441,10 +1428,6 @@ void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET soc
int lingersize=sizeof(linger);
struct timeval tv;
int tvsize=sizeof(tv);
-#ifdef SO_PEERCRED
- struct ucred cred;
- int credsize = sizeof(cred);
-#endif
MonoDomain *domain=mono_domain_get();
MonoObject *obj;
MonoClass *obj_class;
@@ -1478,13 +1461,6 @@ void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET soc
&tvsize);
break;
-#ifdef SO_PEERCRED
- case SocketOptionName_PeerCred:
- ret = _wapi_getsockopt (sock, system_level, system_name, &cred,
- &credsize);
- break;
-#endif
-
default:
ret = _wapi_getsockopt (sock, system_level, system_name, &val,
&valsize);
@@ -1524,32 +1500,6 @@ void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET soc
obj = int_to_object (domain, (tv.tv_sec * 1000) + (tv.tv_usec / 1000));
break;
-#ifdef SO_PEERCRED
- case SocketOptionName_PeerCred:
- {
- /* build a Mono.Posix.PeerCred+PeerCredData if
- * possible
- */
- MonoImage *mono_posix_image = mono_image_loaded ("Mono.Posix");
- MonoPeerCredData *cred_data;
-
- if (mono_posix_image == NULL) {
- *error = WSAENOPROTOOPT;
- return;
- }
-
- obj_class = mono_class_from_name(mono_posix_image,
- "Mono.Posix",
- "PeerCred/PeerCredData");
- obj = mono_object_new(domain, obj_class);
- cred_data = (MonoPeerCredData *)obj;
- cred_data->pid = cred.pid;
- cred_data->uid = cred.uid;
- cred_data->gid = cred.gid;
- break;
- }
-#endif
-
default:
obj = int_to_object (domain, val);
}
diff --git a/mono/metadata/socket-io.h b/mono/metadata/socket-io.h
index 5c2ee72181a..3540882f105 100644
--- a/mono/metadata/socket-io.h
+++ b/mono/metadata/socket-io.h
@@ -130,12 +130,7 @@ typedef enum {
SocketOptionName_BsdUrgent=2,
SocketOptionName_Expedited=2,
SocketOptionName_NoChecksum=1,
- SocketOptionName_ChecksumCoverage=20,
-
- /* This is Mono-specific, keep it in sync with
- * Mono.Posix/PeerCred.cs
- */
- SocketOptionName_PeerCred=10001
+ SocketOptionName_ChecksumCoverage=20
} MonoSocketOptionName;
typedef struct _MonoSocketAsyncResult {
@@ -159,14 +154,6 @@ typedef struct _MonoSocketAsyncResult {
gint error;
} MonoSocketAsyncResult;
-typedef struct
-{
- MonoObject obj;
- gint pid;
- gint uid;
- gint gid;
-} MonoPeerCredData;
-
extern gpointer ves_icall_System_Net_Sockets_Socket_Socket_internal(MonoObject *this, gint32 family, gint32 type, gint32 proto, gint32 *error);
extern void ves_icall_System_Net_Sockets_Socket_Close_internal(SOCKET sock, gint32 *error);
extern gint32 ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal(void);
diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog
index a730a60ba59..b7210c3fe9c 100644
--- a/mono/mini/ChangeLog
+++ b/mono/mini/ChangeLog
@@ -1,54 +1,4 @@
-2004-08-23 Zoltan Varga <vargaz@freemail.hu>
- * inssel-x86.brg inssel-amd64: Add yet another missing tree->dreg assignment.
-
- * mini-x86.c (mono_arch_local_regalloc): Fix bug in long register
- allocation. Fixes #63085.
-
-2004-08-09 Zoltan Varga <vargaz@freemail.hu>
-
- * inssel-x86.brg: Set dreg of LOCALLOC correctly.
-
-Tue Aug 3 11:20:09 CEST 2004 Paolo Molaro <lupus@ximian.com>
-
- * mini-ppc.c: mul.ovf.un exception name fix.
-
-Tue Aug 3 11:19:07 CEST 2004 Paolo Molaro <lupus@ximian.com>
-
- * mini-ppc.c: reg allocator fix.
-
-Tue Aug 3 11:17:07 CEST 2004 Paolo Molaro <lupus@ximian.com>
-
- * mini-ppc.c: make sure temp regs are not used for global reg
- allocation.
-
-Tue Jul 27 16:05:19 CEST 2004 Paolo Molaro <lupus@ximian.com>
-
- * mini-ppc.c, mini-sparc.c, mini-s390.c: keep track of line
- numbers in the debug info (spotted by Geoff Norton,
- <gnorton@customerdna.com>).
-
-Mon Jul 12 17:47:00 CEST 2004 Paolo Molaro <lupus@ximian.com>
-
- * inssel-ppc.brg: arguments on the stack are always
- relative to the stack pointer (spotted by Neale Ferguson).
-
-2004-07-11 Gonzalo Paniagua Javier <gonzalo@ximian.com>
-
- * exceptions-x86.c: delay appending the method name to the trace until
- after mono_jit_info_table_find is called, as this gets the real
- MonoMethod.
-
-2004-07-08 Zoltan Varga <vargaz@freemail.hu>
-
- * mini.c (handle_stack_args): Handle some corner cases. Fixes
- 58863.
-
-2004-07-05 Zoltan Varga <vargaz@freemail.hu>
-
- * mini.c (optimize_branches): Fix linking of bblocks in branch->branch
- optimization.
-
Mon Jun 28 18:05:09 CEST 2004 Paolo Molaro <lupus@ximian.com>
* mini.c: reinstated mono_compile_get_interface_var()
diff --git a/mono/mini/exceptions-x86.c b/mono/mini/exceptions-x86.c
index c0961c485d2..b0783ae39b1 100644
--- a/mono/mini/exceptions-x86.c
+++ b/mono/mini/exceptions-x86.c
@@ -462,6 +462,9 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInf
if (!(*lmf)->method)
return (gpointer)-1;
+ if (trace)
+ *trace = g_strdup_printf ("in (unmanaged) %s", mono_method_full_name ((*lmf)->method, TRUE));
+
if ((ji = mono_jit_info_table_find (domain, (gpointer)(*lmf)->eip))) {
*res = *ji;
} else {
@@ -469,9 +472,6 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInf
res->method = (*lmf)->method;
}
- if (trace)
- *trace = g_strdup_printf ("in (unmanaged) %s", mono_method_full_name (res->method, TRUE));
-
new_ctx->SC_ESI = (*lmf)->esi;
new_ctx->SC_EDI = (*lmf)->edi;
new_ctx->SC_EBX = (*lmf)->ebx;
diff --git a/mono/mini/inssel-ppc.brg b/mono/mini/inssel-ppc.brg
index 38eced8c0dc..a4043e1d797 100644
--- a/mono/mini/inssel-ppc.brg
+++ b/mono/mini/inssel-ppc.brg
@@ -131,7 +131,7 @@ stmt: OP_SETRET (OP_ICONST) {
stmt: OP_OUTARG (reg) {
if (tree->inst_imm) {
- MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, ppc_r1, tree->inst_imm, state->left->reg1);
+ MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, s->frame_reg, tree->inst_imm, state->left->reg1);
return;
}
tree->opcode = OP_SETREG;
@@ -142,7 +142,7 @@ stmt: OP_OUTARG (reg) {
stmt: OP_OUTARG (OP_REGVAR) {
if (tree->inst_imm) {
- MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, ppc_r1, tree->inst_imm, state->left->tree->dreg);
+ MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, s->frame_reg, tree->inst_imm, state->left->tree->dreg);
return;
}
tree->opcode = OP_SETREG;
@@ -153,8 +153,8 @@ stmt: OP_OUTARG (OP_REGVAR) {
stmt: OP_OUTARG (lreg) {
if (tree->inst_imm) {
- MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, ppc_r1, tree->inst_imm, state->left->reg2);
- MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, ppc_r1, tree->inst_imm + 4, state->left->reg1);
+ MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, s->frame_reg, tree->inst_imm, state->left->reg2);
+ MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, s->frame_reg, tree->inst_imm + 4, state->left->reg1);
return;
}
MONO_EMIT_NEW_UNALU (s, OP_SETREG, tree->unused, state->left->reg2);
@@ -166,7 +166,7 @@ stmt: OP_OUTARG (lreg) {
stmt: OP_OUTARG (OP_ICONST) {
if (tree->inst_imm) {
- MONO_EMIT_NEW_STORE_MEMBASE_IMM (s, OP_STORE_MEMBASE_IMM, ppc_r1, tree->inst_imm, state->left->tree->inst_c0);
+ MONO_EMIT_NEW_STORE_MEMBASE_IMM (s, OP_STORE_MEMBASE_IMM, s->frame_reg, tree->inst_imm, state->left->tree->inst_c0);
return;
}
tree->opcode = OP_SETREGIMM;
@@ -205,7 +205,7 @@ stmt: OP_OUTARG (OP_ICONST) {
stmt: OP_OUTARG (CEE_LDIND_REF (OP_REGVAR)) {
if (tree->inst_imm) {
- MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, ppc_r1, tree->inst_imm, state->left->left->tree->dreg);
+ MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, s->frame_reg, tree->inst_imm, state->left->left->tree->dreg);
return;
}
tree->opcode = OP_SETREG;
@@ -223,7 +223,7 @@ stmt: OP_OUTARG (CEE_LDIND_REF (OP_REGVAR)) {
stmt: OP_OUTARG (freg) {
if (tree->inst_imm) {
int opcode = (tree->unused & 0xff00) == 0x0400? OP_STORER4_MEMBASE_REG: OP_STORER8_MEMBASE_REG;
- MONO_EMIT_NEW_STORE_MEMBASE (s, opcode, ppc_r1, tree->inst_imm, state->left->reg1);
+ MONO_EMIT_NEW_STORE_MEMBASE (s, opcode, s->frame_reg, tree->inst_imm, state->left->reg1);
return;
}
tree->opcode = OP_SETFREG;
@@ -234,7 +234,7 @@ stmt: OP_OUTARG (freg) {
stmt: OP_OUTARG_R4 (freg) {
if (tree->inst_imm) {
- MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORER4_MEMBASE_REG, ppc_r1, tree->inst_imm, state->left->reg1);
+ MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORER4_MEMBASE_REG, s->frame_reg, tree->inst_imm, state->left->reg1);
return;
}
tree->opcode = OP_SETFREG;
@@ -245,7 +245,7 @@ stmt: OP_OUTARG_R4 (freg) {
stmt: OP_OUTARG_R8 (freg) {
if (tree->inst_imm) {
- MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORER8_MEMBASE_REG, ppc_r1, tree->inst_imm, state->left->reg1);
+ MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORER8_MEMBASE_REG, s->frame_reg, tree->inst_imm, state->left->reg1);
return;
}
tree->opcode = OP_SETFREG;
@@ -269,7 +269,7 @@ stmt: OP_OUTARG_VT (CEE_LDOBJ (base)) {
}
//g_print ("vt size: %d at R%d + %d\n", tree->inst_imm, vt->inst_basereg, vt->inst_offset);
if (ovf_size != 0) {
- mini_emit_memcpy (s, ppc_r1, tree->inst_imm + (soffset - vt->inst_offset), vt->inst_basereg, soffset, ovf_size * sizeof (gpointer), 0);
+ mini_emit_memcpy (s, s->frame_reg, tree->inst_imm + (soffset - vt->inst_offset), vt->inst_basereg, soffset, ovf_size * sizeof (gpointer), 0);
}
}
diff --git a/mono/mini/inssel-x86.brg b/mono/mini/inssel-x86.brg
index b80affe25ab..b1f1cf67c77 100644
--- a/mono/mini/inssel-x86.brg
+++ b/mono/mini/inssel-x86.brg
@@ -151,7 +151,6 @@ reg: OP_LOCALLOC (OP_ICONST) {
if (tree->flags & MONO_INST_INIT) {
/* microcoded in mini-x86.c */
tree->sreg1 = mono_regstate_next_int (s->rs);
- tree->dreg = state->reg1;
MONO_EMIT_NEW_ICONST (s, tree->sreg1, state->left->tree->inst_c0);
mono_bblock_add_inst (s->cbb, tree);
} else {
@@ -162,7 +161,6 @@ reg: OP_LOCALLOC (OP_ICONST) {
reg: OP_LOCALLOC (reg) {
tree->sreg1 = state->left->tree->dreg;
- tree->dreg = state->reg1;
mono_bblock_add_inst (s->cbb, tree);
}
diff --git a/mono/mini/mini-ppc.c b/mono/mini/mini-ppc.c
index 537cefb50a7..a62d49bd453 100644
--- a/mono/mini/mini-ppc.c
+++ b/mono/mini/mini-ppc.c
@@ -209,7 +209,7 @@ mono_arch_get_global_int_regs (MonoCompile *cfg)
if (cfg->frame_reg != ppc_sp)
top = 31;
#if USE_EXTRA_TEMPS
- top = 29;
+ top -= 2;
#endif
for (i = 13; i < top; ++i)
regs = g_list_prepend (regs, GUINT_TO_POINTER (i));
@@ -1296,11 +1296,7 @@ mono_spillvar_offset_float (MonoCompile *cfg, int spillvar)
#undef DEBUG
#define DEBUG(a) if (cfg->verbose_level > 1) a
//#define DEBUG(a)
-/* use ppc_r3-ppc_10,ppc_r12 as temp registers, f1-f13 for FP registers */
-#define PPC_CALLER_REGS ((0xff<<3) | (1<<12) | USE_EXTRA_TEMPS)
-#define PPC_CALLER_FREGS (0x3ffe)
-
-#define reg_is_freeable(r) (PPC_CALLER_REGS & 1 << (r))
+#define reg_is_freeable(r) ((r) >= 3 && (r) <= 10)
#define freg_is_freeable(r) ((r) >= 1 && (r) <= 13)
typedef struct {
@@ -1635,6 +1631,10 @@ alloc_int_reg (MonoCompile *cfg, InstList *curinst, MonoInst *ins, int sym_reg,
return val;
}
+/* use ppc_r3-ppc_10,ppc_r12 as temp registers, f1-f13 for FP registers */
+#define PPC_CALLER_REGS ((0xff<<3) | (1<<12) | USE_EXTRA_TEMPS)
+#define PPC_CALLER_FREGS (0x3ffe)
+
/*
* Local register allocation.
* We first scan the list of instructions and we save the liveness info of
@@ -2275,7 +2275,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
}
// if (ins->cil_code)
// g_print ("cil code\n");
- mono_debug_record_line_number (cfg, ins, offset);
switch (ins->opcode) {
case OP_BIGMUL:
@@ -2687,7 +2686,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
*/
ppc_mulhwu (code, ppc_r0, ins->sreg1, ins->sreg2);
ppc_cmpi (code, 0, 0, ppc_r0, 0);
- EMIT_COND_SYSTEM_EXCEPTION (CEE_BNE_UN - CEE_BEQ, "OverflowException");
+ EMIT_COND_SYSTEM_EXCEPTION (CEE_BNE_UN - CEE_BEQ, ins->inst_p1);
ppc_mullw (code, ins->dreg, ins->sreg1, ins->sreg2);
break;
case OP_ICONST:
@@ -3410,8 +3409,6 @@ mono_arch_emit_prolog (MonoCompile *cfg)
ArgInfo *ainfo = cinfo->args + i;
inst = cfg->varinfo [pos];
- if (cfg->verbose_level > 2)
- g_print ("Saving argument %d (type: %d)\n", i, ainfo->regtype);
if (inst->opcode == OP_REGVAR) {
if (ainfo->regtype == RegTypeGeneral)
ppc_mr (code, inst->dreg, ainfo->reg);
diff --git a/mono/mini/mini-s390.c b/mono/mini/mini-s390.c
index 0a7db247fa2..101c5c7ec76 100644
--- a/mono/mini/mini-s390.c
+++ b/mono/mini/mini-s390.c
@@ -2944,8 +2944,6 @@ guint8 cond;
code = cfg->native_code + offset;
}
- mono_debug_record_line_number (cfg, ins, offset);
-
switch (ins->opcode) {
case OP_STOREI1_MEMBASE_IMM: {
s390_lhi (code, s390_r14, ins->inst_imm);
diff --git a/mono/mini/mini-sparc.c b/mono/mini/mini-sparc.c
index d0f58dc84cf..54fd7fda138 100644
--- a/mono/mini/mini-sparc.c
+++ b/mono/mini/mini-sparc.c
@@ -2546,7 +2546,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
code_start = (guint8*)code;
// if (ins->cil_code)
// g_print ("cil code\n");
- mono_debug_record_line_number (cfg, ins, offset);
switch (ins->opcode) {
case OP_STOREI1_MEMBASE_IMM:
diff --git a/mono/mini/mini-x86.c b/mono/mini/mini-x86.c
index 4f5842f8750..14710b31792 100644
--- a/mono/mini/mini-x86.c
+++ b/mono/mini/mini-x86.c
@@ -1866,8 +1866,6 @@ mono_arch_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb)
/* force source to be same as dest */
rs->iassign [ins->sreg1] = ins->dreg;
rs->iassign [ins->sreg1 + 1] = ins->unused;
- rs->isymbolic [ins->dreg] = ins->sreg1;
- rs->isymbolic [ins->unused] = ins->sreg1 + 1;
DEBUG (g_print ("\tassigned sreg1 (long) %s to sreg1 R%d\n", mono_arch_regname (ins->dreg), ins->sreg1));
DEBUG (g_print ("\tassigned sreg1 (long-high) %s to sreg1 R%d\n", mono_arch_regname (ins->unused), ins->sreg1 + 1));
diff --git a/mono/mini/mini.c b/mono/mini/mini.c
index 14a32f6dd6c..95a14efc341 100644
--- a/mono/mini/mini.c
+++ b/mono/mini/mini.c
@@ -1581,24 +1581,23 @@ mono_compile_get_interface_var (MonoCompile *cfg, int slot, MonoInst *ins)
*/
static int
handle_stack_args (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **sp, int count) {
- int i, bindex;
+ int i;
MonoBasicBlock *outb;
MonoInst *inst, **locals;
- gboolean found;
if (!count)
return 0;
if (cfg->verbose_level > 3)
g_print ("%d item(s) on exit from B%d\n", count, bb->block_num);
if (!bb->out_scount) {
+ int found = 0;
bb->out_scount = count;
//g_print ("bblock %d has out:", bb->block_num);
- found = FALSE;
for (i = 0; i < bb->out_count; ++i) {
outb = bb->out_bb [i];
//g_print (" %d", outb->block_num);
if (outb->in_stack) {
- found = TRUE;
+ found = 1;
bb->out_stack = outb->in_stack;
break;
}
@@ -1607,34 +1606,19 @@ handle_stack_args (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **sp, int coun
if (!found) {
bb->out_stack = mono_mempool_alloc (cfg->mempool, sizeof (MonoInst*) * count);
for (i = 0; i < count; ++i) {
- /*
- * try to reuse temps already allocated for this purpouse, if they occupy the same
- * stack slot and if they are of the same type.
- * This won't cause conflicts since if 'local' is used to
- * store one of the values in the in_stack of a bblock, then
- * the same variable will be used for the same outgoing stack
- * slot as well.
- * This doesn't work when inlining methods, since the bblocks
- * in the inlined methods do not inherit their in_stack from
- * the bblock they are inlined to. See bug #58863 for an
- * example.
- */
- if (cfg->inlined_method)
- bb->out_stack [i] = mono_compile_create_var (cfg, type_from_stack_type (sp [i]), OP_LOCAL);
- else
- bb->out_stack [i] = mono_compile_get_interface_var (cfg, i, sp [i]);
+/* see bug#58863, but removing this code causes regressions in gtk-sharp build
+ * (SEGV running Method::Initialize() in gapi_codegen.exe)
+ */
+#if 1
+ /* try to reuse temps already allocated for this purpouse, if they occupy the same
+ * stack slot and if they are of the same type. */
+ bb->out_stack [i] = mono_compile_get_interface_var (cfg, i, sp [i]);
+#else
+ bb->out_stack [i] = mono_compile_create_var (cfg, type_from_stack_type (sp [i]), OP_LOCAL);
+#endif
}
}
}
-
- for (i = 0; i < bb->out_count; ++i) {
- outb = bb->out_bb [i];
- if (outb->in_scount)
- continue; /* check they are the same locals */
- outb->in_scount = count;
- outb->in_stack = bb->out_stack;
- }
-
locals = bb->out_stack;
for (i = 0; i < count; ++i) {
/* add store ops at the end of the bb, before the branch */
@@ -1649,36 +1633,14 @@ handle_stack_args (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **sp, int coun
if (cfg->verbose_level > 3)
g_print ("storing %d to temp %d\n", i, locals [i]->inst_c0);
}
-
- /*
- * It is possible that the out bblocks already have in_stack assigned, and
- * the in_stacks differ. In this case, we will store to all the different
- * in_stacks.
- */
-
- found = TRUE;
- bindex = 0;
- while (found) {
- /* Find a bblock which has a different in_stack */
- found = FALSE;
- while (bindex < bb->out_count) {
- outb = bb->out_bb [bindex];
- if (outb->in_stack != locals) {
- /*
- * Instead of storing sp [i] to locals [i], we need to store
- * locals [i] to <new locals>[i], since the sp [i] tree can't
- * be shared between trees.
- */
- for (i = 0; i < count; ++i)
- mono_add_varcopy_to_end (cfg, bb, locals [i]->inst_c0, outb->in_stack [i]->inst_c0);
- locals = outb->in_stack;
- found = TRUE;
- break;
- }
- bindex ++;
- }
- }
+ for (i = 0; i < bb->out_count; ++i) {
+ outb = bb->out_bb [i];
+ if (outb->in_scount)
+ continue; /* check they are the same locals */
+ outb->in_scount = count;
+ outb->in_stack = locals;
+ }
return 0;
}
@@ -2465,7 +2427,6 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
MonoMethodHeader *cheader;
MonoBasicBlock *ebblock, *sbblock;
int i, costs, new_locals_offset;
- MonoMethod *prev_inlined_method;
if (cfg->verbose_level > 2)
g_print ("INLINE START %p %s -> %s\n", cmethod, mono_method_full_name (cfg->method, TRUE), mono_method_full_name (cmethod, TRUE));
@@ -2494,13 +2455,8 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
ebblock->block_num = cfg->num_bblocks++;
ebblock->real_offset = real_offset;
- prev_inlined_method = cfg->inlined_method;
- cfg->inlined_method = cmethod;
-
costs = mono_method_to_ir (cfg, cmethod, sbblock, ebblock, new_locals_offset, rvar, dont_inline, sp, real_offset, *ip == CEE_CALLVIRT);
- cfg->inlined_method = prev_inlined_method;
-
if ((costs >= 0 && costs < 60) || inline_allways) {
if (cfg->verbose_level > 2)
g_print ("INLINE END %s -> %s\n", mono_method_full_name (cfg->method, TRUE), mono_method_full_name (cmethod, TRUE));
@@ -7090,12 +7046,10 @@ optimize_branches (MonoCompile *cfg)
bbn->code->inst_target_bb->region == bb->region) {
if (cfg->verbose_level > 2)
- g_print ("in %s branch to branch triggered %d -> %d -> %d\n", cfg->method->name,
- bb->block_num, bbn->block_num, bbn->code->inst_target_bb->block_num);
-
- replace_in_block (bbn, bb, NULL);
- replace_out_block (bb, bbn, bbn->code->inst_target_bb);
- link_bblock (cfg, bb, bbn->code->inst_target_bb);
+ g_print ("in %s branch to branch triggered %d -> %d\n", cfg->method->name,
+ bb->block_num, bbn->block_num);
+
+ replace_basic_block (bb, bb->out_bb [0], bbn->code->inst_target_bb);
bb->last_ins->inst_target_bb = bbn->code->inst_target_bb;
changed = TRUE;
break;
diff --git a/mono/mini/mini.h b/mono/mini/mini.h
index e62be1b95cb..adc1e9086b5 100644
--- a/mono/mini/mini.h
+++ b/mono/mini/mini.h
@@ -492,7 +492,6 @@ typedef struct {
MonoSpillInfo *spill_info_float; /* fp register spills */
gint spill_count;
/* unsigned char *cil_code; */
- MonoMethod *inlined_method; /* the method which is currently inlined */
/* the exception object passed to catch/filter blocks */
MonoInst *exvar;
diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am
index 2ac008e74c4..23cc36cc3cc 100644
--- a/mono/tests/Makefile.am
+++ b/mono/tests/Makefile.am
@@ -41,7 +41,6 @@ TEST_CS_SRC= \
exception16.cs \
struct.cs \
valuetype-gettype.cs \
- typeof-ptr.cs \
static-constructor.cs \
pinvoke.cs \
pinvoke1.cs \
diff --git a/mono/tests/libtest.c b/mono/tests/libtest.c
index 6a9bad00f5a..0d651b00e80 100644
--- a/mono/tests/libtest.c
+++ b/mono/tests/libtest.c
@@ -636,24 +636,10 @@ mono_test_marshal_primitive_byref_delegate (PrimitiveByrefDelegate delegate)
return 0;
}
-typedef int (*return_int_delegate) (int i);
-
-typedef return_int_delegate (*ReturnDelegateDelegate) ();
-
-int
-mono_test_marshal_return_delegate_delegate (ReturnDelegateDelegate d)
-{
- return (d ()) (55);
-}
-
-
int
mono_test_marshal_stringbuilder (char *s, int n)
{
const char m[] = "This is my message. Isn't it nice?";
-
- if (strcmp (s, "ABCD") != 0)
- return 1;
strncpy(s, m, n);
return 0;
}
@@ -701,20 +687,6 @@ mono_test_marshal_string_array (char **array)
}
int
-mono_test_marshal_stringbuilder_array (char **array)
-{
- if (strcmp (array [0], "ABC"))
- return 1;
- if (strcmp (array [1], "DEF"))
- return 2;
-
- strcpy (array [0], "DEF");
- strcpy (array [1], "ABC");
-
- return 0;
-}
-
-int
mono_test_marshal_unicode_string_array (gunichar2 **array, char **array2)
{
GError *error = NULL;
@@ -1020,18 +992,6 @@ mono_test_marshal_mixed_point (mixed_point pt)
}
int
-mono_test_marshal_mixed_point_2 (mixed_point *pt)
-{
- if (pt->x != 5 || pt->y != 6.75)
- return 1;
-
- pt->x = 10;
- pt->y = 12.35;
-
- return 0;
-}
-
-int
time_t_sizeof (void)
{
return sizeof (time_t);
diff --git a/mono/tests/pinvoke2.cs b/mono/tests/pinvoke2.cs
index 6dd5a7828a7..179f67d0f56 100755
--- a/mono/tests/pinvoke2.cs
+++ b/mono/tests/pinvoke2.cs
@@ -111,9 +111,6 @@ public class Tests {
[DllImport ("libtest", EntryPoint="mono_test_marshal_unicode_string_array", CharSet=CharSet.Unicode)]
public static extern int mono_test_marshal_unicode_string_array (string [] a1, [MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.LPStr)]string [] a2);
- [DllImport ("libtest", EntryPoint="mono_test_marshal_stringbuilder_array")]
- public static extern int mono_test_marshal_stringbuilder_array (StringBuilder [] a1);
-
[DllImport ("libtest", EntryPoint="mono_test_marshal_inout_array")]
public static extern int mono_test_marshal_inout_array ([In, Out] int [] a1);
@@ -416,7 +413,6 @@ public class Tests {
static int test_0_marshal_stringbuilder () {
StringBuilder sb = new StringBuilder(255);
- sb.Append ("ABCD");
mono_test_marshal_stringbuilder (sb, sb.Capacity);
String res = sb.ToString();
@@ -449,20 +445,6 @@ public class Tests {
return mono_test_marshal_unicode_string_array (new String [] { "ABC", "DEF" }, new String [] { "ABC", "DEF" });
}
- static int test_0_marshal_stringbuilder_array () {
- StringBuilder sb1 = new StringBuilder ("ABC");
- StringBuilder sb2 = new StringBuilder ("DEF");
-
- int res = mono_test_marshal_stringbuilder_array (new StringBuilder [] { sb1, sb2 });
- if (res != 0)
- return res;
- if (sb1.ToString () != "DEF")
- return 5;
- if (sb2.ToString () != "ABC")
- return 6;
- return 0;
- }
-
static int test_0_last_error () {
mono_test_last_error (5);
if (Marshal.GetLastWin32Error () == 5)
diff --git a/mono/tests/pinvoke3.cs b/mono/tests/pinvoke3.cs
index 0a0d39ee3aa..f463e14afc5 100755
--- a/mono/tests/pinvoke3.cs
+++ b/mono/tests/pinvoke3.cs
@@ -150,9 +150,6 @@ public class Tests {
[DllImport ("libtest", EntryPoint="mono_test_marshal_primitive_byref_delegate")]
public static extern int mono_test_marshal_primitive_byref_delegate (PrimitiveByrefDelegate d);
- [DllImport ("libtest", EntryPoint="mono_test_marshal_return_delegate_delegate")]
- public static extern int mono_test_marshal_return_delegate_delegate (ReturnDelegateDelegate d);
-
public delegate int TestDelegate (int a, ref SimpleStruct ss, int b);
public delegate SimpleStruct SimpleDelegate2 (SimpleStruct ss);
@@ -171,8 +168,6 @@ public class Tests {
public delegate int PrimitiveByrefDelegate (ref int i);
- public delegate return_int_delegate ReturnDelegateDelegate ();
-
public static int Main () {
return TestDriver.RunTests (typeof (Tests));
}
@@ -283,13 +278,4 @@ public class Tests {
return mono_test_marshal_primitive_byref_delegate (d);
}
-
- public static return_int_delegate return_delegate () {
- return new return_int_delegate (return_self);
- }
-
- static int test_55_marshal_return_delegate_delegate () {
- return mono_test_marshal_return_delegate_delegate (new ReturnDelegateDelegate (return_delegate));
- }
-
}
diff --git a/mono/tests/typeof-ptr.cs b/mono/tests/typeof-ptr.cs
deleted file mode 100644
index eea3d1072db..00000000000
--- a/mono/tests/typeof-ptr.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using System.Reflection;
-
-class T {
- public static unsafe void meth (int a, int* b) {
- }
- static int Main () {
- ParameterInfo[] args = typeof (T).GetMethod ("meth").GetParameters ();
- if (args[0].ParameterType == args[1].ParameterType)
- return 1;
-
- if (typeof(int) == typeof (int*))
- return 2;
- if (args[0].ParameterType != typeof(int))
- return 3;
- if (args[1].ParameterType != typeof(int*))
- return 4;
- return 0;
- }
-}