Author: lupus
Date: 2007-01-12 05:59:57 -0500 (Fri, 12 Jan 2007)
New Revision: 70912

Modified:
   trunk/mono/mono/metadata/ChangeLog
   trunk/mono/mono/metadata/Makefile.am
   trunk/mono/mono/metadata/class-internals.h
   trunk/mono/mono/metadata/debug-helpers.c
Log:


Fri Jan 12 11:58:52 CET 2007 Paolo Molaro <[EMAIL PROTECTED]>

        * Makefile.am, class-internals.h, debug-helpers.c: consolidate
        the wrapper type enum and reduce relocations.



Modified: trunk/mono/mono/metadata/ChangeLog
===================================================================
--- trunk/mono/mono/metadata/ChangeLog  2007-01-12 10:51:17 UTC (rev 70911)
+++ trunk/mono/mono/metadata/ChangeLog  2007-01-12 10:59:57 UTC (rev 70912)
@@ -1,3 +1,9 @@
+
+Fri Jan 12 11:58:52 CET 2007 Paolo Molaro <[EMAIL PROTECTED]>
+
+       * Makefile.am, class-internals.h, debug-helpers.c: consolidate
+       the wrapper type enum and reduce relocations.
+
 2007-01-12  Raja R Harinath  <[EMAIL PROTECTED]>
 
        * reflection.c (inflate_mono_method): Reuse method instantiation

Modified: trunk/mono/mono/metadata/Makefile.am
===================================================================
--- trunk/mono/mono/metadata/Makefile.am        2007-01-12 10:51:17 UTC (rev 
70911)
+++ trunk/mono/mono/metadata/Makefile.am        2007-01-12 10:59:57 UTC (rev 
70912)
@@ -120,6 +120,7 @@
        loader.c        \
        class.c         \
        class-internals.h               \
+       wrapper-types.h         \
        mempool.c       \
        debug-helpers.c
 

Modified: trunk/mono/mono/metadata/class-internals.h
===================================================================
--- trunk/mono/mono/metadata/class-internals.h  2007-01-12 10:51:17 UTC (rev 
70911)
+++ trunk/mono/mono/metadata/class-internals.h  2007-01-12 10:59:57 UTC (rev 
70912)
@@ -19,38 +19,11 @@
 typedef struct _MonoMethodInflated MonoMethodInflated;
 typedef struct _MonoMethodPInvoke MonoMethodPInvoke;
 
-/*
- * remember to update wrapper_type_names if you change something here
- */
 typedef enum {
-       MONO_WRAPPER_NONE,
-       MONO_WRAPPER_DELEGATE_INVOKE,
-       MONO_WRAPPER_DELEGATE_BEGIN_INVOKE,
-       MONO_WRAPPER_DELEGATE_END_INVOKE,
-       MONO_WRAPPER_RUNTIME_INVOKE,
-       MONO_WRAPPER_NATIVE_TO_MANAGED,
-       MONO_WRAPPER_MANAGED_TO_NATIVE,
-       MONO_WRAPPER_MANAGED_TO_MANAGED,
-       MONO_WRAPPER_REMOTING_INVOKE,
-       MONO_WRAPPER_REMOTING_INVOKE_WITH_CHECK,
-       MONO_WRAPPER_XDOMAIN_INVOKE,
-       MONO_WRAPPER_XDOMAIN_DISPATCH,
-       MONO_WRAPPER_LDFLD,
-       MONO_WRAPPER_STFLD,
-       MONO_WRAPPER_LDFLD_REMOTE,
-       MONO_WRAPPER_STFLD_REMOTE,
-       MONO_WRAPPER_SYNCHRONIZED,
-       MONO_WRAPPER_DYNAMIC_METHOD,
-       MONO_WRAPPER_ISINST,
-       MONO_WRAPPER_CASTCLASS,
-       MONO_WRAPPER_PROXY_ISINST,
-       MONO_WRAPPER_STELEMREF,
-       MONO_WRAPPER_UNBOX,
-       MONO_WRAPPER_LDFLDA,
-       MONO_WRAPPER_WRITE_BARRIER,
-       MONO_WRAPPER_UNKNOWN,
-       MONO_WRAPPER_COMINTEROP_INVOKE,
-       MONO_WRAPPER_COMINTEROP
+#define WRAPPER(e,n) MONO_WRAPPER_ ## e,
+#include "wrapper-types.h"
+#undef WRAPPER
+       MONO_WRAPPER_NUM
 } MonoWrapperType;
 
 typedef enum {

Modified: trunk/mono/mono/metadata/debug-helpers.c
===================================================================
--- trunk/mono/mono/metadata/debug-helpers.c    2007-01-12 10:51:17 UTC (rev 
70911)
+++ trunk/mono/mono/metadata/debug-helpers.c    2007-01-12 10:59:57 UTC (rev 
70912)
@@ -17,37 +17,50 @@
        gboolean include_namespace;
 };
 
