1 #ifndef __MONO_OBJECT_INTERNALS_H__
2 #define __MONO_OBJECT_INTERNALS_H__
4 #include <mono/metadata/object.h>
5 #include <mono/metadata/threads.h>
6 #include <mono/metadata/reflection.h>
7 #include <mono/metadata/mempool.h>
8 #include <mono/metadata/class-internals.h>
9 #include <mono/metadata/threads-types.h>
10 #include <mono/io-layer/io-layer.h>
11 #include "mono/utils/mono-compiler.h"
12 #include "mono/utils/mono-error.h"
15 * We should find a better place for this stuff. We can't put it in mono-compiler.h,
16 * since that is included by libgc.
19 #define G_LIKELY(a) (a)
20 #define G_UNLIKELY(a) (a)
24 * glib defines this macro and uses it in the definition of G_LIKELY, and thus,
25 * g_assert (). The macro expands to a complex piece of code, preventing some
26 * gcc versions like 4.3.0 from handling the __builtin_expect construct properly,
27 * causing the generation of the unlikely branch into the middle of the code.
29 #ifdef _G_BOOLEAN_EXPR
30 #undef _G_BOOLEAN_EXPR
31 #define _G_BOOLEAN_EXPR(expr) ((gsize)(expr) != 0)
36 #define mono_assert(expr) G_STMT_START{ \
40 char *msg = g_strdup_printf ("file %s: line %d (%s): " \
41 "assertion failed: (%s)", __FILE__, __LINE__, \
42 __PRETTY_FUNCTION__, #expr); \
43 ex = mono_get_exception_execution_engine (msg); \
45 mono_raise_exception (ex); \
48 #define mono_assert_not_reached() G_STMT_START{ \
50 char *msg = g_strdup_printf ("file %s: line %d (%s): " \
51 "should not be reached", __FILE__, __LINE__, __PRETTY_FUNCTION__); \
52 ex = mono_get_exception_execution_engine (msg); \
54 mono_raise_exception (ex); \
57 #define mono_assert(expr) G_STMT_START{ \
61 char *msg = g_strdup_printf ("file %s: line %d: " \
62 "assertion failed: (%s)", __FILE__, __LINE__, \
64 ex = mono_get_exception_execution_engine (msg); \
66 mono_raise_exception (ex); \
69 #define mono_assert_not_reached() G_STMT_START{ \
71 char *msg = g_strdup_printf ("file %s: line %d): " \
72 "should not be reached", __FILE__, __LINE__); \
73 ex = mono_get_exception_execution_engine (msg); \
75 mono_raise_exception (ex); \
79 #define mono_assert(expr) g_assert(expr)
80 #define mono_assert_not_reached() g_assert_not_reached()
83 #define MONO_CHECK_ARG(arg, expr) G_STMT_START{ \
87 char *msg = g_strdup_printf ("assertion `%s' failed", \
89 if (arg) {} /* check if the name exists */ \
90 ex = mono_get_exception_argument (#arg, msg); \
92 mono_raise_exception (ex); \
95 #define MONO_CHECK_ARG_NULL(arg) G_STMT_START{ \
99 if (arg) {} /* check if the name exists */ \
100 ex = mono_get_exception_argument_null (#arg); \
101 mono_raise_exception (ex); \
104 /* 16 == default capacity */
105 #define mono_stringbuilder_capacity(sb) ((sb)->str ? ((sb)->str->length) : 16)
108 * Macros which cache the results of lookups locally.
109 * These should be used instead of the original versions, if the __GNUC__
110 * restriction is acceptable.
115 /* namespace and name should be a constant */
116 #define mono_class_from_name_cached(image,namespace,name) ({ \
117 static MonoClass *tmp_klass; \
119 tmp_klass = mono_class_from_name ((image), (namespace), (name)); \
120 g_assert (tmp_klass); \
123 /* name should be a compile-time constant */
124 #define mono_class_get_field_from_name_cached(klass,name) ({ \
125 static MonoClassField *tmp_field; \
127 tmp_field = mono_class_get_field_from_name ((klass), (name)); \
128 g_assert (tmp_field); \
131 /* eclass should be a run-time constant */
132 #define mono_array_class_get_cached(eclass,rank) ({ \
133 static MonoClass *tmp_klass; \
135 tmp_klass = mono_array_class_get ((eclass), (rank)); \
136 g_assert (tmp_klass); \
139 /* eclass should be a run-time constant */
140 #define mono_array_new_cached(domain, eclass, size) mono_array_new_specific (mono_class_vtable ((domain), mono_array_class_get_cached ((eclass), 1)), (size))
144 #define mono_class_from_name_cached(image,namespace,name) mono_class_from_name ((image), (namespace), (name))
145 #define mono_class_get_field_from_name_cached(klass,name) mono_class_get_field_from_name ((klass), (name))
146 #define mono_array_class_get_cached(eclass,rank) mono_array_class_get ((eclass), (rank))
147 #define mono_array_new_cached(domain, eclass, size) mono_array_new_specific (mono_class_vtable ((domain), mono_array_class_get_cached ((eclass), 1)), (size))
153 MonoObject
*identity
;
154 } MonoMarshalByRefObject
;
156 /* This is a copy of System.AppDomain */
157 struct _MonoAppDomain
{
158 MonoMarshalByRefObject mbr
;
166 MonoString
*cached_str
;
178 } MonoArgumentHandle
;
181 MonoMethodSignature
*sig
;
187 struct _MonoException
{
189 /* Stores the IPs and the generic sharing infos
190 (vtable/MRGCTX) of the frames. */
191 MonoArray
*trace_ips
;
192 MonoObject
*inner_ex
;
194 MonoString
*help_link
;
195 MonoString
*class_name
;
196 MonoString
*stack_trace
;
197 MonoString
*remote_stack_trace
;
198 gint32 remote_stack_index
;
206 } MonoSystemException
;
209 MonoSystemException base
;
210 MonoString
*param_name
;
211 } MonoArgumentException
;
214 MonoSystemException base
;
216 MonoString
*type_name
;
217 } MonoTypeLoadException
;
221 MonoObject
*async_state
;
223 MonoObject
*async_delegate
;
225 MonoObject
*object_data
;
226 MonoBoolean sync_completed
;
227 MonoBoolean completed
;
228 MonoBoolean endinvoke_called
;
229 MonoObject
*async_callback
;
230 MonoObject
*execution_context
;
231 MonoObject
*original_context
;
235 MonoMarshalByRefObject object
;
237 MonoBoolean disposed
;
240 /* This is a copy of System.Runtime.Remoting.Messaging.CallType */
243 CallType_BeginInvoke
= 1,
244 CallType_EndInvoke
= 2,
248 /* This corresponds to System.Type */
249 struct _MonoReflectionType
{
255 MonoReflectionType type
;
256 MonoObject
*type_info
;
257 } MonoReflectionMonoType
;
261 MonoReflectionType
*class_to_proxy
;
263 MonoObject
*unwrapped_server
;
264 gint32 target_domain_id
;
265 MonoString
*target_uri
;
266 MonoObject
*object_identity
;
268 MonoObject
*stub_data
;
272 MonoMarshalByRefObject object
;
274 GHashTable
* itf_hash
;
278 MonoRealProxy real_proxy
;
279 MonoComObject
*com_object
;
281 } MonoComInteropProxy
;
286 MonoRemoteClass
*remote_class
;
287 MonoBoolean custom_type_info
;
288 } MonoTransparentProxy
;
292 MonoReflectionMethod
*method
;
295 MonoArray
*arg_types
;
299 MonoAsyncResult
*async_result
;
306 gint32 native_offset
;
307 MonoReflectionMethod
*method
;
308 MonoString
*filename
;
311 MonoString
*internal_method_name
;
315 MONO_THREAD_FLAG_DONT_MANAGE
= 1, // Don't wait for or abort this thread
318 struct _MonoInternalThread
{
320 int lock_thread_id
; /* to be used as the pre-shifted thread id in thin locks */
322 MonoArray
*cached_culture_info
;
324 MonoBoolean threadpool_thread
;
328 MonoException
*abort_exc
;
329 int abort_state_handle
;
330 guint64 tid
; /* This is accessed as a gsize in the code (so it can hold a 64bit pointer on systems that need it), but needs to reserve 64 bits of space on all machines as it corresponds to a field in managed code */
333 gpointer
*static_data
;
336 MonoAppContext
*current_appcontext
;
338 GSList
*appdomain_refs
;
339 /* This is modified using atomic ops, so keep it a gint32 */
340 gint32 interruption_requested
;
341 gpointer suspend_event
;
342 gpointer suspended_event
;
343 gpointer resume_event
;
344 CRITICAL_SECTION
*synch_cs
;
345 MonoBoolean thread_dump_requested
;
346 gpointer end_stack
; /* This is only used when running in the debugger. */
347 MonoBoolean thread_interrupt_requested
;
348 guint8 apartment_state
;
349 gint32 critical_region_level
;
350 guint32 small_id
; /* A small, unique id, used for the hazard pointer table. */
351 MonoThreadManageCallback manage_callback
;
352 MonoException
*pending_exception
;
353 MonoThread
*root_domain_thread
;
354 gpointer interrupt_on_stop
;
357 * These fields are used to avoid having to increment corlib versions
358 * when a new field is added to the unmanaged MonoThread structure.
367 struct _MonoInternalThread
*internal_thread
;
368 MonoObject
*start_obj
;
369 MonoObject
*ec_to_set
;
374 MonoReflectionType
*type
;
376 } MonoSerializationEntry
;
380 MonoObject
*additional
;
381 } MonoStreamingContext
;
385 MonoBoolean readOnly
;
386 MonoString
*AMDesignator
;
387 MonoString
*PMDesignator
;
388 MonoString
*DateSeparator
;
389 MonoString
*TimeSeparator
;
390 MonoString
*ShortDatePattern
;
391 MonoString
*LongDatePattern
;
392 MonoString
*ShortTimePattern
;
393 MonoString
*LongTimePattern
;
394 MonoString
*MonthDayPattern
;
395 MonoString
*YearMonthPattern
;
396 MonoString
*FullDateTimePattern
;
397 MonoString
*RFC1123Pattern
;
398 MonoString
*SortableDateTimePattern
;
399 MonoString
*UniversalSortableDateTimePattern
;
400 guint32 FirstDayOfWeek
;
401 MonoObject
*Calendar
;
402 guint32 CalendarWeekRule
;
403 MonoArray
*AbbreviatedDayNames
;
405 MonoArray
*MonthNames
;
406 MonoArray
*AbbreviatedMonthNames
;
407 MonoArray
*ShortDatePatterns
;
408 MonoArray
*LongDatePatterns
;
409 MonoArray
*ShortTimePatterns
;
410 MonoArray
*LongTimePatterns
;
411 MonoArray
*MonthDayPatterns
;
412 MonoArray
*YearMonthPatterns
;
413 MonoArray
*shortDayNames
;
414 } MonoDateTimeFormatInfo
;
419 MonoBoolean readOnly
;
420 MonoString
*decimalFormats
;
421 MonoString
*currencyFormats
;
422 MonoString
*percentFormats
;
423 MonoString
*digitPattern
;
424 MonoString
*zeroPattern
;
425 gint32 currencyDecimalDigits
;
426 MonoString
*currencyDecimalSeparator
;
427 MonoString
*currencyGroupSeparator
;
428 MonoArray
*currencyGroupSizes
;
429 gint32 currencyNegativePattern
;
430 gint32 currencyPositivePattern
;
431 MonoString
*currencySymbol
;
432 MonoString
*naNSymbol
;
433 MonoString
*negativeInfinitySymbol
;
434 MonoString
*negativeSign
;
435 guint32 numberDecimalDigits
;
436 MonoString
*numberDecimalSeparator
;
437 MonoString
*numberGroupSeparator
;
438 MonoArray
*numberGroupSizes
;
439 gint32 numberNegativePattern
;
440 gint32 percentDecimalDigits
;
441 MonoString
*percentDecimalSeparator
;
442 MonoString
*percentGroupSeparator
;
443 MonoArray
*percentGroupSizes
;
444 gint32 percentNegativePattern
;
445 gint32 percentPositivePattern
;
446 MonoString
*percentSymbol
;
447 MonoString
*perMilleSymbol
;
448 MonoString
*positiveInfinitySymbol
;
449 MonoString
*positiveSign
;
450 } MonoNumberFormatInfo
;
455 MonoString
*icu_name
;
456 gpointer ICU_collator
;
461 MonoBoolean is_read_only
;
464 gint32 specific_lcid
;
465 gint32 datetime_index
;
467 MonoBoolean use_user_override
;
468 MonoNumberFormatInfo
*number_format
;
469 MonoDateTimeFormatInfo
*datetime_format
;
470 MonoObject
*textinfo
;
472 MonoString
*displayname
;
473 MonoString
*englishname
;
474 MonoString
*nativename
;
475 MonoString
*iso3lang
;
476 MonoString
*iso2lang
;
477 MonoString
*icu_name
;
478 MonoString
*win3lang
;
479 MonoString
*territory
;
480 MonoCompareInfo
*compareinfo
;
481 const gint32
*calendar_data
;
482 const void* text_info_data
;
488 MonoString
*iso2name
;
489 MonoString
*iso3name
;
490 MonoString
*win3name
;
491 MonoString
*english_name
;
492 MonoString
*currency_symbol
;
493 MonoString
*iso_currency_symbol
;
494 MonoString
*currency_english_name
;
508 } MonoInterfaceTypeAttribute
;
511 * Callbacks supplied by the runtime and called by the modules in metadata/
512 * This interface is easier to extend than adding a new function type +
513 * a new 'install' function for every callback.
516 gpointer (*create_ftnptr
) (MonoDomain
*domain
, gpointer addr
);
517 gpointer (*get_addr_from_ftnptr
) (gpointer descr
);
518 char* (*get_runtime_build_info
) (void);
519 gpointer (*get_vtable_trampoline
) (int slot_index
);
520 } MonoRuntimeCallbacks
;
522 /* used to free a dynamic method */
523 typedef void (*MonoFreeMethodFunc
) (MonoDomain
*domain
, MonoMethod
*method
);
525 /* Used to initialize the method pointers inside vtables */
526 typedef gboolean (*MonoInitVTableFunc
) (MonoVTable
*vtable
);
528 void mono_set_pending_exception (MonoException
*exc
) MONO_INTERNAL
;
530 /* remoting and async support */
533 mono_async_result_new (MonoDomain
*domain
, HANDLE handle
,
534 MonoObject
*state
, gpointer data
, MonoObject
*object_data
) MONO_INTERNAL
;
537 mono_wait_handle_new (MonoDomain
*domain
, HANDLE handle
) MONO_INTERNAL
;
540 mono_wait_handle_get_handle (MonoWaitHandle
*handle
) MONO_INTERNAL
;
543 mono_message_init (MonoDomain
*domain
, MonoMethodMessage
*this_obj
,
544 MonoReflectionMethod
*method
, MonoArray
*out_args
) MONO_INTERNAL
;
547 mono_remoting_invoke (MonoObject
*real_proxy
, MonoMethodMessage
*msg
,
548 MonoObject
**exc
, MonoArray
**out_args
) MONO_INTERNAL
;
551 mono_message_invoke (MonoObject
*target
, MonoMethodMessage
*msg
,
552 MonoObject
**exc
, MonoArray
**out_args
) MONO_INTERNAL
;
555 mono_method_call_message_new (MonoMethod
*method
, gpointer
*params
, MonoMethod
*invoke
,
556 MonoDelegate
**cb
, MonoObject
**state
) MONO_INTERNAL
;
559 mono_method_return_message_restore (MonoMethod
*method
, gpointer
*params
, MonoArray
*out_args
) MONO_INTERNAL
;
562 mono_delegate_ctor_with_method (MonoObject
*this, MonoObject
*target
, gpointer addr
, MonoMethod
*method
) MONO_INTERNAL
;
565 mono_delegate_ctor (MonoObject
*this_obj
, MonoObject
*target
, gpointer addr
) MONO_INTERNAL
;
568 mono_class_get_allocation_ftn (MonoVTable
*vtable
, gboolean for_box
, gboolean
*pass_size_in_words
) MONO_INTERNAL
;
571 mono_runtime_free_method (MonoDomain
*domain
, MonoMethod
*method
) MONO_INTERNAL
;
573 /* runtime initialization functions */
574 typedef void (*MonoExceptionFunc
) (MonoException
*ex
);
577 mono_install_handler (MonoExceptionFunc func
) MONO_INTERNAL
;
580 mono_install_runtime_invoke (MonoInvokeFunc func
) MONO_INTERNAL
;
583 mono_install_compile_method (MonoCompileFunc func
) MONO_INTERNAL
;
586 mono_install_free_method (MonoFreeMethodFunc func
) MONO_INTERNAL
;
589 mono_install_callbacks (MonoRuntimeCallbacks
*cbs
) MONO_INTERNAL
;
591 MonoRuntimeCallbacks
*
592 mono_get_runtime_callbacks (void) MONO_INTERNAL
;
595 mono_type_initialization_init (void) MONO_INTERNAL
;
598 mono_type_initialization_cleanup (void) MONO_INTERNAL
;
601 mono_thread_get_tls_key (void) MONO_INTERNAL
;
604 mono_thread_get_tls_offset (void) MONO_INTERNAL
;
607 mono_domain_get_tls_key (void) MONO_INTERNAL
;
610 mono_domain_get_tls_offset (void) MONO_INTERNAL
;
612 /* Reflection and Reflection.Emit support */
615 * Handling System.Type objects:
617 * Fields defined as System.Type in managed code should be defined as MonoObject*
618 * in unmanaged structures, and the monotype_cast () function should be used for
619 * casting them to MonoReflectionType* to avoid crashes/security issues when
620 * encountering instances of user defined subclasses of System.Type.
623 #define IS_MONOTYPE(obj) (!(obj) || (((MonoObject*)(obj))->vtable->klass->image == mono_defaults.corlib && ((MonoReflectionType*)(obj))->type != NULL))
626 * Make sure the argument, which should be a System.Type is a System.MonoType object
627 * or equivalent, and not an instance of
628 * a user defined subclass of System.Type. This should be used in places were throwing
629 * an exception is safe.
631 #define CHECK_MONOTYPE(obj) do { \
632 if (!IS_MONOTYPE (obj)) \
633 mono_raise_exception (mono_get_exception_not_supported ("User defined subclasses of System.Type are not yet supported")); \
636 /* This should be used for accessing members of Type[] arrays */
637 #define mono_type_array_get(arr,index) monotype_cast (mono_array_get ((arr), gpointer, (index)))
640 * Cast an object to MonoReflectionType, making sure it is a System.MonoType or
643 static inline MonoReflectionType
*
644 monotype_cast (MonoObject
*obj
)
646 g_assert (IS_MONOTYPE (obj
));
648 return (MonoReflectionType
*)obj
;
652 * The following structure must match the C# implementation in our corlib.
655 struct _MonoReflectionMethod
{
659 MonoReflectionType
*reftype
;
662 typedef struct _MonoReflectionGenericMethod MonoReflectionGenericMethod
;
663 struct _MonoReflectionGenericMethod
{
664 MonoReflectionMethod method
;
667 struct _MonoDelegate
{
669 /* The compiled code of the target method */
671 /* The invoke code */
672 gpointer invoke_impl
;
675 gpointer delegate_trampoline
;
677 * If non-NULL, this points to a memory location which stores the address of
678 * the compiled code of the method, or NULL if it is not yet compiled.
680 guint8
**method_code
;
681 MonoReflectionMethod
*method_info
;
682 MonoReflectionMethod
*original_method_info
;
686 typedef struct _MonoMulticastDelegate MonoMulticastDelegate
;
687 struct _MonoMulticastDelegate
{
688 MonoDelegate delegate
;
689 MonoMulticastDelegate
*prev
;
692 struct _MonoReflectionField
{
695 MonoClassField
*field
;
697 MonoReflectionType
*type
;
701 struct _MonoReflectionProperty
{
704 MonoProperty
*property
;
707 /*This is System.EventInfo*/
708 struct _MonoReflectionEvent
{
710 MonoObject
*cached_add_event
;
714 MonoReflectionEvent object
;
717 } MonoReflectionMonoEvent
;
721 MonoReflectionType
*ClassImpl
;
722 MonoObject
*DefaultValueImpl
;
723 MonoObject
*MemberImpl
;
724 MonoString
*NameImpl
;
727 MonoObject
*MarshalAsImpl
;
728 } MonoReflectionParameter
;
730 struct _MonoReflectionMethodBody
{
735 MonoBoolean init_locals
;
736 guint32 local_var_sig_token
;
740 struct _MonoReflectionAssembly
{
742 MonoAssembly
*assembly
;
743 MonoObject
*resolve_event_holder
;
745 MonoObject
*evidence
; /* Evidence */
746 MonoObject
*minimum
; /* PermissionSet - for SecurityAction.RequestMinimum */
747 MonoObject
*optional
; /* PermissionSet - for SecurityAction.RequestOptional */
748 MonoObject
*refuse
; /* PermissionSet - for SecurityAction.RequestRefuse */
749 MonoObject
*granted
; /* PermissionSet - for the resolved assembly granted permissions */
750 MonoObject
*denied
; /* PermissionSet - for the resolved assembly denied permissions */
752 MonoBoolean from_byte_array
;
757 MonoReflectionType
*utype
;
763 MonoReflectionType
*parent
;
764 MonoReflectionType
*ret
;
771 MonoReflectionType
*parent
;
773 MonoReflectionMethod
*get
;
774 MonoReflectionMethod
*set
;
779 MonoReflectionType
*declaring_type
;
780 MonoReflectionType
*reflected_type
;
782 MonoReflectionMethod
*add_method
;
783 MonoReflectionMethod
*remove_method
;
784 MonoReflectionMethod
*raise_method
;
786 MonoArray
*other_methods
;
791 MonoString
*name_space
;
792 MonoReflectionType
*etype
;
793 MonoReflectionType
*nested_in
;
794 MonoReflectionAssembly
*assembly
;
796 MonoBoolean isprimitive
;
802 } MonoReflectionILTokenInfo
;
811 MonoArray
*ex_handlers
;
812 gint32 num_token_fixups
;
813 MonoArray
*token_fixups
;
814 } MonoReflectionILGen
;
821 } MonoILExceptionInfo
;
828 gint32 filter_offset
;
829 } MonoILExceptionBlock
;
833 MonoObject
*catch_type
;
834 gint32 filter_offset
;
838 gint32 handler_offset
;
839 gint32 handler_length
;
840 } MonoReflectionExceptionHandlingClause
;
844 MonoReflectionType
*local_type
;
845 MonoBoolean is_pinned
;
847 } MonoReflectionLocalVariableInfo
;
851 * Must have the same layout as MonoReflectionLocalVariableInfo, since
852 * LocalBuilder inherits from it under net 2.0.
856 MonoBoolean is_pinned
;
859 } MonoReflectionLocalBuilder
;
868 MonoString
*marshaltype
;
869 MonoObject
*marshaltyperef
;
871 MonoBoolean has_size
;
872 } MonoReflectionMarshal
;
879 MonoReflectionMarshal
*marshal_info
;
883 MonoObject
*def_value
;
884 } MonoReflectionParamBuilder
;
889 MonoReflectionILGen
*ilgen
;
890 MonoArray
*parameters
;
898 MonoBoolean init_locals
;
899 MonoArray
*param_modreq
;
900 MonoArray
*param_modopt
;
901 MonoArray
*permissions
;
902 } MonoReflectionCtorBuilder
;
908 MonoArray
*parameters
;
914 MonoReflectionILGen
*ilgen
;
918 MonoReflectionMethod
*override_method
;
920 MonoString
*dllentry
;
925 MonoBoolean init_locals
;
926 MonoGenericContainer
*generic_container
;
927 MonoArray
*generic_params
;
928 MonoArray
*return_modreq
;
929 MonoArray
*return_modopt
;
930 MonoArray
*param_modreq
;
931 MonoArray
*param_modopt
;
932 MonoArray
*permissions
;
933 } MonoReflectionMethodBuilder
;
938 MonoReflectionType
*parent
;
939 MonoReflectionType
*ret
;
940 MonoArray
*parameters
;
944 } MonoReflectionArrayMethod
;
949 MonoString
*filename
;
953 } MonoReflectionResource
;
960 } MonoReflectionWin32Resource
;
965 } MonoReflectionPermissionSet
;
968 MonoReflectionAssembly assembly
;
969 MonoDynamicAssembly
*dynamic_assembly
;
970 MonoReflectionMethod
*entry_point
;
975 MonoArray
*resources
;
976 MonoArray
*public_key
;
982 MonoBoolean delay_sign
;
984 MonoArray
*loaded_modules
;
985 MonoArray
*win32_resources
;
987 MonoArray
*permissions_minimum
;
988 MonoArray
*permissions_optional
;
989 MonoArray
*permissions_refused
;
992 MonoBoolean corlib_internal
;
993 MonoArray
*type_forwarders
;
994 MonoArray
*pktoken
; /* as hexadecimal byte[] */
995 } MonoReflectionAssemblyBuilder
;
1002 MonoObject
*def_value
;
1005 MonoReflectionType
*typeb
;
1006 MonoArray
*rva_data
;
1008 MonoReflectionMarshal
*marshal_info
;
1009 MonoClassField
*handle
;
1012 } MonoReflectionFieldBuilder
;
1019 MonoArray
*parameters
;
1021 MonoObject
*def_value
;
1022 MonoReflectionMethodBuilder
*set_method
;
1023 MonoReflectionMethodBuilder
*get_method
;
1025 } MonoReflectionPropertyBuilder
;
1027 struct _MonoReflectionModule
{
1030 MonoReflectionAssembly
*assembly
;
1033 MonoString
*scopename
;
1034 MonoBoolean is_resource
;
1039 MonoReflectionModule module
;
1040 MonoDynamicImage
*dynamic_image
;
1046 MonoReflectionAssemblyBuilder
*assemblyb
;
1047 MonoArray
*global_methods
;
1048 MonoArray
*global_fields
;
1050 MonoArray
*resources
;
1051 } MonoReflectionModuleBuilder
;
1054 MonoReflectionType type
;
1058 MonoReflectionType
*nesting_type
;
1059 MonoArray
*interfaces
;
1063 MonoArray
*properties
;
1068 MonoArray
*subtypes
;
1071 MonoReflectionModuleBuilder
*module
;
1073 gint32 packing_size
;
1074 MonoGenericContainer
*generic_container
;
1075 MonoArray
*generic_params
;
1076 MonoArray
*permissions
;
1077 MonoReflectionType
*created
;
1078 } MonoReflectionTypeBuilder
;
1081 MonoReflectionType type
;
1082 MonoReflectionType
*element_type
;
1084 } MonoReflectionArrayType
;
1087 MonoReflectionType type
;
1088 MonoReflectionType
*element_type
;
1089 } MonoReflectionDerivedType
;
1092 MonoReflectionType type
;
1093 MonoReflectionTypeBuilder
*tbuilder
;
1094 MonoReflectionMethodBuilder
*mbuilder
;
1097 MonoReflectionType
*base_type
;
1098 MonoArray
*iface_constraints
;
1101 } MonoReflectionGenericParam
;
1103 typedef struct _MonoReflectionGenericClass MonoReflectionGenericClass
;
1104 struct _MonoReflectionGenericClass
{
1105 MonoReflectionType type
;
1106 MonoReflectionType
*generic_type
; /*Can be either a MonoType or a TypeBuilder*/
1107 MonoArray
*type_arguments
;
1108 guint32 initialized
;
1114 MonoString
*codebase
;
1115 gint32 major
, minor
, build
, revision
;
1116 MonoObject
*cultureInfo
;
1119 MonoObject
*keypair
;
1120 MonoArray
*publicKey
;
1121 MonoArray
*keyToken
;
1122 guint32 versioncompat
;
1123 MonoObject
*version
;
1124 guint32 processor_architecture
;
1125 } MonoReflectionAssemblyName
;
1130 MonoReflectionType
*type
;
1131 MonoReflectionTypeBuilder
*typeb
;
1133 MonoReflectionMethodBuilder
*add_method
;
1134 MonoReflectionMethodBuilder
*remove_method
;
1135 MonoReflectionMethodBuilder
*raise_method
;
1136 MonoArray
*other_methods
;
1139 } MonoReflectionEventBuilder
;
1143 MonoReflectionMethod
*ctor
;
1145 } MonoReflectionCustomAttr
;
1152 MonoString
*entry_point
;
1153 MonoBoolean exact_spelling
;
1154 MonoBoolean preserve_sig
;
1155 MonoBoolean set_last_error
;
1156 MonoBoolean best_fit_mapping
;
1157 MonoBoolean throw_on_unmappable
;
1158 } MonoReflectionDllImportAttribute
;
1164 MonoBoolean set_last_error
;
1165 MonoBoolean best_fit_mapping
;
1166 MonoBoolean throw_on_unmappable
;
1167 } MonoReflectionUnmanagedFunctionPointerAttribute
;
1172 } MonoReflectionGuidAttribute
;
1176 MonoMethod
*mhandle
;
1178 MonoReflectionType
*rtype
;
1179 MonoArray
*parameters
;
1182 MonoReflectionModule
*module
;
1183 MonoBoolean skip_visibility
;
1184 MonoBoolean init_locals
;
1185 MonoReflectionILGen
*ilgen
;
1188 GSList
*referenced_by
;
1189 MonoReflectionType
*owner
;
1190 } MonoReflectionDynamicMethod
;
1194 MonoReflectionModuleBuilder
*module
;
1195 MonoArray
*arguments
;
1197 MonoReflectionType
*return_type
;
1199 guint32 unmanaged_call_conv
;
1202 } MonoReflectionSigHelper
;
1206 MonoReflectionGenericClass
*inst
;
1207 MonoObject
*fb
; /*can be either a MonoField or a FieldBuilder*/
1208 } MonoReflectionFieldOnTypeBuilderInst
;
1212 MonoReflectionGenericClass
*inst
;
1213 MonoObject
*cb
; /*can be either a MonoCMethod or ConstructorBuilder*/
1214 } MonoReflectionCtorOnTypeBuilderInst
;
1218 MonoReflectionType
*inst
;
1219 MonoObject
*mb
; /*can be either a MonoMethod or MethodBuilder*/
1220 MonoArray
*method_args
;
1221 MonoReflectionMethodBuilder
*generic_method_definition
;
1222 } MonoReflectionMethodOnTypeBuilderInst
;
1226 MonoBoolean visible
;
1227 } MonoReflectionComVisibleAttribute
;
1230 RESOURCE_LOCATION_EMBEDDED
= 1,
1231 RESOURCE_LOCATION_ANOTHER_ASSEMBLY
= 2,
1232 RESOURCE_LOCATION_IN_MANIFEST
= 4
1237 MonoReflectionAssembly
*assembly
;
1238 MonoString
*filename
;
1240 } MonoManifestResourceInfo
;
1242 /* A boxed IntPtr */
1248 /* Keep in sync with System.GenericParameterAttributes */
1250 GENERIC_PARAMETER_ATTRIBUTE_NON_VARIANT
= 0,
1251 GENERIC_PARAMETER_ATTRIBUTE_COVARIANT
= 1,
1252 GENERIC_PARAMETER_ATTRIBUTE_CONTRAVARIANT
= 2,
1253 GENERIC_PARAMETER_ATTRIBUTE_VARIANCE_MASK
= 3,
1255 GENERIC_PARAMETER_ATTRIBUTE_NO_SPECIAL_CONSTRAINT
= 0,
1256 GENERIC_PARAMETER_ATTRIBUTE_REFERENCE_TYPE_CONSTRAINT
= 4,
1257 GENERIC_PARAMETER_ATTRIBUTE_VALUE_TYPE_CONSTRAINT
= 8,
1258 GENERIC_PARAMETER_ATTRIBUTE_CONSTRUCTOR_CONSTRAINT
= 16,
1259 GENERIC_PARAMETER_ATTRIBUTE_SPECIAL_CONSTRAINTS_MASK
= 28
1260 } GenericParameterAttributes
;
1264 MonoClassField
*field
;
1268 void mono_image_create_pefile (MonoReflectionModuleBuilder
*module
, HANDLE file
) MONO_INTERNAL
;
1269 void mono_image_basic_init (MonoReflectionAssemblyBuilder
*assembly
) MONO_INTERNAL
;
1270 MonoReflectionModule
* mono_image_load_module_dynamic (MonoReflectionAssemblyBuilder
*assembly
, MonoString
*file_name
) MONO_INTERNAL
;
1271 guint32
mono_image_insert_string (MonoReflectionModuleBuilder
*module
, MonoString
*str
) MONO_INTERNAL
;
1272 guint32
mono_image_create_token (MonoDynamicImage
*assembly
, MonoObject
*obj
, gboolean create_methodspec
, gboolean register_token
) MONO_INTERNAL
;
1273 guint32
mono_image_create_method_token (MonoDynamicImage
*assembly
, MonoObject
*obj
, MonoArray
*opt_param_types
) MONO_INTERNAL
;
1274 void mono_image_module_basic_init (MonoReflectionModuleBuilder
*module
) MONO_INTERNAL
;
1275 void mono_image_register_token (MonoDynamicImage
*assembly
, guint32 token
, MonoObject
*obj
) MONO_INTERNAL
;
1276 void mono_dynamic_image_free (MonoDynamicImage
*image
) MONO_INTERNAL
;
1277 void mono_image_set_wrappers_type (MonoReflectionModuleBuilder
*mb
, MonoReflectionType
*type
) MONO_INTERNAL
;
1279 void mono_reflection_setup_internal_class (MonoReflectionTypeBuilder
*tb
) MONO_INTERNAL
;
1281 void mono_reflection_create_internal_class (MonoReflectionTypeBuilder
*tb
) MONO_INTERNAL
;
1283 void mono_reflection_setup_generic_class (MonoReflectionTypeBuilder
*tb
) MONO_INTERNAL
;
1285 void mono_reflection_create_generic_class (MonoReflectionTypeBuilder
*tb
) MONO_INTERNAL
;
1287 MonoReflectionType
* mono_reflection_create_runtime_class (MonoReflectionTypeBuilder
*tb
) MONO_INTERNAL
;
1289 void mono_reflection_get_dynamic_overrides (MonoClass
*klass
, MonoMethod
***overrides
, int *num_overrides
) MONO_INTERNAL
;
1291 void mono_reflection_create_dynamic_method (MonoReflectionDynamicMethod
*m
) MONO_INTERNAL
;
1292 void mono_reflection_destroy_dynamic_method (MonoReflectionDynamicMethod
*mb
) MONO_INTERNAL
;
1294 void mono_reflection_initialize_generic_parameter (MonoReflectionGenericParam
*gparam
) MONO_INTERNAL
;
1295 void mono_reflection_create_unmanaged_type (MonoReflectionType
*type
) MONO_INTERNAL
;
1296 void mono_reflection_register_with_runtime (MonoReflectionType
*type
) MONO_INTERNAL
;
1298 void mono_reflection_create_custom_attr_data_args (MonoImage
*image
, MonoMethod
*method
, const guchar
*data
, guint32 len
, MonoArray
**typed_args
, MonoArray
**named_args
, CattrNamedArg
**named_arg_info
) MONO_INTERNAL
;
1300 MonoArray
* mono_param_get_objects_internal (MonoDomain
*domain
, MonoMethod
*method
, MonoClass
*refclass
) MONO_INTERNAL
;
1303 mono_class_bind_generic_parameters (MonoClass
*klass
, int type_argc
, MonoType
**types
, gboolean is_dynamic
) MONO_INTERNAL
;
1305 mono_reflection_bind_generic_parameters (MonoReflectionType
*type
, int type_argc
, MonoType
**types
) MONO_INTERNAL
;
1306 MonoReflectionMethod
*
1307 mono_reflection_bind_generic_method_parameters (MonoReflectionMethod
*method
, MonoArray
*types
) MONO_INTERNAL
;
1309 mono_reflection_generic_class_initialize (MonoReflectionGenericClass
*type
, MonoArray
*methods
, MonoArray
*ctors
, MonoArray
*fields
, MonoArray
*properties
, MonoArray
*events
) MONO_INTERNAL
;
1310 MonoReflectionEvent
*
1311 mono_reflection_event_builder_get_event_info (MonoReflectionTypeBuilder
*tb
, MonoReflectionEventBuilder
*eb
) MONO_INTERNAL
;
1313 MonoArray
*mono_reflection_sighelper_get_signature_local (MonoReflectionSigHelper
*sig
) MONO_INTERNAL
;
1315 MonoArray
*mono_reflection_sighelper_get_signature_field (MonoReflectionSigHelper
*sig
) MONO_INTERNAL
;
1317 MonoReflectionMarshal
* mono_reflection_marshal_from_marshal_spec (MonoDomain
*domain
, MonoClass
*klass
, MonoMarshalSpec
*spec
) MONO_INTERNAL
;
1320 mono_reflection_lookup_dynamic_token (MonoImage
*image
, guint32 token
, gboolean valid_token
, MonoClass
**handle_class
, MonoGenericContext
*context
) MONO_INTERNAL
;
1323 mono_reflection_call_is_assignable_to (MonoClass
*klass
, MonoClass
*oklass
) MONO_INTERNAL
;
1326 mono_reflection_is_valid_dynamic_token (MonoDynamicImage
*image
, guint32 token
) MONO_INTERNAL
;
1329 mono_reflection_type_get_handle (MonoReflectionType
*ref
) MONO_INTERNAL
;
1332 mono_image_build_metadata (MonoReflectionModuleBuilder
*module
) MONO_INTERNAL
;
1335 mono_get_constant_value_from_blob (MonoDomain
* domain
, MonoTypeEnum type
, const char *blob
, void *value
) MONO_INTERNAL
;
1338 mono_release_type_locks (MonoInternalThread
*thread
) MONO_INTERNAL
;
1341 mono_string_to_utf8_mp (MonoMemPool
*mp
, MonoString
*s
, MonoError
*error
) MONO_INTERNAL
;
1344 mono_string_to_utf8_image (MonoImage
*image
, MonoString
*s
, MonoError
*error
) MONO_INTERNAL
;
1348 mono_array_clone_in_domain (MonoDomain
*domain
, MonoArray
*array
) MONO_INTERNAL
;
1351 mono_array_full_copy (MonoArray
*src
, MonoArray
*dest
) MONO_INTERNAL
;
1354 mono_array_calc_byte_len (MonoClass
*class, mono_array_size_t len
, mono_array_size_t
*res
) MONO_INTERNAL
;
1357 mono_remote_class_vtable (MonoDomain
*domain
, MonoRemoteClass
*remote_class
, MonoRealProxy
*real_proxy
) MONO_INTERNAL
;
1360 mono_upgrade_remote_class (MonoDomain
*domain
, MonoObject
*tproxy
, MonoClass
*klass
) MONO_INTERNAL
;
1363 mono_create_ftnptr (MonoDomain
*domain
, gpointer addr
) MONO_INTERNAL
;
1366 mono_get_addr_from_ftnptr (gpointer descr
) MONO_INTERNAL
;
1369 mono_nullable_init (guint8
*buf
, MonoObject
*value
, MonoClass
*klass
) MONO_INTERNAL
;
1372 mono_nullable_box (guint8
*buf
, MonoClass
*klass
) MONO_INTERNAL
;
1374 #ifdef MONO_SMALL_CONFIG
1375 #define MONO_IMT_SIZE 9
1377 #define MONO_IMT_SIZE 19
1382 gpointer target_code
;
1385 typedef struct _MonoImtBuilderEntry
{
1387 struct _MonoImtBuilderEntry
*next
;
1388 MonoImtItemValue value
;
1390 guint8 has_target_code
: 1;
1391 } MonoImtBuilderEntry
;
1393 typedef struct _MonoIMTCheckItem MonoIMTCheckItem
;
1395 struct _MonoIMTCheckItem
{
1397 int check_target_idx
;
1398 MonoImtItemValue value
;
1400 guint8
*code_target
;
1402 guint8 compare_done
;
1404 guint8 short_branch
;
1405 guint8 has_target_code
;
1408 typedef gpointer (*MonoImtThunkBuilder
) (MonoVTable
*vtable
, MonoDomain
*domain
,
1409 MonoIMTCheckItem
**imt_entries
, int count
, gpointer fail_trunk
);
1412 mono_install_imt_thunk_builder (MonoImtThunkBuilder func
) MONO_INTERNAL
;
1415 mono_install_imt_trampoline (gpointer tramp
) MONO_INTERNAL
;
1418 mono_vtable_build_imt_slot (MonoVTable
* vtable
, int imt_slot
) MONO_INTERNAL
;
1421 mono_method_get_imt_slot (MonoMethod
*method
) MONO_INTERNAL
;
1424 mono_method_add_generic_virtual_invocation (MonoDomain
*domain
, MonoVTable
*vtable
,
1425 gpointer
*vtable_slot
,
1426 MonoMethod
*method
, gpointer code
) MONO_INTERNAL
;
1429 mono_method_alloc_generic_virtual_thunk (MonoDomain
*domain
, int size
) MONO_INTERNAL
;
1432 MONO_UNHANDLED_POLICY_LEGACY
,
1433 MONO_UNHANDLED_POLICY_CURRENT
1434 } MonoRuntimeUnhandledExceptionPolicy
;
1436 MonoRuntimeUnhandledExceptionPolicy
1437 mono_runtime_unhandled_exception_policy_get (void) MONO_INTERNAL
;
1439 mono_runtime_unhandled_exception_policy_set (MonoRuntimeUnhandledExceptionPolicy policy
) MONO_INTERNAL
;
1442 mono_class_try_get_vtable (MonoDomain
*domain
, MonoClass
*class) MONO_INTERNAL
;
1445 mono_runtime_class_init_full (MonoVTable
*vtable
, gboolean raise_exception
) MONO_INTERNAL
;
1448 mono_method_clear_object (MonoDomain
*domain
, MonoMethod
*method
) MONO_INTERNAL
;
1451 mono_class_compute_gc_descriptor (MonoClass
*class) MONO_INTERNAL
;
1454 mono_object_xdomain_representation (MonoObject
*obj
, MonoDomain
*target_domain
, MonoObject
**exc
) MONO_INTERNAL
;
1457 mono_string_to_utf8_checked (MonoString
*s
, MonoError
*error
) MONO_INTERNAL
;
1460 mono_class_is_reflection_method_or_constructor (MonoClass
*class) MONO_INTERNAL
;
1463 mono_get_object_from_blob (MonoDomain
*domain
, MonoType
*type
, const char *blob
) MONO_INTERNAL
;
1466 mono_class_get_ref_info (MonoClass
*klass
) MONO_INTERNAL
;
1469 mono_class_set_ref_info (MonoClass
*klass
, gpointer obj
) MONO_INTERNAL
;
1472 mono_class_free_ref_info (MonoClass
*klass
) MONO_INTERNAL
;
1474 #endif /* __MONO_OBJECT_INTERNALS_H__ */