+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
}
}
- if (method->klass->valuetype)
+ if (method->klass->valuetype && obj)
/* Unbox the instance, since valuetype methods expect an interior pointer. */
obj = mono_object_unbox (obj);
#ifndef __INTERPRETER_MINTOPS_H
#define __INTERPRETER_MINTOPS_H
+#include <glib.h>
+
typedef enum
{
MintOpNoArgs,
#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))