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
);
64 mono_image_g_malloc0 (MonoImage
*image
, guint size
);
67 mono_is_sre_type_builder (MonoClass
*klass
);
70 mono_is_sre_generic_instance (MonoClass
*klass
);
73 mono_is_sre_method_on_tb_inst (MonoClass
*klass
);
76 mono_is_sre_ctor_builder (MonoClass
*klass
);
79 mono_is_sre_ctor_on_tb_inst (MonoClass
*klass
);
82 mono_is_sr_mono_cmethod (MonoClass
*klass
);
85 mono_is_sr_mono_property (MonoClass
*klass
);
88 mono_reflection_type_get_handle (MonoReflectionType
*ref
, MonoError
*error
);
91 mono_reflection_resolve_object (MonoImage
*image
, MonoObject
*obj
, MonoClass
**handle_class
, MonoGenericContext
*context
, MonoError
*error
);
93 MonoType
* mono_type_array_get_and_resolve (MonoArrayHandle array
, int idx
, MonoError
* error
);
96 mono_sre_array_method_free (ArrayMethod
*am
);
99 mono_sre_generic_param_table_entry_free (GenericParamTableEntry
*entry
);
102 mono_reflection_methodbuilder_from_method_builder (ReflectionMethodBuilder
*rmb
, MonoReflectionMethodBuilder
*mb
,
105 mono_reflection_methodbuilder_from_ctor_builder (ReflectionMethodBuilder
*rmb
, MonoReflectionCtorBuilder
*mb
,
109 mono_reflection_resolution_scope_from_image (MonoDynamicImage
*assembly
, MonoImage
*image
);
111 guint32
mono_reflection_method_count_clauses (MonoReflectionILGen
*ilgen
);
117 mono_dynimage_encode_field_signature (MonoDynamicImage
*assembly
, MonoReflectionFieldBuilder
*fb
, MonoError
*error
);
120 mono_dynimage_encode_constant (MonoDynamicImage
*assembly
, MonoObject
*val
, MonoTypeEnum
*ret_type
);
123 mono_dynimage_encode_locals (MonoDynamicImage
*assembly
, MonoReflectionILGen
*ilgen
, MonoError
*error
);
126 mono_dynimage_encode_fieldref_signature (MonoDynamicImage
*assembly
, MonoImage
*field_image
, MonoType
*type
);
129 mono_dynimage_encode_method_signature (MonoDynamicImage
*assembly
, MonoMethodSignature
*sig
);
132 mono_dynimage_encode_method_builder_signature (MonoDynamicImage
*assembly
, ReflectionMethodBuilder
*mb
,
136 mono_dynimage_encode_generic_method_sig (MonoDynamicImage
*assembly
, MonoGenericContext
*context
);
139 mono_dynimage_encode_typedef_or_ref_full (MonoDynamicImage
*assembly
, MonoType
*type
, gboolean try_typespec
);
142 mono_dynimage_encode_reflection_sighelper (MonoDynamicImage
*assembly
, MonoReflectionSigHelperHandle helper
,
145 /* sre-encode, without DISABLE_REFLECTION_EMIT_SAVE (o.w. g_assert_not_reached ()) */
148 mono_dynimage_save_encode_marshal_blob (MonoDynamicImage
*assembly
, MonoReflectionMarshal
*minfo
, MonoError
*error
);
151 mono_dynimage_save_encode_property_signature (MonoDynamicImage
*assembly
, MonoReflectionPropertyBuilder
*fb
, MonoError
*error
);
154 mono_image_get_methodref_token (MonoDynamicImage
*assembly
, MonoMethod
*method
, gboolean create_typespec
);
156 #endif /* __MONO_METADATA_SRE_INTERNALS_H__ */