3 * Copyright 2016 Microsoft
4 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
6 #ifndef __MONO_METADATA_SRE_INTERNALS_H__
7 #define __MONO_METADATA_SRE_INTERNALS_H__
9 #include <mono/metadata/object-internals.h>
11 /* Keep in sync with System.Reflection.Emit.AssemblyBuilderAccess */
12 enum MonoAssemblyBuilderAccess
{
13 MonoAssemblyBuilderAccess_Run
= 1, /* 0b0001 */
14 MonoAssemblyBuilderAccess_Save
= 2, /* 0b0010 */
15 MonoAssemblyBuilderAccess_RunAndSave
= 3, /* Run | Save */
16 MonoAssemblyBuilderAccess_ReflectionOnly
= 6, /* Refonly | Save */
17 MonoAssemblyBuilderAccess_RunAndCollect
= 9, /* Collect | Run */
20 typedef struct _ArrayMethod ArrayMethod
;
24 MonoReflectionGenericParam
*gparam
;
25 } GenericParamTableEntry
;
28 MonoReflectionILGen
*ilgen
;
29 MonoReflectionType
*rtype
;
30 MonoArray
*parameters
;
31 MonoArray
*generic_params
;
32 MonoGenericContainer
*generic_container
;
38 guint32
*table_idx
; /* note: it's a pointer */
42 MonoBoolean init_locals
;
43 MonoBoolean skip_visibility
;
44 MonoArray
*return_modreq
;
45 MonoArray
*return_modopt
;
46 MonoArray
*param_modreq
;
47 MonoArray
*param_modopt
;
48 MonoArray
*permissions
;
53 int charset
, extra_flags
, native_cc
;
54 MonoString
*dll
, *dllentry
;
55 } ReflectionMethodBuilder
; /* FIXME raw pointers to managed objects */
58 mono_reflection_emit_init (void);
61 mono_reflection_dynimage_basic_init (MonoReflectionAssemblyBuilder
*assemblyb
, MonoError
*error
);
64 mono_image_g_malloc0 (MonoImage
*image
, guint size
);
66 #define mono_image_g_malloc0(image, size) (g_cast (mono_image_g_malloc0 ((image), (size))))
69 mono_is_sre_type_builder (MonoClass
*klass
);
72 mono_is_sre_generic_instance (MonoClass
*klass
);
75 mono_is_sre_method_on_tb_inst (MonoClass
*klass
);
78 mono_is_sre_ctor_builder (MonoClass
*klass
);
81 mono_is_sre_ctor_on_tb_inst (MonoClass
*klass
);
84 mono_is_sr_mono_cmethod (MonoClass
*klass
);
87 mono_is_sr_mono_property (MonoClass
*klass
);
90 mono_reflection_type_get_handle (MonoReflectionType
*ref
, MonoError
*error
);
93 mono_reflection_resolve_object (MonoImage
*image
, MonoObject
*obj
, MonoClass
**handle_class
, MonoGenericContext
*context
, MonoError
*error
);
96 mono_reflection_resolve_object_handle (MonoImage
*image
, MonoObjectHandle obj
, MonoClass
**handle_class
, MonoGenericContext
*context
, MonoError
*error
);
98 MonoType
* mono_type_array_get_and_resolve (MonoArrayHandle array
, int idx
, MonoError
* error
);
101 mono_sre_array_method_free (ArrayMethod
*am
);
104 mono_sre_generic_param_table_entry_free (GenericParamTableEntry
*entry
);
107 mono_reflection_methodbuilder_from_method_builder (ReflectionMethodBuilder
*rmb
, MonoReflectionMethodBuilder
*mb
,
110 mono_reflection_methodbuilder_from_ctor_builder (ReflectionMethodBuilder
*rmb
, MonoReflectionCtorBuilder
*mb
,
114 mono_reflection_resolution_scope_from_image (MonoDynamicImage
*assembly
, MonoImage
*image
);
116 guint32
mono_reflection_method_count_clauses (MonoReflectionILGen
*ilgen
);
122 mono_dynimage_encode_field_signature (MonoDynamicImage
*assembly
, MonoReflectionFieldBuilder
*fb
, MonoError
*error
);
125 mono_dynimage_encode_constant (MonoDynamicImage
*assembly
, MonoObject
*val
, MonoTypeEnum
*ret_type
);
128 mono_dynimage_encode_locals (MonoDynamicImage
*assembly
, MonoReflectionILGen
*ilgen
, MonoError
*error
);
131 mono_dynimage_encode_fieldref_signature (MonoDynamicImage
*assembly
, MonoImage
*field_image
, MonoType
*type
);
134 mono_dynimage_encode_method_signature (MonoDynamicImage
*assembly
, MonoMethodSignature
*sig
);
137 mono_dynimage_encode_method_builder_signature (MonoDynamicImage
*assembly
, ReflectionMethodBuilder
*mb
,
141 mono_dynimage_encode_generic_method_sig (MonoDynamicImage
*assembly
, MonoGenericContext
*context
);
144 mono_dynimage_encode_typedef_or_ref_full (MonoDynamicImage
*assembly
, MonoType
*type
, gboolean try_typespec
);
147 mono_dynimage_encode_reflection_sighelper (MonoDynamicImage
*assembly
, MonoReflectionSigHelperHandle helper
,
150 /* sre-encode, without DISABLE_REFLECTION_EMIT_SAVE (o.w. g_assert_not_reached ()) */
153 mono_dynimage_save_encode_marshal_blob (MonoDynamicImage
*assembly
, MonoReflectionMarshal
*minfo
, MonoError
*error
);
156 mono_dynimage_save_encode_property_signature (MonoDynamicImage
*assembly
, MonoReflectionPropertyBuilder
*fb
, MonoError
*error
);
159 mono_image_get_methodref_token (MonoDynamicImage
*assembly
, MonoMethod
*method
, gboolean create_typespec
);
161 #endif /* __MONO_METADATA_SRE_INTERNALS_H__ */