profiler-private.h \
rand.h \
rand.c \
+ remoting.h \
remoting.c \
runtime.c \
security.c \
#include "mono/metadata/attrdefs.h"
#include "mono/metadata/gc-internal.h"
#include "mono/metadata/cominterop.h"
+#include "mono/metadata/remoting.h"
#include "mono/metadata/reflection-internals.h"
#include "mono/utils/mono-counters.h"
#include "mono/utils/mono-tls.h"
register_icall (mono_gchandle_get_target, "mono_gchandle_get_target", "object int32", TRUE);
mono_cominterop_init ();
+ mono_remoting_init ();
}
}
#include <mono/metadata/opcodes.h>
#include <mono/metadata/reflection.h>
#include <mono/metadata/method-builder.h>
+#include <mono/metadata/remoting.h>
#define mono_marshal_find_bitfield_offset(type, elem, byte_offset, bitmask) \
do { \
MonoMethodBuilder *mb, MonoMethodSignature *sig,
int max_stack, WrapperInfo *info, gboolean *out_found) MONO_INTERNAL;
-#ifndef DISABLE_REMOTING
-
-MonoMethod *
-mono_marshal_get_remoting_invoke (MonoMethod *method) MONO_INTERNAL;
-
-MonoMethod *
-mono_marshal_get_xappdomain_invoke (MonoMethod *method) MONO_INTERNAL;
-
-MonoMethod *
-mono_marshal_get_remoting_invoke_for_target (MonoMethod *method, MonoRemotingTarget target_type) MONO_INTERNAL;
-
-MonoMethod *
-mono_marshal_get_remoting_invoke_with_check (MonoMethod *method) MONO_INTERNAL;
-
-MonoMethod *
-mono_marshal_get_stfld_wrapper (MonoType *type) MONO_INTERNAL;
-
-MonoMethod *
-mono_marshal_get_ldfld_wrapper (MonoType *type) MONO_INTERNAL;
-
-MonoMethod *
-mono_marshal_get_ldflda_wrapper (MonoType *type) MONO_INTERNAL;
-
-MonoMethod *
-mono_marshal_get_ldfld_remote_wrapper (MonoClass *klass) MONO_INTERNAL;
-
-MonoMethod *
-mono_marshal_get_stfld_remote_wrapper (MonoClass *klass) MONO_INTERNAL;
-
-MonoMethod *
-mono_marshal_get_proxy_cancast (MonoClass *klass) MONO_INTERNAL;
-
-#endif
-
G_END_DECLS
#endif /* __MONO_MARSHAL_H__ */
#include "config.h"
+#include "mono/metadata/remoting.h"
#include "mono/metadata/marshal.h"
#include "mono/metadata/abi-details.h"
#include "mono/metadata/cominterop.h"
static MonoReflectionType *
type_from_handle (MonoType *handle);
+static mono_mutex_t remoting_mutex;
+static gboolean remoting_mutex_inited;
+
static MonoClass *byte_array_class;
static MonoMethod *method_rs_serialize, *method_rs_deserialize, *method_exc_fixexc, *method_rs_appdomain_target;
static MonoMethod *method_set_call_context, *method_needs_context_sink, *method_rs_serialize_exc;
mono_register_jit_icall (func, name, sig, save);
}
+static inline void
+remoting_lock (void)
+{
+ g_assert (remoting_mutex_inited);
+ mono_mutex_lock (&remoting_mutex);
+}
+
+static inline void
+remoting_unlock (void)
+{
+ g_assert (remoting_mutex_inited);
+ mono_mutex_unlock (&remoting_mutex);
+}
+
/*
* Return the hash table pointed to by VAR, lazily creating it if neccesary.
*/
get_cache (GHashTable **var, GHashFunc hash_func, GCompareFunc equal_func)
{
if (!(*var)) {
- mono_marshal_lock_internal ();
+ remoting_lock ();
if (!(*var)) {
GHashTable *cache =
g_hash_table_new (hash_func, equal_func);
mono_memory_barrier ();
*var = cache;
}
- mono_marshal_unlock_internal ();
+ remoting_unlock ();
}
return *var;
}
get_cache_full (GHashTable **var, GHashFunc hash_func, GCompareFunc equal_func, GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func)
{
if (!(*var)) {
- mono_marshal_lock_internal ();
+ remoting_lock ();
if (!(*var)) {
GHashTable *cache =
g_hash_table_new_full (hash_func, equal_func, key_destroy_func, value_destroy_func);
mono_memory_barrier ();
*var = cache;
}
- mono_marshal_unlock_internal ();
+ remoting_unlock ();
}
return *var;
}
+void
+mono_remoting_init (void)
+{
+ mono_mutex_init (&remoting_mutex);
+ remoting_mutex_inited = TRUE;
+}
+
static void
mono_remoting_marshal_init (void)
{
--- /dev/null
+/*
+ * remoting.h: Remoting support
+ *
+ * (C) 2004 Xamarin, Inc. http://www.xamarin.com
+ *
+ */
+
+#ifndef __MONO_REMOTING_H__
+#define __MONO_REMOTING_H__
+
+#include "config.h"
+#include <mono/metadata/class.h>
+#include <mono/metadata/object-internals.h>
+#include <mono/metadata/class-internals.h>
+
+void mono_remoting_init (void) MONO_INTERNAL;
+
+#ifndef DISABLE_REMOTING
+
+MonoMethod *
+mono_marshal_get_remoting_invoke (MonoMethod *method) MONO_INTERNAL;
+
+MonoMethod *
+mono_marshal_get_xappdomain_invoke (MonoMethod *method) MONO_INTERNAL;
+
+MonoMethod *
+mono_marshal_get_remoting_invoke_for_target (MonoMethod *method, MonoRemotingTarget target_type) MONO_INTERNAL;
+
+MonoMethod *
+mono_marshal_get_remoting_invoke_with_check (MonoMethod *method) MONO_INTERNAL;
+
+MonoMethod *
+mono_marshal_get_stfld_wrapper (MonoType *type) MONO_INTERNAL;
+
+MonoMethod *
+mono_marshal_get_ldfld_wrapper (MonoType *type) MONO_INTERNAL;
+
+MonoMethod *
+mono_marshal_get_ldflda_wrapper (MonoType *type) MONO_INTERNAL;
+
+MonoMethod *
+mono_marshal_get_ldfld_remote_wrapper (MonoClass *klass) MONO_INTERNAL;
+
+MonoMethod *
+mono_marshal_get_stfld_remote_wrapper (MonoClass *klass) MONO_INTERNAL;
+
+MonoMethod *
+mono_marshal_get_proxy_cancast (MonoClass *klass) MONO_INTERNAL;
+
+#endif
+
+#endif