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_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
+#define WRAPPER(e,n) MONO_WRAPPER_ ## e,
+#include "wrapper-types.h"
+#undef WRAPPER
+ MONO_WRAPPER_NUM
} MonoWrapperType;
typedef enum {
typedef enum {
MONO_REMOTING_TARGET_UNKNOWN,
- MONO_REMOTING_TARGET_APPDOMAIN
+ MONO_REMOTING_TARGET_APPDOMAIN,
+ MONO_REMOTING_TARGET_COMINTEROP
} MonoRemotingTarget;
struct _MonoMethod {
unsigned int save_lmf:1;
unsigned int dynamic:1; /* created & destroyed during runtime */
unsigned int is_inflated:1; /* whether we're a MonoMethodInflated */
- signed int slot : 21;
+ unsigned int skip_visibility:1; /* whenever to skip JIT visibility checks */
+ signed int slot : 20;
};
struct _MonoMethodNormal {
/* next byte */
guint has_static_refs : 1; /* it has static fields that are GC-tracked */
guint no_special_static_fields : 1; /* has no thread/context static fields */
+ /* directly or indirectly derives from ComImport attributed class.
+ * this means we need to create a proxy for instances of this class
+ * for COM Interop. set this flag on loading so all we need is a quick check
+ * during object creation rather than having to traverse supertypes
+ */
+ guint is_com_object : 1;
guint8 exception_type; /* MONO_EXCEPTION_* */
void* exception_data; /* Additional information about the exception */
* Computed object instance size, total.
*/
int instance_size;
- int class_size;
int vtable_size; /* number of slots */
+ union {
+ int class_size; /* size of area for static fields */
+ int element_size; /* for array types */
+ } sizes;
/*
* From the TypeDef table
guint8 rank;
guint remote : 1; /* class is remotely activated */
guint initialized : 1; /* cctor has been run */
+ guint init_failed : 1; /* cctor execution failed */
/* do not add any fields after vtable, the structure is dynamically extended */
gpointer vtable [MONO_ZERO_LEN_ARRAY];
};
struct _MonoGenericClass {
MonoGenericInst *inst; /* the instantiation */
MonoClass *container_class; /* the generic type definition */
- MonoGenericContext *context; /* current context */
+ MonoGenericContext *cached_context; /* if present, a "trivial" context that doesn't contain any method instantiation */
guint is_dynamic : 1; /* We're a MonoDynamicGenericClass */
- guint is_inflated : 1; /* We're a MonoInflatedGenericClass */
-};
-
-/*
- * Performance optimization:
- * We don't create the `MonoClass' for a `MonoGenericClass' until we really
- * need it.
- */
-struct _MonoInflatedGenericClass {
- MonoGenericClass generic_class;
- guint is_initialized : 1;
- MonoClass *klass;
+ MonoClass *cached_class; /* if present, the MonoClass corresponding to the instantiation. */
};
/*
* a TypeBuilder.
*/
struct _MonoDynamicGenericClass {
- MonoInflatedGenericClass generic_class;
+ MonoGenericClass generic_class;
int count_methods;
MonoMethod **methods;
int count_ctors;
*/
struct _MonoGenericMethod {
MonoGenericInst *inst; /* the instantiation */
- MonoGenericClass *generic_class; /* if we're in a generic type */
+ MonoGenericInst *class_inst; /* if we're in a generic type, the instantiation of that type */
MonoGenericContainer *container; /* type parameters */
gpointer reflection_info;
};
/*
- * The generic context.
+ * The generic context: an instantiation of a set of class and method generic parameters.
*/
struct _MonoGenericContext {
- /*
- * The container which has been instantiated.
- *
- * If we're in a generic method, the generic method definition's container.
- * Otherwise the generic type's container.
- */
- MonoGenericContainer *container;
- /* The current generic class */
- MonoGenericClass *gclass;
+ /* The instantiation corresponding to the class generic parameters */
+ MonoGenericInst *class_inst;
/* The current generic method */
MonoGenericMethod *gmethod;
};
MonoGenericContainer *parent;
/* If we're a generic method definition, caches all their instantiations. */
GHashTable *method_hash;
- /* If we're a generic type definition, its `MonoClass'. */
- MonoClass *klass;
+ /* the generic type definition or the generic method definition corresponding to this container */
+ union {
+ MonoClass *klass;
+ MonoMethod *method;
+ } owner;
int type_argc : 6;
/* If true, we're a generic method, otherwise a generic type definition. */
/* Invariant: parent != NULL => is_method */
struct _MonoGenericParam {
MonoGenericContainer *owner; /* Type or method this parameter was defined in. */
MonoClass *pklass; /* The corresponding `MonoClass'. */
- MonoMethod *method; /* If we're a method type parameter, the method. */
const char *name;
guint16 flags;
guint16 num;
typedef enum {
MONO_LOADER_ERROR_TYPE,
MONO_LOADER_ERROR_METHOD,
- MONO_LOADER_ERROR_FIELD
+ MONO_LOADER_ERROR_FIELD,
+ MONO_LOADER_ERROR_ASSEMBLY
} MonoLoaderErrorKind;
typedef struct {
MonoLoaderErrorKind kind;
- char *class_name, *assembly_name; /* If kind == TYPE */
+ char *class_name; /* If kind == TYPE */
+ char *assembly_name; /* If kind == TYPE or ASSEMBLY */
MonoClass *klass; /* If kind != TYPE */
const char *member_name; /* If kind != TYPE */
+ gboolean ref_only; /* If kind == ASSEMBLY */
} MonoLoaderError;
#define mono_class_has_parent(klass,parent) (((klass)->idepth >= (parent)->idepth) && ((klass)->supertypes [(parent)->idepth - 1] == (parent)))
typedef struct {
gulong new_object_count;
gulong initialized_class_count;
+ gulong generic_vtable_count;
gulong used_class_count;
+ gulong method_count;
gulong class_vtable_size;
gulong class_static_data_size;
gulong generic_instance_count;
gboolean enabled;
} MonoStats;
+/*
+ * The definition of the first field in SafeHandle,
+ * Keep in sync with SafeHandle.cs, this is only used
+ * to access the `handle' parameter.
+ */
+typedef struct {
+ MonoObject base;
+ void *handle;
+} MonoSafeHandle;
+
+/*
+ * Keep in sync with HandleRef.cs
+ */
+typedef struct {
+ MonoObject *wrapper;
+ void *handle;
+} MonoHandleRef;
+
extern MonoStats mono_stats MONO_INTERNAL;
typedef gpointer (*MonoTrampoline) (MonoMethod *method);
typedef gboolean (*MonoGetCachedClassInfo) (MonoClass *klass, MonoCachedClassInfo *res);
+typedef gboolean (*MonoGetClassFromName) (MonoImage *image, const char *name_space, const char *name, MonoClass **res);
+
void
mono_classes_init (void) MONO_INTERNAL;
void
mono_install_get_cached_class_info (MonoGetCachedClassInfo func) MONO_INTERNAL;
-MonoInflatedGenericClass*
-mono_get_inflated_generic_class (MonoGenericClass *gclass) MONO_INTERNAL;
+void
+mono_install_get_class_from_name (MonoGetClassFromName func) MONO_INTERNAL;
+
+MonoGenericContext*
+mono_class_get_context (MonoClass *class) MONO_INTERNAL;
+
+MonoGenericContext*
+mono_generic_class_get_context (MonoGenericClass *gclass) MONO_INTERNAL;
+
+MonoGenericContext*
+mono_method_get_context (MonoMethod *method) MONO_INTERNAL;
MonoMethod*
mono_class_inflate_generic_method_full (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context);
MonoClass *runtimesecurityframe_class;
MonoClass *executioncontext_class;
MonoClass *internals_visible_class;
- MonoClass *generic_array_class;
+ MonoClass *generic_ilist_class;
MonoClass *generic_nullable_class;
MonoClass *variant_class;
+ MonoClass *com_object_class;
+ MonoClass *com_interop_proxy_class;
+ MonoClass *iunknown_class;
+ MonoClass *idispatch_class;
+ MonoClass *safehandle_class;
+ MonoClass *handleref_class;
} MonoDefaults;
extern MonoDefaults mono_defaults MONO_INTERNAL;
mono_loader_unlock (void) MONO_INTERNAL;
void
-mono_loader_set_error_assembly_load (const char *assembly_name) MONO_INTERNAL;
+mono_loader_set_error_assembly_load (const char *assembly_name, gboolean ref_only) MONO_INTERNAL;
void
mono_loader_set_error_type_load (const char *class_name, const char *assembly_name) MONO_INTERNAL;
void
mono_loader_clear_error (void) MONO_INTERNAL;
+void
+mono_reflection_init (void) MONO_INTERNAL;
+
void
mono_icall_init (void) MONO_INTERNAL;
MonoArrayType *mono_dup_array_type (MonoArrayType *a) MONO_INTERNAL;
MonoMethodSignature *mono_metadata_signature_deep_dup (MonoMethodSignature *sig) MONO_INTERNAL;
+void
+mono_image_init_name_cache (MonoImage *image);
+
gboolean mono_class_is_nullable (MonoClass *klass) MONO_INTERNAL;
MonoClass *mono_class_get_nullable_param (MonoClass *klass) MONO_INTERNAL;
+/* object debugging functions, for use inside gdb */
+void mono_object_describe (MonoObject *obj);
+void mono_object_describe_fields (MonoObject *obj);
+void mono_value_describe_fields (MonoClass* klass, const char* addr);
+void mono_class_describe_statics (MonoClass* klass);
+
#endif /* __MONO_METADATA_CLASS_INTERBALS_H__ */