1. 05 4月, 2023 1 次提交
    • D
      Use similar types for self-referential generics instead of the exact canonical type (#83995) · bc887b38
      David Wrighton 提交于
      - Take advantage of work done a few years ago to simplify the interaction with the interop subsystem
      - In the problematic case, simulate loads with two different types as instantiations which are unrelated in field layout, and see if they match up. Only enable this code in a few very small isolated parts of the runtime
      - Filter more of the type loader logic through the byvalue class cache which should improve performance a bit
      - Similarly when considering blittability, tweak the logic to use the special load path
      
      - Support for self-recursive generics is not enabled for static fields, as that requires a somewhat different tweak, and there is less apparent demand. (For that scenario self-referential generics really should support having fields of type T.)
      - Support for indirect self-recursive generics is also not enabled. The approach taken here is not practical for that, and there does not appear to be significant demand for that either.
      
      Fixes #6924
      bc887b38
  2. 28 3月, 2023 1 次提交
    • A
      Fix function pointer as fields inspection (#83981) · ed3721b0
      Aaron Robinson 提交于
      This was missed when C# function pointers support
      was added to the runtime. The current fix is reporting
      all functions pointers as `IntPtr` type. It should be
      possible in a future update to properly represent a
      more accurate type for the function pointer.
      ed3721b0
  3. 17 3月, 2023 1 次提交
    • V
      CoreCLR support for InlineArrayAttribute. (struct layout part) (#82744) · a2b70f99
      Vladimir Sadov 提交于
      * initial port from the prototype
      
      * parse the attribute in MT builder
      
      * validate replicated size
      
      * aot changes
      
      * refmap
      
      * validate total size in ilc
      
      * add the actual attribute
      
      * Apply suggestions from code review
      Co-authored-by: NJan Kotas <jkotas@microsoft.com>
      
      * add a small use of InlineArray in CoreLib - to get some crossgen coverage.
      
      * a few more uses in CorLib
      
      * fix for sequential layout
      
      * Standardize on use of "InlineArray" in the implementation
      
      * simpler layout replication
      
      * some initial tests (will add more)
      
      * more tests
      
      * limit the max size of array instance to 1MiB
      
      * fix an assert in importercalls.cpp
      
      * "result" in GC layout should track the pointer count, not the size
      
      * error messages
      
      * fixed uses of "value array" in comments.
      
      * PR feedback on StackAllocedArguments
      
      * use the same size limit for inline arrays in the typeloader
      
      * more PR feedback
      
      * remove SetCannotBeBlittedByObjectCloner
      
      * moving GetInlineArrayLength to MetadataType and related changes
      
      * use  type.Context.Target.PointerSize
      
      * lost resources change
      
      * fix for x86
      
      * Do not make InlineArrayType an inline array just yet.
      
      * CORINFO_FLG_INDEXABLE_FIELDS
      
      ---------
      Co-authored-by: NJan Kotas <jkotas@microsoft.com>
      a2b70f99
  4. 17 2月, 2023 1 次提交
  5. 30 7月, 2022 1 次提交
  6. 24 7月, 2022 1 次提交
  7. 17 7月, 2022 1 次提交
    • A
      Fix typos (#72314) · 3ea30ed3
      Adeel Mujahid 提交于
      * Fix typos
      
      * Cleanup trailing whitespaces in committed files
      
      * Revert a macro for win32 compat
      
      * Disambiguate test data method
      
      * Revert XMLPath test which rely on external assets
      
      * Revert whitespace change in Xml tests
      
      * Revert ClrEtwAl and ILLink.Shared
      
      * Revert crossgen2 props/targets and *.wxl
      3ea30ed3
  8. 13 7月, 2022 1 次提交
  9. 03 7月, 2022 1 次提交
    • A
      Consume Roslyn with `ref` fields support (#71498) · 912ef01e
      Aaron Robinson 提交于
      * Use C# ref field support
      Update public APIs
      
      * Create new ByReference to be used in Reflection and tailcall slow paths
      
      * Limit net6.0 TFM in DiagnosticsSource to C# 10.
      
      * Remove temporary LifetimeAnnotationAttribute
      This is supplied by Roslyn.
      
      * Update to Roslyn compiler with ref field support.
      
      * Update comments with those approved in official docs.
      
      * Handle byref field in interpreter
      
      * Fix build break when DEBUG_INTERP defined.
      912ef01e
  10. 02 7月, 2022 1 次提交
    • D
      Version resilient cross module code compilation and inlining (#71271) · a78c46d1
      David Wrighton 提交于
      - Refactor Module into ModuleBase and Module
        - The goal is to have allow a subset version of Module which can only hold refs, this is to be used by the manifest module in an R2R image to allow for version resilient cross module references.
        - Update handling of ModuleBase so that its used everywhere that tokens are parsed from R2R
        - Remove ENCODE_MODULE_ID_FOR_STATICS and ENCODE_ACTIVE_DEPENDENCY
          - These were only used for NGEN, and conflict with easy impelmentation for the ModuleBase concept
        - Remove locking in ENCODE_STRING_HANDLE processing, and tweak comments. Comments applied to the removed ngen based code, and the lock was only necessary for the old ngen thing.
        - Adjust ComputeLoaderModuleWorker for locating loader module
          - Follow comment more accurately, to avoid putting every generic into its definition module. This will make R2R function lookup able to find compiled instantiations in some cases. This may be what we want long term, it may not.
        - Remove MemberRefToDesc map and replace with LookupMap like the other token types. We no longer make use of the hot table, so this is more efficient
          - Also reduces complexity of implementation of ModuleBase
      
      - Build fixup to describe a single method as a standalone blob of data
        - There are parallel implementations in Crossgen2 and in the runtime
        - They produce binary identical output
        - Basic R2RDump support for new fixup
      
      - Adjust module indices used within the R2R format to support a module index which refers to the R2R manifest metadata. This requires bumping the R2R version to 6.2
        - Add a module index between the set of assembly refs in the index 0 module and the set of assembly refs in the R2R manifest metadata
      
      - Adjust compilation dependency rules to include a few critical AsyncStateMachineBox methods
      
      - Remove PEImage handling of native metadata which was duplicative
      
      - Do not enable any more devirtualization than was already in use, even in the cross module compilation scenario. In particular, do not enable devirtualization of methods where the decl method isn't within the version bubble, even if the decl method could be represented with a cross module reference token. (This could be fixed, but is out of scope for this initial investigation)
      
      Make the compilation deterministic in this new model, even though we are generating new tokens on demand
        - Implement this by detecting when we need new tokens during a compile, and recompiling with new tokens when necessary
        - This may result in compiling the same code as much as twice
      
      Compile the right set of methods with cross module inlining enabled
      - Add support for compiling the called virtual methods on generic types
        - This catches the List<T> and Dictionary<TKey,TValue> scenarios
      - Support input of PGO data to control the set of methods
      - Enable new `READYTORUN_FLAG_UNRELATED_R2R_CODE` flag on R2R images which is used to indicate which modules may have generic code not directly related to the metadata of the image
      - Lookup R2R methods in an `alternate` location as well as the metadata defining module. This allows for many generics to be embedded without needing to use the new `READYTORUN_FLAG_UNRELATED_R2R_CODE` flag, which has global effects on performance.
      
      - Add command line switches to enable/disable the new behavior
      
      - Enhance the version resilience test to cover this new behavior
      a78c46d1
  11. 22 6月, 2022 1 次提交
  12. 21 6月, 2022 1 次提交
    • D
      Add support for cross module inlining and cross module generic compilation to Crossgen2 (#68919) · 18ec279e
      David Wrighton 提交于
      * Add support for cross module inlining and cross module generic compilation to Crossgen2
      - Refactor Module into ModuleBase and Module
        - The goal is to have allow a subset version of Module which can only hold refs, this is to be used by the manifest module in an R2R image to allow for version resilient cross module references.
        - Update handling of ModuleBase so that its used everywhere that tokens are parsed from R2R
        - Remove ENCODE_MODULE_ID_FOR_STATICS and ENCODE_ACTIVE_DEPENDENCY
          - These were only used for NGEN, and conflict with easy impelmentation for the ModuleBase concept
        - Remove locking in ENCODE_STRING_HANDLE processing, and tweak comments. Comments applied to the removed ngen based code, and the lock was only necessary for the old ngen thing.
        - Adjust ComputeLoaderModuleWorker for locating loader module
          - Follow comment more accurately, to avoid putting every generic into its definition module. This will make R2R function lookup able to find compiled instantiations in some cases. This may be what we want long term, it may not.
        - Remove MemberRefToDesc map and replace with LookupMap like the other token types. We no longer make use of the hot table, so this is more efficient
          - Also reduces complexity of implementation of ModuleBase
      
      - Build fixup to describe a single method as a standalone blob of data
        - There are parallel implementations in Crossgen2 and in the runtime
        - They produce binary identical output
        - Basic R2RDump support for new fixup
      
      - Adjust module indices used within the R2R format to support a module index which refers to the R2R manifest metadata. This requires bumping the R2R version to 6.2
        - Add a module index between the set of assembly refs in the index 0 module and the set of assembly refs in the R2R manifest metadata
      
      - Adjust compilation dependency rules to include a few critical AsyncStateMachineBox methods
      
      - Remove PEImage handling of native metadata which was duplicative
      
      - Do not enable any more devirtualization than was already in use, even in the cross module compilation scenario. In particular, do not enable devirtualization of methods where the decl method isn't within the version bubble, even if the decl method could be represented with a cross-module reference token. (This could be fixed, but is out of scope for this initial investigation)
      
      Make the compilation deterministic in this new model, even though we are generating new tokens on demand
        - Implement this by detecting when we need new tokens during a compile, and recompiling with new tokens when necessary
        - This may result in compiling the same code as much as twice
      
      Compile the right set of methods with cross module inlining enabled
      - Add support for compiling the called virtual methods on generic types
        - This catches the List<T> and Dictionary<TKey,TValue> scenarios
      
      - Add command line switches to enable/disable the new behavior
        - By default the new behavior is not enabled
      18ec279e
  13. 08 5月, 2022 1 次提交
  14. 19 4月, 2022 1 次提交
  15. 30 1月, 2022 1 次提交
    • A
      Fix layout and GCInfo for ByRef fields. (#64422) · 6d21c938
      Aaron Robinson 提交于
      * Fix the GCInfo for types containing ByRef fields.
      
      Update tests to use recursion and validate GCStress scenarios.
      
      * Update stack walking for ref field discovery.
      
      * Indicate the TypedReference is a value type during field initialization.
       - This was missed in the initial support for ref fields.
      6d21c938
  16. 12 1月, 2022 1 次提交
  17. 25 11月, 2021 1 次提交
  18. 12 10月, 2021 1 次提交
    • V
      Some more cleanups in Assembly/Binder/Loader area (#59590) · 7088332d
      Vladimir Sadov 提交于
      * moved default binder allocation to AppDomain::Create
      
      * allowNativeSkip parameter is unused.
      
      * Removed PEFile::IsResource and PEFile::IsIStream - these do not exist in CoreClr
      
      * make GCC happy
      
      * folded impl
      
      * Folded PEFile into PEAssembly
      
      * renamed pefile files
      
      * reorder PEAssembly members
      
      * removed meaningless LAYOUT_CREATEIFNEEDED - we always require that
      
      * r2r bundled image should Open via cache - no reasons not to.
      
      * Some cleanup in PEImage
      
      * PEAssembly needs only one reference to PEImage
      
      * a few tweaks
      
      * some more
      
      * We never update published hosted assemblies, no need to support the scenario.
      
      * Done with PEAssembly for now
      
      * couple fixes, mostly in comments afected by renames
      
      * more cleanups for  PEImage
      
      * PR review suggestion
      Co-authored-by: NElinor Fung <elfung@microsoft.com>
      
      * PR review feedback
      
      * this line should be deleted, not commented.
      
      * Apply suggestions from code review
      Co-authored-by: NElinor Fung <elfung@microsoft.com>
      
      * More PR feedback
      Co-authored-by: NElinor Fung <elfung@microsoft.com>
      7088332d
  19. 20 8月, 2021 2 次提交
  20. 19 8月, 2021 1 次提交
  21. 09 7月, 2021 1 次提交
    • D
      Fix race condition caused by updating interface map with exact target (#55308) · 9270b34a
      David Wrighton 提交于
      - Change interface map reading to reliably perform a volatile load (without barrier)
      - When performing scan for exact interface match/match trhough SpecialMarkerTypeForGenericCasting, be careful to only read the map once and use that value for all comparisons
      - All other uses of InterfaceMapIterator have been audited, and look to be safe
      9270b34a
  22. 29 6月, 2021 1 次提交
    • D
      Faster type load for scenarios made more common by generic math (#54588) · 31441884
      David Wrighton 提交于
      Change interface map layout in two interesting ways
      1. For interface maps defined in System.Private.CoreLib, rely on the C# compiler to prevent any ambiguous duplicates, and to find the full interface expansion, instead of expanding it within the type loader See code marked with #SpecialCorelibInterfaceExpansionAlgorithm
      - Note that this optimization is only applied for ValueTypes as the presence of inheritance makes the optimization much more complex in many cases, and isn't needed.
      - This optimization reduces the amount of parsing of the interface implementation table must be done for valuetypes in CoreLib. In particular, with the new interfaces that are added as part of #54650 there is a very deep interface hierarchy that requires a great deal of scanning. As those interfaces are added to all the primitive types, the impact on startup performance is significant and measurable.
      2. For interface map expansion that follows the curiously recurring generic pattern, place the open instantiation of the type in the interface map instead of the the exact instantiation, and update all places in the runtime which consider the interface map to deal with that change (Mostly by adding special purpose logic to work with the special marker type in the interface map, but there is also logic to simply force the exact interface type to be loaded, when working with the partially loaded type is not quite good enough, or excessively complex)
      - This optimization reduces the set of interface types that need to be loaded if they are unused. Of particular benefit are the numerous interfaces associated with the primitive types that are added as part of #54650.
      
      Performance of launching an extremely simple .NET process (process with empty main method). Results acquired using local testing on my developer machine, using a simple script that launches the process 500 times in a row.
      
      | Before #54650 | After #54650 | After #54650 and #54588 (this pr) |
      | :-: | :-: | :-: |
      | 14.1ms | 16.5ms |14.3ms |
      31441884
  23. 06 5月, 2021 1 次提交
  24. 22 4月, 2021 1 次提交
    • A
      Simplify some CallConv logic (#51596) · 44ce2fee
      Aaron Robinson 提交于
      * Simplify some CallConv logic
      
      Reuse the CallConvBuilder class in more places
      Unify CharSet logic for UnmanagedFunctionPointer and DllImport
      
      * Add needed cast.
      
      * Explicitly handle the 0 case for the CorNativeLinkType enum.
      
      * Comment update.
      
      * Review feedback.
      
      * Update dllimport.cpp
      
      Style feedback.
      44ce2fee
  25. 20 4月, 2021 1 次提交
  26. 27 3月, 2021 1 次提交
    • J
      Add CoreCLR implementation of CallConvMemberFunction. (#47828) · 01d724c1
      Jeremy Koritzinsky 提交于
      * Add CoreCLR implementation of CallConvMemberFunction.
      
      * Add tests and make a few fixes to get them passing.
      
      * Fix Clang build
      
      * Fix argument ordering for calling a cdecl or stdcall instance method from managed.
      
      * Update src/coreclr/dlls/mscorrc/mscorrc.rc
      Co-authored-by: NJan Kotas <jkotas@microsoft.com>
      
      * Fix UnmanagedCallersOnly instance method calls for stdcall and cdecl.
      
      * Update issues.targets.
      
      * Fix formatting.
      
      * Add dummy param to validate param order. Rewrite traversal to second-to-last argument.
      
      * Merge implementations of call conv modopt name comparison.
      
      Use a macro-based implementation initially since it allows us to add new calling conventions by adding one line and the macro-ized code is relatively small.
      
      * Fix assignment alignment.
      
      * SAL and contracts.
      
      * Add assert
      
      * Fix UnmanagedCallersOnly parsing in the refactored parser.
      Co-authored-by: NJan Kotas <jkotas@microsoft.com>
      01d724c1
  27. 18 2月, 2021 1 次提交
    • D
      Adjust logic in cor.h, corhdr.h, corinfo.h, corjit.h and such so that they may... · 4f3545e2
      David Wrighton 提交于
      Adjust logic in cor.h, corhdr.h, corinfo.h, corjit.h and such so that they may be included without the PAL (#46055)
      
      This was done via simple substitution of the standard sized integer types, and dealing with the fallout. It is tested by using the ICorJitInfo interface directly within the crossgen2 jitinterface thunk library.
      
      Effort was made to use a minimum number of casts, as casts in such a large change are likely to be wrong somewhere.
      - Exceptions are the use of casting to handle some calls to the existing internal metadata api and around use of char16_t.
      
      In addition, a small amount of logic from the PAL headers were pulled into the proper header to allow compilation in the presence of some SAL annotation, and other small details.
      4f3545e2
  28. 22 1月, 2021 2 次提交
    • J
      Use CorInfoCallConvExtension throughout runtime interop code (#47251) · 73da00ff
      Jeremy Koritzinsky 提交于
      * First pass to move the vm to use CorInfoCallConvExtension for all IL-stub-related calling convention needs.
      
      * Use CorInfoCallConvExtension all the way down to the native function signature emit stage.
      
      * PR feedback.
      
      * Fix variable name.
      
      * Update src/coreclr/vm/dllimport.cpp
      73da00ff
    • S
      Arm64 apple vm fixes for arg alignment. (#46665) · 648437b1
      Sergey Andreenko 提交于
      * Add `MarshalInfo::IsValueClass`.
      
      * Add `TypeHandle* pTypeHandle` to `SizeOf`.
      
      * Add a few asserts/start using inline function instead of macro.
      
      * use TARGET_POINTER_SIZE instead of STACK_ELEM_SIZE.
      
      * Use `m_curOfs` instead of `m_idxStack` in `ArgIteratorBase` on all platforms.
      
      Before some platforms were using stackSlots, some curOfs in bytes.
      
      * Use byte sizes and offsets in `ArgLocDesc`.
      
      Fix arm32.
      
      x86 fixes.
      
      use StackSize on ArgSizes
      
      Add `GetStackArgumentByteIndexFromOffset` and return back the old values for asserts.
      
      another fix
      
      * Stop using `#define STACK_ELEM_SIZE`
      
      * Add `isFloatHfa`.
      
      * delete checking code.
      
      because it won't pass on arm64 apple.
      
      * arm64 apple fixes.
      
      * roundUp the stack size.
      
      * Add a reflection test.
      
      * Return byte offset from `GetNextOfs`.
      
      It is not a complete fix for arm64 apple, but covers most cases.
      
      * Add `FLOAT_REGISTER_SIZE`
      
      * Use StackElemSize for ` pLoc->m_byteStackSize`.
      
      * replace `assert` with `_ASSERTE`.
      
      * Use `ALIGN_UP` in the code that I have changed.
      
      * rename `m_curOfs` as `m_ofsStack`.
      
      * delete "ceremony " from `StackElemSize`.
      
      * Delete `cSlots` and don't call `StackElemSize` on `GetArgSize`.
      
      * Fix an assert.
      
      * Fix nit.
      
      * fix wrong return for hfa<float>.
      
      * fix nit.
      
      * Fix crossgen job.
      648437b1
  29. 07 1月, 2021 1 次提交
    • J
      Introduce CallConvSuppressGCTransition type to enable suppressing the... · 92870e5e
      Jeremy Koritzinsky 提交于
      Introduce CallConvSuppressGCTransition type to enable suppressing the transition frame for unmanaged function pointer calls (#46343)
      
      * Add public CallConvSuppressGCTransition type
      
      * Fix parsing CallConv modopts out of an IL stub.
      
      * Insert SuppressGCTransition modopt into ilstub target sig. Use modopts for IL stub callconv when SuppressGCTransition in use.
      
      * Recognize CallConvSuppressGCTransition as supressing the GC transition for modopts (Coreclr and crossgen1).
      
      * Support specifying CallConvSuppressGCTransition on both inlinable and non-inlinable calli.
      
      * Enable SuppressGCTransition on calli signatures in crossgen2.
      
      * Fix callconv in il
      
      * PR feedback
      
      * Add docs.
      
      * Use STANDARD_VM_CONTRACT and fix clang build.
      
      * Update contracts in jitinterface.
      
      * Exclude test on mono since support isn't implemented.
      
      * Fix contract.
      
      * PR feedback.
      
      * Add flags back to cache.
      92870e5e
  30. 08 12月, 2020 1 次提交
    • T
      December infra rollout - remove duplicated 'src' from coreclr subrepo... · 69e114c1
      Tomáš Rylek 提交于
      December infra rollout - remove duplicated 'src' from coreclr subrepo (src/coreclr/src becomes src/coreclr) (#44973)
      
      * Move src/coreclr/src/Directory.Build.targets to src/coreclr
      Merge src/coreclr/src/CMakeLists.txt into src/coreclr/CMakeLists.txt
      
      * Mechanical move of src/coreclr/src to src/coreclr
      
      * Scripts adjustments to reflect the changed paths
      69e114c1
  31. 21 10月, 2020 2 次提交
    • J
      Enable implicit fallthrough warning (#43397) · dc7b1d2c
      Jan Vorlicek 提交于
      * Enable implicit fallthrough warning
      
      This change enables warnings for implicit fallthrough in
      switch cases and fixes all the cases where the warning
      was reported.
      It also fixes some places where the fall through was incorrect. 
      Fortunately, these places were not causing functional issues.
      dc7b1d2c
    • D
      Update MulticoreJit (#39996) · 781077f0
      Dong-Heon Jung 提交于
      - Enable Generic Methods in MulticoreJit
      - Enable NDirect Stub in MulticoreJit
      781077f0
  32. 06 8月, 2020 1 次提交
    • D
      Add support for reporting byrefs to RVA static fields of collectible assemblies (#40346) · 69b91f94
      David Wrighton 提交于
      - Keep track of all RVA static field locations
        - For assemblies loaded from PE files, use a range that is the entire PE range
        - For assemblies dynamically created, use piecemeal ranges for each individual RVA static field
      - Report byref references via the GcReportLoaderAllocator mechanism in PromoteCarefully
      
      - Add a test to cover this scenario, and thread statics
        - disable test on Mono, as it doesn't pass there yet
      69b91f94
  33. 29 7月, 2020 2 次提交
  34. 26 7月, 2020 1 次提交
  35. 16 7月, 2020 1 次提交
  36. 08 7月, 2020 1 次提交