Skip to content

Instantly share code, notes, and snippets.

@larryhou
Created December 9, 2020 03:51
Show Gist options
  • Select an option

  • Save larryhou/95a89d83abbbb5ed630d864a08a20357 to your computer and use it in GitHub Desktop.

Select an option

Save larryhou/95a89d83abbbb5ed630d864a08a20357 to your computer and use it in GitHub Desktop.

https://github.com/mono/mono/blob/977ab697fae184565d97bcf8ec754525614b36b1/mono/metadata/class-internals.h#L355

struct MonoVTable {
	MonoClass  *klass;
	 /*
	 * According to comments in gc_gcj.h, this should be the second word in
	 * the vtable.
	 */
	MonoGCDescriptor gc_descr;
	MonoDomain *domain;  /* each object/vtable belongs to exactly one domain */
	gpointer    type; /* System.Type type for klass */
	guint8     *interface_bitmap;
	guint32     max_interface_id;
	guint8      rank;
	/* Keep this a guint8, the jit depends on it */
	guint8      initialized; /* cctor has been run */
	/* Keep this a guint8, the jit depends on it */
	guint8      flags; /* MonoVTableFlags */
	guint remote          : 1; /* class is remotely activated */
	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;
	/* interp virtual method table */
	gpointer *interp_vtable;
	/* do not add any fields after vtable, the structure is dynamically extended */
	/* vtable contains function pointers to methods or their trampolines, at the
	 end there may be a slot containing the pointer to the static fields */
	gpointer    vtable [MONO_ZERO_LEN_ARRAY];	
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment