[Mono-devel-list] [PATCH] Implementation for ReflectionOnlyLoad methods
Paolo Molaro
lupus at ximian.com
Wed Jan 19 09:49:04 EST 2005
On 01/19/05 Carlos Alberto Cortez wrote:
> I think it is read to be commited (except, of course, by the fact that
> any style/code errors the jit guys could tell me).
I don't see any need to duplicate the hashtables that holds assemblies
for the metadata-only ones. Just use the same data structures as
the normal assemblies and tag metadata-only assemblies with a boolean or
bit in MonoImage. You'll need to check this flag in the current codepaths,
of course.
> +MonoAssembly*
> +mono_assembly_refonly_invoke_search_hook (MonoAssemblyName *aname)
Why is this public API needed?
> +void
> +mono_install_assembly_refonly_search_hook (MonoAssemblySearchFunc func, gpointer user_data)
Same.
> +void
> +mono_install_assembly_refonly_preload_hook (MonoAssemblyPreLoadFunc func, gpointer user_data)
Idem.
> MonoAssembly*
> -mono_assembly_loaded (MonoAssemblyName *aname)
> +mono_assembly_load (MonoAssemblyName *aname, const char *basedir, MonoImageOpenStatus *status)
> {
> + return mono_assembly_load_refonly (aname, basedir, status, FALSE);
> +}
> +
> +MonoAssembly*
> +mono_assembly_loaded (MonoAssemblyName *aname, gboolean ref_only)
You changed the public API here: this is not allowed.
> @@ -525,7 +533,11 @@
> if (t == null)
> return null;
>
> - return Activator.CreateInstance (t);
> + try {
> + return Activator.CreateInstance (t);
> + } catch (InvalidOperationException e) {
> + throw new ArgumentException ("It is illegal to invoke a method on a Type loaded via ReflectionOnly methods.");
> + }
Please also add test cases to the test suite that test for this kind of change.
> Index: MonoMethod.cs
> ===================================================================
> --- MonoMethod.cs (revisión: 39129)
> +++ MonoMethod.cs (copia de trabajo)
> @@ -118,6 +118,8 @@
> throw new ArgumentException ("parameters");
> try {
> return InternalInvoke (obj, parameters);
> + } catch (InvalidOperationException) {
> + throw;
Test case needed here.
> Index: AppDomain.cs
> ===================================================================
> --- AppDomain.cs (revisión: 39129)
> +++ AppDomain.cs (copia de trabajo)
> @@ -64,6 +64,9 @@
> [ThreadStatic]
> static Hashtable assembly_resolve_in_progress;
>
> + [ThreadStatic]
> + static Hashtable assembly_prebind_resolve_in_progress;
> +
I'm not sure a second hash table is needed here: you can always check the
RefOnly flag when doing a lookup, right?
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