[sre] Wrap mono_image_create_token with HANDLE_FUNCTION_{ENTER,RETURN}
[mono-project.git] / mono / metadata / sre-internals.h
blob058092b6f197dc8c938749cc88a6ce4895595f43
1 /**
2 * \file
3 * Copyright 2016 Microsoft
4 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
5 */
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;
22 typedef struct {
23 guint32 owner;
24 MonoReflectionGenericParam *gparam;
25 } GenericParamTableEntry;
27 typedef struct {
28 MonoReflectionILGen *ilgen;
29 MonoReflectionType *rtype;
30 MonoArray *parameters;
31 MonoArray *generic_params;
32 MonoGenericContainer *generic_container;
33 MonoArray *pinfo;
34 MonoArray *opt_types;
35 guint32 attrs;
36 guint32 iattrs;
37 guint32 call_conv;
38 guint32 *table_idx; /* note: it's a pointer */
39 MonoArray *code;
40 MonoObject *type;
41 MonoString *name;
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;
49 MonoMethod *mhandle;
50 guint32 nrefs;
51 gpointer *refs;
52 /* for PInvoke */
53 int charset, extra_flags, native_cc;
54 MonoString *dll, *dllentry;
55 } ReflectionMethodBuilder; /* FIXME raw pointers to managed objects */
57 void
58 mono_reflection_emit_init (void);
60 void
61 mono_reflection_dynimage_basic_init (MonoReflectionAssemblyBuilder *assemblyb);
63 gpointer
64 mono_image_g_malloc0 (MonoImage *image, guint size);
66 gboolean
67 mono_is_sre_type_builder (MonoClass *klass);
69 gboolean
70 mono_is_sre_generic_instance (MonoClass *klass);
72 gboolean
73 mono_is_sre_method_on_tb_inst (MonoClass *klass);
75 gboolean
76 mono_is_sre_ctor_builder (MonoClass *klass);
78 gboolean
79 mono_is_sre_ctor_on_tb_inst (MonoClass *klass);
81 gboolean
82 mono_is_sr_mono_cmethod (MonoClass *klass);
84 gboolean
85 mono_is_sr_mono_property (MonoClass *klass);
87 MonoType*
88 mono_reflection_type_get_handle (MonoReflectionType *ref, MonoError *error);
90 gpointer
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);
95 void
96 mono_sre_array_method_free (ArrayMethod *am);
98 void
99 mono_sre_generic_param_table_entry_free (GenericParamTableEntry *entry);
101 gboolean
102 mono_reflection_methodbuilder_from_method_builder (ReflectionMethodBuilder *rmb, MonoReflectionMethodBuilder *mb,
103 MonoError *error);
104 gboolean
105 mono_reflection_methodbuilder_from_ctor_builder (ReflectionMethodBuilder *rmb, MonoReflectionCtorBuilder *mb,
106 MonoError *error);
108 guint32
109 mono_reflection_resolution_scope_from_image (MonoDynamicImage *assembly, MonoImage *image);
111 guint32 mono_reflection_method_count_clauses (MonoReflectionILGen *ilgen);
114 /* sre-encode */
116 guint32
117 mono_dynimage_encode_field_signature (MonoDynamicImage *assembly, MonoReflectionFieldBuilder *fb, MonoError *error);
119 guint32
120 mono_dynimage_encode_constant (MonoDynamicImage *assembly, MonoObject *val, MonoTypeEnum *ret_type);
122 guint32
123 mono_dynimage_encode_locals (MonoDynamicImage *assembly, MonoReflectionILGen *ilgen, MonoError *error);
125 guint32
126 mono_dynimage_encode_fieldref_signature (MonoDynamicImage *assembly, MonoImage *field_image, MonoType *type);
128 guint32
129 mono_dynimage_encode_method_signature (MonoDynamicImage *assembly, MonoMethodSignature *sig);
131 guint32
132 mono_dynimage_encode_method_builder_signature (MonoDynamicImage *assembly, ReflectionMethodBuilder *mb,
133 MonoError *error);
135 guint32
136 mono_dynimage_encode_generic_method_sig (MonoDynamicImage *assembly, MonoGenericContext *context);
138 guint32
139 mono_dynimage_encode_typedef_or_ref_full (MonoDynamicImage *assembly, MonoType *type, gboolean try_typespec);
141 guint32
142 mono_dynimage_encode_reflection_sighelper (MonoDynamicImage *assembly, MonoReflectionSigHelperHandle helper,
143 MonoError *error);
145 /* sre-encode, without DISABLE_REFLECTION_EMIT_SAVE (o.w. g_assert_not_reached ()) */
147 guint32
148 mono_dynimage_save_encode_marshal_blob (MonoDynamicImage *assembly, MonoReflectionMarshal *minfo, MonoError *error);
150 guint32
151 mono_dynimage_save_encode_property_signature (MonoDynamicImage *assembly, MonoReflectionPropertyBuilder *fb, MonoError *error);
153 guint32
154 mono_image_get_methodref_token (MonoDynamicImage *assembly, MonoMethod *method, gboolean create_typespec);
156 #endif /* __MONO_METADATA_SRE_INTERNALS_H__ */