Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-10-24[netcore] Managed ThreadPool implementation (#17387)Filip Navara
* Wire up the managed side of the portable thread pool * Remove old native thread pool code * Fix non-netcore build * Fix Thread.IsThreadPoolThread * Fix MSVC builds * Code style fix * Make the locking primitives uninterruptible * Revert icall changes for non-netcore * Implement Thread.ResetThreadPoolThread * Compile out more thread pool code for netcore * Remove ThreadPoolBoundHandle, it is shared now * Address PR feedback on code style
2019-10-14[loader] Move PInvoke and DllMap code into separate source fileRyan Lucia
2019-09-12[netcore] Create a separate version of threadpool.c for netcore with the ↵Zoltan Varga
domain support removed. (#16250) * [netcore] Create a separate version of threadpool.c for netcore with the domain support removed. * Fix the windows build. * Fix the build.
2019-07-19[metadata] Fix name of header fileAlexander Köplinger
The file added as part of d5b374bb51a07bf3525d63b4cef6ad6979c27d07 was actually called loaded-images-internals.h
2019-07-18[loader] Add MonoAssemblyLoadContext; stop sharing MonoImages on netcore ↵Aleksey Kliger (λgeek)
(#15527) Implement a couple of things: 1. Add a `MonoAssemblyLoadContext` opaque struct 2. On netcore Mono, use it to keep track of which `MonoImage`s are loaded. (Addresses part of #13891) In a bit more detail: - Add a `MonoLoadedImages` struct to hold the hash tables that we use for checking if a `MonoImage` is already loaded - Add an opaque `MonoAssemblyLoadContext` typedef - (Framework Mono) Add a `get_global_loaded_images()` function to get the shared `MonoLoadedImages` - (netcore Mono) Add a `MonoAssemblyLoadContext` struct that owns a `MonoLoadedImages` and add a `default_alc` member to `MonoDomain - Pass a `MonoAssemblyLoadContext*` to most `MonoImage`-loading functions - on Framework Mono its usually NULL and we fall back to the global loaded images, on netcore Mono it's usually `domain->default_alc->loaded_images` - (netcore Mono) Create a default Assembly Load Context when a `MonoDomain` is created - Add a `MonoAssemblyLoadContext*` field to `MonoAssemblyLoadRequest` and pass an ALC in a few places. --- Remaining work: (netcore Mono) There are still places where a `MonoAssemblyLoadRequest` or a `MonoAssemblyOpenRequest` has a `NULL` ALC - those will need to be tracked down and fixed. (netcore Mono) Eventually `MonoAssemblyLoadContext` should keep track of the loaded `MonoAssembly`s, not just images. One goal on netcore Mono is to ifdef out `MonoDomain:domain_assemblies`. --- * [loader] Add a MonoLoadedImages struct to own the MonoImage sharing Initially, there's just a single global set of loaded images. Once we have AssemblyLoadContext support, each ALC will have a separate set. NOTE: - Some of the existing Mono API is difficult to support with this design since it assumes each MonoImage is loaded at most once. * [loader] Add a MonoAssemblyLoadContext member to MonoImage for netcore * [loader] Unregister image from its owner when closing * [loader] Pass MonoLoadedImages to register_image * [domain] Add mono_domain_default_alc and mono_alc_get_loaded_images * [loader] Add an AssemblyLoadContext argument to mono_image_loaded_internal * [metadata] Add mono_image_get_alc () * [loader] Pass MonoAssemblyLoadContext to mono_image_open_from_data_internal * [loader] Pass MonoAssemblyLoadContext to mono_image_open_from_module_handle * [loaded] Pass MonoLoadedImages to mono_image_open_a_lot_parameterized * [loader] Pass MonoAssemblyLoadContext to mono_image_open_a_lot * [runtime] Mark mono_image_open_full external only Runtime should use mono_image_open_a_lot. * [runtime] Mark mono_image_loaded_by_guid external only Also mark mono_image_loaded_by_guid_full external only Runtime will need some (as yet unwritten) mechanism that takes a MonoAssemblyLoadContext as an argument. * [domain] Create a default ALC for each MonoDomain * [netcore] Pass default ALC in mono_core_preload_hook If the assembly name matches a trusted platform assembly, open it in the default ALC of the root domain * [mini] Open main assembly in default ALC in the root domain * [netcore] Don't define get_global_loaded_images() Every assembly load request should come from an assembly load context. Each ALC has a set of loaded images. So we should never need a global list. With this PR, we no longer share MonoImages across distinct ALCs. So in principle, each ALC can open the same assembly but resolve its references in different ways. Fixes part of https://github.com/mono/mono/issues/13891 * [runtime] Mark mono_pe_file_open external only * [loader] Pass MonoAssemblyLoadContext to mono_image_open_raw and mono_image_open_metadata_only * [loader] Pass MonoAssemblyLoadContext to do_mono_image_open and set MonoImage:alc * [loader] Add version 2 of assembly preload hook Pass MonoAssemblyLoadContext through the preload hook. This is used in mono_assembly_request_byname_nosearch which, in turn, is called by load_reference_by_aname_default_asmctx which is used to resolve references from one assembly to another. * [netcore] Pass native ALC ptr to AssemblyLoadContext.InternalLoadFile * [netcore] Implement AssemblyLoadContext.InternalInitializeNativeALC also implement mono_domain_create_individual_alc () * [netcore] Pass ALC to System.Reflection.Assembly.InternalLoad Pass the domain default ALC to mono_assembly_load () Also pass MonoAssemblyLoadContext to mono_assembly_load_full_gac_base_default () * [loader] Implement MONO_LOADED_IMAGES_ASSEMBLY properly Store the MonoLoadedImages for netmodules in the MonoImage for the main image of an assembly. This is also used by SRE - the dummy module of the AssemblyBuilder has the loaded_images that contains the ModuleBuilders. * [loader] Use global_loaded_images for netmodules with framework Mono The new stuff is only for ALC support in netcore * [loader] Drop netmodule support in MonoAssemblyLoadContext netmodules are not supported in netcore * [loader] Spin out image hashing out of image.c Move MonoLoadedImages support code to loaded-images.c loaded-images-global.c and loaded-images-netcore.c Also spin out assembly-load-context.c for MonoAssemblyLoadContext functions * Move ALC icall to assembly-load-context.c * formatting fix * [msvc] Add new files to .filters * update comments * [image] Change mono_loaded_images_remove_image to decrement the refcount Decrement the refcount and remove the image from the loaded images hashes in one place. Change mono_loaded_images_remove_image to return TRUE if the rest of image unloading should proceed or not. * [loader] Drop unused argument to mono_alc_init
2019-06-21[api] Add a mono/metadata/profiler-legacy.h header (#15098)Aleksey Kliger (λgeek)
* [api] Add mono/metadata/profiler-legacy.h header Add a header with the legacy Mono profiler API. New code should use the API from mono/metadata/profiler.h. * [profiler] Mark the legacy profiler API with MONO_DEPRECATED * [runtime] Don't install the profiler-legacy.h header Make the decision later whether these should be in the set of public API headers
2019-05-27Add missing new files to Makefile.am, fix tarball build (#14656)Alexander Köplinger
They were added in https://github.com/mono/mono/pull/14427
2019-05-09Introduce enum and static data for JIT icalls, that are currently hashed ↵Jay Krell
(#14359) * Introduce enum and static data for JIT icalls, that are currently hashed by string and address and use dynamic allocation. These will be used shortly. * PR: Move MONO_JIT_ICALLS content from class-internals.h to jit-icall-reg.h. Not clear what is the best name but moving along.
2018-10-23[coop] Transition all functions in object.h to MONO_RT_EXTERNAL_ONLY (#11188)Jay Krell
In general this is achieved by renaming mono_foo to mono_foo_internal, and mono_foo_bar calls mono_foo_bar_internal, possibly adding a GC mode change to mono_foo_bar and removing from mono_foo_bar_internal. We can also consider other names like m_foo_bar, mi_foo_bar, m.foo_bar, m->foo_bar, m::foo_bar, using mi = mono_internal; mi::foo, foo.bar(), etc. * [test] Report dlsym failure with an assertion failure and give the symbol. * Compilation of external-only.c/.o needs special care. Because it is dead code, except for exports, the linker does not necessarily eagerly look into it (.o within .a), and export anything. This is the usual behavior of Windows linker. Unix linker I guess it varies between programs and shared libraries, but it was observed and broke a test, and a small case was constructed to demonstrate the behavior (i.e. where the dlsym assert is added), even though I assumed the opposite -- so must be program vs. sharedlibrary. Therefore, we `#include external-only.c` in object.c. Longer term we should probably use Windows .def files and their Unix equivalent, and/or be sure to list external-only.o directly on the link command line, instead of burying it in a static library. .def files were used in the past and have other advantages/differences. Other than guaranteeably reaching into .a/.lib files to find exports, they also export on NT/x86 as plain "mono_foo" instead of "_mono_foo", easing portability of LoadLibrary / GetProcAddress. The loss of the x86 C name mangling *could* be viewed as a loss, of a tiny amount of safety. They also make declspec(dllimport) and declspec(dllexport) both pointless, at least for C functions -- dllimport remains significant for data and C++ (no need to list mangled names in .def file), and to microoptimize one instruction out of some calls on non-LTCG builds.
2018-09-22[Coop] Convert or partially convert ↵Jay Krell
mono_domain_try_type_resolve_typebuilder, mono_domain_try_type_resolve, mono_domain_try_type_resolve_name. (#10675) * Convert or partially convert mono_domain_try_type_resolve_typebuilder, mono_domain_try_type_resolve, mono_domain_try_type_resolve_name. In order to use TYPED_HANDLE_DECL, this required splitting handle.h into at least two pieces, here called handle-decl.h and handle.h. A fair amount of early returns had to be converted. * PR: Move mono_domain_try_type_resolve_name from domain-internals.h to reflection-internals.h. Move mono_domain_try_type_resolve_typebuilder ditto. Move ves_icall_TypeBuilder_create_runtime_class from object-internals.h to reflection-internals.h. Move TYPED_HANDLE_DECL (MonoReflectionAssembly) from handle-0.h to reflection-internals.h (previously object-internals.h) Move TYPED_HANDLE_DECL (MonoReflectionTypeBuilder) ditto. Add MONO_HANDLE_BOOL to handle.h so we can 1. Stop inverting tests and 2. Prefer true first in ternary. x = MONO_HANDLE_BOOL (y) ? z : 0 instead of x = MONO_HANDLE_IS_NULL (y) ? 0 : z Add include "reflection-internals.h" to mono-security.c Add include "reflection-internals.h" to security.h object-forward.h: Place MONO_RT_MANAGED_ATTR on MonoReflectionTypeBuilder. Really it should just be MonoObject, and then implied by everything that contains it. Place MONO_RT_MANAGED_ATTR consistently. Sort by native then managed. mono_reflection_get_type_with_rootimage: Rename assembly to refection_assembly and then use assembly to reduce occurences of MONO_HANDLE_GETVAL (assembly, assembly). mono-security.c: include config.h unconditionally and just once. * Change mono_class_get_ref_info_raw to return MonoReflectionTypeBuilder* instead of MonoObject*. Remove casts on mono_class_get_ref_info_raw calls. Change mono_class_get_ref_info to return MonoReflectionTypeBuilderHandle instead of MonoObjectHandle. Move mono_class_get_ref_info from object-internals.h to reflection-internals.h. Use mono_class_get_ref_info instead of mono_class_get_ref_info_raw. * Cleanup -- MONO_HANDLE_BOOL and contains instead of cast. * PR: Fix incorrect comment. Fix precise GC hole wrt invoke.
2018-08-30[cxx] Add loader-internals.h missed in ↵Jay Krell
https://github.com/mono/mono/pull/10252. (#10377)
2018-08-28[metadata] Remove sysmath.h from Makefile.amAlexander Köplinger
It was removed in c16ff9ab235abef10213f49dceb5251c7d8f6efd.
2018-08-24Fix windows build.Rodrigo Kumpera
2018-07-24[runtime] Removes unused icallsMarek Safar
2018-03-16Fix issue #7596 on Windows x64. (#7625)Johan Lorensson
* Fix error in vcxproj filter causing load error in Visual Studio. * Fixes issue #7596 on Windows x64. Passing value types in Windows x64 not fitting into register will be passed by reference (ArgValuetypeAddrInIReg or ArgValuetypeAddrOnStack ) using a local variable allocated in caller’s frame. Current implementation sized and marshaled the native struct correctly when using pinvoke, but it sized the final local passed as reference to the native method using the managed stack size instead of the native. This caused the final copy into the local to overwrite other locals on stack if managed and native struct stack sizes differed. The fix is to flag the local variable used as stack parameter with its pinvoke state. This makes sure the stack allocation size will be correct when using value types passed on the stacks in pinvokes. When running other unit tests with sequence points I hit a similar issue with empty structs as return parameters (using [StructLayout (LayoutKind.Sequential, Size = 0)]. This commit includes a fix to ignore the return value if it’s an empty struct on Windows x64.
2018-03-09[metadata] split IL generation code into seperate compilation units. (#7487)Bernhard Urban
* [metadata] split IL generation code into seperate compilation units. * [metadata] move ENABLE_ILGEN definition to configure * [metadata] split IL generation code into seperate compilation units. By adding callbacks for IL generating runtime code, we can link in code later into the runtime that does such for configurations which do not need IL generation initially. This is the case if you configure the runtime with `--enable-minimal=jit,interpreter`. In such configuration, the build will produce an additional library, called `libmono-ilgen`. An embedded can choose to link this library to the final binary and initialize IL generation with the following three, newly added, API calls: * `void mono_marshal_ilgen_init (void)` * `void mono_method_builder_ilgen_init (void)` * `void mono_sgen_mono_ilgen_init (void)` This change is mostly moving code around, but there are minor changes like introducing the enum `MarshalTypeCheckPositions`, so we avoid copy/paste constants accross compilation units. * [windows] add IL gen files to windows build and set ENABLE_ILGEN * [fixup!] fix windows build * [fixup!] resolve merge conflicts with class getter commits * marshal.c: b8da9736209427ef49267923e1321c801c65dfd2 * sgen-mono.c: 8ba4947f7a3b37b3c5e5458834109fad317f91bc at some point I gave up to resolve merge conflicts and worked through errors/warnings by compiling with > `CFLAGS=-DENABLE_CHECKED_BUILD_PRIVATE_TYPES=1` so the result is likely a bit different * redo lost changes from 57f3f34e60ee6d17fb1dada4b8799f3d753ca2b0 * redo lost changes from 52514effbf19992edc323ff9d7bf21766bc50b2c * [fixup!] fix array marshal * [method-builder] use eglib types review comment by Ludovic, https://github.com/mono/mono/pull/7375#discussion_r171876337 * [marshal] remove stelem strings from header review comment by Rodrigo, https://github.com/mono/mono/pull/7375#discussion_r171921029
2018-02-27[marshal] Use MonoClass getters in marshal.c (#7253)Aleksey Kliger (λgeek)
* [runtime] Use getters in IS_MONOTYPE() * [metadata] Add m_class_offsetof_fieldName accessors These look like: ```c intptr_t m_class_offsetof_someField (void) { return MONO_STRUCT_OFFSET (MonoClass, someField); } ``` When Mono is compiled with the definition of MonoClass hidden (--enable-checked-build=private_types), only the function prototypes are available via mono/metadata/class-abi-details.h When Mono is compiled without the checked build flag, the functions are inlined into that header. * [metadata] Add accessor function mono_class_set_nonblittable This is needed by mono_marshal_load_type_info () * [marshal] Use m_class_get_ getters to access MonoClass fields
2018-02-11[runtime] Make icall tables loadable. (#6905)Zoltan Varga
* [runtime] Make icall tables loadable. Move the icall table code into a separate icall-table.c file, which is either linked into libmono or compiled into a separate libmono-icall-table.a archive which can be linked into an app, and installed by calling mono_icall_table_init (). * Change ClCompile to ClInclude for new .h file.
2018-02-07[metadata] Define getters for MonoClass fields (#6652)Aleksey Kliger (λgeek)
* [configure.ac] Add --enable-checked-build=private_types option The idea is that when private_types is turned on, we will hide the definitions of various structs in Mono and only allow access via getter/setter methods. If private_types is off, those same getters would be static inline functions and also the struct definition would be visible (to allow for incremental conversion of existing code). * [metadata] Move _MonoClass definition to class-private-definition.h * [metadata] Define a getter for every MonoClass field in a checked build, the getters are just declared in class-internals.h and defined in class-accessors.h in a non-checked build, the getters are static inline functions in class-internals.h For a field foo of type FooType define FooType m_class_get_foo (MonoClass *klass) { return klass->foo; } The exceptions are fields that are embedded structs, e.g. MonoType byval_arg, for those we return a pointer to the field instead of a copy: MonoType * m_class_get_byval_arg (MonoClass *klass) { return &klass->byval_arg; } * [metadata] Rename MonoClass boolean getters to use is/has names instead of the string m_class_get_fieldname pattern - m_class_is_inited - m_class_is_size_inited - m_class_is_valuetype - m_class_is_enumtype - m_class_is_blittable - m_class_is_unicode - m_class_was_typebuilder - m_class_is_ghcimpl - m_class_has_finalize - m_class_is_delegate - m_class_is_gc_descr_inited - m_class_has_cctor - m_class_has_references - m_class_has_static_refs - m_class_has_no_special_static_fields - m_class_is_com_object - m_class_is_interfaces_inited - m_class_is_simd_type - m_class_is_has_finalize_inited - m_class_is_fields_inited - m_class_has_failure * [metadata] (class-internals.h) Use m_class_get_ getters * [metadata] (class-inlines.h) Use m_class_get_ getters * [metadata] (class-accessors.c) Use m_class_get_ getters; setters not done The setters are not converted. Ultimately, I think that will sort itself out - a few of them are only used from SRE and from MonoClass construction - we will eventually provide setters for just two places and hide them elsewhere.
2018-02-06[metadata] Move MonoClass initialization to a separate file (#6611)Aleksey Kliger (λgeek)
Use `git blame -C10 mono/metadata/class-init.c` to see attribution for most of the old code. This PR comprises: * [metadata] Move (some) MonoClass construction to class-init.c So far moved MonoClassDef, MonoClassGtd and MonoClassGenericInst construction functions. The idea is to eventually isolate functions that needs write/setter access to MonoClass fields in a separate translation unit and make MonoClass opaque and only accessible via getters everywhere else. * [metadata] Move pointer MonoClass creation to class-init.c * Mark mono_ptr_class_get as external only, runtime should use mono_class_create_ptr. * [msvc] Add mono/metadata/class-init.c (and .h) to the .targets file * [metadata] Rename mono_generic_class_get_class to mono_class_create_generic_inst * [metadata] Move array class creation to class-init.c * Mark mono_array_class_get external only, runtime should use mono_class_create_array * Mark mono_bounded_array_class_get external only, runtime should use mono_class_create_bounded_array * [metadata] Move generic param creation to class-init.c * Also move mono_class_setup_vtable_general, mono_class_init_sizes, mono_class_setup_methods * [metadata] Move mono_class_setup_basic_field_info to class-init.c * [metadata] Move mono_class_setup_fields to class-init.c * [metadata] Rename mono_class_from_generic_parameter_internal to mono_class_create_generic_parameter * [metadata] Move mono_class_layout_fields to class-init.c * [metadata] Move mono_class_setup_{properties,events} to class-init.h * [metadata] Move mono_class_setup_interfaces to class-init.c * Also move mono_class_setup_mono_type * [metadata] Move mono_class_setup_parent to class-init.c * [metadata] remove some extern statistics
2017-11-09Remove Boehm specific code path in GC aware hash tables as it can now ↵Jonathan Chambers
push/mark roots.
2017-10-03Merged changes in master libmonoruntime into PR.lateralusX
2017-10-03Align libmonoruntime vcxproj with makefile.lateralusX
2017-10-03Fix libmonoruntime targets and filters.lateralusX