[Mono-dev] [PATCH] move access check code from mini/mini.c to metadata/class.c

Paolo Molaro lupus at ximian.com
Tue Jul 3 04:57:25 EDT 2007


On 07/02/07 Rodrigo Kumpera wrote:
> The attached patch moves can_access_field and can_access_method from 
> mini.cto
> class.c. The reason behind this change is to allow code sharing between
> verifier and JIT as access checks are meat to be exactly the same between
> the two. The current patch just move the code and makes no modification.
> Following patches will implement the TODO items.

> Index: metadata/class.h
> ===================================================================
> --- metadata/class.h	(revision 81207)
> +++ metadata/class.h	(working copy)
> @@ -258,6 +258,12 @@
>  char *
>  mono_class_name_from_token (MonoImage *image, guint32 type_token);
>  
> +gboolean
> +can_access_field (MonoMethod *method, MonoClassField *field);
> +
> +gboolean
> +can_access_method (MonoMethod *method, MonoMethod *called);
> +
>  G_END_DECLS
>  
>  #endif /* _MONO_CLI_CLASS_H_ */

metadata/class.h is a public API header: any function exported there
must obey the naming rules, in particular avoiding the pollution of the
user namespace. All the public mono functions must have a "mono_" prefix.
Also, in the spirit of C-based OOP code the functions that can be
considered instance methods for a type should have a prefix that
matches the type name (but lowercase and with underscores inserted
in lowercase->uppercase transitions). In this case the function names
should be:

	mono_method_can_access_field
and
	mono_method_can_access_method

With this change the patch can be committed.
Thanks!

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better



More information about the Mono-devel-list mailing list