2003-12-01 Dick Porter <dick@ximian.com>
[mono.git] / mono / metadata / ChangeLog
index 17416aa665c94ab36b68a0e4a26790031f0df924..548557896571d844a2cca40d3eb81f77ad4a835c 100644 (file)
@@ -1,5 +1,576 @@
+2003-12-01  Dick Porter  <dick@ximian.com>
+
+       * icall.c: 
+       * locales.c: Implement string compares and searching
+
+       * object.h: Add extra Thread field
+
+2003-11-30  Zoltan Varga  <vargaz@freemail.hu>
+
+       * reflection.c (fixup_method): Add support for MonoCMethod.
+
+2003-11-28  Zoltan Varga  <vargaz@freemail.hu>
+
+       * gc.c: Fix hangs and error messages when GC_DONT_GC is set.
+
+       * reflection.c (assembly_name_to_aname): Allow extra characters in
+       assembly names. Fixes #51468.
+
+2003-11-26  Zoltan Varga  <vargaz@freemail.hu>
+
+       * exception.c (mono_exception_from_name_domain): New helper function.
+
+       * appdomain.c (ves_icall_System_AppDomain_createDomain): Create the
+       exception object in the correct domain.
+
+       * appdomain.c (ves_icall_System_AppDomain_LoadAssemblyRaw): Fix 
+       formatting + make a copy a the input data.
+
+       * loader.c (mono_get_method_from_token): Methods which contain
+       native code do not have entries in the ImplMap.
+
+       (ves_icall_System_AppDomain_LoadAssemblyRaw): Fix exception throw.
+       Thanks to Gonzalo for spotting this.
+       
+       * appdomain.c (ves_icall_System_AppDomain_LoadAssemblyRaw): Applied
+       patch from ztashev@openlinksw.co.uk (Zdravko Tashev). New icall.
+
+       * assembly.h (mono_assembly_load_from): Split the second part of 
+       assembly loading into a new public function.
+
+       * exception.h (mono_get_exception_bad_image_format): New function.
+
+2003-11-24  Zoltan Varga  <vargaz@freemail.hu>
+
+       icall.c (ves_icall_System_Reflection_Assembly_InternalGetType): 
+       Enumerate all modules inside a dynamic assembly. Fixes #51293.
+       
+       * icall.c: Add new icall for creating dynamic methods.
+
+       * loader.h debug-helpers.c: Add new wrapper type for dynamic methods.
+
+       * reflection.h (MonoReflectionDynamicMethod): Fix type of bool fields.
+
+       * reflection.c (mono_reflection_create_dynamic_method): New icall to
+       create a dynamic method.
+
+       * reflection.c (resolve_object): New helper function.
+
+       * reflection.c: Generalize ReflectionMethodBuilder and the functions
+       which manipulate it so they can also work on dynamic methods.
+
+       * reflection.c (reflection_method_builder_to_mono_method): Avoid 
+       creating the MonoReflectionMethodAux structure if it is not needed.
+       
+       * reflection.h verify.c: Update after changes to object layout.
+
+       * reflection.c (method_builder_encode_signature): Fix compilation on
+       gcc 2.95.x.
+
+2003-11-21  Lluis Sanchez Gual  <lluis@ximian.com>
+
+       * appdomain.h: Added support for context static fields. Added static_data
+         field to MonoAppContext and renamed thread_static_fields to a more
+         generic special_static_fields in MonoAppDomain, since it can now contain
+         context static fields.
+       * domain.c: Updated hashtable name.
+       * object.c: Replaced field_is_thread_static() for a more generic
+         field_is_special_static() which also checks for context static attribute.
+         In mono_class_vtable(), added support for static context fields.
+       * threads.c: Changed methods that manage thread static fields to more
+         generic methods so they can be reused both for thread and context static
+         data.
+       * threads.h: Declared some new methods.
+
+2003-11-21  Zoltan Varga  <vargaz@freemail.hu>
+
+       * reflection.h: Update after changes to the managed types.
+
+       * reflection.c (encode_custom_modifiers): New helper function.
+
+       * reflection.c (method_encode_signature): Emit custom modifiers.
+
+       * reflection.c (field_encode_signature): Emit custom modifiers.
+
+2003-11-18  Zoltan Varga  <vargaz@freemail.hu>
+
+       * reflection.h (MonoReflectionAssemblyName): Applied patch from Laurent Morichetti (l_m@pacbell.net). Fix type of 'flags' field.
+
+       * icall.c (ves_icall_System_ValueType_Equals): New optimized 
+       implementation.
+
+       * icall.c (ves_icall_System_ValueType_InternalGetHashCode): New 
+       icall.
+
+       * object.c (mono_field_get_value_object): New function.
+
+       * object.c appdomain.h appdomain.c: Make out_of_memory_ex domain
+       specific.
+
+2003-11-17  Zoltan Varga  <vargaz@freemail.hu>
+
+       * appdomain.c (mono_runtime_get_out_of_memory_ex): New function to
+       return a preallocated out-of-memory exception instance.
+
+       * object.c (out_of_memory): Use the new function.
+
+       * metadata.c (mono_metadata_parse_type): Handle the case when the byref
+       flag is before the custom modifiers. Fixes #49802.
+
+2003-11-16  Martin Baulig  <martin@ximian.com>
+
+       * class.c (mono_class_is_open_constructed_type): Implemented the
+       MONO_TYPE_GENERICINST case.
+
+2003-11-16  Zoltan Varga  <vargaz@freemail.hu>
+
+       * assembly.c (mono_assembly_fill_assembly_name): New function to
+       fill out the MonoAssemblyName structure.
+       (mono_assembly_open): Use the new function.
+
+       * icall.c (fill_reflection_assembly_name): New helper function.
+
+       * icall.c (ves_icall_System_Reflection_Assembly_FillName): Use the
+       new function.
+
+       * icall.c (ves_icall_System_Reflection_Assembly_InternalGetAssemblyName): New icall.
+
+2003-11-15  Martin Baulig  <martin@ximian.com>
+
+       * class.c (mono_class_is_open_constructed_type): New public
+       function; checks whether a type is an open constructed type,
+       ie. whether it still contains type parameters.
+       (mono_class_inflate_generic_type): If we're a type parameter and
+       the inflated type is also a MONO_TYPE_(M)VAR, return the original
+       type.
+
+       * class.h (MonoGenericInst): Added `guint32 is_open'.
+
+       * loader.c (method_from_methodspec): Check whether we're an open
+       or closed constructed type and set `ginst->is_open'.
+
+       * reflection.c (mono_reflection_bind_generic_parameters): Check
+       whether we're an open or closed constructed type and set
+       `ginst->is_open'.
+       (mono_reflection_inflate_method_or_ctor): Don't inflate methods
+       from open constructed types.
+
+2003-11-15  Martin Baulig  <martin@ximian.com>
+
+       * reflection.c (mono_reflection_bind_generic_parameters): If we're
+       a generic instance (instead of a generic type declaration) with
+       unbound generic parameters, bind them to our actual types.
+
+2003-11-14  Martin Baulig  <martin@ximian.com>
+
+       * reflection.h (MonoReflectionGenericInst): Added `MonoArray *interfaces'.
+
+       * reflection.c (mono_reflection_bind_generic_parameters): If we're
+       an interface type, populate `res->interfaces' with instantiated
+       versions of all the interfaces we inherit.
+
+2003-11-13  Aleksey Demakov  <avd@openlinksw.com>
+
+       * assembly.c (mono_assembly_load): Fixed problem finding mscorlib.dll
+       when MONO_PATH is set but doesn't contain the install dir.
+
+2003-11-13  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * icall.c:
+       (ves_icall_Type_GetInterfaces): don't return an interface twice when
+       it's also implemented in base classes. Fixes bug #50927.
+
+2003-11-13  Zoltan Varga  <vargaz@freemail.hu>
+
+       * gc.c (ves_icall_System_GC_WaitForPendingFinalizers): Avoid deadlocks
+       if this method is called from a finalizer. Fixes #50913.
+
+2003-11-12  Miguel de Icaza  <miguel@ximian.com>
+
+       * threads.c: Implement VolatileRead/VolatileWrite
+
+       * icall.c: Add new icalls for VolatileRead/VolatileWrite
+
+2003-11-12  Zoltan Varga  <vargaz@freemail.hu>
+
+       * icall.c (ves_icall_System_Reflection_Assembly_GetTypes): Applied 
+       patch from Danilo Sagan (dsegan@gmx.net). Fix compilation under gcc
+       2.95.3.
+
+       * assembly.c (mono_assembly_open): Fix windows build. Applied patch 
+       from Peter Ross (pro@missioncriticalit.com).
+       
+2003-11-12  Lluis Sanchez Gual  <lluis@ximian.com>
+
+       * icall.c: Added internal call for System.Environment::GetMachineConfigPath
+
+2003-11-12  Zoltan Varga  <vargaz@freemail.hu>
+
+       * assembly.c (mono_assembly_load_references): Disable check because it
+       triggers on older corlibs which lots of people have.
+
+2003-11-12  Jackson Harper  <jackson@ximian.com>
+
+       * assembly.c: Change corlib name to mscorlib. Add a temp. hack to
+       load corlib.dll if mscorlib.dll is not found.
+       * assembly.h: Remove corlib name define.
+       * class.c:
+       * domain.c:
+       * image.c: Change corlib name to mscorlib.
+       
+2003-11-12  Zoltan Varga  <vargaz@freemail.hu>
+
+       * debug-mono-symfile.c: Add patch from FreeBSD ports tree.
+
+2003-11-11  Miguel de Icaza  <miguel@ximian.com>
+
+       * appdomain.h: Added loader_optimization here to sync with the C#
+       code, and add disallow_binding_redirects field.
+
+2003-11-11  Zoltan Varga  <vargaz@freemail.hu>
+
+       * mono-debug.c (mono_debug_add_method): Ignore unknown modules.
+
+       * reflection.c (mono_image_build_metadata): Fix crash on modules
+       with no types.
+
+       * reflection.h (MonoMethodInfo): Track changes to the managed structure.
+
+       * icall.c (ves_icall_get_method_info): Return callingConvention as
+       well.
+
+       * icall.c (ves_icall_System_Reflection_Assembly_GetNamespaces): Add 
+       namespaces from the EXPORTEDTYPE table as well.
+
+       * icall.c (ves_icall_System_Reflection_Assembly_GetTypes): Merge types
+       from all modules inside the assembly.
+       
+2003-11-11  Martin Baulig  <martin@ximian.com>
+
+       * reflection.c (mono_reflection_bind_generic_parameters): Make
+       this work for interfaces.
+
+2003-11-11  Martin Baulig  <martin@ximian.com>
+
+       * mono-debug.c (mono_debug_add_type): Ignore unknown modules.
+
+2003-11-11  Martin Baulig  <martin@ximian.com>
+
+       * reflection.c (mono_reflection_inflate_method_or_ctor): Allow
+       "MonoInflatedMethod" and "MonoInflatedCtor".
+
+2003-11-11  Zoltan Varga  <vargaz@freemail.hu>
+
+       * reflection.c (resolution_scope_from_image): Use the assembly table
+       from the manifest module, since other modules don't have it.
+
+       * debug-helpers.c (mono_type_full_name): New helper function.
+
+       * image.h (MonoAssembly): Change 'dynamic' to a boolean.
+
+       * image.c (mono_image_load_file_for_image): New public function which
+       is a replacement for the load_file_for_image in class.c.
+
+       * assembly.c (mono_assembly_load_module): A wrapper for the function
+       above which does assembly association and reference loading too.
+
+       * class.c (mono_class_from_name): Call mono_assembly_load_module.
+
+2003-11-11  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * appdomain.c: not all of the attributes for the full assembly name
+       are required and the order doesn't matter. Fixes bug #50787.
+
+2003-11-10  Dick Porter  <dick@ximian.com>
+
+       * locales.c: Use platform-endian UTF16
+
+2003-11-10  Zoltan Varga  <vargaz@freemail.hu>
+
+       * reflection.c: Emit FILE and EXPORTEDTYPE tables.
+       
+2003-11-10  Martin Baulig  <martin@ximian.com>
+
+       * metadata.c
+       (mono_metadata_load_generic_params): Make this actually work.
+
+       * reflection.c (mono_reflection_bind_generic_parameters): If our
+       parent is a generic instance, pass all the `types' to it, no
+       matter whether it has the same number of type parameters or not.
+
+2003-11-10  Zoltan Varga  <vargaz@freemail.hu>
+
+       * reflection.c: Emit FILE and EXPORTEDTYPE tables.
+
+       * assembly.c (mono_assembly_load_references): Move the image<->assembly
+       assignment code to this function so it gets called recursively for all
+       modules.
+
+       * image.c (load_modules): Remove the assembly assignment since it is
+       now done by mono_assembly_load_references.
+       
+       * icall.c (ves_icall_System_Reflection_Assembly_InternalGetType): 
+       Add 'module' argument.
+       (mono_module_get_types): New helper function.
+       (ves_icall_System_Reflection_Module_InternalGetTypes): New icall.
+
+2003-11-08  Martin Baulig  <martin@ximian.com>
+
+       * class.c (mono_class_inflate_generic_method): Interface method
+       don't have a header.
+
+       * reflection.c (mono_image_get_methodspec_token): Take an
+       additional `MonoGenericInst *' argument instead of reading it from
+       the header; this is necessary to support interfaces.
+       (mono_image_create_token): Pass the `MonoGenericInst *' from the
+       MonoReflectionInflatedMethod to mono_image_get_methodspec_token().
+       (inflated_method_get_object): Take an additional `MonoGenericInst *'
+       argument.
+
+       * reflection.h (MonoReflectionInflatedMethod): Added
+       `MonoGenericInst *ginst'.
+
+2003-11-07  Zoltan Varga  <vargaz@freemail.hu>
+
+       * gc.c (mono_domain_finalize): Fix compilation for no GC case.
+
+2003-11-06  Zoltan Varga  <zovarga@ws-zovarga2>
+
+       * appdomain.c (mono_domain_unload): Add a workaround for bug #27663.
+
+2003-11-06  Zoltan Varga  <vargaz@freemail.hu>
+
+       * reflection.c 
+       (reflection_methodbuilder_from_method_builder):
+       (reflection_methodbuilder_from_ctor_builder): New helper functions to 
+       initialize a ReflectionMethodBuilder structure.
+       (mono_image_get_methodbuilder_token):
+       (mono_image_get_ctorbuilder_token): New functions to emit memberref
+       tokens which point to types in another module inside the same assembly.
+
+       * reflection.c: Use the new helper functions.
+       
+       * reflection.c (mono_image_basic_init): Initialize basedir and culture.
+
+       * icall.c loader.c reflection.c: Use ModuleBuilder->dynamic_image 
+       instead of AssemblyBuilder->dynamic_assembly in the appropriate places.
+
+       * reflection.c (resolution_scope_from_image): Emit a moduleref if
+       neccesary.
+
+       * reflection.c (mono_image_build_metadata): Emit metadata only for the
+       current module. Emit the manifest only for the main module.
+
+       * reflection.c (mono_image_create_token): Add assertion when a 
+       memberref needs to be created.
+
+       * reflection.c reflection.h (MonoDynamicAssembly): Remove unused fields.
+
+       * reflection.c (mono_reflection_get_custom_attrs_blob): Allocate a 
+       larger buffer for the custom attribute blob. Fixes #50637.
+       
+2003-11-03  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * threadpool.c: notify listener on async processing handles after
+       invoking the async callback. Thanks to Zoltan.
+
+2003-11-03  Zoltan Varga  <vargaz@freemail.hu>
+
+       * reflection.c (create_dynamic_mono_image): Call mono_image_init to 
+       avoid code duplication.
+
+       * reflection.h (MonoDynamicImage): New type which is currently unused,
+       but will be used through the ref.emit code in place of 
+       MonoDynamicAssembly.
+
+       * reflection.h (MonoReflectionAssemblyBuilder): Track changes to the
+       object layout.
+
+       * reflection.c (create_dynamic_mono_image): Rewrote so it now creates
+       a MonoDynamicImage instead of just a MonoImage.
+       
+       * reflection.h reflection.c icall.c: Move nearly all AssemblyBuilder
+       icalls to ModuleBuilder but keep their semantics, so they will work
+       with moduleb->assemblyb. This will change later.
+       
+2003-11-03  Zoltan Varga  <vargaz@freemail.hu>
+
+       * reflection.h (MonoReflectionAssemblyBuilder): Track changes to the
+       object layout.
+
+       * reflection.c (mono_image_build_metadata): Avoid creation of a default
+       main module, since it is now done by the managed code.
+
+2003-11-03  Martin Baulig  <martin@ximian.com>
+
+       * reflection.c (mono_reflection_inflate_method_or_ctor): Set
+       `ginst->klass' here.
+       (method_encode_methodspec): Don't use the `ginst->generic_method's
+       klass if it's a generic instance, use `ginst->klass' in this case.
+
+2003-11-03  Martin Baulig  <martin@ximian.com>
+
+       * reflection.c (mono_image_get_generic_method_param_info):
+       Removed, use mono_image_get_generic_param_info() instead.
+       (mono_image_get_type_info): Write the GenericParam table before
+       the Method table.  This is neccessary because in the GenericParam
+       table, type parameters of the class (ie. '!0' etc.) must come
+       before the ones from its generic methods (ie. '!!0' etc).
+
+2003-11-03  Zoltan Varga  <vargaz@freemail.hu>
+
+       * icall.c (ves_icall_System_Reflection_Assembly_FillName): Fill out AssemblyName->codebase. Fixes #50469.
+
+2003-11-02  Martin Baulig  <martin@ximian.com>
+
+       * reflection.c (create_generic_typespec): Take a
+       `MonoReflectionTypeBuilder *' instead of a `MonoType *' and get
+       the generic parameters from it.
+
+2003-11-02  Martin Baulig  <martin@ximian.com>
+
+       * reflection.c (fieldref_encode_signature): Take a `MonoType *'
+       instead of a `MonoClassField *' since we just need the type.
+       (create_generic_typespec): New static function.  Creates a
+       TypeSpec token for a generic type declaration.
+       (mono_image_get_generic_field_token): New static function.
+       (mono_image_create_token): If we're a FieldBuilder in a generic
+       type declaration, call mono_image_get_generic_field_token() to get
+       the token.
+
+2003-11-02  Martin Baulig  <martin@ximian.com>
+
+       * reflection.h
+       (MonoReflectionInflatedMethod, MonoReflectionInflatedField): Added
+       `MonoReflectionGenericInst *declaring_type' and
+       `MonoReflectionGenericInst *reflected_type' fields.
+
+       * reflection.c (mono_reflection_inflate_method_or_ctor): Take a
+       `MonoReflectionGenericInst *declaring_type' and a
+       `MonoReflectionGenericInst *reflected_type' argument instead of a
+       single `MonoReflectionGenericInst *type' one.  Set
+       `res->declaring_type' and `res->reflected_type' from them.
+       (mono_reflection_inflate_field): Likewise.      
+
+2003-11-02  Martin Baulig  <martin@ximian.com>
+
+       * class.c (mono_class_setup_vtable): Don't store generic methods
+       in the vtable.  
+
+2003-11-02  Martin Baulig  <martin@ximian.com>
+
+       * reflection.h (MonoReflectionGenericInst): Added
+       `MonoReflectionType *declaring_type'.
+
+       * reflection.c (mono_reflection_bind_generic_parameters): Use
+       `if (tb->parent)' instead of `klass->parent'.
+
+2003-11-01  Zoltan Varga  <vargaz@freemail.hu>
+
+       * assembly.c (mono_assembly_open): Avoid crash if a module is loaded
+       with an empty ASSEMBLY table.
+
+       * reflection.c (mono_image_build_metadata): Avoid using the same loop
+       variable in the inner and outer loops.
+
+2003-10-31  Zoltan Varga  <vargaz@freemail.hu>
+
+       * metadata.h (mono_metadata_make_token): Put parentheses around macro
+       argument.
+
+       * appdomain.h appdomain.c (ves_icall_System_AppDomain_InternalPushDomainRef): Fix signature.
+       
+       * appdomain.c appdomain.h icall.c: Get rid of the InvokeInDomain 
+       icalls. Instead, do everything in managed code. This is needed since
+       it is hard to restore the original domain etc. in unmanaged code in the
+       presence of undeniable exceptions.
+
+       * appdomain.c (ves_icall_System_AppDomain_InternalPushDomainRef): 
+       New icalls to push and pop appdomain refs.
+
+2003-10-31  Martin Baulig  <martin@ximian.com>
+
+       * class.c (inflate_generic_type): Renamed to
+       mono_class_inflate_generic_type() and made it public.
+
+       * icall.c ("System.Reflection.MonoGenericInst::inflate_field"):
+       New interncall.
+
+       * loader.c (mono_field_from_memberref): Also set the retklass for
+       typespecs.
+
+       * fielder.c (mono_image_get_inflated_field_token): New static
+       method; creates a metadata token for an inflated field.
+       (mono_image_create_token, fixup_method): Added support for
+       "MonoInflatedField".
+       (fieldbuilder_to_mono_class_field): New static function.
+       (mono_reflection_inflate_field): New public function.
+
+       * reflection.h
+       (MonoReflectionGenericInst): Added `MonoArray *fields'.
+       (MonoReflectionInflatedField): New typedef.     
+
+2003-10-30  Bernie Solomon  <bernard@ugsolutions.com>
+
+       * socket-io.c (in6_addr ipaddress_to_struct_in6_addr): fix
+       for Solaris and other platforms without s6_addr16
+
+2003-10-30  Martin Baulig  <martin@ximian.com>
+
+       * class.c (inflate_generic_type): Take just one `MonoGenericInst *'
+       argument instead of two.
+       (mono_class_inflate_generic_signature): Likewise.
+       (inflate_generic_header): Likewise.
+       (mono_class_inflate_generic_method): Likewise.  In addition, if
+       `ginst->klass' is set, it becomes the new `method->klass'.
+
+       * class.h (MonoGenericInst): Removed the `gpointer mbuilder'
+       field.
+
+       * reflection.c (encode_generic_method_sig): Write a 0xa as the
+       first byte. [FIXME]
+       (method_encode_methodspec): If we have generic parameters, create
+       a MethodSpec instead of a MethodRef.
+       (fixup_method): Added support for "MonoInflatedMethod" and
+       "MonoInflatedCtor".
+       (mono_image_create_token): Added support for "MonoInflatedMethod"
+       and "MonoInflatedCtor".
+       (inflated_method_get_object): New static function; returns a
+       managed "System.Reflection.MonoInflatedMethod" object.
+       (mono_reflection_bind_generic_method_parameters): Return a
+       `MonoReflectionInflatedMethod' instead of a `MonoReflectionMethod'.
+       (mono_reflection_inflate_method_or_ctor): Likewise.
+       (mono_image_get_generic_method_param_info): Initialize unused
+       fields to zero.
+       (mono_image_get_generic_param_info): Likewise.
+
+       * reflection.h (MonoReflectionInflatedMethod): New public
+       typedef.  Corresponds to the managed "S.R.MonoInflatedMethod" and
+       "S.R.MonoInflatedCtor" classes.
+
+       * loader.c (method_from_memberref): If we're a TypeSpec and it
+       resolves to a generic instance, inflate the method.
+
+2003-10-28  Dick Porter  <dick@ximian.com>
+
+       * object.c (mono_runtime_run_main): Convert command-line arguments
+       into utf8, falling back to the user's locale encoding to do so.
+
+2003-10-27  Zoltan Varga  <vargaz@freemail.hu>
+
+       * loader.c (mono_get_method_from_token): Avoid looking up the icalls
+       at this time.
+
+       * marshal.c (mono_marshal_get_native_wrapper): Lookup icalls here.
+
+       * reflection.c (reflection_methodbuilder_to_mono_method): Avoid looking
+       up icalls at method definition time. Partially fixes #33569.
+
 2003-10-25  Zoltan Varga  <vargaz@freemail.hu>
 
+       * marshal.c (mono_marshal_get_native_wrapper): Add support for [Out]
+       marshalling of arrays. Fixes #50116.
+
        * appdomain.c (ves_icall_System_AppDomain_InternalIsFinalizingForUnload): New icall.
 
        * appdomain.c (unload_thread_main): Clear class->cached_vtable if it