Merge from HEAD.
authorZoltan Varga <vargaz@gmail.com>
Mon, 5 Jul 2004 12:32:14 +0000 (12:32 -0000)
committerZoltan Varga <vargaz@gmail.com>
Mon, 5 Jul 2004 12:32:14 +0000 (12:32 -0000)
svn path=/branches/mono-1-0/mono/; revision=30738

mono/interpreter/ChangeLog
mono/interpreter/interp.c
mono/interpreter/mintops.h

index 2c2d176ef2fff31869ad5becf9f9ea5ab9f557d3..088f0756976b9b373aa08881bf20b51b5bd538f0 100644 (file)
@@ -1,3 +1,9 @@
+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
index 872fad14aae30dd9addd4271031211c426bcdf73..3f7ad24660dc3e529a32260fc4fcb131cd0ea40d 100644 (file)
@@ -1164,7 +1164,7 @@ handle_enum:
                }
        }
 
-       if (method->klass->valuetype)
+       if (method->klass->valuetype && obj)
                /* Unbox the instance, since valuetype methods expect an interior pointer. */
                obj = mono_object_unbox (obj);
 
index ab559de7ac67d493dd2a54c7c082200297caab76..e787526e2febe225faeb272671a1f38770600f42 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __INTERPRETER_MINTOPS_H
 #define __INTERPRETER_MINTOPS_H
 
+#include <glib.h>
+
 typedef enum
 {
        MintOpNoArgs,
@@ -29,11 +31,19 @@ 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))