+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
+ points to a vtable in the dying appdomain.
+
+ * appdomain.c (mono_domain_unload): Move the notification of OnUnload
+ listeners into unmanaged code inside the lock.
+
+ * object.c (mono_class_vtable): Turn off typed allocation in non-root
+ domains and add some comments.
+
+2003-10-25 Martin Baulig <martin@ximian.com>
+
+ * class.h (MonoGenericInst): Added `MonoClass *klass' field.
+
+ * image.h (MonoImage): Added `GHashTable *typespec_cache'.
+
+ * metadata.c (mono_metadata_parse_generic_inst): Renamed to
+ `do_mono_metadata_parse_generic_inst'; pass it the MonoType we're
+ currently parsing. Create the generic class and store it in
+ `generic_inst->klass' before parsing the type arguments. This is
+ required to support "recursive" definitions; see mcs/tests/gen-23.cs
+ for an example.
+ (mono_type_create_from_typespec): Use a new `image->typespec_cache'
+ to support recursive typespec entries.
+
+ * class.c (mono_class_setup_parent): If our parent is a generic
+ instance, we may get called before it has its name set.
+ (mono_class_from_generic): Splitted into
+ mono_class_create_from_generic() and mono_class_initialize_generic().
+
+2003-10-25 Martin Baulig <martin@ximian.com>
+
+ * icall.c (ves_icall_Type_BindGenericParameters): Return a
+ `MonoReflectionGenericInst *' instead of a `MonoReflectionType *'.
+ ("System.Reflection.MonoGenericInst::inflate_method"): New interncall.
+ ("System.Reflection.MonoGenericInst::inflate_ctor"): New interncall.
+
+ * reflection.c (my_mono_class_from_mono_type): Added MONO_TYPE_GENERICINST.
+ (create_typespec): Likewise.
+ (mono_reflection_bind_generic_parameters): Return a
+ `MonoReflectionGenericInst *' instead of a `MonoClass *'.
+ (mono_reflection_inflate_method_or_ctor): New public function.
+
+ * reflection.h (MonoReflectionGenericInst): New typedef.
+
+2003-10-24 Zoltan Varga <vargaz@freemail.hu>
+
+ * object.c (mono_class_proxy_vtable): Run the whole vtable construction
+ inside the domain lock. Fixes #49993.
+
+ * object.c (mono_class_vtable): When typed allocation is used,
+ allocate vtables in the GC heap instead of in the mempool, since the
+ vtables contain GC descriptors which are used by the collector even
+ after the domain owning the mempool is unloaded.
+
+ * domain.c (mono_domain_set): Rename to mono_domain_set_internal.
+
+ * domain.c (mono_domain_unload): Rename to mono_domain_free to better
+ reflect what it does. Also invalidate mempools instead of freeing
+ them if a define is set.
+
+ * appdomain.h (MonoAppDomainState): New enumeration to hold the state
+ of the appdomain.
+
+ * appdomain.h (_MonoDomain): New field 'finalizable_object_hash' to
+ hold the finalizable objects in this domain.
+
+ * appdomain.h (_MonoDomain): New field 'state' to hold the state of the
+ appdomain.
+
+ * appdomain.c (mono_domain_set): New function to set the current
+ appdomain, but only if it is not being unloaded.
+
+ * appdomain.c threads.c threadpool.c object.c: Avoid entering an
+ appdomain which is being unloaded.
+
+ * appdomain.c (ves_icall_System_AppDomain_InternalUnload): Prevent
+ unloading of the root appdomain.
+
+ * appdomain.c (ves_icall_System_AppDomain_InternalInvokeInDomain): New
+ icall to execute a method in another appdomain. Intended as a
+ replacement for InternalSetDomain, which can confuse the code
+ generation in the JIT.
+
+ * appdomain.c (mono_domain_is_unloading): New function to determine
+ whenever an appdomain is unloading.
+
+ * appdomain.c (mono_domain_unload): New function to correctly unload
+ an appdomain.
+
+ * assembly.c (mono_assembly_load_references): Check that an assembly
+ does not references itself.
+
+ * gc.c (mono_domain_finalize): Rewrote so instead of finalizing a
+ domain manually, it asks the finalizer thread to do it, then waits for
+ the result. Also added a timeout.
+
+ * icall.c: Register the new icalls.
+
+ * threads.h threads.c: Export the mono_gc_stop_world and
+ mono_gc_start_world functions.
+
+ * mempool.h mempool.c (mono_mempool_invalidate): New debugging
+ function to fill out the mempool with 0x2a.
+
+2003-10-22 Zoltan Varga <vargaz@freemail.hu>
+
+ * reflection.h (MonoReflectionMethodAux): New structure to store
+ information which is rarely used, thus is not in the MonoMethod
+ structure.
+
+ * reflection.h (MonoDynamicAssembly): New field 'method_aux_hash' to
+ store the aux info.
+
+ * reflection.c (mono_methodbuilder_to_mono_method): Store param names
+ and marshalling info into the aux structure.
+
+ * loader.c (mono_method_get_marshal_info): Retrieve the marshal info
+ from the aux structure.
+
+ * loader.c (mono_method_get_param_names): Retrieve the param names from
+ the aux structure.
+
+2003-10-21 Zoltan Varga <vargaz@freemail.hu>
+
+ * exception.h exception.c: Add AppDomainUnloadedException && fix
+ warning.
+
+2003-10-21 Dick Porter <dick@ximian.com>
+
+ * socket-io.c
+ (ves_icall_System_Net_Sockets_Socket_Select_internal): Applied
+ patch from Laramie Leavitt moving divide out of loop. (Bug 45381).
+
+2003-10-21 Martin Baulig <martin@ximian.com>
+
+ * reflection.c (mono_reflection_bind_generic_parameters):
+ `klass->parent' is NULL for interfaces.
+
+2003-10-21 Martin Baulig <martin@ximian.com>
+
+ * reflection.c (create_typespec): Added MONO_TYPE_VAR and MONO_TYPE_MVAR.
+
+2003-10-20 Zoltan Varga <vargaz@freemail.hu>
+
+ * exception.c (mono_exception_from_name_msg): New helper function for
+ creating exceptions and initializing their message field.
+
+ * exception.c: Simplify functions using the new helper.
+
+ * exception.h exception.c (mono_get_exception_cannot_unload_appdomain):
+ New function.
+
+ * object.h object.c: Remove G_GNUC_NORETURN from the signature of
+ mono_raise_exception, since otherwise gcc doesn't generate the function
+ epilog for raise_exception, confusing the stack unwinding in the JIT.
+ Fixes #45043.
+
+ * rawbuffer.c (mono_raw_buffer_load_mmap): Map mmap-ed memory with
+ PROT_EXEC. This seems to prevent segmentation faults on Fedora Linux.
+ Fixes #49499.
+
+2003-10-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * icall.c: OutputDebugStringW expects 16-bit unicode characters, not
+ utf8.
+
+2003-10-18 Lluis Sanchez Gual <lluis@ximian.com>
+
+ * icall.c: Removed GetUninitializedObject method because
+ AllocateUninitializedClassInstance does the same.
+
+2003-10-18 Martin Baulig <martin@ximian.com>
+
+ * class.c (inflate_generic_signature): Renamed to
+ mono_class_inflate_generic_signature() and made it public.
+ (my_mono_class_from_generic_parameter): New static function; if we
+ don't already have the generic parameter's MonoClass, create a
+ very simple one which is just used internally in the runtime and
+ not passed back to managed code.
+
+ * class.h (MonoGenericInst): Added `gpointer mbuilder' field.
+
+ * metadata.h (MonoMethodSignature): Moved the
+ `MonoGenericParam *gen_params' to the MonoMethodHeader.
+ (MonoMethodHeader): Moved the `MonoGenericParam *gen_params' here.
+
+ * icall.c (ves_icall_MethodInfo_GetGenericArguments): Renamed to
+ ves_icall_MonoMethod_GetGenericArguments(); this is now an
+ interncall on the MonoMethod class, not on MethodInfo.
+ (ves_icall_MethodInfo_BindGenericParameters): Removed, we're now
+ calling mono_reflection_bind_generic_method_parameters() directly.
+
+ * loader.c (mono_method_get_signature): If this is a MethodSpec;
+ return the already computed `method->signature'.
+ (method_from_methodspec): New static function to load a method
+ from a MethodSpec entry.
+ (mono_get_method_from_token): Call the new method_from_methodspec()
+ for MethodSpec tokens.
+ (mono_get_method_from_token): If we're a generic method, load the
+ type parameters.
+
+ * reflection.c (mono_image_get_memberref_token): Allow
+ MEMBERREF_PARENT_TYPEDEF here; this will be used in the MethodSpec
+ table.
+ (fixup_method): Added support for MONO_TABLE_METHODSPEC.
+ (mono_image_create_token): First check whether it's a generic
+ method (so we'd need to create a MethodSpec), then do the other
+ two alternatives.
+ (mono_reflection_bind_generic_method_parameters): Return a
+ `MonoReflectionMethod *' instead of a `MonoMethod *'; we're now
+ called directly from the interncall.
+
+2003-10-17 Zoltan Varga <vargaz@freemail.hu>
+
+ * reflection.c (load_public_key): Move loading of the public key
+ into managed code.
+
+ * image.h (MonoAssemblyName): Add public_key and hash_alg fields.
+
+ * assembly.c (mono_assembly_open): Fill in public_key and hash_alg
+ fields.
+
+ * icall.c (ves_icall_System_Reflection_Assembly_FillName): Fill in
+ culture, hash_alg and public_key. Fixes #49555.
+
+2003-10-17 Martin Baulig <martin@ximian.com>
+
+ * class.h (MonoGenericInst): Moved this declaration here and added
+ `MonoMethod *generic_method'.
+
+ * icall.c
+ (ves_icall_MethodInfo_GetGenericArguments): New interncall.
+ (ves_icall_MethodInfo_BindGenericParameters): New interncall.
+
+ * metadata.c (mono_metadata_type_equal): Two types of
+ MONO_TYPE_VAR or MONO_TYPE_MVAR equals if they have the same
+ index; ie. don't compare the address of the `MonoGenericParam'
+ structure.
+ (mono_metadata_load_generic_params): Removed the `MonoMethod
+ *method' argument.
+
+ * metadata.h (MonoGenericInst): Moved declaration to class.h.
+ (MonoMethodHeader): Added `MonoGenericInst *geninst'.
+
+ * reflection.c (method_encode_signature): Encode the number of
+ generic parameters.
+ (encode_generic_method_sig): New static function.
+ (method_encode_methodspec): New static function; creates an entry
+ in the MethodSpec table for a generic method.
+ (mono_image_get_methodspec_token): New static function.
+ (mono_image_create_token): Call mono_image_get_methodspec_token()
+ for generic methods.
+ (mono_reflection_bind_generic_method_parameters): New public
+ function. Instantiates a generic method.
+
+2003-10-16 Martin Baulig <martin@ximian.com>
+
+ * metadata.h (MonoMethodSignature): Moved `MonoGenericParam
+ *gen_params' here from MonoMethodHeader.
+
+ * metadata.c (mono_metadata_parse_method_signature): If we have
+ generic parameters, initialize `method->gen_params' and then set
+ the correct `type->data.generic_param' in all the parameters.
+
+2003-10-16 Zoltan Varga <vargaz@freemail.hu>
+
+ * threads.c (mono_threads_get_default_stacksize): New function to
+ return the default stacksize.
+
+ * gc.c (mono_gc_cleanup): Use a separate event for waiting for the
+ termination of the finalizer thread, since the previous method had
+ race conditions. Fixes #49628.
+
+ * gc.c (mono_gc_init): Use the same stacksize for the finalizer thread
+ as for the other managed threads.
+
+2003-10-16 Martin Baulig <martin@ximian.com>
+
+ * class.c (inflate_generic_signature): Copy `generic_param_count'
+ and `gen_params'.
+
+ * icall.c (ves_icall_MethodInfo_get_IsGenericMethodDefinition):
+ New interncall.
+
+ * metadata.c (mono_metadata_parse_method_signature): Actually set
+ the `method->generic_param_count' here.
+ (mono_metadata_load_generic_params): Initialize `pklass' to NULL.
+
2003-10-15 Zoltan Varga <vargaz@freemail.hu>
+ * object.h: Add a new field to TypedRef to simplify the implementation
+ of the REFANY opcodes in the JIT.
+
+ * icall.c: Make use of the new field.
+
* metadata.c (mono_type_size): Compute the size of TYPEDBYREF types
dynamically.