Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7add6cb
Initial noalloc variant of load_cattr_value function
ivanpovazan May 13, 2022
2bf15b1
Removing redundant parameter and some of managed objects handling
ivanpovazan May 13, 2022
a2c5f38
Cleaning up the case when object is used as attribute parameter
ivanpovazan May 13, 2022
f6d1989
Adding support for MonoCustomAttrValue type
ivanpovazan May 18, 2022
ee3a6ce
Enable native to managed wrapper to receive calling convention attribute
ivanpovazan May 19, 2022
66db12d
Removing type information from MonoCustomAttrValue - the type is avai…
ivanpovazan May 20, 2022
ef5190f
Adding error info when asserting
ivanpovazan May 20, 2022
9a690c0
Cleanup
ivanpovazan May 20, 2022
d5e927e
Fix handling return values of mono_reflection_create_custom_attr_data…
ivanpovazan May 23, 2022
04ba8f6
Fix build errors
ivanpovazan May 25, 2022
f1e0734
When multiple conventions are specified generate a warning and take t…
ivanpovazan May 25, 2022
a51e9bd
Fix uint to int conversion
ivanpovazan May 25, 2022
48d9960
Reverting "[mono] Avoid an assertion when cattrs with array parameter…
ivanpovazan May 25, 2022
e95949a
Cleaning up unreachable code
ivanpovazan May 25, 2022
673609e
Adding stripped-down version of UnmanagedCallersOnly attribute tests …
ivanpovazan May 24, 2022
e8a5b60
Disabling UnmanagedCallersOnly test on wasm since tests currently do …
ivanpovazan May 25, 2022
a3fdffb
Disabling UnmanagedCallersOnly test on Andriod since tests currently …
ivanpovazan May 30, 2022
19dc4eb
Moving MonoCustomAttrValue types to custom-attrs-internals.h
ivanpovazan May 26, 2022
7efb13d
Adding back type information for MonoCustomAttrValue in order to prop…
ivanpovazan May 27, 2022
ce22537
Adding MonoDecodeCustomAttr to simplify usage of mono_reflection_crea…
ivanpovazan May 30, 2022
5d053f9
Mark functions not used outside of TU as static
ivanpovazan May 30, 2022
297768f
No need to recursively free custom attribute parameter since only 1-D…
ivanpovazan May 30, 2022
cb73c27
Use return value instead of out parameter when returning MonoDecodeCu…
ivanpovazan May 31, 2022
92902c3
Cleanup: typo, formatting, use utility functions
ivanpovazan May 31, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions src/mono/mono/component/debugger-agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -2931,21 +2931,14 @@ static gint32 isFixedSizeArray (MonoClassField *f)
MonoClass *fixed_size_class = mono_class_try_get_fixed_buffer_class ();
if (fixed_size_class != NULL && mono_class_has_parent (ctor_class, fixed_size_class)) {
attr = &cinfo->attrs [aindex];
gpointer *typed_args, *named_args;
CattrNamedArg *arginfo;
int num_named_args;

mono_reflection_create_custom_attr_data_args_noalloc (mono_get_corlib (), attr->ctor, attr->data, attr->data_size,
&typed_args, &named_args, &num_named_args, &arginfo, error);
MonoDecodeCustomAttr *decoded_args = mono_reflection_create_custom_attr_data_args_noalloc (mono_get_corlib (), attr->ctor, attr->data, attr->data_size, error);
if (!is_ok (error)) {
ret = 0;
goto leave;
}
ret = *(gint32*)typed_args [1];
g_free (typed_args [1]);
g_free (typed_args);
g_free (named_args);
g_free (arginfo);

ret = *(gint32*)decoded_args->typed_args[1]->value.primitive;
mono_reflection_free_custom_attr_data_args_noalloc (decoded_args);
return ret;
}
}
Expand Down
30 changes: 27 additions & 3 deletions src/mono/mono/metadata/custom-attrs-internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,29 @@
#include <mono/metadata/object-internals.h>
#include <mono/metadata/reflection.h>

typedef struct _MonoCustomAttrValueArray MonoCustomAttrValueArray;

typedef struct _MonoCustomAttrValue {
union {
gpointer primitive; /* int/enum/MonoType/string */
MonoCustomAttrValueArray *array;
} value;
MonoTypeEnum type : 8;
} MonoCustomAttrValue;

struct _MonoCustomAttrValueArray {
int len;
MonoCustomAttrValue values[MONO_ZERO_LEN_ARRAY];
};

typedef struct _MonoDecodeCustomAttr {
int typed_args_num;
int named_args_num;
MonoCustomAttrValue **typed_args;
MonoCustomAttrValue **named_args;
CattrNamedArg *named_args_info;
} MonoDecodeCustomAttr;

MonoCustomAttrInfo*
mono_custom_attrs_from_builders (MonoImage *alloc_img, MonoImage *image, MonoArray *cattrs);

Expand All @@ -33,8 +56,9 @@ MONO_COMPONENT_API void
mono_reflection_create_custom_attr_data_args (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, MonoArrayHandleOut typed_args_out, MonoArrayHandleOut named_args_out, CattrNamedArg **named_arg_info, MonoError *error);

MONO_COMPONENT_API void
mono_reflection_create_custom_attr_data_args_noalloc (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len,
gpointer **typed_args_out, gpointer **named_args_out, int *num_named_args,
CattrNamedArg **named_arg_info, MonoError *error);
mono_reflection_free_custom_attr_data_args_noalloc(MonoDecodeCustomAttr* decoded_args);

MONO_COMPONENT_API MonoDecodeCustomAttr*
mono_reflection_create_custom_attr_data_args_noalloc (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, MonoError *error);

#endif /* __MONO_METADATA_REFLECTION_CUSTOM_ATTRS_INTERNALS_H__ */
Loading