Commit Graph
192 Commits
Author SHA1 Message Date
Elinor Fung c2ec86b1c5 Rename GeneratedDllImportAttribute -> LibraryImportAttribute (#66307) 2022-03-09 18:07:52 -08:00
Elinor Fung 94480f128c Rename classes in p/invoke generator to be LibraryImport (#66217) 2022-03-04 19:42:33 -08:00
Elinor Fung a0635832f1 Rename DllImportGenerator project to LibraryImportGenerator (#66029) 2022-03-03 22:17:23 -08:00
Jeremy Koritzinsky 922777acf3 Disable default marshalling for bool (#65749) 2022-03-02 20:57:54 -08:00
Elinor Fung d9eafd0c55 Move diagnostics for invalid GeneratedDllImportAttribute usage to generator instead of analyzer (#65915) 2022-02-28 16:57:47 -08:00
Elinor Fung 7984b32774 Update GeneratedDllImportAttribute CharSet -> StringMarshalling (#65544) 2022-02-23 18:36:10 -08:00
Jeremy Koritzinsky fdb949d9c6 Add proposed plan for the COM source generator (#60143) 2022-02-23 14:26:24 -08:00
Aleksey Kliger (λgeek) f0c7520818 [docs] Create mono-thread-state-machine.md (#65720)
* Create mono-thread-state-machine.md

  Add the thread state machine design document

* Add some sequence diagrams

* Add hybrid suspend race sequence diagram

* More details on self-transitions

* fix coop GC suspend discussion

* undo accidental deletion
2022-02-22 19:50:33 -05:00
Andy Ayers 537d6077d7 JIT: revise approach for x64 OSR epilogs (#65609)
Rework x64 OSR so OSR methods have standard epilogs.

Details in attached doc.
2022-02-21 11:08:33 -08:00
Jeremy KoritzinskyandElinor Fung ca6f4206f5 Remove ExactSpelling from GeneratedDllImport (#65343)
* Update conversion code fix to offer multiple fixes for appending each previously probed entry-point suffix when ExactSpelling is false.

* Remove ExactSpelling property and move properties that were relying on ExactSpelling = false to use explicit entrypoint names.

* Emit ExactSpelling = true for all of our emitted target DllImports.

* Fix a few entry points

* Add a comment around CharSet.Auto

* Update compatibility doc.

* Update docs/design/libraries/DllImportGenerator/Compatibility.md

Co-authored-by: Elinor Fung <[email protected]>

Co-authored-by: Elinor Fung <[email protected]>
2022-02-18 22:51:27 -08:00
Qiao Pengchengandqiaopengcheng 90b7be39c4 [LoongArch64] JIT/EE interface for getting ABI-info (#62893)
* [LoongArch64] add ToolBox directory about jitinterace for getting ABI-info. (#59561)

Co-authored-by: Loongson's .NET-teams

* [LoongArch64] add new interace for getting ABI-info. (#59561)

* [LoongArch64] add the linking page for LoongArch64 ABI-info. (#59561)

* [LoongArch64] moved ThunkInput.txt to #62885.

* [LoongArch64] moved vm/jitinterface.cpp to #62885.

* remove the JIT/EE interface back from #62885..

* [LoongArch64] Fix the compiling error after merge.

* [LoongArch64] add comments for the returned value of `getFieldTypeByHnd`.

* [LoongArch64] rename getFieldTypeByHnd to getFieldSizeClassificationByHnd.
Also add macro define for returned value of `getFieldSizeClassificationByHnd`.

* [LoongArch64] Delete the interface `getArgType2`.
And refactor the returned values of `getFieldSizeClassificationByHnd`.

* [LoongArch64] delete `GetArgType` within `ToolBox/superpmi`.

* [LoongArch64] rename `getFieldSizeClassificationByHnd` to
`getLoongArch64PassStructInRegisterFlags`.

* [LoongArch64] amend the floating-ABI for native-struct.

* [LoongArch64] update all related `GetFieldSizeClassificationByHnd`
by `GetLoongArch64PassStructInRegisterFlags` and amend some comments.

* [LoongArch64] replace `LookupApproxFieldTypeHandle()`
by `GetFieldTypeHandleThrowing()`.

* [LoongArch64] implements the crossgen2 for LoongArch64.

* Revert "[LoongArch64] implements the crossgen2 for LoongArch64."

This reverts commit b05a2b90e8d8a2f6d1cf7f101ddfc9d4ed8d984e.

The crossgen2 for LoongArch64 will be submitted by a new PR.

* [LoongArch64] update the `GUID JITEEVersionIdentifier`.
Also delete some unused comments.

Co-authored-by: qiaopengcheng <[email protected]>
2022-02-18 00:07:48 -08:00
David WrightonandAaron Robinson 135a9608c4 Proposed changes to ECMA 335 for ref field support (#63659)
* Initial proposed changes for ref fields

* Fix end of line issue

* Update docs/design/specs/Ecma-335-Augments.md

Co-authored-by: Aaron Robinson <[email protected]>

* Update local signature wording

Co-authored-by: Aaron Robinson <[email protected]>
2022-02-16 12:16:04 -08:00
David Wrighton 9e45de46c9 Add default method support to virtual statics (#64717)
- The preview feature version of virtual statics implemented for .NET 6 does not allow for the interface methods to have a default implementation.
- With this change, we add support for the interface method having an actual implementation to CoreCLR. From what I can tell the Mono runtime already had such support
- There are some small ECMA spec updates to allow this change that are also included

In addition, I've taken the liberty to enable running the coreclr test suite on Mono on Windows. It needed a small amount of fixup.
2022-02-09 10:44:15 -08:00
Jakob Botsch NielsenandMichal Strehovský 3fc8b09944 Add JIT support for control-flow guard on x64 and arm64 (#63763)
Add support for generating control-flow guard checks. The support is enabled by a JIT flag or by setting COMPlus_JitForceControlFlowGuard=1.

Co-authored-by: Michal Strehovský <[email protected]>
2022-02-08 18:20:12 +01:00
Austin Wise db1bbf4068 Fix link in readytorun-format.md (#64878)
The link was not rendering correctly, as the link text and target were on separate lines.
2022-02-06 10:39:55 -08:00
Andy Ayers 04bcc055e9 Writeup on OSR Details and Debugging (#64428)
Information about how to think about OSR and to debug jit and runtime
when OSR is enabled.
2022-02-01 18:17:26 -08:00
Jan Kotas b571499765 Clarify purpose of PDB Document hashing (#64306)
Fixes #63505
2022-01-25 17:31:27 -08:00
David Wrighton 9d360c9aa2 Update NativeAOT codegen and Crossgen2 for CreateSpan (#63977)
- Make sure FieldRVA pointers remain aligned as required by the code generator
  - Use the same Packing Size approach as the IL Linker will use (See jbevain/cecil#817 for details)
  - Compilers that generate CreateSpan will need to follow that trick to be compatible with rewriters.
- Provide ECMA spec augment describing packing size detail
2022-01-23 14:23:32 -08:00
Jeremy KoritzinskyandElinor Fung 94b699cc6f Update StructMarshalling design now that DisableRuntimeMarshallingAttribute is approved (#63765)
Co-authored-by: Elinor Fung <[email protected]>
2022-01-19 16:46:00 -08:00
Michal Strehovský 207590a7b8 Fold coreclr/ToolBox into coreclr/tools (#63917)
This separation only existed because of Razzle build sequencing of desktop CLR. It doesn't make sense for CoreCLR. The only thing the extra directory is doing now is that it breaks tab completion when navigating the CoreCLR source tree because ToolBox comes before tools alphabetically and most things live in tools.
2022-01-18 10:10:36 -05:00
Ilona TomkowiczandAnkit Jain 7574e03e71 [wasm][debugger] Add Browsable Attribute support. (#62045)
* Description of DebuggerBrowsable behavior.

* Added test for browse attributes.

* Corrected typos in the doc.

* Added Browse Never feature. Corrected Collapse test. ToDo: RootHidden.

* Draft of RootHidden solution.

* Added Array to test cases as it behaves differently than Collection.

* Added name concatenation to make array/list elemetns in debug window unique.

* Update docs/design/mono/debugger.md

Co-authored-by: Ankit Jain <[email protected]>

* Applied PR review suggestions.

* Added a reference to regular Browsable attribute behavior in .net.

* Applied most of review suggestions.

* Stopping GetFieldsValue early.

* Remove unintentional change to the original code.

* Do not skip fields that don't have browsable attributes.

* Changing the expected behavior to match Console Application. EventHandlers are Browsable.Never by default.

* Changed the place of checking if objetc is an array.

* Update src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs

Co-authored-by: Ankit Jain <[email protected]>

* Removed unused variables.

* Removing space and unused import.

* Partially addressed @radical comments.

* Addressed the comment about extension instead of Union.

* Removed string cultural vunerability.

* Added Properties dictionary, the same as for fields.

* Fixed the bug I made by using dynamc.

* Applying @radical comments about refactoring.

* Corrected typo.

* Added tests for properties.

* Draft of changes for properties handling - never and root hidden failing.

* Fix for RootHidden properties.

* Added tests for static fields decorated with Browsable.

* Correct a typo.

* Undo merge unintentional changes.

* Changing expected behavior for MulticastDelegateTest - in Console Application EventHandler is Browsable.Never by default so we should not expect it to be visible in the debug window.

* Removing not relevant changes created after merge with main.

* Remove file added in merge with main.

* Revert "Removing not relevant changes created after merge with main."

This reverts commit b1acf8b546d1b95bea101290c25ec7f15cb78799.

* Revert.

* Revert revert.

* One broken test for custom getter.

* Ugly fix to make all the tests work.

* Refactored JArray aggregation to Dictionary.

* Better naming.

* Remove not connected to PR file.

* Applied @thaystg suggestions.

* Removed comments.

Co-authored-by: Ankit Jain <[email protected]>
2022-01-03 13:43:26 +01:00
Michal Strehovský 07ed923f57 Switch to objwriter from the dotnet/llvm-project repo (#63177) 2021-12-31 13:34:33 +09:00
Jeremy Koritzinsky 562d1e7f8c Remove the varargs-based mdarray helper. (#62855) 2021-12-16 15:11:50 -08:00
Michal Strehovský f44b0ba183 Add docs around NativeAOT workflows (#62837) 2021-12-16 10:35:54 +09:00
8ae1c49726 Convert some old style intrinsics to NamedIntrinsic (#62271)
* Convert some old style intrinsics to NamedIntrinsic

* Delete GetStubContextAddr and related code

* More cleanups

Co-authored-by: EgorBo <[email protected]>
Co-authored-by: Jan Kotas <[email protected]>
2021-12-09 08:25:34 -08:00
Ilona Tomkowicz 1281b91d2d [wasm][debugger] A draft of doc for describing debugger behavior. (#62015)
* A draft of doc for describing debugger behaviour.

* Removing spaces.
2021-11-30 10:32:33 +01:00
Adeel Mujahid 03e0187a1a Fix miscellaneous typos (#62062)
* Fix miscellaneous typos

* Cleanup trailing whitespaces
```sh
# git remote add dotnet https://github.com/dotnet/runtime && git pull --rebase dotnet main

if uname 2>/devnull | grep -q Darwin; then
    space=" "
fi

git show --name-only --pretty="" HEAD...dotnet/main |\
    xargs -I{} sh -c "test -f {} && sed -i$space'' 's/[[:space:]]*$//' {}"
```
2021-11-26 16:32:13 -08:00
Jeremy KoritzinskyandAaron Robinson 06a0c76a81 Update GetPinnableReference() usage in multi-step custom type marshalling (#61539)
* Update GetPinnableReference() usage in multi-step custom tyep marshalling

Change GetPinnableReference() on a marshaller type to be used as a side effect when marshalling in all cases when a fixed() statement is usable.

Use the Value property getter to get the value to pass to native in all cases.

Update our marshallers and tests to follow this design update.

* Apply suggestions from code review

Co-authored-by: Aaron Robinson <[email protected]>

* Don't emit the assingment to the Value property in the Unmarshal stage when using [Out]

* Fix the unmarshalling conditions

* Fix Utf16StringMarshaller to correctly handle the "null pointer" case now that we're using spans internally for storage in all cases.

Co-authored-by: Aaron Robinson <[email protected]>
2021-11-19 18:16:07 -08:00
Elinor Fung 4254fa30b7 [DllImportGenerator] Don't flag methods with known unsupported UnmanagedType (#61808) 2021-11-18 18:56:00 -07:00
Elinor Fung 4f43e82fcb [DllImportGenerator] Initialize by-value out array to default (#61431) 2021-11-10 15:27:59 -08:00
Michal Strehovský b6657214f4 Remove sorting requirement for interface lists (#60541)
Fixes #60454.
2021-11-08 13:55:37 -08:00
Aaron RobinsonandElinor Fung 6527f540e4 Add TFM and version support query to marshaller interface. (#61064)
* Add TFM and version support query to marshaller interface.

* If any marshaller fails to support the current tfm version, fallback
to using the built-in DllImport attribute.

* Add tests for fallback generation on downlevel or generation if marshallers
  are supported on the target framework.

* Convert CreateCompilationWithReferenceAssemblies to CreateCompilation overload.

Co-authored-by: Elinor Fung <[email protected]>
2021-11-02 21:27:34 -07:00
Jeremy KoritzinskyandElinor Fung 24e7a4a1a1 Make QCalls respect the EntryPoint property (#60992)
Co-authored-by: Elinor Fung <[email protected]>
2021-11-02 16:37:18 -07:00
Andy Ayers c263d61ace Add historical note on optimizing aspects of Value Numbering (#60985) 2021-10-28 14:59:37 -07:00
Andy Ayers 24db6c6808 Add 2009 Jit Architecture Plan (excerpts) (#60939)
We plan to gradually open up portions of historical documents that seem
relevant to our current work on the JIT.

This PR includes a writeup that is the inspiration for the current SSA
and Value Numbering designs.
2021-10-27 15:20:22 -07:00
cfe257f79d Add design details regarding dynamic buffers in struct marshalling (#60374)
* Update StructMarshalling.md with details

Co-authored-by: Elinor Fung <[email protected]>
Co-authored-by: Jeremy Koritzinsky <[email protected]>
2021-10-13 17:59:51 -07:00
Elinor Fung cc8ed00158 Updates to DllImportGenerator docs (#60211) 2021-10-09 09:33:14 -07:00
Jeremy Koritzinsky 752533d113 Merge branch 'main' into feature/use-dllimport-generator 2021-09-30 14:44:57 -07:00
Aleksey Kliger (λgeek)andAnkit Jain acb00500a0 Build one MonoTargetsTasks assembly for Microsoft.NET.Runtime.MonoTargets.Sdk pack (#59720)
* Build one MonoTargetsTasks assembly for Mono.NET.Runtime.MonoTargets.Sdk pack

   Instead of 3 assemblies for some tiny tasks.

   Building a single assembly also ensures that everything in the pack depends on and bundles identical versions of dependent assemblies.  For example on net472, a single version of System.Text.Json with a single fixed version shared by both the JsonToItemsTaskFactory task factory and the RuntimeConfigParser task.

   Related to https://github.com/dotnet/runtime/issues/59619

* Update testing and wasm to use MonoTargetsTasks.dll

* Move assembly stripper to a separate assembly

   Build it with nullability checking disabled.

   Build the main MonoTargetsTasks assembly with nullability enabled

* Don't include msbuild assemblies in MonoTargets package

* re-enable analyzers for the MonoTargetsTasks assembly

* Include *.dll in the MonoTargetsTasks nupkg

   In particular, pick up all the dependent assemblies for the net472 build

* Update various READMEs

* remove unneeded target

* Switch ILStrip to use the same Parallel.ForEach logic as MonoAOTCompiler

* Remove unneeded NoWarn warnings

* rearrange package references in MonoTargetsTask.csproj for readabilty

* More ItemGroup reformatting

* fix nits

* Use SystemThreadingTasksExtensionsVersion instead of hardcoding

Co-authored-by: Ankit Jain <[email protected]>
2021-09-30 11:13:26 -04:00
Elinor Fung b7283efb78 Make Utf16CharMarshaller pin ref parameters (#59700) 2021-09-28 13:45:46 -07:00
Johan Lorensson 802a5b9284 Update MonoVM diagnostics-tracing doc with new features and scenarios. (#58620) 2021-09-28 17:25:32 +02:00
Jeremy Koritzinsky d924fbc7e9 Merge branch 'main' of github.com:dotnet/runtime into merge-main 2021-09-24 09:26:18 -07:00
Jeremy Koritzinsky 4cfb51f0ce Hook up DllImportGenerator to the libraries build (excluding solution file regeneration).
Move System.Runtime.InteropServices unit tests to a subdirectory.
2021-09-22 17:02:14 -07:00
Andrew Au 0ac7a35873 Update Unloadability documentation (#59383) 2021-09-21 11:33:23 -07:00
Jeremy Koritzinsky fc18f4de2e Merge branch 'feature/DllImportGenerator' of /home/jekoritz/scratch/bash/dllimportgenerator into port-dllimport-generator 2021-09-20 09:15:15 -07:00
Andrii Kurdiumov 16a0ab39f1 Fix link (#59200) 2021-09-16 16:54:55 -06:00
Juan Hoyos 561f89a905 Enhance CrossGen2 to emit PerfMap debug directory entry (#58552)
* Only pass perfmap argument for Linux
* Enhance CrossGen2 to emit PerfMap debug directory entry

This is used to correlate PE's with their corresponding PerfMaps. For example the header in the perfmap could be:
```
FFFFFFFF 00 026D4D21B3EE3D93843FF7A964235822
FFFFFFFE 00 1
FFFFFFFD 00 1
FFFFFFFC 00 3
FFFFFFFB 00 1
```
And the PE will have the corresponding entries in the PE as:
```
PerfMap (Type 21):
        System.Private.CoreLib.ni.r2rmap, Signature = 026d4d21b3ee3d93843ff7a964235822, Version = 1
```

* Emit headers for debug directory entries from the nodes themselves.
* Add PerfMap Debug Directory Entry spec
* Extend perfmap and r2r documentation
2021-09-10 13:19:34 -07:00
Aaron Robinson 70f4c48013 Initial document for JIT and GC stress usage (#58147)
* Initial document for JIT and GC stress.
2021-09-01 11:07:45 -07:00
WhiteBlackGoose e7765d9c13 Typo fixed (#58393) 2021-08-30 13:26:23 -06:00
Mike McLaughlin f81e82df0c Fix crashreport for stack overflow (#57428)
* Fix crashreport for stack overflow

Issue: https://github.com/dotnet/runtime/issues/57032

The stack overflow managed exception wasn't been set/written out.

Changed the "unmanaged_frames" value to "stack_frames" because it includes both native and managed frames.

Aggregated the repeated stack frames adding a "repeated"/repeated_frames value/array for the time of times the sequence was repeated.

Looks like this:

    {
      "repeated" : "0x1542",
      "repeated_frames" : [
       {
        "is_managed" : "true",
        "module_address" : "0x10e402000",
        "stack_pointer" : "0x7000045ce020",
        "native_address" : "0x11b9ee8c9",
        "native_offset" : "0x29",
        "token" : "0x600006f",
        "il_offset" : "0x0",
        "method_name" : "Macson.Client.Diagnostics.CrashyClass.Foo2()",
        "timestamp" : "0xa8561820",
        "sizeofimage" : "0xe000",
        "filename" : "Macson.Client.dll",
        "guid" : "49cd869a682942bc95c0c34ca206c61d"
       },
       {
        "is_managed" : "true",
        "module_address" : "0x10e402000",
        "stack_pointer" : "0x7000045ce040",
        "native_address" : "0x11b9ee879",
        "native_offset" : "0x29",
        "token" : "0x6000070",
        "il_offset" : "0x0",
        "method_name" : "Macson.Client.Diagnostics.CrashyClass.Foo1()",
        ...
       },
      ]
    }

* Update createdump doc

* Fix Windows triage dump flags

* Code review feedback
2021-08-17 13:02:14 -07:00