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/io-layer/io-layer.h>
9 #include "mono/utils/mono-compiler.h"
12 * We should find a better place for this stuff. We can't put it in mono-compiler.h,
13 * since that is included by libgc.
16 #define G_LIKELY(a) (a)
17 #define G_UNLIKELY(a) (a)
21 * glib defines this macro and uses it in the definition of G_LIKELY, and thus,
22 * g_assert (). The macro expands to a complex piece of code, preventing some
23 * gcc versions like 4.3.0 from handling the __builtin_expect construct properly,
24 * causing the generation of the unlikely branch into the middle of the code.
26 #ifdef _G_BOOLEAN_EXPR
27 #undef _G_BOOLEAN_EXPR
28 #define _G_BOOLEAN_EXPR(expr) (gsize)(expr)
33 #define mono_assert(expr) G_STMT_START{ \
37 char *msg = g_strdup_printf ("file %s: line %d (%s): " \
38 "assertion failed: (%s)", __FILE__, __LINE__, \
39 __PRETTY_FUNCTION__, #expr); \
40 ex = mono_get_exception_execution_engine (msg); \
42 mono_raise_exception (ex); \
45 #define mono_assert_not_reached() G_STMT_START{ \
47 char *msg = g_strdup_printf ("file %s: line %d (%s): " \
48 "should not be reached", __FILE__, __LINE__, __PRETTY_FUNCTION__); \
49 ex = mono_get_exception_execution_engine (msg); \
51 mono_raise_exception (ex); \
54 #define mono_assert(expr) G_STMT_START{ \
58 char *msg = g_strdup_printf ("file %s: line %d: " \
59 "assertion failed: (%s)", __FILE__, __LINE__, \
61 ex = mono_get_exception_execution_engine (msg); \
63 mono_raise_exception (ex); \
66 #define mono_assert_not_reached() G_STMT_START{ \
68 char *msg = g_strdup_printf ("file %s: line %d): " \
69 "should not be reached", __FILE__, __LINE__); \
70 ex = mono_get_exception_execution_engine (msg); \
72 mono_raise_exception (ex); \
76 #define mono_assert(expr) g_assert(expr)
77 #define mono_assert_not_reached() g_assert_not_reached()
80 #define MONO_CHECK_ARG(arg, expr) G_STMT_START{ \
84 char *msg = g_strdup_printf ("assertion `%s' failed", \
86 if (arg) {} /* check if the name exists */ \
87 ex = mono_get_exception_argument (#arg, msg); \
89 mono_raise_exception (ex); \
92 #define MONO_CHECK_ARG_NULL(arg) G_STMT_START{ \
96 if (arg) {} /* check if the name exists */ \
97 ex = mono_get_exception_argument_null (#arg); \
98 mono_raise_exception (ex); \
102 /* 16 == default capacity */
103 #define mono_stringbuilder_capacity(sb) ((sb)->str ? ((sb)->str->length) : 16)
107 MonoObject
*identity
;
108 } MonoMarshalByRefObject
;
110 /* This is a copy of System.AppDomain */
111 struct _MonoAppDomain
{
112 MonoMarshalByRefObject mbr
;
120 MonoString
*cached_str
;
132 } MonoArgumentHandle
;
135 MonoMethodSignature
*sig
;
141 struct _MonoException
{
143 /* Stores the IPs and the generic sharing infos
144 (vtable/MRGCTX) of the frames. */
145 MonoArray
*trace_ips
;
146 MonoObject
*inner_ex
;
148 MonoString
*help_link
;
149 MonoString
*class_name
;
150 MonoString
*stack_trace
;
151 MonoString
*remote_stack_trace
;
152 gint32 remote_stack_index
;
160 } MonoSystemException
;
163 MonoSystemException base
;
164 MonoString
*param_name
;
165 } MonoArgumentException
;
168 MonoSystemException base
;
170 MonoString
*type_name
;
171 } MonoTypeLoadException
;
175 MonoObject
*async_state
;
177 MonoObject
*async_delegate
;
179 MonoObject
*object_data
;
180 MonoBoolean sync_completed
;
181 MonoBoolean completed
;
182 MonoBoolean endinvoke_called
;
183 MonoObject
*async_callback
;
184 MonoObject
*execution_context
;
185 MonoObject
*original_context
;
189 MonoMarshalByRefObject object
;
191 MonoBoolean disposed
;
194 /* This is a copy of System.Runtime.Remoting.Messaging.CallType */
197 CallType_BeginInvoke
= 1,
198 CallType_EndInvoke
= 2,
202 struct _MonoReflectionType
{
209 MonoReflectionType
*class_to_proxy
;
211 MonoObject
*unwrapped_server
;
212 gint32 target_domain_id
;
213 MonoString
*target_uri
;
214 MonoObject
*object_identity
;
216 MonoObject
*stub_data
;
220 MonoMarshalByRefObject object
;
222 GHashTable
* itf_hash
;
226 MonoRealProxy real_proxy
;
227 MonoComObject
*com_object
;
229 } MonoComInteropProxy
;
234 MonoRemoteClass
*remote_class
;
235 MonoBoolean custom_type_info
;
236 } MonoTransparentProxy
;
240 MonoReflectionMethod
*method
;
243 MonoArray
*arg_types
;
247 MonoAsyncResult
*async_result
;
254 gint32 native_offset
;
255 MonoReflectionMethod
*method
;
256 MonoString
*filename
;
259 MonoString
*internal_method_name
;
264 int lock_thread_id
; /* to be used as the pre-shifted thread id in thin locks */
266 MonoArray
*cached_culture_info
;
268 MonoBoolean threadpool_thread
;
272 MonoException
*abort_exc
;
273 MonoObject
*abort_state
;
274 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 */
277 gpointer
*static_data
;
280 MonoAppContext
*current_appcontext
;
282 MonoObject
*start_obj
;
283 GSList
*appdomain_refs
;
284 /* This is modified using atomic ops, so keep it a gint32 */
285 gint32 interruption_requested
;
286 gpointer suspend_event
;
287 gpointer suspended_event
;
288 gpointer resume_event
;
289 CRITICAL_SECTION
*synch_cs
;
290 guint8
* serialized_culture_info
;
291 guint32 serialized_culture_info_len
;
292 guint8
* serialized_ui_culture_info
;
293 guint32 serialized_ui_culture_info_len
;
294 MonoObject
*execution_context
;
295 MonoBoolean thread_dump_requested
;
296 gpointer end_stack
; /* This is only used when running in the debugger. */
297 MonoBoolean thread_interrupt_requested
;
298 guint8 apartment_state
;
299 gint32 critical_region_level
;
300 guint32 small_id
; /* A small, unique id, used for the hazard pointer table. */
301 MonoThreadManageCallback manage_callback
;
302 MonoException
*pending_exception
;
304 * These fields are used to avoid having to increment corlib versions
305 * when a new field is added to the unmanaged MonoThread structure.
316 MonoReflectionType
*type
;
318 } MonoSerializationEntry
;
322 MonoObject
*additional
;
323 } MonoStreamingContext
;
327 MonoBoolean readOnly
;
328 MonoString
*AMDesignator
;
329 MonoString
*PMDesignator
;
330 MonoString
*DateSeparator
;
331 MonoString
*TimeSeparator
;
332 MonoString
*ShortDatePattern
;
333 MonoString
*LongDatePattern
;
334 MonoString
*ShortTimePattern
;
335 MonoString
*LongTimePattern
;
336 MonoString
*MonthDayPattern
;
337 MonoString
*YearMonthPattern
;
338 MonoString
*FullDateTimePattern
;
339 MonoString
*RFC1123Pattern
;
340 MonoString
*SortableDateTimePattern
;
341 MonoString
*UniversalSortableDateTimePattern
;
342 guint32 FirstDayOfWeek
;
343 MonoObject
*Calendar
;
344 guint32 CalendarWeekRule
;
345 MonoArray
*AbbreviatedDayNames
;
347 MonoArray
*MonthNames
;
348 MonoArray
*AbbreviatedMonthNames
;
349 MonoArray
*ShortDatePatterns
;
350 MonoArray
*LongDatePatterns
;
351 MonoArray
*ShortTimePatterns
;
352 MonoArray
*LongTimePatterns
;
353 MonoArray
*MonthDayPatterns
;
354 MonoArray
*YearMonthPatterns
;
355 MonoArray
*shortDayNames
;
356 } MonoDateTimeFormatInfo
;
361 MonoBoolean readOnly
;
362 MonoString
*decimalFormats
;
363 MonoString
*currencyFormats
;
364 MonoString
*percentFormats
;
365 MonoString
*digitPattern
;
366 MonoString
*zeroPattern
;
367 gint32 currencyDecimalDigits
;
368 MonoString
*currencyDecimalSeparator
;
369 MonoString
*currencyGroupSeparator
;
370 MonoArray
*currencyGroupSizes
;
371 gint32 currencyNegativePattern
;
372 gint32 currencyPositivePattern
;
373 MonoString
*currencySymbol
;
374 MonoString
*naNSymbol
;
375 MonoString
*negativeInfinitySymbol
;
376 MonoString
*negativeSign
;
377 guint32 numberDecimalDigits
;
378 MonoString
*numberDecimalSeparator
;
379 MonoString
*numberGroupSeparator
;
380 MonoArray
*numberGroupSizes
;
381 gint32 numberNegativePattern
;
382 gint32 percentDecimalDigits
;
383 MonoString
*percentDecimalSeparator
;
384 MonoString
*percentGroupSeparator
;
385 MonoArray
*percentGroupSizes
;
386 gint32 percentNegativePattern
;
387 gint32 percentPositivePattern
;
388 MonoString
*percentSymbol
;
389 MonoString
*perMilleSymbol
;
390 MonoString
*positiveInfinitySymbol
;
391 MonoString
*positiveSign
;
392 } MonoNumberFormatInfo
;
397 MonoString
*icu_name
;
398 gpointer ICU_collator
;
403 MonoBoolean is_read_only
;
406 gint32 specific_lcid
;
407 gint32 datetime_index
;
409 MonoBoolean use_user_override
;
410 MonoNumberFormatInfo
*number_format
;
411 MonoDateTimeFormatInfo
*datetime_format
;
412 MonoObject
*textinfo
;
414 MonoString
*displayname
;
415 MonoString
*englishname
;
416 MonoString
*nativename
;
417 MonoString
*iso3lang
;
418 MonoString
*iso2lang
;
419 MonoString
*icu_name
;
420 MonoString
*win3lang
;
421 MonoString
*territory
;
422 MonoCompareInfo
*compareinfo
;
423 const gint32
*calendar_data
;
424 const void* text_info_data
;
430 MonoString
*iso2name
;
431 MonoString
*iso3name
;
432 MonoString
*win3name
;
433 MonoString
*english_name
;
434 MonoString
*currency_symbol
;
435 MonoString
*iso_currency_symbol
;
436 MonoString
*currency_english_name
;
450 } MonoInterfaceTypeAttribute
;
452 /* used to free a dynamic method */
453 typedef void (*MonoFreeMethodFunc
) (MonoDomain
*domain
, MonoMethod
*method
);
455 /* Used to initialize the method pointers inside vtables */
456 typedef gboolean (*MonoInitVTableFunc
) (MonoVTable
*vtable
);
458 void mono_set_pending_exception (MonoException
*exc
) MONO_INTERNAL
;
460 /* remoting and async support */
463 mono_async_result_new (MonoDomain
*domain
, HANDLE handle
,
464 MonoObject
*state
, gpointer data
, MonoObject
*object_data
) MONO_INTERNAL
;
467 mono_wait_handle_new (MonoDomain
*domain
, HANDLE handle
) MONO_INTERNAL
;
470 mono_wait_handle_get_handle (MonoWaitHandle
*handle
) MONO_INTERNAL
;
473 mono_message_init (MonoDomain
*domain
, MonoMethodMessage
*this_obj
,
474 MonoReflectionMethod
*method
, MonoArray
*out_args
) MONO_INTERNAL
;
477 mono_remoting_invoke (MonoObject
*real_proxy
, MonoMethodMessage
*msg
,
478 MonoObject
**exc
, MonoArray
**out_args
) MONO_INTERNAL
;
481 mono_message_invoke (MonoObject
*target
, MonoMethodMessage
*msg
,
482 MonoObject
**exc
, MonoArray
**out_args
) MONO_INTERNAL
;
485 mono_method_call_message_new (MonoMethod
*method
, gpointer
*params
, MonoMethod
*invoke
,
486 MonoDelegate
**cb
, MonoObject
**state
) MONO_INTERNAL
;
489 mono_method_return_message_restore (MonoMethod
*method
, gpointer
*params
, MonoArray
*out_args
) MONO_INTERNAL
;
492 mono_delegate_ctor_with_method (MonoObject
*this, MonoObject
*target
, gpointer addr
, MonoMethod
*method
) MONO_INTERNAL
;
495 mono_delegate_ctor (MonoObject
*this_obj
, MonoObject
*target
, gpointer addr
) MONO_INTERNAL
;
498 mono_class_get_allocation_ftn (MonoVTable
*vtable
, gboolean for_box
, gboolean
*pass_size_in_words
) MONO_INTERNAL
;
501 mono_runtime_free_method (MonoDomain
*domain
, MonoMethod
*method
) MONO_INTERNAL
;
503 /* runtime initialization functions */
504 typedef void (*MonoExceptionFunc
) (MonoException
*ex
);
507 mono_install_handler (MonoExceptionFunc func
) MONO_INTERNAL
;
510 mono_install_runtime_invoke (MonoInvokeFunc func
) MONO_INTERNAL
;
513 mono_install_compile_method (MonoCompileFunc func
) MONO_INTERNAL
;
516 mono_install_free_method (MonoFreeMethodFunc func
) MONO_INTERNAL
;
519 mono_type_initialization_init (void) MONO_INTERNAL
;
522 mono_type_initialization_cleanup (void) MONO_INTERNAL
;
525 mono_thread_get_tls_key (void) MONO_INTERNAL
;
528 mono_thread_get_tls_offset (void) MONO_INTERNAL
;
531 mono_domain_get_tls_key (void) MONO_INTERNAL
;
534 mono_domain_get_tls_offset (void) MONO_INTERNAL
;
536 /* Reflection and Reflection.Emit support */
539 * The following structure must match the C# implementation in our corlib.
542 struct _MonoReflectionMethod
{
546 MonoReflectionType
*reftype
;
549 typedef struct _MonoReflectionGenericMethod MonoReflectionGenericMethod
;
550 struct _MonoReflectionGenericMethod
{
551 MonoReflectionMethod method
;
554 struct _MonoDelegate
{
556 /* The compiled code of the target method */
558 /* The invoke code */
559 gpointer invoke_impl
;
562 gpointer delegate_trampoline
;
564 * If non-NULL, this points to a memory location which stores the address of
565 * the compiled code of the method, or NULL if it is not yet compiled.
567 guint8
**method_code
;
568 MonoReflectionMethod
*method_info
;
569 MonoReflectionMethod
*original_method_info
;
573 typedef struct _MonoMulticastDelegate MonoMulticastDelegate
;
574 struct _MonoMulticastDelegate
{
575 MonoDelegate delegate
;
576 MonoMulticastDelegate
*prev
;
579 struct _MonoReflectionField
{
582 MonoClassField
*field
;
584 MonoReflectionType
*type
;
588 struct _MonoReflectionProperty
{
591 MonoProperty
*property
;
594 struct _MonoReflectionEvent
{
602 MonoReflectionType
*ClassImpl
;
603 MonoObject
*DefaultValueImpl
;
604 MonoObject
*MemberImpl
;
605 MonoString
*NameImpl
;
608 MonoObject
*MarshalAsImpl
;
609 } MonoReflectionParameter
;
611 struct _MonoReflectionMethodBody
{
616 MonoBoolean init_locals
;
617 guint32 local_var_sig_token
;
621 struct _MonoReflectionAssembly
{
623 MonoAssembly
*assembly
;
624 MonoObject
*resolve_event_holder
;
626 MonoObject
*evidence
; /* Evidence */
627 MonoObject
*minimum
; /* PermissionSet - for SecurityAction.RequestMinimum */
628 MonoObject
*optional
; /* PermissionSet - for SecurityAction.RequestOptional */
629 MonoObject
*refuse
; /* PermissionSet - for SecurityAction.RequestRefuse */
630 MonoObject
*granted
; /* PermissionSet - for the resolved assembly granted permissions */
631 MonoObject
*denied
; /* PermissionSet - for the resolved assembly denied permissions */
633 MonoBoolean from_byte_array
;
638 MonoReflectionType
*utype
;
644 MonoReflectionType
*parent
;
645 MonoReflectionType
*ret
;
652 MonoReflectionType
*parent
;
654 MonoReflectionMethod
*get
;
655 MonoReflectionMethod
*set
;
660 MonoReflectionType
*declaring_type
;
661 MonoReflectionType
*reflected_type
;
663 MonoReflectionMethod
*add_method
;
664 MonoReflectionMethod
*remove_method
;
665 MonoReflectionMethod
*raise_method
;
667 MonoArray
*other_methods
;
672 MonoString
*name_space
;
673 MonoReflectionType
*etype
;
674 MonoReflectionType
*nested_in
;
675 MonoReflectionAssembly
*assembly
;
677 MonoBoolean isprimitive
;
683 } MonoReflectionILTokenInfo
;
692 MonoArray
*ex_handlers
;
693 gint32 num_token_fixups
;
694 MonoArray
*token_fixups
;
695 } MonoReflectionILGen
;
702 } MonoILExceptionInfo
;
705 MonoReflectionType
*extype
;
709 gint32 filter_offset
;
710 } MonoILExceptionBlock
;
714 MonoReflectionType
*catch_type
;
715 gint32 filter_offset
;
719 gint32 handler_offset
;
720 gint32 handler_length
;
721 } MonoReflectionExceptionHandlingClause
;
725 MonoReflectionType
*local_type
;
726 MonoBoolean is_pinned
;
728 } MonoReflectionLocalVariableInfo
;
732 * Must have the same layout as MonoReflectionLocalVariableInfo, since
733 * LocalBuilder inherits from it under net 2.0.
736 MonoReflectionType
*type
;
737 MonoBoolean is_pinned
;
740 } MonoReflectionLocalBuilder
;
749 MonoString
*marshaltype
;
750 MonoReflectionType
*marshaltyperef
;
752 MonoBoolean has_size
;
753 } MonoReflectionMarshal
;
760 MonoReflectionMarshal
*marshal_info
;
764 MonoObject
*def_value
;
765 } MonoReflectionParamBuilder
;
770 MonoReflectionILGen
*ilgen
;
771 MonoArray
*parameters
;
779 MonoBoolean init_locals
;
780 MonoArray
*param_modreq
;
781 MonoArray
*param_modopt
;
782 MonoArray
*permissions
;
783 } MonoReflectionCtorBuilder
;
788 MonoReflectionType
*rtype
;
789 MonoArray
*parameters
;
795 MonoReflectionILGen
*ilgen
;
799 MonoReflectionMethod
*override_method
;
801 MonoString
*dllentry
;
806 MonoBoolean init_locals
;
807 MonoGenericContainer
*generic_container
;
808 MonoArray
*generic_params
;
809 MonoArray
*return_modreq
;
810 MonoArray
*return_modopt
;
811 MonoArray
*param_modreq
;
812 MonoArray
*param_modopt
;
813 MonoArray
*permissions
;
814 } MonoReflectionMethodBuilder
;
819 MonoReflectionType
*parent
;
820 MonoReflectionType
*ret
;
821 MonoArray
*parameters
;
825 } MonoReflectionArrayMethod
;
830 MonoString
*filename
;
834 } MonoReflectionResource
;
841 } MonoReflectionWin32Resource
;
846 } MonoReflectionPermissionSet
;
849 MonoReflectionAssembly assembly
;
850 MonoDynamicAssembly
*dynamic_assembly
;
851 MonoReflectionMethod
*entry_point
;
856 MonoArray
*resources
;
857 MonoArray
*public_key
;
863 MonoBoolean delay_sign
;
865 MonoArray
*loaded_modules
;
866 MonoArray
*win32_resources
;
868 MonoArray
*permissions_minimum
;
869 MonoArray
*permissions_optional
;
870 MonoArray
*permissions_refused
;
873 MonoBoolean corlib_internal
;
874 MonoArray
*type_forwarders
;
875 } MonoReflectionAssemblyBuilder
;
880 MonoReflectionType
*type
;
882 MonoObject
*def_value
;
885 MonoReflectionType
*typeb
;
888 MonoReflectionMarshal
*marshal_info
;
889 MonoClassField
*handle
;
892 } MonoReflectionFieldBuilder
;
898 MonoReflectionType
*type
;
899 MonoArray
*parameters
;
901 MonoObject
*def_value
;
902 MonoReflectionMethodBuilder
*set_method
;
903 MonoReflectionMethodBuilder
*get_method
;
905 } MonoReflectionPropertyBuilder
;
907 struct _MonoReflectionModule
{
910 MonoReflectionAssembly
*assembly
;
913 MonoString
*scopename
;
914 MonoBoolean is_resource
;
919 MonoReflectionModule module
;
920 MonoDynamicImage
*dynamic_image
;
926 MonoReflectionAssemblyBuilder
*assemblyb
;
927 MonoArray
*global_methods
;
928 MonoArray
*global_fields
;
930 MonoArray
*resources
;
931 } MonoReflectionModuleBuilder
;
934 MonoReflectionType type
;
937 MonoReflectionType
*parent
;
938 MonoReflectionType
*nesting_type
;
939 MonoArray
*interfaces
;
943 MonoArray
*properties
;
951 MonoReflectionModuleBuilder
*module
;
954 MonoGenericContainer
*generic_container
;
955 MonoArray
*generic_params
;
956 MonoArray
*permissions
;
957 MonoReflectionType
*created
;
958 } MonoReflectionTypeBuilder
;
961 MonoReflectionType type
;
962 MonoReflectionTypeBuilder
*tbuilder
;
963 MonoReflectionMethodBuilder
*mbuilder
;
966 MonoReflectionType
*base_type
;
967 MonoArray
*iface_constraints
;
970 } MonoReflectionGenericParam
;
972 typedef struct _MonoReflectionGenericClass MonoReflectionGenericClass
;
973 struct _MonoReflectionGenericClass
{
974 MonoReflectionType type
;
975 MonoReflectionTypeBuilder
*generic_type
;
982 MonoString
*codebase
;
983 gint32 major
, minor
, build
, revision
;
984 MonoObject
*cultureInfo
;
988 MonoArray
*publicKey
;
990 guint32 versioncompat
;
992 guint32 processor_architecture
;
993 } MonoReflectionAssemblyName
;
998 MonoReflectionType
*type
;
999 MonoReflectionTypeBuilder
*typeb
;
1001 MonoReflectionMethodBuilder
*add_method
;
1002 MonoReflectionMethodBuilder
*remove_method
;
1003 MonoReflectionMethodBuilder
*raise_method
;
1004 MonoArray
*other_methods
;
1007 } MonoReflectionEventBuilder
;
1011 MonoReflectionMethod
*ctor
;
1013 } MonoReflectionCustomAttr
;
1020 MonoString
*entry_point
;
1021 MonoBoolean exact_spelling
;
1022 MonoBoolean preserve_sig
;
1023 MonoBoolean set_last_error
;
1024 MonoBoolean best_fit_mapping
;
1025 MonoBoolean throw_on_unmappable
;
1026 } MonoReflectionDllImportAttribute
;
1032 MonoBoolean set_last_error
;
1033 MonoBoolean best_fit_mapping
;
1034 MonoBoolean throw_on_unmappable
;
1035 } MonoReflectionUnmanagedFunctionPointerAttribute
;
1040 } MonoReflectionGuidAttribute
;
1044 MonoMethod
*mhandle
;
1046 MonoReflectionType
*rtype
;
1047 MonoArray
*parameters
;
1050 MonoReflectionModule
*module
;
1051 MonoBoolean skip_visibility
;
1052 MonoBoolean init_locals
;
1053 MonoReflectionILGen
*ilgen
;
1056 GSList
*referenced_by
;
1057 MonoReflectionType
*owner
;
1058 } MonoReflectionDynamicMethod
;
1062 MonoReflectionModuleBuilder
*module
;
1063 MonoArray
*arguments
;
1065 MonoReflectionType
*return_type
;
1067 guint32 unmanaged_call_conv
;
1070 } MonoReflectionSigHelper
;
1074 MonoReflectionGenericClass
*inst
;
1075 MonoReflectionFieldBuilder
*fb
;
1076 } MonoReflectionFieldOnTypeBuilderInst
;
1080 MonoReflectionGenericClass
*inst
;
1081 MonoReflectionCtorBuilder
*cb
;
1082 } MonoReflectionCtorOnTypeBuilderInst
;
1086 MonoReflectionGenericClass
*inst
;
1087 MonoReflectionMethodBuilder
*mb
;
1088 } MonoReflectionMethodOnTypeBuilderInst
;
1092 MonoBoolean
*visible
;
1093 } MonoReflectionComVisibleAttribute
;
1096 RESOURCE_LOCATION_EMBEDDED
= 1,
1097 RESOURCE_LOCATION_ANOTHER_ASSEMBLY
= 2,
1098 RESOURCE_LOCATION_IN_MANIFEST
= 4
1103 MonoReflectionAssembly
*assembly
;
1104 MonoString
*filename
;
1106 } MonoManifestResourceInfo
;
1108 /* Keep in sync with System.GenericParameterAttributes */
1110 GENERIC_PARAMETER_ATTRIBUTE_NON_VARIANT
= 0,
1111 GENERIC_PARAMETER_ATTRIBUTE_COVARIANT
= 1,
1112 GENERIC_PARAMETER_ATTRIBUTE_CONTRAVARIANT
= 2,
1113 GENERIC_PARAMETER_ATTRIBUTE_VARIANCE_MASK
= 3,
1115 GENERIC_PARAMETER_ATTRIBUTE_NO_SPECIAL_CONSTRAINT
= 0,
1116 GENERIC_PARAMETER_ATTRIBUTE_REFERENCE_TYPE_CONSTRAINT
= 4,
1117 GENERIC_PARAMETER_ATTRIBUTE_VALUE_TYPE_CONSTRAINT
= 8,
1118 GENERIC_PARAMETER_ATTRIBUTE_CONSTRUCTOR_CONSTRAINT
= 16,
1119 GENERIC_PARAMETER_ATTRIBUTE_SPECIAL_CONSTRAINTS_MASK
= 28
1120 } GenericParameterAttributes
;
1122 void mono_image_create_pefile (MonoReflectionModuleBuilder
*module
, HANDLE file
) MONO_INTERNAL
;
1123 void mono_image_basic_init (MonoReflectionAssemblyBuilder
*assembly
) MONO_INTERNAL
;
1124 MonoReflectionModule
* mono_image_load_module_dynamic (MonoReflectionAssemblyBuilder
*assembly
, MonoString
*file_name
) MONO_INTERNAL
;
1125 guint32
mono_image_insert_string (MonoReflectionModuleBuilder
*module
, MonoString
*str
) MONO_INTERNAL
;
1126 guint32
mono_image_create_token (MonoDynamicImage
*assembly
, MonoObject
*obj
, gboolean create_methodspec
, gboolean register_token
) MONO_INTERNAL
;
1127 guint32
mono_image_create_method_token (MonoDynamicImage
*assembly
, MonoObject
*obj
, MonoArray
*opt_param_types
) MONO_INTERNAL
;
1128 void mono_image_module_basic_init (MonoReflectionModuleBuilder
*module
) MONO_INTERNAL
;
1129 void mono_image_register_token (MonoDynamicImage
*assembly
, guint32 token
, MonoObject
*obj
) MONO_INTERNAL
;
1130 void mono_dynamic_image_free (MonoDynamicImage
*image
) MONO_INTERNAL
;
1132 void mono_reflection_setup_internal_class (MonoReflectionTypeBuilder
*tb
) MONO_INTERNAL
;
1134 void mono_reflection_create_internal_class (MonoReflectionTypeBuilder
*tb
) MONO_INTERNAL
;
1136 void mono_reflection_setup_generic_class (MonoReflectionTypeBuilder
*tb
) MONO_INTERNAL
;
1138 void mono_reflection_create_generic_class (MonoReflectionTypeBuilder
*tb
) MONO_INTERNAL
;
1140 MonoReflectionType
* mono_reflection_create_runtime_class (MonoReflectionTypeBuilder
*tb
) MONO_INTERNAL
;
1142 void mono_reflection_get_dynamic_overrides (MonoClass
*klass
, MonoMethod
***overrides
, int *num_overrides
) MONO_INTERNAL
;
1144 void mono_reflection_create_dynamic_method (MonoReflectionDynamicMethod
*m
) MONO_INTERNAL
;
1145 void mono_reflection_destroy_dynamic_method (MonoReflectionDynamicMethod
*mb
) MONO_INTERNAL
;
1147 void mono_reflection_initialize_generic_parameter (MonoReflectionGenericParam
*gparam
) MONO_INTERNAL
;
1150 mono_class_bind_generic_parameters (MonoClass
*klass
, int type_argc
, MonoType
**types
, gboolean is_dynamic
) MONO_INTERNAL
;
1152 mono_reflection_bind_generic_parameters (MonoReflectionType
*type
, int type_argc
, MonoType
**types
) MONO_INTERNAL
;
1153 MonoReflectionMethod
*
1154 mono_reflection_bind_generic_method_parameters (MonoReflectionMethod
*method
, MonoArray
*types
) MONO_INTERNAL
;
1156 mono_reflection_generic_class_initialize (MonoReflectionGenericClass
*type
, MonoArray
*methods
, MonoArray
*ctors
, MonoArray
*fields
, MonoArray
*properties
, MonoArray
*events
) MONO_INTERNAL
;
1157 MonoReflectionEvent
*
1158 mono_reflection_event_builder_get_event_info (MonoReflectionTypeBuilder
*tb
, MonoReflectionEventBuilder
*eb
) MONO_INTERNAL
;
1160 MonoArray
*mono_reflection_sighelper_get_signature_local (MonoReflectionSigHelper
*sig
) MONO_INTERNAL
;
1162 MonoArray
*mono_reflection_sighelper_get_signature_field (MonoReflectionSigHelper
*sig
) MONO_INTERNAL
;
1164 MonoReflectionMarshal
* mono_reflection_marshal_from_marshal_spec (MonoDomain
*domain
, MonoClass
*klass
, MonoMarshalSpec
*spec
) MONO_INTERNAL
;
1167 mono_reflection_lookup_dynamic_token (MonoImage
*image
, guint32 token
, gboolean valid_token
, MonoClass
**handle_class
, MonoGenericContext
*context
) MONO_INTERNAL
;
1170 mono_reflection_call_is_assignable_to (MonoClass
*klass
, MonoClass
*oklass
) MONO_INTERNAL
;
1173 mono_reflection_is_valid_dynamic_token (MonoDynamicImage
*image
, guint32 token
) MONO_INTERNAL
;
1176 mono_image_build_metadata (MonoReflectionModuleBuilder
*module
) MONO_INTERNAL
;
1179 mono_get_constant_value_from_blob (MonoDomain
* domain
, MonoTypeEnum type
, const char *blob
, void *value
) MONO_INTERNAL
;
1182 mono_release_type_locks (MonoThread
*thread
) MONO_INTERNAL
;
1185 mono_string_to_utf8_mp (MonoMemPool
*mp
, MonoString
*s
) MONO_INTERNAL
;
1188 mono_array_clone_in_domain (MonoDomain
*domain
, MonoArray
*array
) MONO_INTERNAL
;
1191 mono_array_full_copy (MonoArray
*src
, MonoArray
*dest
) MONO_INTERNAL
;
1194 mono_remote_class_vtable (MonoDomain
*domain
, MonoRemoteClass
*remote_class
, MonoRealProxy
*real_proxy
) MONO_INTERNAL
;
1197 mono_upgrade_remote_class (MonoDomain
*domain
, MonoObject
*tproxy
, MonoClass
*klass
) MONO_INTERNAL
;
1200 mono_create_ftnptr (MonoDomain
*domain
, gpointer addr
) MONO_INTERNAL
;
1203 mono_get_addr_from_ftnptr (gpointer descr
) MONO_INTERNAL
;
1206 mono_nullable_init (guint8
*buf
, MonoObject
*value
, MonoClass
*klass
) MONO_INTERNAL
;
1209 mono_nullable_box (guint8
*buf
, MonoClass
*klass
) MONO_INTERNAL
;
1211 #define MONO_IMT_SIZE 19
1215 gpointer target_code
;
1218 typedef struct _MonoImtBuilderEntry
{
1220 struct _MonoImtBuilderEntry
*next
;
1221 MonoImtItemValue value
;
1223 } MonoImtBuilderEntry
;
1225 typedef struct _MonoIMTCheckItem MonoIMTCheckItem
;
1227 struct _MonoIMTCheckItem
{
1229 int check_target_idx
;
1230 MonoImtItemValue value
;
1232 guint8
*code_target
;
1234 guint8 compare_done
;
1236 guint8 short_branch
;
1239 typedef gpointer (*MonoImtThunkBuilder
) (MonoVTable
*vtable
, MonoDomain
*domain
,
1240 MonoIMTCheckItem
**imt_entries
, int count
, gpointer fail_trunk
);
1243 mono_install_imt_thunk_builder (MonoImtThunkBuilder func
) MONO_INTERNAL
;
1246 mono_install_imt_trampoline (gpointer tramp
) MONO_INTERNAL
;
1249 mono_install_vtable_trampoline (gpointer tramp
) MONO_INTERNAL
;
1252 mono_vtable_build_imt_slot (MonoVTable
* vtable
, int imt_slot
) MONO_INTERNAL
;
1255 mono_method_get_imt_slot (MonoMethod
*method
) MONO_INTERNAL
;
1258 mono_method_add_generic_virtual_invocation (MonoDomain
*domain
, gpointer
*vtable_slot
,
1259 MonoGenericInst
*method_inst
, gpointer code
) MONO_INTERNAL
;
1262 mono_method_alloc_generic_virtual_thunk (MonoDomain
*domain
, int size
) MONO_INTERNAL
;
1265 MONO_UNHANDLED_POLICY_LEGACY
,
1266 MONO_UNHANDLED_POLICY_CURRENT
1267 } MonoRuntimeUnhandledExceptionPolicy
;
1269 MonoRuntimeUnhandledExceptionPolicy
1270 mono_runtime_unhandled_exception_policy_get (void) MONO_INTERNAL
;
1272 mono_runtime_unhandled_exception_policy_set (MonoRuntimeUnhandledExceptionPolicy policy
) MONO_INTERNAL
;
1275 mono_class_try_get_vtable (MonoDomain
*domain
, MonoClass
*class) MONO_INTERNAL
;
1278 mono_runtime_class_init_full (MonoVTable
*vtable
, gboolean raise_exception
) MONO_INTERNAL
;
1280 #endif /* __MONO_OBJECT_INTERNALS_H__ */