-static const char *wrapper_type_names [] = {
-       "none",
-       "delegate-invoke",
-       "delegate-begin-invoke",
-       "delegate-end-invoke",
-       "runtime-invoke",
-       "native-to-managed",
-       "managed-to-native",
-       "managed-to-managed",
-       "remoting-invoke",
-       "remoting-invoke-with-check",
-       "xdomain-invoke",
-       "xdomain-dispatch",
-       "ldfld",
-       "stfld",
-       "ldfld-remote",
-       "stfld-remote",
-       "synchronized",
-       "dynamic-method",
-       "isinst",
-       "cancast",
-       "proxy_isinst",
-       "stelemref",
-       "unbox",
-       "ldflda",
-       "write-barrier",
-       "unknown",
-       "cominterop-invoke",
-       "cominterop"
+#ifdef HAVE_ARRAY_ELEM_INIT
+#define MSGSTRFIELD(line) MSGSTRFIELD1(line)
+#define MSGSTRFIELD1(line) str##line
+static const struct msgstr_t {
+#define WRAPPER(a,b) char MSGSTRFIELD(__LINE__) [sizeof (b)];
+#include "wrapper-types.h"
+#undef WRAPPER
+} opstr = {
+#define WRAPPER(a,b) b,
+#include "wrapper-types.h"
+#undef WRAPPER
 };
+static const gint16 opidx [] = {
+#define WRAPPER(a,b) [MONO_WRAPPER_ ## a] = offsetof (struct msgstr_t, 
MSGSTRFIELD(__LINE__)),
+#include "wrapper-types.h"
+#undef WRAPPER
+};
 
+static const char*
+wrapper_type_to_str (guint32 wrapper_type)
+{
+       g_assert (wrapper_type < MONO_WRAPPER_NUM);
+
+       return (const char*)&opstr + opidx [wrapper_type];
+}
+
+#else
+#define WRAPPER(a,b) b,
+static const char* const
+wrapper_type_names [MONO_WRAPPER_NUM + 1] = {
+#include "wrapper-types.h"
+       NULL
+};
+
+static const char*
+wrapper_type_to_str (guint32 wrapper_type)
+{
+       g_assert (wrapper_type < MONO_WRAPPER_NUM);
+
+       return wrapper_type_names [wrapper_type];
+}
+
+#endif
+
 static void
 append_class_name (GString *res, MonoClass *class, gboolean include_namespace)
 {
@@ -507,14 +520,6 @@
        return result;
 }
 
-static const char*
-wrapper_type_to_str (guint32 wrapper_type)
-{
-       g_assert (wrapper_type < sizeof (wrapper_type_names) / sizeof (char*));
-
-       return wrapper_type_names [wrapper_type];
-}
-
 char *
 mono_method_full_name (MonoMethod *method, gboolean signature)
 {

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

Reply via email to