+/*
+ * Copyright 2012 Xamarin Inc
+ */
#ifndef __MONO_METADATA_CLASS_INTERBALS_H__
#define __MONO_METADATA_CLASS_INTERBALS_H__
*/
#define MONO_PROP_DYNAMIC_CATTR 0x1000
+#ifdef ENABLE_ICALL_EXPORT
+#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+#define ICALL_EXPORT
+#else
+#define ICALL_EXPORT static
+#endif
+
typedef enum {
#define WRAPPER(e,n) MONO_WRAPPER_ ## e,
#include "wrapper-types.h"
guint is_inflated : 1; /* class is a generic instance */
/* next byte */
guint has_finalize_inited : 1; /* has_finalize is initialized */
+ guint fields_inited : 1; /* fields is initialized */
guint8 exception_type; /* MONO_EXCEPTION_* */
#define MONO_CLASS_IMPLEMENTS_INTERFACE(k,uiid) (((uiid) <= (k)->max_interface_id) && mono_class_interface_match ((k)->interface_bitmap, (uiid)))
+#define MONO_VTABLE_AVAILABLE_GC_BITS 4
int mono_class_interface_offset (MonoClass *klass, MonoClass *itf);
int mono_class_interface_offset_with_variance (MonoClass *klass, MonoClass *itf, gboolean *non_exact_match) MONO_INTERNAL;
* the vtable.
*/
void *gc_descr;
- void *size_descr;
MonoDomain *domain; /* each object/vtable belongs to exactly one domain */
gpointer type; /* System.Type type for klass */
guint8 *interface_bitmap;
guint initialized : 1; /* cctor has been run */
guint init_failed : 1; /* cctor execution failed */
guint has_static_fields : 1; /* pointer to the data stored at the end of the vtable array */
+ guint gc_bits : MONO_VTABLE_AVAILABLE_GC_BITS; /* Those bits are reserved for the usaged of the GC */
+
guint32 imt_collisions_bitmap;
MonoRuntimeGenericContext *runtime_generic_context;
/* do not add any fields after vtable, the structure is dynamically extended */
struct _MonoGenericParam {
MonoGenericContainer *owner; /* Type or method this parameter was defined in. */
guint16 num;
+ /* For internal runtime use, used to make different versions of the same param */
+ guint16 serial;
/*
* If owner is NULL, or owner is 'owned' by this gparam,
* then this is the image whose mempool this struct was allocated from.
char *msg; /* If kind == BAD_IMAGE */
} MonoLoaderError;
-#define mono_class_has_parent(klass,parent) (((klass)->idepth >= (parent)->idepth) && ((klass)->supertypes [(parent)->idepth - 1] == (parent)))
+void
+mono_class_setup_supertypes (MonoClass *klass) MONO_INTERNAL;
+
+void
+mono_class_setup_fields_locking (MonoClass *class) MONO_INTERNAL;
+
+/* WARNING
+ * Only call this function if you can ensure both @klass and @parent
+ * have supertype information initialized.
+ * This can be accomplished by mono_class_setup_supertypes or mono_class_init.
+ * If unsure, use mono_class_has_parent.
+ */
+static inline gboolean
+mono_class_has_parent_fast (MonoClass *klass, MonoClass *parent)
+{
+ return (klass->idepth >= parent->idepth) && (klass->supertypes [parent->idepth - 1] == parent);
+}
+
+static inline gboolean
+mono_class_has_parent (MonoClass *klass, MonoClass *parent)
+{
+ if (G_UNLIKELY (!klass->supertypes))
+ mono_class_setup_supertypes (klass);
+
+ if (G_UNLIKELY (!parent->supertypes))
+ mono_class_setup_supertypes (parent);
+
+ return mono_class_has_parent_fast (klass, parent);
+}
typedef struct {
MonoVTable *default_vtable;
typedef gpointer (*MonoTrampoline) (MonoMethod *method);
typedef gpointer (*MonoJumpTrampoline) (MonoDomain *domain, MonoMethod *method, gboolean add_sync_wrapper);
typedef gpointer (*MonoRemotingTrampoline) (MonoDomain *domain, MonoMethod *method, MonoRemotingTarget target);
-typedef gpointer (*MonoDelegateTrampoline) (MonoClass *klass);
+typedef gpointer (*MonoDelegateTrampoline) (MonoDomain *domain, MonoClass *klass);
typedef gpointer (*MonoLookupDynamicToken) (MonoImage *image, guint32 token, gboolean valid_token, MonoClass **handle_class, MonoGenericContext *context);
void
mono_class_setup_parent (MonoClass *klass, MonoClass *parent) MONO_INTERNAL;
-void
-mono_class_setup_supertypes (MonoClass *klass) MONO_INTERNAL;
-
MonoMethod*
mono_class_get_method_by_index (MonoClass *class, int index) MONO_INTERNAL;