diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index 6d3f2efaf848ce..0e5219042b700d 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -3,19 +3,19 @@
"isRoot": true,
"tools": {
"coverlet.console": {
- "version": "1.7.2",
+ "version": "3.1.0",
"commands": [
"coverlet"
]
},
"dotnet-reportgenerator-globaltool": {
- "version": "4.5.8",
+ "version": "5.0.2",
"commands": [
"reportgenerator"
]
},
"microsoft.dotnet.xharness.cli": {
- "version": "1.0.0-prerelease.21622.1",
+ "version": "1.0.0-prerelease.22067.1",
"commands": [
"xharness"
]
diff --git a/.github/fabricbot.json b/.github/fabricbot.json
index 72acfd8440a06d..723e3f5c493f2f 100644
--- a/.github/fabricbot.json
+++ b/.github/fabricbot.json
@@ -996,7 +996,7 @@
"subCapability": "IssueCommentResponder",
"version": "1.0",
"config": {
- "taskName": "Replace `needs more info` label with `needs further triage` label when the author comments on an issue",
+ "taskName": "Replace `needs-author-action` label with `needs further triage` label when the author comments on an issue",
"conditions": {
"operator": "and",
"operands": [
@@ -1017,7 +1017,7 @@
{
"name": "hasLabel",
"parameters": {
- "label": "needs more info"
+ "label": "needs-author-action"
}
},
{
@@ -1036,7 +1036,7 @@
{
"name": "removeLabel",
"parameters": {
- "label": "needs more info"
+ "label": "needs-author-action"
}
}
],
@@ -1575,7 +1575,7 @@
{
"name": "hasLabel",
"parameters": {
- "label": "needs more info"
+ "label": "needs-author-action"
}
},
{
@@ -5416,7 +5416,7 @@
{
"name": "labelAdded",
"parameters": {
- "label": "needs more info"
+ "label": "needs-author-action"
}
}
]
@@ -5426,12 +5426,12 @@
"issues",
"project_card"
],
- "taskName": "Needs more info notification",
+ "taskName": "Needs-author-action notification",
"actions": [
{
"name": "addReply",
"parameters": {
- "comment": "This issue has been marked `needs more info` since it may be missing important information. Please refer to our [contribution guidelines](https://github.com/dotnet/runtime/blob/main/CONTRIBUTING.md#writing-a-good-bug-report) for tips on how to report issues effectively."
+ "comment": "This issue has been marked `needs-author-action` since it may be missing important information. Please refer to our [contribution guidelines](https://github.com/dotnet/runtime/blob/main/CONTRIBUTING.md#writing-a-good-bug-report) for tips on how to report issues effectively."
}
}
]
@@ -5951,7 +5951,7 @@
{
"name": "labelAdded",
"parameters": {
- "label": "needs more info"
+ "label": "needs-author-action"
}
},
{
@@ -6003,25 +6003,7 @@
{
"name": "hasLabel",
"parameters": {
- "label": "area-System.Collections"
- }
- },
- {
- "name": "hasLabel",
- "parameters": {
- "label": "area-System.Linq"
- }
- },
- {
- "name": "hasLabel",
- "parameters": {
- "label": "area-System.Text.Json"
- }
- },
- {
- "name": "hasLabel",
- "parameters": {
- "label": "area-System.Xml"
+ "label": "area-Meta"
}
}
]
@@ -6032,7 +6014,7 @@
{
"name": "isInProject",
"parameters": {
- "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs",
+ "projectName": "Area Pod: Eric / Jeff - PRs",
"isOrgProject": true
}
}
@@ -6046,12 +6028,12 @@
"issues",
"project_card"
],
- "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - PRs] Add new PR to Board",
+ "taskName": "[Area Pod: Eric / Jeff - PRs] Add new PR to Board",
"actions": [
{
"name": "addToProject",
"parameters": {
- "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs",
+ "projectName": "Area Pod: Eric / Jeff - PRs",
"columnName": "Needs Champion",
"isOrgProject": true
}
@@ -6686,7 +6668,7 @@
{
"name": "labelAdded",
"parameters": {
- "label": "needs more info"
+ "label": "needs-author-action"
}
},
{
@@ -6723,6 +6705,119 @@
]
}
},
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "PullRequestResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.CodeDom"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Configuration"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Reflection"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Reflection.Emit"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Reflection.Metadata"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Resources"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Runtime.CompilerServices"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Text.RegularExpressions"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Threading.Channels"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Threading.Tasks"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.DirectoryServices"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isInProject",
+ "parameters": {
+ "projectName": "Area Pod: Buyaa / Jose / Steve - PRs",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "pull_request",
+ "eventNames": [
+ "pull_request",
+ "issues",
+ "project_card"
+ ],
+ "taskName": "[Area Pod: Buyaa / Jose / Steve - PRs] Add new PR to Board",
+ "actions": [
+ {
+ "name": "addToProject",
+ "parameters": {
+ "projectName": "Area Pod: Buyaa / Jose / Steve - PRs",
+ "columnName": "Needs Champion",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ },
{
"taskType": "trigger",
"capabilityId": "IssueResponder",
@@ -7257,7 +7352,7 @@
{
"name": "labelAdded",
"parameters": {
- "label": "needs more info"
+ "label": "needs-author-action"
}
},
{
@@ -7294,6 +7389,77 @@
]
}
},
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "PullRequestResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Collections"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Linq"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Text.Json"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Xml"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isInProject",
+ "parameters": {
+ "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "pull_request",
+ "eventNames": [
+ "pull_request",
+ "issues",
+ "project_card"
+ ],
+ "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - PRs] Add new PR to Board",
+ "actions": [
+ {
+ "name": "addToProject",
+ "parameters": {
+ "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs",
+ "columnName": "Needs Champion",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ },
{
"taskType": "trigger",
"capabilityId": "IssueResponder",
@@ -7379,5 +7545,984 @@
}
]
}
+ },
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "IssuesOnlyResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-DependencyModel"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Caching"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Configuration"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-DependencyInjection"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Hosting"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Logging"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Options"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Primitives"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel.Composition"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Composition"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Diagnostics.Activity"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Globalization"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "isAction",
+ "parameters": {
+ "action": "reopened"
+ }
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isInMilestone",
+ "parameters": {}
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-DependencyModel"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-Extensions-Caching"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-Extensions-Configuration"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-Extensions-DependencyInjection"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-Extensions-Hosting"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-Extensions-Logging"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-Extensions-Options"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-Extensions-Primitives"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-System.ComponentModel"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-System.ComponentModel.Composition"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-System.Composition"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-System.Diagnostics.Activity"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "area-System.Globalization"
+ }
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "name": "isOpen",
+ "parameters": {}
+ },
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isInProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "isOrgProject": true
+ }
+ }
+ ]
+ },
+ {
+ "name": "isInProjectColumn",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "isOrgProject": true,
+ "columnName": "Triaged"
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "issue",
+ "eventNames": [
+ "issues",
+ "project_card"
+ ],
+ "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Add new issue to Board",
+ "actions": [
+ {
+ "name": "addToProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "columnName": "Needs Triage",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ },
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "IssueCommentResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-DependencyModel"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Caching"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Configuration"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-DependencyInjection"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Hosting"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Logging"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Options"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Primitives"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel.Composition"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Composition"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Diagnostics.Activity"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Globalization"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isCloseAndComment",
+ "parameters": {}
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "activitySenderHasPermissions",
+ "parameters": {
+ "permissions": "write"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isInProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "isOrgProject": true
+ }
+ }
+ ]
+ },
+ {
+ "name": "isInProjectColumn",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "columnName": "Triaged",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "issue",
+ "eventNames": [
+ "issue_comment"
+ ],
+ "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Needs Further Triage",
+ "actions": [
+ {
+ "name": "addToProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "columnName": "Needs Triage",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ },
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "IssuesOnlyResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "name": "isInProjectColumn",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "columnName": "Needs Triage",
+ "isOrgProject": true
+ }
+ },
+ {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-DependencyModel"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Caching"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Configuration"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-DependencyInjection"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Hosting"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Logging"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Options"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Primitives"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel.Composition"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Composition"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Diagnostics.Activity"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Globalization"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "issue",
+ "eventNames": [
+ "issues",
+ "project_card"
+ ],
+ "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Remove relabeled issues",
+ "actions": [
+ {
+ "name": "removeFromProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ },
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "IssuesOnlyResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "name": "isInProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "isOrgProject": true
+ }
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isInProjectColumn",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "columnName": "Triaged"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "addedToMilestone",
+ "parameters": {}
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "needs more info"
+ }
+ },
+ {
+ "name": "labelAdded",
+ "parameters": {
+ "label": "api-ready-for-review"
+ }
+ },
+ {
+ "name": "isAction",
+ "parameters": {
+ "action": "closed"
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "issue",
+ "eventNames": [
+ "issues",
+ "project_card"
+ ],
+ "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Move to Triaged Column",
+ "actions": [
+ {
+ "name": "addToProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage",
+ "columnName": "Triaged",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ },
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "PullRequestResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "or",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-DependencyModel"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Caching"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Configuration"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-DependencyInjection"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Hosting"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Logging"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Options"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Primitives"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel.Composition"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Composition"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Diagnostics.Activity"
+ }
+ },
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Globalization"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "isInProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - PRs",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "pull_request",
+ "eventNames": [
+ "pull_request",
+ "issues",
+ "project_card"
+ ],
+ "taskName": "[Area Pod: Eric / Maryam / Tarek - PRs] Add new PR to Board",
+ "actions": [
+ {
+ "name": "addToProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - PRs",
+ "columnName": "Needs Champion",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
+ },
+ {
+ "taskType": "trigger",
+ "capabilityId": "IssueResponder",
+ "subCapability": "PullRequestResponder",
+ "version": "1.0",
+ "config": {
+ "conditions": {
+ "operator": "and",
+ "operands": [
+ {
+ "name": "isInProjectColumn",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - PRs",
+ "columnName": "Needs Champion",
+ "isOrgProject": true
+ }
+ },
+ {
+ "operator": "and",
+ "operands": [
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-DependencyModel"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Caching"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Configuration"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-DependencyInjection"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Hosting"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Logging"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Options"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-Extensions-Primitives"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.ComponentModel.Composition"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Composition"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Diagnostics.Activity"
+ }
+ }
+ ]
+ },
+ {
+ "operator": "not",
+ "operands": [
+ {
+ "name": "hasLabel",
+ "parameters": {
+ "label": "area-System.Globalization"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "eventType": "pull_request",
+ "eventNames": [
+ "pull_request",
+ "issues",
+ "project_card"
+ ],
+ "taskName": "[Area Pod: Eric / Maryam / Tarek - PRs] Remove relabeled PRs",
+ "actions": [
+ {
+ "name": "removeFromProject",
+ "parameters": {
+ "projectName": "Area Pod: Eric / Maryam / Tarek - PRs",
+ "isOrgProject": true
+ }
+ }
+ ]
+ }
}
]
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index c1a783db2aa7c9..6627d2c2d0a75b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -187,6 +187,7 @@ node_modules/
*.metaproj.tmp
bin.localpkg/
src/mono/wasm/runtime/dotnet.d.ts.sha256
+src/mono/sample/wasm/browser-nextjs/public/
# RIA/Silverlight projects
Generated_Code/
diff --git a/Directory.Build.props b/Directory.Build.props
index 0983ba4ae36f89..e9e6fc4e362346 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -31,6 +31,7 @@
armarmelarm64
+ loongarch64s390xwasmx64
@@ -157,26 +158,27 @@
- <_toolRuntimeRID Condition="'$(CrossBuild)' == 'true'">$(_hostOS.ToLowerInvariant)-$(_hostArch)
- <_toolRuntimeRID Condition="'$(BuildingInsideVisualStudio)' == 'true'">$(_runtimeOS)-x64
- <_toolRuntimeRID Condition="'$(_toolRuntimeRID)' == ''">$(_runtimeOS)-$(_hostArch)
+ <_toolsRID Condition="'$(CrossBuild)' == 'true'">$(_hostOS.ToLowerInvariant)-$(_hostArch)
+ <_toolsRID Condition="'$(BuildingInsideVisualStudio)' == 'true'">$(_runtimeOS)-x64
+ <_toolsRID Condition="'$(_toolsRID)' == ''">$(_runtimeOS)-$(_hostArch)
- <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser'">linux-x64
- <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser' and '$(HostOS)' == 'windows'">win-x64
- <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'browser' and '$(HostOS)' == 'osx'">osx-x64
+ <_toolsRID Condition="'$(_runtimeOS)' == 'browser'">linux-x64
+ <_toolsRID Condition="'$(_runtimeOS)' == 'browser' and '$(HostOS)' == 'windows'">win-x64
+ <_toolsRID Condition="'$(_runtimeOS)' == 'browser' and '$(HostOS)' == 'osx'">osx-x64
- <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'android'">linux-x64
- <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'android' and '$(HostOS)' == 'windows'">win-x64
- <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'android' and '$(HostOS)' == 'osx'">osx-x64
+ <_toolsRID Condition="'$(_runtimeOS)' == 'android'">linux-x64
+ <_toolsRID Condition="'$(_runtimeOS)' == 'android' and '$(HostOS)' == 'windows'">win-x64
+ <_toolsRID Condition="'$(_runtimeOS)' == 'android' and '$(HostOS)' == 'osx'">osx-x64
- <_toolRuntimeRID Condition="'$(_runtimeOS)' == 'maccatalyst' or '$(_runtimeOS)' == 'ios' or '$(_runtimeOS)' == 'iOSSimulator' or '$(_runtimeOS)' == 'tvos' or '$(_runtimeOS)' == 'tvOSSimulator'">osx-x64
+ <_toolsRID Condition="'$(_runtimeOS)' == 'maccatalyst' or '$(_runtimeOS)' == 'ios' or '$(_runtimeOS)' == 'iOSSimulator' or '$(_runtimeOS)' == 'tvos' or '$(_runtimeOS)' == 'tvOSSimulator'">osx-x64
-
- linux-$(_hostArch)
- $(_toolRuntimeRID)
+
+ linux-$(_hostArch)
+ $(_toolsRID)
+ $(ToolsRID)$(_packageOS)-$(TargetArchitecture)
diff --git a/docs/coding-guidelines/interop-guidelines.md b/docs/coding-guidelines/interop-guidelines.md
index 997aa1fd3772a8..55d4e9ddcae0ab 100644
--- a/docs/coding-guidelines/interop-guidelines.md
+++ b/docs/coding-guidelines/interop-guidelines.md
@@ -166,6 +166,12 @@ Using enums instead of partial, static classes can lead to needing lots of casts
When defining the P/Invoke signatures and structs, we follow the guidelines in the [interop best practices documentation](https://docs.microsoft.com/en-us/dotnet/standard/native-interop/best-practices).
+The runtime repo makes use of [source-generated p/invokes](../design/features/source-generator-pinvokes.md) whenever possible (see [the compatibility doc](../design/libraries/DllImportGenerator/Compatibility.md) for unsupported scenarios). Methods should be marked `GeneratedDllImport` and be `static` and `partial`.
+
+If implicit framework references are disabled (as is the case for most libraries projects), explicit references to the below are required for marshalling arrays:
+ - `System.Memory`
+ - `System.Runtime.CompilerServices.Unsafe`
+
## UNIX shims
Often, various UNIX flavors offer the same API from the point-of-view of compatibility with C/C++ source code, but they do not have the same ABI. e.g. Fields can be laid out differently, constants can have different numeric values, exports can be named differently, etc. There are not only differences between operating systems (Mac OS X vs. Ubuntu vs. FreeBSD), but also differences related to the underlying processor architecture (x64 vs. x86 vs. ARM).
@@ -174,6 +180,8 @@ This leaves us with a situation where we can't write portable P/Invoke declarati
To address this, we're moving to a model where all UNIX interop from dotnet/runtime starts with a P/Invoke to a C++ lib written specifically for dotnet/runtime. These libs -- System.*.Native.so (aka "shims") -- are intended to be very thin layers over underlying platform libraries. Generally, they are not there to add any significant abstraction, but to create a stable ABI such that the same IL assembly can work across UNIX flavors.
+The System.Native shims are a private implementation detail of the Microsoft.NETCore.App shared framework and are intended only for use by code inside of the shared framework. Calling into the shims from external to Microsoft.NETCore.App has similar risks to using private reflection, with no guarantees from version to version or even patch to patch of stable exports. Assemblies that ship outside of the shared framework (e.g. Microsoft.Extensions.*) must not directly access the shims.
+
Guidelines for shim C++ API:
- Keep them as "thin"/1:1 as possible.
diff --git a/docs/design/features/standalone-gc-loading.md b/docs/design/features/standalone-gc-loading.md
index 3373bf5559f553..ed7440002e8da8 100644
--- a/docs/design/features/standalone-gc-loading.md
+++ b/docs/design/features/standalone-gc-loading.md
@@ -47,7 +47,7 @@ Worth noting is that the JIT (both RyuJIT and the legacy JIT(s) before it) can b
and have realized these same benefits. The existence of an interface and an implementation loadable
from shared libraries has enabled RyuJIT in particular to be used as the code generator for both the
CoreRT compiler and crossgen, while still being flexible enough to be tested using tools that implement
-very non-standard execution engines such as [SuperPMI](https://github.com/dotnet/runtime/blob/main/src/coreclr/ToolBox/superpmi/readme.txt).
+very non-standard execution engines such as [SuperPMI](https://github.com/dotnet/runtime/blob/main/src/coreclr/tools/superpmi/readme.md).
The below loading protocol is inspired directly by the JIT loader and many aspects of the GC loader are identical
to what the JIT does when loading dynamic shared libraries.
diff --git a/docs/design/libraries/DllImportGenerator/StructMarshalling.md b/docs/design/libraries/DllImportGenerator/StructMarshalling.md
index ab332616b74132..63781d6d77dbb2 100644
--- a/docs/design/libraries/DllImportGenerator/StructMarshalling.md
+++ b/docs/design/libraries/DllImportGenerator/StructMarshalling.md
@@ -6,10 +6,11 @@ These types pose an interesting problem for a number of reasons listed below. Wi
## Problems
-- Unmanaged vs Blittable
- - The C# language (and Roslyn) do not have a concept of "blittable types". It only has the concept of "unmanaged types", which is similar to blittable, but differs for `bool`s and `char`s. `bool` and `char` types are "unmanaged", but are never (in the case of `bool`), or only sometimes (in the case of `char`) blittable. As a result, we cannot use the "is this type unmanaged" check in Roslyn for structures.
+- What types require marshalling and what types can be passed as-is to native code?
+ - Unmanaged vs Blittable
+ - The C# language (and Roslyn) do not have a concept of "blittable types". It only has the concept of "unmanaged types", which is similar to blittable, but differs for `bool`s and `char`s. `bool` and `char` types are "unmanaged", but are never (in the case of `bool`), or only sometimes (in the case of `char`) blittable. As a result, we cannot use the "is this type unmanaged" check in Roslyn for structures without an additional mechanism provided by the runtime.
- Limited type information in ref assemblies.
- - In the ref assemblies generated by dotnet/runtime, we save space and prevent users from relying on private implementation details of structures by emitting limited information about their fields. Structures that have at least one non-object field are given a private `int` field, and structures that have at least one field that transitively contains an object are given one private `object`-typed field. As a result, we do not have full type information at code-generation time for any structures defined in the BCL when compiling a library that uses the ref assemblies.
+ - In the ref assemblies generated by dotnet/arcade's GenAPI (used in dotnet/runtime), we save space and prevent users from relying on private implementation details of structures by emitting limited information about their fields. Structures that have at least one non-object field are given a private `int` field, and structures that have at least one field that transitively contains an object are given one private `object`-typed field. As a result, we do not have full type information at code-generation time for any structures defined in the BCL when compiling a library that uses the ref assemblies.
- Private reflection
- Even when we do have information about all of the fields, we can't emit code that references them if they are private, so we would have to emit unsafe code and calculate offsets manually to support marshaling them.
@@ -19,16 +20,13 @@ We've been working around another problem for a while in the runtime-integrated
I propose an opt-in design where the owner of a struct has to explicitly opt-in to usage for interop. This enables our team to add special support as desired for various types such as `Span` while also avoiding the private reflection and limited type information issues mentioned above.
-This design would use these attributes:
+All design options would use these attributes:
```csharp
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class)]
public class GeneratedMarshallingAttribute : Attribute {}
-[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class)]
-public class BlittableTypeAttribute : Attribute {}
-
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class)]
public class NativeMarshallingAttribute : Attribute
{
@@ -42,7 +40,7 @@ public class MarshalUsingAttribute : Attribute
}
```
-The `NativeMarshallingAttribute` and `MarshalUsingAttribute` attributes would require that the provided native type `TNative` is a blittable `struct` and has a subset of three methods with the following names and shapes (with the managed type named TManaged):
+The `NativeMarshallingAttribute` and `MarshalUsingAttribute` attributes would require that the provided native type `TNative` is a `struct` that does not require any marshalling and has a subset of three methods with the following names and shapes (with the managed type named TManaged):
```csharp
partial struct TNative
@@ -59,7 +57,7 @@ The analyzer will report an error if neither the constructor nor the `ToManaged`
> :question: Does this API surface and shape work for all marshalling scenarios we plan on supporting? It may have issues with the current "layout class" by-value `[Out]` parameter marshalling where the runtime updates a `class` typed object in place. We already recommend against using classes for interop for performance reasons and a struct value passed via `ref` or `out` with the same members would cover this scenario.
-If the native type `TNative` also has a public `Value` property, then the value of the `Value` property will be passed to native code instead of the `TNative` value itself. As a result, the type `TNative` will be allowed to be non-blittable and the type of the `Value` property will be required to be blittable. If the `Value` property is settable, then when marshalling in the native-to-managed direction, a default value of `TNative` will have its `Value` property set to the native value. If `Value` does not have a setter, then marshalling from native to managed is not supported.
+If the native type `TNative` also has a public `Value` property, then the value of the `Value` property will be passed to native code instead of the `TNative` value itself. As a result, the type `TNative` will be allowed to require marshalling and the type of the `Value` property will be required be passable to native code without any additional marshalling. If the `Value` property is settable, then when marshalling in the native-to-managed direction, a default value of `TNative` will have its `Value` property set to the native value. If `Value` does not have a setter, then marshalling from native to managed is not supported.
If a `Value` property is provided, the developer may also provide a ref-returning or readonly-ref-returning `GetPinnableReference` method. The `GetPinnableReference` method will be called before the `Value` property getter is called. The ref returned by `GetPinnableReference` will be pinned with a `fixed` statement, but the pinned value will not be used (it acts exclusively as a side-effect).
@@ -90,7 +88,7 @@ public struct TMarshaler
#### Pinning
-Since C# 7.3 added a feature to enable custom pinning logic for user types, we should also add support for custom pinning logic. If the user provides a `GetPinnableReference` method on the managed type that matches the requirements to be used in a `fixed` statement and the pointed-to type is blittable, then we will support using pinning to marshal the managed value when possible. The analyzer should issue a warning when the pointed-to type would not match the final native type, accounting for the `Value` property on the native type. Since `MarshalUsingAttribute` is applied at usage time instead of at type authoring time, we will not enable the pinning feature since the implementation of `GetPinnableReference` is likely designed to match the default marshalling rules provided by the type author, not the rules provided by the marshaller provided by the `MarshalUsingAttribute`.
+Since C# 7.3 added a feature to enable custom pinning logic for user types, we should also add support for custom pinning logic. If the user provides a `GetPinnableReference` method on the managed type that matches the requirements to be used in a `fixed` statement and the pointed-to type would not require any additional marshalling, then we will support using pinning to marshal the managed value when possible. The analyzer should issue a warning when the pointed-to type would not match the final native type, accounting for the `Value` property on the native type. Since `MarshalUsingAttribute` is applied at usage time instead of at type authoring time, we will not enable the pinning feature since the implementation of `GetPinnableReference` is likely designed to match the default marshalling rules provided by the type author, not the rules provided by the marshaller provided by the `MarshalUsingAttribute`.
#### Caller-allocated memory
@@ -111,27 +109,18 @@ When these members are present, the source generator will call the two-parameter
Type authors can pass down the `buffer` pointer to native code by defining a `Value` property that returns a pointer to the first element, generally through code using `MemoryMarshal.GetReference()` and `Unsafe.AsPointer`. If `RequiresStackBuffer` is not provided or set to `false`, the `buffer` span must be pinned to be used safely. The `buffer` span can be pinned by defining a `GetPinnableReference()` method on the native type that returns a reference to the first element of the span.
-### Usage
-
-There are 2 usage mechanisms of these attributes.
-
-#### Usage 1, Source-generated interop
-
-The user can apply the `GeneratedMarshallingAttribute` to their structure `S`. The source generator will determine if the type is blittable. If it is blittable, the source generator will generate a partial definition and apply the `BlittableTypeAttribute` to the struct type `S`. Otherwise, it will generate a blittable representation of the struct with the aformentioned required shape and apply the `NativeMarshallingAttribute` and point it to the blittable representation. The blittable representation can either be generated as a separate top-level type or as a nested type on `S`.
+### Determining if a type is doesn't need marshalling
-#### Usage 2, Manual interop
-
-The user may want to manually mark their types as marshalable in this system due to specific restrictions in their code base around marshaling specific types that the source generator does not account for. We could also use this internally to support custom types in source instead of in the code generator. In this scenario, the user would apply either the `BlittableTypeAttribute` or the `NativeMarshallingAttribute` attribute to their struct type. An analyzer would validate that the struct is blittable if the `BlittableTypeAttribute` is applied or validate that the native struct type is blittable and has marshalling methods of the required shape when the `NativeMarshallingAttribute` is applied.
-
-The P/Invoke source generator (as well as the struct source generator when nested struct types are used) would use the `BlittableTypeAttribute` and `NativeMarshallingAttribute` to determine how to marshal a value type parameter or field instead of looking at the fields of the struct directly.
+For this design, we need to decide how to determine a type doesn't need to be marshalled and already has a representation we can pass directly to native code - that is, we need a definition for "does not require marshalling". We have two designs that we have experimented with below, and we have decided to go with design 2.
-If a structure type does not have either the `BlittableTypeAttribute` or the `NativeMarshallingAttribute` applied at the type definition, the user can supply a `MarshalUsingAttribute` at the marshalling location (field, parameter, or return value) with a native type matching the same requirements as `NativeMarshallingAttribute`'s native type.
-
-All generated stubs will be marked with [`SkipLocalsInitAttribute`](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.skiplocalsinitattribute) on supported frameworks. This does require attention when performing custom marshalling as the state of stub allocated memory will be in an undefined state.
+#### Design 1: Introducing `BlittableTypeAttribute`
-### Why do we need `BlittableTypeAttribute`?
+Traditionally, the concept of "does not require marshalling" is referred to as "blittable". The built-in runtime marshalling system has an issue as mentioned above that the concept of `unmanaged` is not the same as the concept of `blittable`. Additionally, due to the ref assembly issue above, we cannot rely on ref assemblies to have accurate information in terms of fields of a type. To solve these issues in combination with the desire to enable manual interop, we need to provide a way for users to signal that a given type should be blittable and that the source generator should not generate marshalling code. We'll introduce a new attribute, the `BlittableTypeAttribute`:
-Based on the design above, it seems that we wouldn't need `BlittableTypeAttribute`. However, due to the ref assembly issue above in combination with the desire to enable manual interop, we need to provide a way for users to signal that a given type should be blittable and that the source generator should not generate marshalling code.
+```csharp
+[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class)]
+public class BlittableTypeAttribute : Attribute {}
+```
I'll give a specific example for where we need the `BlittableTypeAttribute` below. Let's take a scenario where we don't have `BlittableTypeAttribute`.
@@ -210,7 +199,7 @@ When the source generator (either Struct, P/Invoke, Reverse P/Invoke, etc.) enco
If someone actively disables the analyzer or writes their types in IL, then they have stepped out of the supported scenarios and marshalling code generated for their types may be inaccurate.
-#### Exception: Generics
+##### Exception: Generics
Because the Roslyn compiler needs to be able to validate that there are not recursive struct definitions, reference assemblies have to contain a field of a type parameter type in the reference assembly if they do in the runtime assembly. As a result, we can inspect private generic fields reliably.
@@ -221,6 +210,32 @@ To enable blittable generics support in this struct marshalling model, we extend
Since all fields typed with non-parameterized types are validated to be blittable at type definition time, we know that they are all blittable at type usage time. So, we only need to validate that the generic fields are instantiated with blittable types.
+#### Design 2: [`DisableRuntimeMarshallingAttribute`](https://github.com/dotnet/runtime/issues/60639)
+
+As an alternative design, we can use a different definition of "does not require marshalling". This design proposes changing the definition from "the runtime's definition of blittable" to "types considered `unmanaged` in C#". The `DisableRuntimeMarshallingAttribute` attribute helps us solve this problem. When applied to an assembly, this attribute causes the runtime to not do any marshalling for any types that are `unmanaged` types and do not have any auto-layout fields for all P/Invokes in the assembly; this includes when the types do not fit the runtime's definition of "blittable". This definition of "does not require marshalling" will work for all of our scenarios, with one issue listed below.
+
+For the auto-layout clause, we have one small issue; today, our ref-assemblies do not expose if a value type is marked as `[StructLayout(LayoutKind.Auto)]`, so we'd still have some cases where we might have runtime failures. However, we can update the tooling used in dotnet/runtime, GenAPI, to expose this information if we so desire. Once that case is handled, we have a mechanism that we can safely use to determine, at compile time, which types will not require marshalling. If we decide to not cover this case (as cases where users mark types as `LayoutKind.Auto` manually are exceptionally rare), we still have a solid design as Roslyn will automatically determine for us if a type is `unmanaged`, so we don't need to do any additional work.
+
+As `unmanaged` is a C# language concept, we can use Roslyn's APIs to determine if a type is `unmanaged` to determine if it does not require marshalling without needing to define any new attributes and reshape the ecosystem. However, to enable this work, the DllImportGenerator, as well as any other source generators that generate calls to native code using the interop team's infrastructure, will need to require that the user applies the `DisableRuntimeMarshallingAttribute` to their assembly when custom user-defined types are used. As we believe that users should be able to move over their assemblies to the new source-generated interop world as a whole assembly, we do not believe that this will cause any serious issues in adoption. To help support users in this case, the interop team will provide a code-fix that will generate the `DisableRuntimeMarshallingAttribute` for users when they use the source generator.
+
+### Usage
+
+There are 2 usage mechanisms of these attributes.
+
+#### Usage 1, Source-generated interop
+
+The user can apply the `GeneratedMarshallingAttribute` to their structure `S`. The source generator will determine if the type requires marshalling. If it does, it will generate a representation of the struct that does not require marshalling with the aformentioned required shape and apply the `NativeMarshallingAttribute` and point it to that new type. This generated representation can either be generated as a separate top-level type or as a nested type on `S`.
+
+#### Usage 2, Manual interop
+
+The user may want to manually mark their types as marshalable with custom marshalling rules in this system due to specific restrictions in their code base around marshaling specific types that the source generator does not account for. We could also use this internally to support custom types in source instead of in the code generator. In this scenario, the user would apply either the `NativeMarshallingAttribute` attribute to their struct type. An analyzer would validate that the native struct type does not require marshalling and has marshalling methods of the required shape when the `NativeMarshallingAttribute` is applied.
+
+The P/Invoke source generator (as well as the struct source generator when nested struct types are used) would use the `NativeMarshallingAttribute` to determine how to marshal a parameter or field with an unknown type.
+
+If a structure type does not meet the requirements to not require marshalling or does not have the `NativeMarshallingAttribute` applied at the type definition, the user can supply a `MarshalUsingAttribute` at the marshalling location (field, parameter, or return value) with a native type matching the same requirements as `NativeMarshallingAttribute`'s native type.
+
+All generated stubs will be marked with [`SkipLocalsInitAttribute`](https://docs.microsoft.com/dotnet/api/system.runtime.compilerservices.skiplocalsinitattribute) on supported frameworks. This does require attention when performing custom marshalling as the state of stub allocated memory will be in an undefined state.
+
### Special case: Transparent Structures
There has been discussion about Transparent Structures, structure types that are treated as their underlying types when passed to native code. The support for a `Value` property on a generated marshalling type supports the transparent struct support. For example, we could support strongly typed `HRESULT` returns with this model as shown below:
@@ -250,7 +265,7 @@ struct HRESULT
In this case, the underlying native type would actually be an `int`, but the user could use the strongly-typed `HResult` type as the public surface area.
-> :question: Should we support transparent structures on manually annotated blittable types? If we do, we should do so in an opt-in manner to make it possible to have a `Value` property on the blittable type.
+> :question: Should we support transparent structures on manually annotated types that wouldn't need marshalling otherwise? If we do, we should do so in an opt-in manner to make it possible to have a `Value` property on the type without assuming that it is for interop in all cases.
#### Example: ComWrappers marshalling with Transparent Structures
diff --git a/docs/design/mono/debugger.md b/docs/design/mono/debugger.md
index 3a3a2936b79eb4..2268d81bf1047b 100644
--- a/docs/design/mono/debugger.md
+++ b/docs/design/mono/debugger.md
@@ -18,4 +18,11 @@ Web Assembly Debugger supports usage of following attributes:
- Stepping In/Over: results in an additional stepping need to proceed to the next line.
- __System.Diagnostics.DebuggerDisplay__
- __System.Diagnostics.DebuggerTypeProxy__
-- ...
\ No newline at end of file
+- __System.Diagnostics.DebuggerBrowsable__ ([doc](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.debuggerbrowsableattribute?view=net-6.0))
+ - Collapsed - displayed normally.
+ - RootHidden:
+ - Simple type - not displayed in the debugger window.
+ - Collection / Array - the values of a collection are displayed in a flat view, using the naming convention: *rootName[idx]*.
+
+ - Never - not displayed in the debugger window.
+
diff --git a/docs/pr-builds.md b/docs/pr-builds.md
new file mode 100644
index 00000000000000..f5f7555ae7e675
--- /dev/null
+++ b/docs/pr-builds.md
@@ -0,0 +1,94 @@
+## PR Builds
+When submitting a PR to the `dotnet/runtime` repository various builds will run validation in many areas to ensure we keep productivity and quality high.
+
+The `dotnet/runtime` validation system can become overwhelming as we need to cover a lot of build scenarios and test in all the platforms that we support. In order to try to make this more reliable and spend the least amount of time testing what the PR changes need we have various pipelines, required and optional that are covered in this document.
+
+Most of the repository pipelines use a custom mechanism to evaluate paths based on the changes contained in the PR to try and build/test the least that we can without compromising quality. This is the initial step on every pipeline that depends on this infrastructure, called "Evalute Paths". In this step you can see the result of the evaluation for each subset of the repository. For more details on which subsets we have based on paths see [here](https://github.com/dotnet/runtime/blob/513fe2863ad5ec6dc453d223d4b60f787a0ffa78/eng/pipelines/common/evaluate-default-paths.yml). Also to understand how this mechanism works you can read this [comment](https://github.com/dotnet/runtime/blob/513fe2863ad5ec6dc453d223d4b60f787a0ffa78/eng/pipelines/evaluate-changed-paths.sh#L3-L12).
+
+### Runtime pipeline
+This is the "main" pipeline for the runtime product. In this pipeline we include the most critical tests and platforms where we have enough test resources in order to deliver test results in a reasonable amount of time. The tests executed in this pipeline for runtime and libraries are considered innerloop, are the tests that are executed locally when one runs tests locally.
+
+For mobile platforms and wasm we run some smoke tests that aim to protect the quality of these platforms. We had to move to a smoke test approach given the hardware and time limitations that we encountered and contributors were affected by this with unstability and long wait times for their PRs to finish validation.
+
+### Runtime-dev-innerloop pipeline
+This pipeline is also required, and its intent is to cover a developer innerloop scenarios that could be affected by any change, like running a specific build command or running tests inside Visual Studio, etc.
+
+### Dotnet-linker-tests
+This is also a required pipeline. The purpose of this pipeline is to test that the libraries code is linker friendly. Meaning that when we trim our libraries using the ILLink, we don't have any trimming bugs, like a required method on a specific scenario is trimmed away by accident.
+
+### Runtime-staging
+This pipeline runs on every change, however it behaves a little different than the other pipelines. This pipeline, will not fail if there are test failures, however it will fail if there is a timeout or a build failure. The reason why we fail on build failures is because we want to protect the developer innerloop (building the repository) for this platform.
+
+The tests will not fail because the intent of this platform is to stage new platforms where the test infrastructure is new and we need to test if we have enough capacity to include that new platform on the "main" runtime pipeline without causing flakiness. Once we analyze data and a platform is stable when running on PRs in this pipeline for at least a weak it can be promoted either to the `runtime-extra-platforms` pipeline or to the `runtime` pipeline.
+
+### Runtime-extra-platforms
+This pipeline does not run by default as it is not required for a PR, but it runs twice a day, and it can also be invoked in specific PRs by commenting `/azp run runtime-extra-platforms`. However, this pipeline is still an important part of our testing.
+
+This pipeline runs innerloop tests on platforms where we don't have enough hardware capacity to run tests (mobile, browser) or on platforms where we believe tests should organically pass based on the coverage we have in the "main" runtime pipeline. For example, in the "main" pipeline we run tests on Ubuntu 21.10 but since we also support Ubuntu 18.04 which is an LTS release, we run tests on Ubuntu 18.04 of this pipeline just to make sure we have healthy tests on those platforms which we are releasing a product for.
+
+Another concrete scenario would be windows arm64 for libraries tests. Where we don't have enough hardware, but the JIT is the most important piece to test as that is what generates the native code to run on that platform, so we run JIT tests on arm64 in the "main" pipeline, but our libraries tests are only run on the `runtime-extra-platforms` pipeline.
+
+### Outerloop pipelines
+We have various pipelines that their names contain `Outerloop` on them. These pipelines will not run by default on every PR, they can also be invoked using the `/azp run` comment and will run on a daily basis to analyze test results.
+
+These pipelines will run tests that take very long, that are not very stable (i.e some networking tests), or that modify machine state. Such tests are called `Outerloop` tests rather than `innerloop`.
+
+## Rerunning Validation
+
+Validation may fail for several reasons:
+
+### Option 1: You have a defect in your PR
+
+* Simply push the fix to your PR branch, and validation will start over.
+
+### Option 2: There is a flaky test that is not related to your PR
+
+* Your assumption should be that a failed test indicates a problem in your PR. (If we don't operate this way, chaos ensues.) If the test fails when run again, it is almost surely a failure caused by your PR. However, there are occasions where unrelated failures occur. Here's some ways to know:
+ * Perhaps you see the same failure in CI results for unrelated active PR's.
+ * It's a known issue listed in our [big tracking issue](https://github.com/dotnet/runtime/issues/702) or tagged `blocking-clean-ci` [(query here)](https://github.com/dotnet/runtime/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3Ablocking-clean-ci+)
+ * It's otherwise beyond any reasonable doubt that your code changes could not have caused this.
+ * If the tests pass on rerun, that may suggest it's not related.
+* In this situation, you want to re-run but not necessarily rebase on main.
+ * To rerun just the failed leg(s):
+ * Click on any leg. Navigate through the Azure DevOps UI, find the "..." button and choose "Retry failed legs"
+ * Or, on the GitHub Checks tab choose "re-run failed checks". This will not rebase your change.
+ * To rerun all validation:
+ * Add a comment `/azp run runtime`
+ * Or, click on "re-run all checks" in the GitHub Checks tab
+ * Or, simply close and reopen the PR.
+* If you have established that it is an unrelated failure, please ensure we have an active issue for it. See the [unrelated failure](#what-to-do-if-you-determine-the-failure-is-unrelated) section below.
+* Whoever merges the PR should be satisfied that the failure is unrelated, is not introduced by the change, and that we are appropriately tracking it.
+
+### Option 3: The state of the main branch HEAD is bad.
+
+* This is the very rare case where there was a build break in main, and you got unlucky. Hopefully the break has been fixed, and you want CI to rebase your change and rerun validation.
+* To rebase and rerun all validation:
+ * Add a comment `/azp run runtime`
+ * Or, click on "re-run all checks" in the GitHub Checks tab
+ * Or, simply close and reopen the PR.
+ * Or, ammend your commit with `--amend --no-edit` and force push to your branch.
+
+### Additional information:
+ * You can list the available pipelines by adding a comment like `/azp list` or get the available commands by adding a comment like `azp help`.
+ * In the rare case the license/cla check fails to register a response, it can be rerun by issuing a GET request to `https://cla.dotnetfoundation.org/check/dotnet/runtime?pullRequest={pr_number}`. A successful response may be a redirect to `https://github.com`.
+ * Reach out to the infrastructure team for assistance on [Teams channel](https://teams.microsoft.com/l/channel/19%3ab27b36ecd10a46398da76b02f0411de7%40thread.skype/Infrastructure?groupId=014ca51d-be57-47fa-9628-a15efcc3c376&tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47) (for corpnet users) or on [Gitter](https://gitter.im/dotnet/community) in other cases.
+
+## What to do if you determine the failure is unrelated
+
+If you have determined the failure is definitely not caused by changes in your PR, please do this:
+
+* Search for an [existing issue](https://github.com/dotnet/runtime/issues). Usually the test method name or (if a crash/hang) the test assembly name are good search parameters.
+ * If there's an existing issue, add a comment with
+ * a) the link to the build
+ * b) the affected configuration (ie `net6.0-windows-Release-x64-Windows.81.Amd64.Open`)
+ * c) all console output including the error message and stack trace from the Azure DevOps tab (This is necessary as retention policies are in place that recycle old builds.)
+ * d) if there's a dump file (see Attachments tab in Azure DevOps) include that
+ * If the issue is already closed, reopen it and update the labels to reflect the current failure state.
+ * If there's no existing issue, create an issue with the same information listed above.
+ * Update the original pull request with a comment linking to the new or existing issue.
+* In a follow-up Pull Request, disable the failing test(s) with the corresponding issue link tracking the disable.
+ * Update the tracking issue with the label `disabled-test`.
+ * For libraries tests add a [`[ActiveIssue(link)]`](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/ActiveIssueAttribute.cs) attribute on the test method. You can narrow the disabling down to runtime variant, flavor, and platform. For an example see [File_AppendAllLinesAsync_Encoded](https://github.com/dotnet/runtime/blob/cf49643711ad8aa4685a8054286c1348cef6e1d8/src/libraries/System.IO.FileSystem/tests/File/AppendAsync.cs#L74)
+ * For runtime tests found under `src/tests`, please edit [`issues.targets`](https://github.com/dotnet/runtime/blob/main/src/tests/issues.targets). There are several groups for different types of disable (mono vs. coreclr, different platforms, different scenarios). Add the folder containing the test and issue mimicking any of the samples in the file.
+
+There are plenty of possible bugs, e.g. race conditions, where a failure might highlight a real problem and it won't manifest again on a retry. Therefore these steps should be followed for every iteration of the PR build, e.g. before retrying/rebuilding.
\ No newline at end of file
diff --git a/docs/pr-guide.md b/docs/pr-guide.md
index b250efd6e12dd9..eb7dea7a01ba7e 100644
--- a/docs/pr-guide.md
+++ b/docs/pr-guide.md
@@ -24,71 +24,10 @@ Anyone with write access can merge a pull request manually or by setting the [au
* The PR has been approved by at least one reviewer and any other objections are addressed.
* You can request another review from the original reviewer.
-* The PR successfully builds and passes all tests in the Continuous Integration (CI) system.
- * Depending on your change, you may need to re-run validation. See [rerunning validation](#rerunning-validation) below.
+* The PR successfully builds and passes all tests in the Continuous Integration (CI) system. For more information please read to our [PR Builds](pr-builds.md) doc.
Typically, PRs are merged as one commit. It creates a simpler history than a Merge Commit. "Special circumstances" are rare, and typically mean that there are a series of cleanly separated changes that will be too hard to understand if squashed together, or for some reason we want to preserve the ability to bisect them.
-## Rerunning Validation
-
-Validation may fail for several reasons:
-
-### Option 1: You have a defect in your PR
-
-* Simply push the fix to your PR branch, and validation will start over.
-
-### Option 2: There is a flaky test that is not related to your PR
-
-* Your assumption should be that a failed test indicates a problem in your PR. (If we don't operate this way, chaos ensues.) If the test fails when run again, it is almost surely a failure caused by your PR. However, there are occasions where unrelated failures occur. Here's some ways to know:
- * Perhaps you see the same failure in CI results for unrelated active PR's.
- * It's a known issue listed in our [big tracking issue](https://github.com/dotnet/runtime/issues/702) or tagged `blocking-clean-ci` [(query here)](https://github.com/dotnet/runtime/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3Ablocking-clean-ci+)
- * Its otherwise beyond any reasonable doubt that your code changes could not have caused this.
- * If the tests pass on rerun, that may suggest it's not related.
-* In this situation, you want to re-run but not necessarily rebase on main.
- * To rerun just the failed leg(s):
- * Click on any leg. Navigate through the Azure DevOps UI, find the "..." button and choose "Retry failed legs"
- * Or, on the GitHub Checks tab choose "re-run failed checks". This will not rebase your change.
- * To rerun all validation:
- * Add a comment `/azp run runtime`
- * Or, click on "re-run all checks" in the GitHub Checks tab
- * Or, simply close and reopen the PR.
-* If you have established that it is an unrelated failure, please ensure we have an active issue for it. See the [unrelated failure](#what-to-do-if-you-determine-the-failure-is-unrelated) section below.
-* Whoever merges the PR should be satisfied that the failure is unrelated, is not introduced by the change, and that we are appropriately tracking it.
-
-### Option 3: The state of the main branch HEAD is bad.
-
-* This is the very rare case where there was a build break in main, and you got unlucky. Hopefully the break has been fixed, and you want CI to rebase your change and rerun validation.
-* To rebase and rerun all validation:
- * Add a comment `/azp run runtime`
- * Or, click on "re-run all checks" in the GitHub Checks tab
- * Or, simply close and reopen the PR.
- * Or, ammend your commit with `--amend --no-edit` and force push to your branch.
-
-### Additional information:
- * You can list the available pipelines by adding a comment like `/azp list` or get the available commands by adding a comment like `azp help`.
- * In the rare case the license/cla check fails to register a response, it can be rerun by issuing a GET request to `https://cla.dotnetfoundation.org/check/dotnet/runtime?pullRequest={pr_number}`. A successful response may be a redirect to `https://github.com`.
- * Reach out to the infrastructure team for assistance on [Teams channel](https://teams.microsoft.com/l/channel/19%3ab27b36ecd10a46398da76b02f0411de7%40thread.skype/Infrastructure?groupId=014ca51d-be57-47fa-9628-a15efcc3c376&tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47) (for corpnet users) or on [Gitter](https://gitter.im/dotnet/community) in other cases.
-
-## What to do if you determine the failure is unrelated
-
-If you have determined the failure is definitely not caused by changes in your PR, please do this:
-
-* Search for an [existing issue](https://github.com/dotnet/runtime/issues). Usually the test method name or (if a crash/hang) the test assembly name are good search parameters.
- * If there's an existing issue, add a comment with
- * a) the link to the build
- * b) the affected configuration (ie `net6.0-windows-Release-x64-Windows.81.Amd64.Open`)
- * c) all console output including the error message and stack trace from the Azure DevOps tab (This is necessary as retention policies are in place that recycle old builds.)
- * d) if there's a dump file (see Attachments tab in Azure DevOps) include that
- * If the issue is already closed, reopen it and update the labels to reflect the current failure state.
- * If there's no existing issue, create an issue with the same information listed above.
- * Update the original pull request with a comment linking to the new or existing issue.
-* In a follow-up Pull Request, disable the failing test(s) with the corresponding issue link tracking the disable.
- * Update the tracking issue with the label `disabled-test`.
- * For libraries tests add a [`[ActiveIssue(link)]`](https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.XUnitExtensions/src/Attributes/ActiveIssueAttribute.cs) attribute on the test method. You can narrow the disabling down to runtime variant, flavor, and platform. For an example see [File_AppendAllLinesAsync_Encoded](https://github.com/dotnet/runtime/blob/a259ec2e967d502f82163beba6b84da5319c5e08/src/libraries/System.IO.FileSystem/tests/File/AppendAsync.cs#L899)
- * For runtime tests found under `src/tests`, please edit [`issues.targets`](https://github.com/dotnet/runtime/blob/main/src/tests/issues.targets). There are several groups for different types of disable (mono vs. coreclr, different platforms, different scenarios). Add the folder containing the test and issue mimicking any of the samples in the file.
-
-There are plenty of possible bugs, e.g. race conditions, where a failure might highlight a real problem and it won't manifest again on a retry. Therefore these steps should be followed for every iteration of the PR build, e.g. before retrying/rebuilding.
-
## Blocking Pull Request Merging
If for whatever reason you would like to move your pull request back to an in-progress status to avoid merging it in the current form, you can do that by adding [WIP] prefix to the pull request title.
diff --git a/docs/project/glossary.md b/docs/project/glossary.md
index cb7e0b21538b8c..9104049e947ec1 100644
--- a/docs/project/glossary.md
+++ b/docs/project/glossary.md
@@ -43,7 +43,7 @@ terminology.
| SDK | Software Development Kit. The [.NET SDK](https://docs.microsoft.com/dotnet/core/sdk) contains the .NET CLI, .NET libraries and runtime, and the dotnet driver. |
| SEH | [Structured Exception Handling](https://docs.microsoft.com/windows/win32/debug/structured-exception-handling). Unified mechanism for handling hardware and software exceptions on Windows. |
| SOS | [Son of Strike](https://docs.microsoft.com/archive/blogs/jasonz/sos-debugging-of-the-clr-part-1). The debugging extension for DbgEng based debuggers. Uses the DAC as an abstraction layer for its operation. |
-| SuperPMI | JIT component test framework (super fast JIT testing - it mocks/replays EE in EE-JIT interface) - see [SuperPMI details](https://github.com/dotnet/runtime/blob/main/src/coreclr/ToolBox/superpmi/readme.txt). |
+| SuperPMI | JIT component test framework (super fast JIT testing - it mocks/replays EE in EE-JIT interface) - see [SuperPMI details](https://github.com/dotnet/runtime/blob/main/src/coreclr/tools/superpmi/readme.md). |
| SVR | The CLR used to be built as two variants, with one called "mscorsvr.dll", to mean the "server" version. In particular, it contained the server GC implementation, which was intended for multi-threaded apps capable of taking advantage of multiple processors. In the .NET Framework 2 release, the two variants were merged into "mscorwks.dll". The WKS version was the default, however the SVR version remained available. |
| TFM | [Target Framework Moniker](https://docs.microsoft.com/dotnet/standard/frameworks) such as `net6.0` or `netstandard2.0`. |
| TPA | Trusted Platform Assemblies used to be a special set of assemblies that comprised the platform assemblies, when it was originally designed. As of today, it is simply the set of assemblies known to constitute the application. |
diff --git a/docs/workflow/Codespaces.md b/docs/workflow/Codespaces.md
index 391cd4087429e6..858da337216f25 100644
--- a/docs/workflow/Codespaces.md
+++ b/docs/workflow/Codespaces.md
@@ -5,13 +5,11 @@ Codespaces allows you to develop in a Docker container running in the cloud. You
dotnet/runtime runs a nightly GitHub Action to build the latest code in the repo. This allows you to immediately start developing and testing after creating a codespace without having to build the whole repo. When the machine is created, it will have built the repo using the code as of 6 AM UTC that morning.
-**NOTE**: In order to use a prebuilt codespace, when you create your machine be sure to select an **`8 core`** machine.
-
1. From https://github.com/dotnet/runtime, drop-down the `Code` button and select the `Codespaces` tab.

-2. Select `8-core` for the Machine type. This will ensure you get a "pre built" image.
+2. Select the Machine type. For dotnet/runtime, it is recommended to select at least a `4-core` machine. You can also verify that a "Prebuild" is ready.

diff --git a/docs/workflow/building/coreclr/osx-instructions.md b/docs/workflow/building/coreclr/osx-instructions.md
index d8bf4fe604fcb8..41e8d87de1a7ec 100644
--- a/docs/workflow/building/coreclr/osx-instructions.md
+++ b/docs/workflow/building/coreclr/osx-instructions.md
@@ -1,49 +1,12 @@
-Build CoreCLR on OS X
+Build CoreCLR on macOS
=====================
-This guide will walk you through building CoreCLR on OS X. We'll start by showing how to set up your environment from scratch.
+This guide will walk you through building CoreCLR on macOS. We'll start by showing how to set up your environment from scratch.
Environment
===========
-These instructions were validated on macOS 10.12. Sierra. On older versions coreFX will fail to build properly because of SSL API changes.
-
-If your machine has Command Line Tools for XCode 6.3 installed, you'll need to update them to the 6.3.1 version or higher in order to successfully build. There was an issue with the headers that shipped with version 6.3 that was subsequently fixed in 6.3.1.
-
-Git Setup
----------
-
-Clone the CoreCLR and CoreFX repositories (either upstream or a fork).
-
-```sh
-git clone https://github.com/dotnet/runtime
-# Cloning into 'runtime'...
-```
-
-CMake
------
-
-CoreCLR has a dependency on CMake for the build. You can install it with [Homebrew](https://brew.sh/).
-
-```sh
-brew install cmake
-```
-
-ICU
----
-ICU (International Components for Unicode) is also required to build and run. It can be obtained via [Homebrew](https://brew.sh/).
-
-```sh
-brew install icu4c
-```
-
-pkg-config
-----------
-pkg-config is also required to build. It can be obtained via [Homebrew](https://brew.sh/).
-
-```sh
-brew install pkg-config
-```
+Ensure you have all of the prerequisites installed from the [macOS Requirements](/docs/workflow/requirements/macos-requirements.md).
Build the Runtime and System.Private.CoreLib
============================================
diff --git a/docs/workflow/codespace-machine-size.png b/docs/workflow/codespace-machine-size.png
index 07945fb9ff672d..d0687c85b05f36 100644
Binary files a/docs/workflow/codespace-machine-size.png and b/docs/workflow/codespace-machine-size.png differ
diff --git a/docs/workflow/debugging/coreclr/debugging-aot-compilers.md b/docs/workflow/debugging/coreclr/debugging-aot-compilers.md
index 048d571df45f21..d21fa21a5cb77b 100644
--- a/docs/workflow/debugging/coreclr/debugging-aot-compilers.md
+++ b/docs/workflow/debugging/coreclr/debugging-aot-compilers.md
@@ -19,7 +19,7 @@ Built in debugging aids in the managed compilers
---------------------------------
- When debugging a multi-threaded component of the compiler and not investigating a multi-threading issue itself, it is generally advisable to disable the use of multiple threads.
-To do this use the `--parallelism 1` switch (for crossgen2) or `--singlethreaded` (for ILC) to specify that the maximum parallelism of the process shall be 1.
+To do this use the `--parallelism 1` switch to specify that the maximum parallelism of the process shall be 1.
- When debugging the behavior of compiling a single method, the compiler may be instructed to only compile a single method. This is done via the various --singlemethod options
@@ -172,3 +172,7 @@ devenv /debugexe C:\git2\runtime\.dotnet\dotnet.exe "c:\git2\runtime\artifacts\t
```
This will launch the Visual Studio debugger, with a solution setup for debugging the dotnet.exe process. By default this solution will debug the native code of the process only. To debug the managed components, edit the properties on the solution and set the `Debugger Type` to `Managed (.NET Core, .NET 5+)` or `Mixed (.NET Core, .NET 5+)`.
+
+# Debugging compilation graph
+
+The AOT compilation is driven by a dependency graph. If you need to troubleshoot the dependency graph (to figure out why something was or wasn't generated) you can follow [this guide](debuging-compiler-dependency-analysis.md)
diff --git a/docs/workflow/debugging/coreclr/debuging-compiler-dependency-analysis.md b/docs/workflow/debugging/coreclr/debuging-compiler-dependency-analysis.md
new file mode 100644
index 00000000000000..cc918c391f62a1
--- /dev/null
+++ b/docs/workflow/debugging/coreclr/debuging-compiler-dependency-analysis.md
@@ -0,0 +1,47 @@
+Debugging Compiler Dependency Analysis
+============================
+
+The general technique is to identify what node is missing from the graph or is erroneously present in the graph, and change the dependency analysis logic to adjust the graph. This document describes the various ways of debugging to identify what's happening.
+
+Analysis techniques for the dependency graph.
+1. Use the DependencyGraphViewer tool (if running on Windows). This tool is located in `src/coreclr/tools/aot/DependencyGraphViewer`
+ - This is the only convenient way to examine the graph while also simultaneously debugging the compiler.
+ - While this is currently Windows only due to use of WinForms, it would be fairly straightforward to make a command line based tool.
+ - Dependency graph does not support multiple simultaneous logging facilities, so make sure that you do not set IlcGenerateDgmlFile or invoke ILCompiler with the DGML generation turned on.
+2. Pass command line switches to the compiler to generate a dependency graph dgml file. This will produce the same data as is viewable in the viewer tool, but in a textual xml format.
+ - Future efforts may make the xml file loadable by the viewer tool.
+3. Instrument the compiler dependency analysis. (This may be necessary in cases where the viewer is unable to provide sufficient information about why the graph is structured as it is.)
+
+DependencyGraphViewer
+====================================
+
+This application allows viewing the dependency graph produced by the AOT compilation.
+
+Usage instructions:
+1. Launch the process as an administrator
+2. Run the compiler
+- The compiler can be run to completion, or stopped.
+3. Explore through the graph
+
+# Graphs View #
+- Choose one of the graphs that appears in the Dependency Graphs view to explore. As compilers execute, new graphs will automatically appear here.
+- The set of graphs loaded into the process is limited by available memory space. To clear the used memory, close all windows of the application.
+
+# Graph View #
+- In the Dependency Graph view, enter a regular expression in the text box, and then press ""Filter"". This will display a list of the nodes in the graph which have names which match the regular expression.
+- Commonly, if there is a object file symbol associated with the node it should be used as part of the regular expression. See the various implementations of GetName in the compiler for naming behavior.
+- Additionally, the event source marking mode assigns an Id to each node, and that is found as the mark object on the node, so if a specific id is known, just type that in, and it will appear in the window. (This is for use when using this tool in parallel with debugging the compiler.
+
+# Single Node Exploration #
+Once the interesting node(s) have been identified in the dependency graph window, select one of them, and then press Explore.
+ - In the Node Explorer window, the Dependent nodes (the ones which dependend on the current node are the nodes displayed above, and the Dependee nodes (the nodes that this node depends on) are displayed below. Each node in the list is paired with a textual reason as to why that edge in the graph exists.
+ - Select a node to explore further and press the corresponding button to make it happen.
+
+WhyDGML
+=======
+This tool can be used to visualize paths from a node of interest to the roots. To use it, pass command line option to the compiler to generate the DGML file (`--dgmllog name_of_output_file`) and then use this tool to find the path to the root. If you're looking at an optimized NativeAOT compilation, `--scandgmllog` might be preferable since it will have more details.
+The input to the tool is the DGML file and name of a node of interest. The output is the list of reasons why that node was included.
+
+This tool located in folder `src/coreclr/tools/aot/WhyDgml`
+
+See https://github.com/dotnet/corert/pull/7962 for example of usage and output.
diff --git a/docs/workflow/requirements/freebsd-requirements.md b/docs/workflow/requirements/freebsd-requirements.md
index 941b949a252878..c14c1c1a27cf01 100644
--- a/docs/workflow/requirements/freebsd-requirements.md
+++ b/docs/workflow/requirements/freebsd-requirements.md
@@ -1,13 +1,12 @@
-Requirements to build dotnet/runtime on FreeBSD
+Requirements to build and run dotnet/runtime on FreeBSD
=====================
-This guide will walk you through the requirements needed to build dotnet/runtime on FreeBSD. We'll start by showing how to set up your environment from scratch.
+This guide will walk you through the requirements needed to build and run dotnet/runtime on FreeBSD. We'll start by showing how to set up your environment from scratch.
Since there is no official build and FreeBSD package, native build on FreeBSD is not trivial. There are generally three options, sorted by ease of use:
- cross-compile on Linux using Docker
- cross-compile on Linux using Toolchain
- build on FreeBSD
-
Environment
===========
@@ -65,3 +64,46 @@ sudo pkg install --yes libunwind icu libinotify lttng-ust krb5 cmake openssl nin
Additionally, working dotnet cli with SDK is needed. On other platforms this would be downloaded automatically during build but it is not currently available for FreeBSD.
It needs to be built once on supported platform or obtained via community resources.
+Running on FreeBSD
+-------------------
+Install the following packages:
+- icu
+- libunwind
+- lttng-ust (optional, debug support)
+- krb5
+- openssl (optional, SSL support)
+- libinotify
+- terminfo-db (optional, terminal colors)
+
+The lines to install all the packages above using package manager.
+
+```sh
+sudo pkg install --yes libunwind icu libinotify lttng-ust krb5 openssl terminfo-db
+```
+
+Extract the SDK:
+The canonical location for the SDK is `/usr/share/dotnet`
+
+"VERSION" is the SDK version being unpacked.
+
+```sh
+sudo mkdir /usr/share/dotnet
+tar xf /tmp/dotnet-sdk-VERSION-freebsd-x64.tar.gz -C /usr/share/dotnet/
+```
+
+NuGet Packages:
+The canonical location for the NuGet packages is `/var/cache/nuget`
+
+"VERSION" is the same version as the SDK from above.
+
+- Microsoft.NETCore.App.Host.freebsd-x64.VERSION.nupkg
+- Microsoft.NETCore.App.Runtime.freebsd-x64.VERSION.nupkg
+- Microsoft.AspNetCore.App.Runtime.freebsd-x64.VERSION.nupkg
+
+Add the following line to any `NuGet.config` you are using under the `` section:
+
+```xml
+
+```
+
+Finally, either add `/usr/share/dotnet` to your PATH or create a symbolic for `/usr/share/dotnet/dotnet`
diff --git a/eng/CodeAnalysis.src.globalconfig b/eng/CodeAnalysis.src.globalconfig
index 400c8c432c21bf..0fc9bf8e5a7eeb 100644
--- a/eng/CodeAnalysis.src.globalconfig
+++ b/eng/CodeAnalysis.src.globalconfig
@@ -1444,7 +1444,7 @@ dotnet_diagnostic.IDE0057.severity = suggestion
dotnet_diagnostic.IDE0058.severity = silent
# IDE0059: Unnecessary assignment of a value
-dotnet_diagnostic.IDE0059.severity = suggestion
+dotnet_diagnostic.IDE0059.severity = warning
# IDE0060: Remove unused parameter
dotnet_diagnostic.IDE0060.severity = silent
diff --git a/eng/CodeAnalysis.test.globalconfig b/eng/CodeAnalysis.test.globalconfig
index 572310d3b86d0a..f56a38cfa707c0 100644
--- a/eng/CodeAnalysis.test.globalconfig
+++ b/eng/CodeAnalysis.test.globalconfig
@@ -1681,7 +1681,7 @@ dotnet_diagnostic.xUnit2012.severity = warning
dotnet_diagnostic.xUnit2013.severity = none
# xUnit2014: Do not use throws check to check for asynchronously thrown exception
-dotnet_diagnostic.xUnit2014.severity = warning
+dotnet_diagnostic.xUnit2014.severity = none
# xUnit2015: Do not use typeof expression to check the exception type
dotnet_diagnostic.xUnit2015.severity = warning
diff --git a/eng/Subsets.props b/eng/Subsets.props
index f0bb31a28aea72..5ce54174451364 100644
--- a/eng/Subsets.props
+++ b/eng/Subsets.props
@@ -58,7 +58,7 @@
- clr.native+linuxdac+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs
+ clr.native+linuxdac+clr.corelib+clr.tools+clr.nativecorelib+clr.packages+clr.nativeaotlibs+clr.spmiclr.iltools+clr.packages
@@ -112,6 +112,7 @@
+
@@ -206,6 +207,10 @@
$(ClrRuntimeBuildSubsets);ClrNativeAotSubset=true
+
+ $(ClrRuntimeBuildSubsets);ClrSpmiSubset=true
+
+
@@ -243,7 +248,7 @@
-
diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index e3a571f451cdea..af284815b19ecb 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -1,8 +1,8 @@
-
+ https://github.com/dotnet/icu
- d9371f17932fbf828f1d1e2f21a99b64ba40eba5
+ 4170ccfbbcada3e22aa4428a84524fabef006e38https://github.com/dotnet/msquic
@@ -16,239 +16,243 @@
https://github.com/dotnet/wcf7f504aabb1988e9a093c1e74d8040bd52feb2f01
-
+ https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ fe77708023f3d8a51c1548b86487a692897227ec
-
+ https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ fe77708023f3d8a51c1548b86487a692897227ec
-
+ https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ fe77708023f3d8a51c1548b86487a692897227ec
-
+ https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ fe77708023f3d8a51c1548b86487a692897227ec
-
+ https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ fe77708023f3d8a51c1548b86487a692897227ec
-
+ https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ fe77708023f3d8a51c1548b86487a692897227ec
-
+ https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ fe77708023f3d8a51c1548b86487a692897227ec
-
+ https://github.com/dotnet/llvm-project
- ef5d90bc37b53288e32d78dbf34eae32cd0893d3
+ fe77708023f3d8a51c1548b86487a692897227ec
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7
-
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7https://github.com/microsoft/vstest140434f7109d357d0158ade9e5164a4861513965
-
+ https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+ https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+ https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+ https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+ https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+ https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+ https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+ https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+ https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+ https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+ https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+ https://github.com/dotnet/llvm-project
- 662aff66999c435aec09c58643e9fd703eadc3e0
+ 79a6d232058e2c2f1d9e833355b72f07fe342a3b
-
+ https://github.com/dotnet/llvm-project
- 662aff66999c435aec09c58643e9fd703eadc3e0
+ 79a6d232058e2c2f1d9e833355b72f07fe342a3b
-
+ https://github.com/dotnet/llvm-project
- 662aff66999c435aec09c58643e9fd703eadc3e0
+ 79a6d232058e2c2f1d9e833355b72f07fe342a3b
-
+ https://github.com/dotnet/llvm-project
- 662aff66999c435aec09c58643e9fd703eadc3e0
+ 79a6d232058e2c2f1d9e833355b72f07fe342a3b
-
+ https://github.com/dotnet/llvm-project
- 662aff66999c435aec09c58643e9fd703eadc3e0
+ 79a6d232058e2c2f1d9e833355b72f07fe342a3b
-
+ https://github.com/dotnet/llvm-project
- 662aff66999c435aec09c58643e9fd703eadc3e0
+ 79a6d232058e2c2f1d9e833355b72f07fe342a3b
-
+ https://github.com/dotnet/llvm-project
- 662aff66999c435aec09c58643e9fd703eadc3e0
+ 79a6d232058e2c2f1d9e833355b72f07fe342a3b
-
+ https://github.com/dotnet/llvm-project
- 662aff66999c435aec09c58643e9fd703eadc3e0
+ 79a6d232058e2c2f1d9e833355b72f07fe342a3b
-
+ https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ ae2f60c950cc021921fce83c796cbcb5ff96c658
-
+ https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ ae2f60c950cc021921fce83c796cbcb5ff96c658
-
+ https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ ae2f60c950cc021921fce83c796cbcb5ff96c658
-
+ https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ ae2f60c950cc021921fce83c796cbcb5ff96c658
-
+ https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ ae2f60c950cc021921fce83c796cbcb5ff96c658
-
+ https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ ae2f60c950cc021921fce83c796cbcb5ff96c658
-
+ https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ ae2f60c950cc021921fce83c796cbcb5ff96c658
-
+ https://github.com/dotnet/runtime
- 834b278911962102919b3a7dec22ca6cb26bfa8a
+ ae2f60c950cc021921fce83c796cbcb5ff96c658
-
+ https://github.com/dotnet/linker
- 41467d340a3345f08cb8ba67c20c1ea40c57682f
+ e485816b48273d03bd6266a64dad9bea97f861d5
-
+ https://github.com/dotnet/xharness
- 7ad8d01a879af9437a7c33d01409bd761700cdad
+ 3060cda4543b80824a9238bcd176bb1a5af72044
-
+ https://github.com/dotnet/xharness
- 7ad8d01a879af9437a7c33d01409bd761700cdad
+ 3060cda4543b80824a9238bcd176bb1a5af72044
-
+
+ https://github.com/dotnet/xharness
+ 3060cda4543b80824a9238bcd176bb1a5af72044
+
+ https://github.com/dotnet/arcade
- 0cd94b1d02c03377d99f3739beb191591f6abee5
+ 9ffc76ac9f5799de9b28ee59f9bfbe0f8844d0d7https://dev.azure.com/dnceng/internal/_git/dotnet-optimization
@@ -266,17 +270,17 @@
https://dev.azure.com/dnceng/internal/_git/dotnet-optimization91d6b3c1f51888d166701510189505f35714665c
-
+ https://github.com/dotnet/hotreload-utils
- f0d838421286fed81005fd4ddf6562555b641b3b
+ b6504c8dca937ff1a59d3283374241eacf26684a
-
+ https://github.com/dotnet/runtime-assets
- f6e023ee68f858cd020a13dc9dfc13ba6a82b64b
+ a597df23119faf540d95cebab14b82f084c47384
-
+ https://github.com/dotnet/roslyn-analyzers
- e101c379c6e3c7011562ee3af3e3de066da0048f
+ f471d3381584f10f9908432e0b2b2b8ef07a0aa6https://github.com/dotnet/sdk
diff --git a/eng/Versions.props b/eng/Versions.props
index 47d31b37c8e334..04f7adea4cff9d 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -42,50 +42,50 @@
3.11.0
- 4.0.0-4.final
- 4.0.0-4.final
+ 4.0.1
+ 4.0.13.3.2
- 4.0.0-4.final
- 4.0.0-4.final
- 7.0.0-preview1.21613.1
+ 4.0.1
+ 4.0.1
+ 7.0.0-preview1.22068.22.0.0-alpha.1.21525.11
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 2.5.1-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
- 7.0.0-beta.21621.3
+ 7.0.0-beta.22068.3
+ 7.0.0-beta.22068.3
+ 7.0.0-beta.22068.3
+ 7.0.0-beta.22068.3
+ 7.0.0-beta.22068.3
+ 7.0.0-beta.22068.3
+ 2.5.1-beta.22068.3
+ 7.0.0-beta.22068.3
+ 7.0.0-beta.22068.3
+ 7.0.0-beta.22068.3
+ 7.0.0-beta.22068.3
+ 7.0.0-beta.22068.3
+ 7.0.0-beta.22068.3
+ 7.0.0-beta.22068.3
+ 7.0.0-beta.22068.36.0.0-preview.1.102
- 7.0.0-alpha.1.21620.1
- 7.0.0-alpha.1.21620.1
- 7.0.0-alpha.1.21620.1
+ 7.0.0-alpha.1.22066.4
+ 7.0.0-alpha.1.22066.4
+ 7.0.0-alpha.1.22066.43.1.0
- 7.0.0-alpha.1.21620.1
- 1.0.0-alpha.1.21630.1
- 1.0.0-alpha.1.21630.1
- 1.0.0-alpha.1.21630.1
- 1.0.0-alpha.1.21630.1
- 1.0.0-alpha.1.21630.1
- 1.0.0-alpha.1.21630.1
- 1.0.0-alpha.1.21630.1
- 1.0.0-alpha.1.21630.1
+ 7.0.0-alpha.1.22066.4
+ 1.0.0-alpha.1.22070.1
+ 1.0.0-alpha.1.22070.1
+ 1.0.0-alpha.1.22070.1
+ 1.0.0-alpha.1.22070.1
+ 1.0.0-alpha.1.22070.1
+ 1.0.0-alpha.1.22070.1
+ 1.0.0-alpha.1.22070.1
+ 1.0.0-alpha.1.22070.15.0.04.3.0
@@ -120,24 +120,24 @@
5.0.05.0.04.9.0-rc2.21473.1
- 7.0.0-alpha.1.21620.1
- 7.0.0-alpha.1.21620.1
+ 7.0.0-alpha.1.22066.4
+ 7.0.0-alpha.1.22066.44.5.44.5.0
- 7.0.0-alpha.1.21620.1
+ 7.0.0-alpha.1.22066.4
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
- 7.0.0-beta.21620.3
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.1
+ 7.0.0-beta.22060.11.0.0-prerelease.21577.21.0.0-prerelease.21577.2
@@ -160,12 +160,14 @@
1.0.1-prerelease-0000616.9.0-preview-20201201-01
- 1.0.0-prerelease.21622.1
- 1.0.0-prerelease.21622.1
- 1.0.2-alpha.0.21620.2
- 2.4.2-pre.9
+ 1.0.0-prerelease.22067.1
+ 1.0.0-prerelease.22067.1
+ 1.0.0-prerelease.22067.1
+ 1.0.2-alpha.0.22069.1
+ 2.4.2-pre.22
+ 0.12.0-pre.202.4.2
- 1.3.0
+ 3.1.012.0.32.0.44.12.0
@@ -175,21 +177,21 @@
6.0.0-preview-20211019.1
- 7.0.100-1.21620.1
+ 7.0.100-1.22063.2$(MicrosoftNETILLinkTasksVersion)
- 7.0.0-alpha.1.21620.1
+ 7.0.0-alpha.1.22067.17.0.0-alpha.1.21529.3
- 11.1.0-alpha.1.21615.1
- 11.1.0-alpha.1.21615.1
- 11.1.0-alpha.1.21615.1
- 11.1.0-alpha.1.21615.1
- 11.1.0-alpha.1.21615.1
- 11.1.0-alpha.1.21615.1
- 11.1.0-alpha.1.21615.1
- 11.1.0-alpha.1.21615.1
+ 11.1.0-alpha.1.22067.2
+ 11.1.0-alpha.1.22067.2
+ 11.1.0-alpha.1.22067.2
+ 11.1.0-alpha.1.22067.2
+ 11.1.0-alpha.1.22067.2
+ 11.1.0-alpha.1.22067.2
+ 11.1.0-alpha.1.22067.2
+ 11.1.0-alpha.1.22067.27.0.0-alpha.1.21601.1$(MicrosoftNETWorkloadEmscriptenManifest70100Version)
diff --git a/eng/build.sh b/eng/build.sh
index f1ef5958fdbc92..ea8e3089e95f4d 100755
--- a/eng/build.sh
+++ b/eng/build.sh
@@ -17,7 +17,7 @@ scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
usage()
{
echo "Common settings:"
- echo " --arch (-a) Target platform: x86, x64, arm, armel, arm64, s390x or wasm."
+ echo " --arch (-a) Target platform: x86, x64, arm, armel, arm64, loongarch64, s390x or wasm."
echo " [Default: Your machine's architecture.]"
echo " --binaryLog (-bl) Output binary log."
echo " --cross Optional argument to signify cross compilation."
@@ -206,12 +206,12 @@ while [[ $# > 0 ]]; do
fi
passedArch="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
case "$passedArch" in
- x64|x86|arm|armel|arm64|s390x|wasm)
+ x64|x86|arm|armel|arm64|loongarch64|s390x|wasm)
arch=$passedArch
;;
*)
echo "Unsupported target architecture '$2'."
- echo "The allowed values are x86, x64, arm, armel, arm64, s390x, and wasm."
+ echo "The allowed values are x86, x64, arm, armel, arm64, loongarch64, s390x, and wasm."
exit 1
;;
esac
diff --git a/eng/common/cross/arm/tizen-build-rootfs.sh b/eng/common/cross/arm/tizen-build-rootfs.sh
new file mode 100644
index 00000000000000..9fdb32e920e22c
--- /dev/null
+++ b/eng/common/cross/arm/tizen-build-rootfs.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+set -e
+
+__ARM_HARDFP_CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+__TIZEN_CROSSDIR="$__ARM_HARDFP_CrossDir/tizen"
+
+if [[ -z "$ROOTFS_DIR" ]]; then
+ echo "ROOTFS_DIR is not defined."
+ exit 1;
+fi
+
+TIZEN_TMP_DIR=$ROOTFS_DIR/tizen_tmp
+mkdir -p $TIZEN_TMP_DIR
+
+# Download files
+echo ">>Start downloading files"
+VERBOSE=1 $__ARM_HARDFP_CrossDir/tizen-fetch.sh $TIZEN_TMP_DIR
+echo "<>Start constructing Tizen rootfs"
+TIZEN_RPM_FILES=`ls $TIZEN_TMP_DIR/*.rpm`
+cd $ROOTFS_DIR
+for f in $TIZEN_RPM_FILES; do
+ rpm2cpio $f | cpio -idm --quiet
+done
+echo "<>Start configuring Tizen rootfs"
+ln -sfn asm-arm ./usr/include/asm
+patch -p1 < $__TIZEN_CROSSDIR/tizen.patch
+echo "</dev/null; then
+ VERBOSE=0
+fi
+
+Log()
+{
+ if [ $VERBOSE -ge $1 ]; then
+ echo ${@:2}
+ fi
+}
+
+Inform()
+{
+ Log 1 -e "\x1B[0;34m$@\x1B[m"
+}
+
+Debug()
+{
+ Log 2 -e "\x1B[0;32m$@\x1B[m"
+}
+
+Error()
+{
+ >&2 Log 0 -e "\x1B[0;31m$@\x1B[m"
+}
+
+Fetch()
+{
+ URL=$1
+ FILE=$2
+ PROGRESS=$3
+ if [ $VERBOSE -ge 1 ] && [ $PROGRESS ]; then
+ CURL_OPT="--progress-bar"
+ else
+ CURL_OPT="--silent"
+ fi
+ curl $CURL_OPT $URL > $FILE
+}
+
+hash curl 2> /dev/null || { Error "Require 'curl' Aborting."; exit 1; }
+hash xmllint 2> /dev/null || { Error "Require 'xmllint' Aborting."; exit 1; }
+hash sha256sum 2> /dev/null || { Error "Require 'sha256sum' Aborting."; exit 1; }
+
+TMPDIR=$1
+if [ ! -d $TMPDIR ]; then
+ TMPDIR=./tizen_tmp
+ Debug "Create temporary directory : $TMPDIR"
+ mkdir -p $TMPDIR
+fi
+
+TIZEN_URL=http://download.tizen.org/snapshots/tizen
+BUILD_XML=build.xml
+REPOMD_XML=repomd.xml
+PRIMARY_XML=primary.xml
+TARGET_URL="http://__not_initialized"
+
+Xpath_get()
+{
+ XPATH_RESULT=''
+ XPATH=$1
+ XML_FILE=$2
+ RESULT=$(xmllint --xpath $XPATH $XML_FILE)
+ if [[ -z ${RESULT// } ]]; then
+ Error "Can not find target from $XML_FILE"
+ Debug "Xpath = $XPATH"
+ exit 1
+ fi
+ XPATH_RESULT=$RESULT
+}
+
+fetch_tizen_pkgs_init()
+{
+ TARGET=$1
+ PROFILE=$2
+ Debug "Initialize TARGET=$TARGET, PROFILE=$PROFILE"
+
+ TMP_PKG_DIR=$TMPDIR/tizen_${PROFILE}_pkgs
+ if [ -d $TMP_PKG_DIR ]; then rm -rf $TMP_PKG_DIR; fi
+ mkdir -p $TMP_PKG_DIR
+
+ PKG_URL=$TIZEN_URL/$PROFILE/latest
+
+ BUILD_XML_URL=$PKG_URL/$BUILD_XML
+ TMP_BUILD=$TMP_PKG_DIR/$BUILD_XML
+ TMP_REPOMD=$TMP_PKG_DIR/$REPOMD_XML
+ TMP_PRIMARY=$TMP_PKG_DIR/$PRIMARY_XML
+ TMP_PRIMARYGZ=${TMP_PRIMARY}.gz
+
+ Fetch $BUILD_XML_URL $TMP_BUILD
+
+ Debug "fetch $BUILD_XML_URL to $TMP_BUILD"
+
+ TARGET_XPATH="//build/buildtargets/buildtarget[@name=\"$TARGET\"]/repo[@type=\"binary\"]/text()"
+ Xpath_get $TARGET_XPATH $TMP_BUILD
+ TARGET_PATH=$XPATH_RESULT
+ TARGET_URL=$PKG_URL/$TARGET_PATH
+
+ REPOMD_URL=$TARGET_URL/repodata/repomd.xml
+ PRIMARY_XPATH='string(//*[local-name()="data"][@type="primary"]/*[local-name()="location"]/@href)'
+
+ Fetch $REPOMD_URL $TMP_REPOMD
+
+ Debug "fetch $REPOMD_URL to $TMP_REPOMD"
+
+ Xpath_get $PRIMARY_XPATH $TMP_REPOMD
+ PRIMARY_XML_PATH=$XPATH_RESULT
+ PRIMARY_URL=$TARGET_URL/$PRIMARY_XML_PATH
+
+ Fetch $PRIMARY_URL $TMP_PRIMARYGZ
+
+ Debug "fetch $PRIMARY_URL to $TMP_PRIMARYGZ"
+
+ gunzip $TMP_PRIMARYGZ
+
+ Debug "unzip $TMP_PRIMARYGZ to $TMP_PRIMARY"
+}
+
+fetch_tizen_pkgs()
+{
+ ARCH=$1
+ PACKAGE_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="location"]/@href)'
+
+ PACKAGE_CHECKSUM_XPATH_TPL='string(//*[local-name()="metadata"]/*[local-name()="package"][*[local-name()="name"][text()="_PKG_"]][*[local-name()="arch"][text()="_ARCH_"]]/*[local-name()="checksum"]/text())'
+
+ for pkg in ${@:2}
+ do
+ Inform "Fetching... $pkg"
+ XPATH=${PACKAGE_XPATH_TPL/_PKG_/$pkg}
+ XPATH=${XPATH/_ARCH_/$ARCH}
+ Xpath_get $XPATH $TMP_PRIMARY
+ PKG_PATH=$XPATH_RESULT
+
+ XPATH=${PACKAGE_CHECKSUM_XPATH_TPL/_PKG_/$pkg}
+ XPATH=${XPATH/_ARCH_/$ARCH}
+ Xpath_get $XPATH $TMP_PRIMARY
+ CHECKSUM=$XPATH_RESULT
+
+ PKG_URL=$TARGET_URL/$PKG_PATH
+ PKG_FILE=$(basename $PKG_PATH)
+ PKG_PATH=$TMPDIR/$PKG_FILE
+
+ Debug "Download $PKG_URL to $PKG_PATH"
+ Fetch $PKG_URL $PKG_PATH true
+
+ echo "$CHECKSUM $PKG_PATH" | sha256sum -c - > /dev/null
+ if [ $? -ne 0 ]; then
+ Error "Fail to fetch $PKG_URL to $PKG_PATH"
+ Debug "Checksum = $CHECKSUM"
+ exit 1
+ fi
+ done
+}
+
+Inform "Initialize arm base"
+fetch_tizen_pkgs_init standard base
+Inform "fetch common packages"
+fetch_tizen_pkgs armv7hl gcc gcc-devel-static glibc glibc-devel libicu libicu-devel libatomic linux-glibc-devel keyutils keyutils-devel libkeyutils
+Inform "fetch coreclr packages"
+fetch_tizen_pkgs armv7hl lldb lldb-devel libgcc libstdc++ libstdc++-devel libunwind libunwind-devel lttng-ust-devel lttng-ust userspace-rcu-devel userspace-rcu
+Inform "fetch corefx packages"
+fetch_tizen_pkgs armv7hl libcom_err libcom_err-devel zlib zlib-devel libopenssl11 libopenssl1.1-devel krb5 krb5-devel
+
+Inform "Initialize standard unified"
+fetch_tizen_pkgs_init standard unified
+Inform "fetch corefx packages"
+fetch_tizen_pkgs armv7hl gssdp gssdp-devel tizen-release
+
diff --git a/eng/common/cross/arm/tizen/tizen.patch b/eng/common/cross/arm/tizen/tizen.patch
new file mode 100644
index 00000000000000..fb12ade7250ae9
--- /dev/null
+++ b/eng/common/cross/arm/tizen/tizen.patch
@@ -0,0 +1,9 @@
+diff -u -r a/usr/lib/libc.so b/usr/lib/libc.so
+--- a/usr/lib/libc.so 2016-12-30 23:00:08.284951863 +0900
++++ b/usr/lib/libc.so 2016-12-30 23:00:32.140951815 +0900
+@@ -2,4 +2,4 @@
+ Use the shared library, but some functions are only in
+ the static library, so try that secondarily. */
+ OUTPUT_FORMAT(elf32-littlearm)
+-GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux-armhf.so.3 ) )
++GROUP ( libc.so.6 libc_nonshared.a AS_NEEDED ( ld-linux-armhf.so.3 ) )
diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh
index 5102245b7b5e3f..e94d13d62ef64d 100755
--- a/eng/common/cross/build-rootfs.sh
+++ b/eng/common/cross/build-rootfs.sh
@@ -185,8 +185,8 @@ while :; do
__LLDB_Package="liblldb-6.0-dev"
;;
tizen)
- if [ "$__BuildArch" != "armel" ] && [ "$__BuildArch" != "arm64" ]; then
- echo "Tizen is available only for armel and arm64."
+ if [ "$__BuildArch" != "arm" ] && [ "$__BuildArch" != "armel" ] && [ "$__BuildArch" != "arm64" ]; then
+ echo "Tizen is available only for arm, armel and arm64."
usage;
exit 1;
fi
diff --git a/eng/common/cross/toolchain.cmake b/eng/common/cross/toolchain.cmake
index 9d22fc92693031..fba2afda438b66 100644
--- a/eng/common/cross/toolchain.cmake
+++ b/eng/common/cross/toolchain.cmake
@@ -34,6 +34,16 @@ elseif(TARGET_ARCH_NAME STREQUAL "arm")
else()
set(TOOLCHAIN "arm-linux-gnueabihf")
endif()
+ if(TIZEN)
+ set(TIZEN_TOOLCHAIN "armv7hl-tizen-linux-gnueabihf/9.2.0")
+ endif()
+elseif(TARGET_ARCH_NAME STREQUAL "armv6")
+ set(CMAKE_SYSTEM_PROCESSOR armv6l)
+ if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf)
+ set(TOOLCHAIN "armv6-alpine-linux-musleabihf")
+ else()
+ set(TOOLCHAIN "arm-linux-gnueabihf")
+ endif()
elseif(TARGET_ARCH_NAME STREQUAL "arm64")
set(CMAKE_SYSTEM_PROCESSOR aarch64)
if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl)
@@ -57,7 +67,7 @@ elseif (ILLUMOS)
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(TOOLCHAIN "x86_64-illumos")
else()
- message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64, s390x and x86 are supported!")
+ message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, armv6, arm64, s390x and x86 are supported!")
endif()
if(DEFINED ENV{TOOLCHAIN})
@@ -66,6 +76,10 @@ endif()
# Specify include paths
if(TIZEN)
+ if(TARGET_ARCH_NAME STREQUAL "arm")
+ include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/)
+ include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7hl-tizen-linux-gnueabihf)
+ endif()
if(TARGET_ARCH_NAME STREQUAL "armel")
include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/)
include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7l-tizen-linux-gnueabi)
@@ -160,7 +174,7 @@ if(LINUX)
add_toolchain_linker_flag("-Wl,--rpath-link=${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}")
endif()
-if(TARGET_ARCH_NAME STREQUAL "armel")
+if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$")
if(TIZEN)
add_toolchain_linker_flag("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}")
add_toolchain_linker_flag("-L${CROSS_ROOTFS}/lib")
@@ -187,7 +201,7 @@ endif()
# Specify compile options
-if((TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64|s390x)$" AND NOT ANDROID) OR ILLUMOS)
+if((TARGET_ARCH_NAME MATCHES "^(arm|armv6|armel|arm64|s390x)$" AND NOT ANDROID) OR ILLUMOS)
set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN})
set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN})
set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN})
@@ -215,7 +229,7 @@ elseif(TARGET_ARCH_NAME STREQUAL "x86")
endif()
if(TIZEN)
- if(TARGET_ARCH_NAME MATCHES "^(armel|arm64)$")
+ if(TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64)$")
add_compile_options(-Wno-deprecated-declarations) # compile-time option
add_compile_options(-D__extern_always_inline=inline) # compile-time option
endif()
diff --git a/eng/common/generate-graph-files.ps1 b/eng/common/generate-graph-files.ps1
deleted file mode 100644
index 0728b1a8b570d6..00000000000000
--- a/eng/common/generate-graph-files.ps1
+++ /dev/null
@@ -1,86 +0,0 @@
-Param(
- [Parameter(Mandatory=$true)][string] $barToken, # Token generated at https://maestro-prod.westus2.cloudapp.azure.com/Account/Tokens
- [Parameter(Mandatory=$true)][string] $gitHubPat, # GitHub personal access token from https://github.com/settings/tokens (no auth scopes needed)
- [Parameter(Mandatory=$true)][string] $azdoPat, # Azure Dev Ops tokens from https://dev.azure.com/dnceng/_details/security/tokens (code read scope needed)
- [Parameter(Mandatory=$true)][string] $outputFolder, # Where the graphviz.txt file will be created
- [string] $darcVersion, # darc's version
- [string] $graphvizVersion = '2.38', # GraphViz version
- [switch] $includeToolset # Whether the graph should include toolset dependencies or not. i.e. arcade, optimization. For more about
- # toolset dependencies see https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md#toolset-vs-product-dependencies
-)
-
-function CheckExitCode ([string]$stage)
-{
- $exitCode = $LASTEXITCODE
- if ($exitCode -ne 0) {
- Write-PipelineTelemetryError -Category 'Arcade' -Message "Something failed in stage: '$stage'. Check for errors above. Exiting now..."
- ExitWithExitCode $exitCode
- }
-}
-
-try {
- $ErrorActionPreference = 'Stop'
- . $PSScriptRoot\tools.ps1
-
- Import-Module -Name (Join-Path $PSScriptRoot 'native\CommonLibrary.psm1')
-
- Push-Location $PSScriptRoot
-
- Write-Host 'Installing darc...'
- . .\darc-init.ps1 -darcVersion $darcVersion
- CheckExitCode 'Running darc-init'
-
- $engCommonBaseDir = Join-Path $PSScriptRoot 'native\'
- $graphvizInstallDir = CommonLibrary\Get-NativeInstallDirectory
- $nativeToolBaseUri = 'https://netcorenativeassets.blob.core.windows.net/resource-packages/external'
- $installBin = Join-Path $graphvizInstallDir 'bin'
-
- Write-Host 'Installing dot...'
- .\native\install-tool.ps1 -ToolName graphviz -InstallPath $installBin -BaseUri $nativeToolBaseUri -CommonLibraryDirectory $engCommonBaseDir -Version $graphvizVersion -Verbose
-
- $darcExe = "$env:USERPROFILE\.dotnet\tools"
- $darcExe = Resolve-Path "$darcExe\darc.exe"
-
- Create-Directory $outputFolder
-
- # Generate 3 graph descriptions:
- # 1. Flat with coherency information
- # 2. Graphviz (dot) file
- # 3. Standard dependency graph
- $graphVizFilePath = "$outputFolder\graphviz.txt"
- $graphVizImageFilePath = "$outputFolder\graph.png"
- $normalGraphFilePath = "$outputFolder\graph-full.txt"
- $flatGraphFilePath = "$outputFolder\graph-flat.txt"
- $baseOptions = @( '--github-pat', "$gitHubPat", '--azdev-pat', "$azdoPat", '--password', "$barToken" )
-
- if ($includeToolset) {
- Write-Host 'Toolsets will be included in the graph...'
- $baseOptions += @( '--include-toolset' )
- }
-
- Write-Host 'Generating standard dependency graph...'
- & "$darcExe" get-dependency-graph @baseOptions --output-file $normalGraphFilePath
- CheckExitCode 'Generating normal dependency graph'
-
- Write-Host 'Generating flat dependency graph and graphviz file...'
- & "$darcExe" get-dependency-graph @baseOptions --flat --coherency --graphviz $graphVizFilePath --output-file $flatGraphFilePath
- CheckExitCode 'Generating flat and graphviz dependency graph'
-
- Write-Host "Generating graph image $graphVizFilePath"
- $dotFilePath = Join-Path $installBin "graphviz\$graphvizVersion\release\bin\dot.exe"
- & "$dotFilePath" -Tpng -o"$graphVizImageFilePath" "$graphVizFilePath"
- CheckExitCode 'Generating graphviz image'
-
- Write-Host "'$graphVizFilePath', '$flatGraphFilePath', '$normalGraphFilePath' and '$graphVizImageFilePath' created!"
-}
-catch {
- if (!$includeToolset) {
- Write-Host 'This might be a toolset repo which includes only toolset dependencies. ' -NoNewline -ForegroundColor Yellow
- Write-Host 'Since -includeToolset is not set there is no graph to create. Include -includeToolset and try again...' -ForegroundColor Yellow
- }
- Write-Host $_.ScriptStackTrace
- Write-PipelineTelemetryError -Category 'Arcade' -Message $_
- ExitWithExitCode 1
-} finally {
- Pop-Location
-}
\ No newline at end of file
diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1
index 2427ca6b6aec74..8508397d77640e 100644
--- a/eng/common/post-build/publish-using-darc.ps1
+++ b/eng/common/post-build/publish-using-darc.ps1
@@ -5,13 +5,8 @@ param(
[Parameter(Mandatory=$true)][string] $MaestroToken,
[Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro-prod.westus2.cloudapp.azure.com',
[Parameter(Mandatory=$true)][string] $WaitPublishingFinish,
- [Parameter(Mandatory=$false)][string] $EnableSourceLinkValidation,
- [Parameter(Mandatory=$false)][string] $EnableSigningValidation,
- [Parameter(Mandatory=$false)][string] $EnableNugetValidation,
- [Parameter(Mandatory=$false)][string] $PublishInstallersAndChecksums,
[Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters,
- [Parameter(Mandatory=$false)][string] $SymbolPublishingAdditionalParameters,
- [Parameter(Mandatory=$false)][string] $SigningValidationAdditionalParameters
+ [Parameter(Mandatory=$false)][string] $SymbolPublishingAdditionalParameters
)
try {
@@ -35,27 +30,6 @@ try {
$optionalParams.Add("--no-wait") | Out-Null
}
- if ("false" -ne $PublishInstallersAndChecksums) {
- $optionalParams.Add("--publish-installers-and-checksums") | Out-Null
- }
-
- if ("true" -eq $EnableNugetValidation) {
- $optionalParams.Add("--validate-nuget") | Out-Null
- }
-
- if ("true" -eq $EnableSourceLinkValidation) {
- $optionalParams.Add("--validate-sourcelinkchecksums") | Out-Null
- }
-
- if ("true" -eq $EnableSigningValidation) {
- $optionalParams.Add("--validate-signingchecksums") | Out-Null
-
- if ("" -ne $SigningValidationAdditionalParameters) {
- $optionalParams.Add("--signing-validation-parameters") | Out-Null
- $optionalParams.Add($SigningValidationAdditionalParameters) | Out-Null
- }
- }
-
& $darc add-build-to-channel `
--id $buildId `
--publishing-infra-version $PublishingInfraVersion `
diff --git a/eng/common/sdl/configure-sdl-tool.ps1 b/eng/common/sdl/configure-sdl-tool.ps1
index 8a68fc24b11b0d..bdbf49e6c71de8 100644
--- a/eng/common/sdl/configure-sdl-tool.ps1
+++ b/eng/common/sdl/configure-sdl-tool.ps1
@@ -15,7 +15,9 @@ Param(
# Optional: Additional params to add to any tool using CredScan.
[string[]] $CrScanAdditionalRunConfigParams,
# Optional: Additional params to add to any tool using PoliCheck.
- [string[]] $PoliCheckAdditionalRunConfigParams
+ [string[]] $PoliCheckAdditionalRunConfigParams,
+ # Optional: Additional params to add to any tool using CodeQL/Semmle.
+ [string[]] $CodeQLAdditionalRunConfigParams
)
$ErrorActionPreference = 'Stop'
@@ -78,6 +80,11 @@ try {
$tool.Args += "`"Target < $TargetDirectory`""
}
$tool.Args += $PoliCheckAdditionalRunConfigParams
+ } elseif ($tool.Name -eq 'semmle' -or $tool.Name -eq 'codeql') {
+ if ($targetDirectory) {
+ $tool.Args += "`"SourceCodeDirectory < $TargetDirectory`""
+ }
+ $tool.Args += $CodeQLAdditionalRunConfigParams
}
# Create variable pointing to the args array directly so we can use splat syntax later.
diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1
index e5bef8ebd3a3b4..4797e012c7d2f7 100644
--- a/eng/common/sdl/execute-all-sdl-tools.ps1
+++ b/eng/common/sdl/execute-all-sdl-tools.ps1
@@ -34,6 +34,7 @@ Param(
[string] $GuardianLoggerLevel='Standard', # Optional: the logger level for the Guardian CLI; options are Trace, Verbose, Standard, Warning, and Error
[string[]] $CrScanAdditionalRunConfigParams, # Optional: Additional Params to custom build a CredScan run config in the format @("xyz:abc","sdf:1")
[string[]] $PoliCheckAdditionalRunConfigParams, # Optional: Additional Params to custom build a Policheck run config in the format @("xyz:abc","sdf:1")
+ [string[]] $CodeQLAdditionalRunConfigParams, # Optional: Additional Params to custom build a Semmle/CodeQL run config in the format @("xyz < abc","sdf < 1")
[bool] $BreakOnFailure=$False # Optional: Fail the build if there were errors during the run
)
@@ -105,7 +106,8 @@ try {
-AzureDevOpsAccessToken $AzureDevOpsAccessToken `
-GuardianLoggerLevel $GuardianLoggerLevel `
-CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams `
- -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams
+ -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams `
+ -CodeQLAdditionalRunConfigParams $CodeQLAdditionalRunConfigParams
if ($BreakOnFailure) {
Exit-IfNZEC "Sdl"
}
diff --git a/eng/common/templates/job/generate-graph-files.yml b/eng/common/templates/job/generate-graph-files.yml
deleted file mode 100644
index e54ce956f9088e..00000000000000
--- a/eng/common/templates/job/generate-graph-files.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-parameters:
- # Optional: dependencies of the job
- dependsOn: ''
-
- # Optional: A defined YAML pool - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#pool
- pool: {}
-
- # Optional: Include toolset dependencies in the generated graph files
- includeToolset: false
-
-jobs:
-- job: Generate_Graph_Files
-
- dependsOn: ${{ parameters.dependsOn }}
-
- displayName: Generate Graph Files
-
- pool: ${{ parameters.pool }}
-
- variables:
- # Publish-Build-Assets provides: MaestroAccessToken, BotAccount-dotnet-maestro-bot-PAT
- # DotNet-AllOrgs-Darc-Pats provides: dn-bot-devdiv-dnceng-rw-code-pat
- - group: Publish-Build-Assets
- - group: DotNet-AllOrgs-Darc-Pats
- - name: _GraphArguments
- value: -gitHubPat $(BotAccount-dotnet-maestro-bot-PAT)
- -azdoPat $(dn-bot-devdiv-dnceng-rw-code-pat)
- -barToken $(MaestroAccessToken)
- -outputFolder '$(Build.StagingDirectory)/GraphFiles/'
- - ${{ if ne(parameters.includeToolset, 'false') }}:
- - name: _GraphArguments
- value: ${{ variables._GraphArguments }} -includeToolset
-
- steps:
- - task: PowerShell@2
- displayName: Generate Graph Files
- inputs:
- filePath: eng\common\generate-graph-files.ps1
- arguments: $(_GraphArguments)
- continueOnError: true
- - task: PublishBuildArtifacts@1
- displayName: Publish Graph to Artifacts
- inputs:
- PathtoPublish: '$(Build.StagingDirectory)/GraphFiles'
- PublishLocation: Container
- ArtifactName: GraphFiles
- continueOnError: true
- condition: always()
diff --git a/eng/common/templates/jobs/codeql-build.yml b/eng/common/templates/jobs/codeql-build.yml
new file mode 100644
index 00000000000000..f7dc5ea4aaa63c
--- /dev/null
+++ b/eng/common/templates/jobs/codeql-build.yml
@@ -0,0 +1,31 @@
+parameters:
+ # See schema documentation in /Documentation/AzureDevOps/TemplateSchema.md
+ continueOnError: false
+ # Required: A collection of jobs to run - https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=vsts&tabs=schema#job
+ jobs: []
+ # Optional: if specified, restore and use this version of Guardian instead of the default.
+ overrideGuardianVersion: ''
+
+jobs:
+- template: /eng/common/templates/jobs/jobs.yml
+ parameters:
+ enableMicrobuild: false
+ enablePublishBuildArtifacts: false
+ enablePublishTestResults: false
+ enablePublishBuildAssets: false
+ enablePublishUsingPipelines: false
+ enableTelemetry: true
+
+ variables:
+ - group: Publish-Build-Assets
+ # The Guardian version specified in 'eng/common/sdl/packages.config'. This value must be kept in
+ # sync with the packages.config file.
+ - name: DefaultGuardianVersion
+ value: 0.109.0
+ - name: GuardianPackagesConfigFile
+ value: $(Build.SourcesDirectory)\eng\common\sdl\packages.config
+ - name: GuardianVersion
+ value: ${{ coalesce(parameters.overrideGuardianVersion, '$(DefaultGuardianVersion)') }}
+
+ jobs: ${{ parameters.jobs }}
+
diff --git a/eng/common/templates/jobs/jobs.yml b/eng/common/templates/jobs/jobs.yml
index 8dd1fdbd144a06..ff4ab75c886dc7 100644
--- a/eng/common/templates/jobs/jobs.yml
+++ b/eng/common/templates/jobs/jobs.yml
@@ -87,13 +87,3 @@ jobs:
runAsPublic: ${{ parameters.runAsPublic }}
publishUsingPipelines: ${{ parameters.enablePublishUsingPipelines }}
enablePublishBuildArtifacts: ${{ parameters.enablePublishBuildArtifacts }}
-
- - ${{ if eq(parameters.graphFileGeneration.enabled, true) }}:
- - template: ../job/generate-graph-files.yml
- parameters:
- continueOnError: ${{ parameters.continueOnError }}
- includeToolset: ${{ parameters.graphFileGeneration.includeToolset }}
- dependsOn:
- - Asset_Registry_Publish
- pool:
- vmImage: 'windows-2019'
diff --git a/eng/common/templates/post-build/channels/generic-internal-channel.yml b/eng/common/templates/post-build/channels/generic-internal-channel.yml
deleted file mode 100644
index 8990dfc8c87cc3..00000000000000
--- a/eng/common/templates/post-build/channels/generic-internal-channel.yml
+++ /dev/null
@@ -1,190 +0,0 @@
-parameters:
- BARBuildId: ''
- PromoteToChannelIds: ''
- artifactsPublishingAdditionalParameters: ''
- dependsOn:
- - Validate
- publishInstallersAndChecksums: true
- symbolPublishingAdditionalParameters: ''
- stageName: ''
- channelName: ''
- channelId: ''
- transportFeed: ''
- shippingFeed: ''
- symbolsFeed: ''
-
-stages:
-- stage: ${{ parameters.stageName }}
- dependsOn: ${{ parameters.dependsOn }}
- variables:
- - template: ../common-variables.yml
- displayName: ${{ parameters.channelName }} Publishing
- jobs:
- - template: ../setup-maestro-vars.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
-
- - job: publish_symbols
- displayName: Symbol Publishing
- dependsOn: setupMaestroVars
- condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'], format('[{0}]', ${{ parameters.channelId }} ))
- variables:
- - group: DotNet-Symbol-Server-Pats
- - name: AzDOProjectName
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
- - name: AzDOPipelineId
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
- - name: AzDOBuildId
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
- pool:
- vmImage: 'windows-2019'
- steps:
- - script: echo "##vso[task.logissue type=warning]Going forward, v2 Arcade publishing is no longer supported. Please read https://github.com/dotnet/arcade/blob/main/Documentation/CorePackages/Publishing.md for details, then contact dnceng if you have further questions."
- displayName: Warn about v2 Arcade Publishing Usage
-
- # This is necessary whenever we want to publish/restore to an AzDO private feed
- - task: NuGetAuthenticate@0
- displayName: 'Authenticate to AzDO Feeds'
-
- - task: DownloadBuildArtifacts@0
- displayName: Download Build Assets
- continueOnError: true
- inputs:
- buildType: specific
- buildVersionToDownload: specific
- project: $(AzDOProjectName)
- pipeline: $(AzDOPipelineId)
- buildId: $(AzDOBuildId)
- downloadType: 'specific'
- itemPattern: |
- PdbArtifacts/**
- BlobArtifacts/**
- downloadPath: '$(Build.ArtifactStagingDirectory)'
- checkDownloadedFiles: true
-
- # This is necessary whenever we want to publish/restore to an AzDO private feed
- # Since sdk-task.ps1 tries to restore packages we need to do this authentication here
- # otherwise it'll complain about accessing a private feed.
- - task: NuGetAuthenticate@0
- displayName: 'Authenticate to AzDO Feeds'
-
- - task: PowerShell@2
- displayName: Enable cross-org publishing
- inputs:
- filePath: eng\common\enable-cross-org-publishing.ps1
- arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
-
- - task: PowerShell@2
- displayName: Publish
- inputs:
- filePath: eng\common\sdk-task.ps1
- arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet
- /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
- /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
- /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/'
- /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
- /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt'
- /p:Configuration=Release
- /p:PublishToMSDL=false
- ${{ parameters.symbolPublishingAdditionalParameters }}
-
- - template: ../../steps/publish-logs.yml
- parameters:
- StageLabel: '${{ parameters.stageName }}'
- JobLabel: 'SymbolPublishing'
-
- - job: publish_assets
- displayName: Publish Assets
- dependsOn: setupMaestroVars
- timeoutInMinutes: 120
- variables:
- - name: BARBuildId
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
- - name: IsStableBuild
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ]
- - name: AzDOProjectName
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
- - name: AzDOPipelineId
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
- - name: AzDOBuildId
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
- condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'], format('[{0}]', ${{ parameters.channelId }} ))
- pool:
- vmImage: 'windows-2019'
- steps:
- - script: echo "##vso[task.logissue type=warning]Going forward, v2 Arcade publishing is no longer supported. Please read https://github.com/dotnet/arcade/blob/main/Documentation/CorePackages/Publishing.md for details, then contact dnceng if you have further questions."
- displayName: Warn about v2 Arcade Publishing Usage
-
- - task: DownloadBuildArtifacts@0
- displayName: Download Build Assets
- continueOnError: true
- inputs:
- buildType: specific
- buildVersionToDownload: specific
- project: $(AzDOProjectName)
- pipeline: $(AzDOPipelineId)
- buildId: $(AzDOBuildId)
- downloadType: 'specific'
- itemPattern: |
- PackageArtifacts/**
- BlobArtifacts/**
- AssetManifests/**
- downloadPath: '$(Build.ArtifactStagingDirectory)'
- checkDownloadedFiles: true
-
- - task: NuGetToolInstaller@1
- displayName: 'Install NuGet.exe'
-
- # This is necessary whenever we want to publish/restore to an AzDO private feed
- - task: NuGetAuthenticate@0
- displayName: 'Authenticate to AzDO Feeds'
-
- - task: PowerShell@2
- displayName: Enable cross-org publishing
- inputs:
- filePath: eng\common\enable-cross-org-publishing.ps1
- arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
-
- - task: PowerShell@2
- displayName: Publish Assets
- inputs:
- filePath: eng\common\sdk-task.ps1
- arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet
- /p:PublishingInfraVersion=2
- /p:IsStableBuild=$(IsStableBuild)
- /p:IsInternalBuild=$(IsInternalBuild)
- /p:RepositoryName=$(Build.Repository.Name)
- /p:CommitSha=$(Build.SourceVersion)
- /p:NugetPath=$(NuGetExeToolPath)
- /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)'
- /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)'
- /p:BARBuildId=$(BARBuildId)
- /p:MaestroApiEndpoint='$(MaestroApiEndPoint)'
- /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)'
- /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/'
- /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
- /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/'
- /p:Configuration=Release
- /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }}
- /p:ChecksumsTargetStaticFeed=$(InternalChecksumsBlobFeedUrl)
- /p:ChecksumsAzureAccountKey=$(InternalChecksumsBlobFeedKey)
- /p:InstallersTargetStaticFeed=$(InternalInstallersBlobFeedUrl)
- /p:InstallersAzureAccountKey=$(InternalInstallersBlobFeedKey)
- /p:AzureDevOpsStaticShippingFeed='${{ parameters.shippingFeed }}'
- /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
- /p:AzureDevOpsStaticTransportFeed='${{ parameters.transportFeed }}'
- /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
- /p:AzureDevOpsStaticSymbolsFeed='${{ parameters.symbolsFeed }}'
- /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
- /p:PublishToMSDL=false
- ${{ parameters.artifactsPublishingAdditionalParameters }}
-
- - template: ../../steps/publish-logs.yml
- parameters:
- StageLabel: '${{ parameters.stageName }}'
- JobLabel: 'AssetsPublishing'
-
- - template: ../../steps/add-build-to-channel.yml
- parameters:
- ChannelId: ${{ parameters.channelId }}
diff --git a/eng/common/templates/post-build/channels/generic-public-channel.yml b/eng/common/templates/post-build/channels/generic-public-channel.yml
deleted file mode 100644
index 3220c6a4f92ffb..00000000000000
--- a/eng/common/templates/post-build/channels/generic-public-channel.yml
+++ /dev/null
@@ -1,192 +0,0 @@
-parameters:
- BARBuildId: ''
- PromoteToChannelIds: ''
- artifactsPublishingAdditionalParameters: ''
- dependsOn:
- - Validate
- publishInstallersAndChecksums: true
- symbolPublishingAdditionalParameters: ''
- stageName: ''
- channelName: ''
- channelId: ''
- transportFeed: ''
- shippingFeed: ''
- symbolsFeed: ''
- # If the channel name is empty, no links will be generated
- akaMSChannelName: ''
-
-stages:
-- stage: ${{ parameters.stageName }}
- dependsOn: ${{ parameters.dependsOn }}
- variables:
- - template: ../common-variables.yml
- displayName: ${{ parameters.channelName }} Publishing
- jobs:
- - template: ../setup-maestro-vars.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
-
- - job: publish_symbols
- displayName: Symbol Publishing
- dependsOn: setupMaestroVars
- condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'], format('[{0}]', ${{ parameters.channelId }} ))
- variables:
- - group: DotNet-Symbol-Server-Pats
- - name: AzDOProjectName
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
- - name: AzDOPipelineId
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
- - name: AzDOBuildId
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
- pool:
- vmImage: 'windows-2019'
- steps:
- - script: echo "##vso[task.logissue type=warning]Going forward, v2 Arcade publishing is no longer supported. Please read https://github.com/dotnet/arcade/blob/main/Documentation/CorePackages/Publishing.md for details, then contact dnceng if you have further questions."
- displayName: Warn about v2 Arcade Publishing Usage
-
- - task: DownloadBuildArtifacts@0
- displayName: Download Build Assets
- continueOnError: true
- inputs:
- buildType: specific
- buildVersionToDownload: specific
- project: $(AzDOProjectName)
- pipeline: $(AzDOPipelineId)
- buildId: $(AzDOBuildId)
- downloadType: 'specific'
- itemPattern: |
- PdbArtifacts/**
- BlobArtifacts/**
- downloadPath: '$(Build.ArtifactStagingDirectory)'
- checkDownloadedFiles: true
-
- # This is necessary whenever we want to publish/restore to an AzDO private feed
- # Since sdk-task.ps1 tries to restore packages we need to do this authentication here
- # otherwise it'll complain about accessing a private feed.
- - task: NuGetAuthenticate@0
- displayName: 'Authenticate to AzDO Feeds'
-
- - task: PowerShell@2
- displayName: Enable cross-org publishing
- inputs:
- filePath: eng\common\enable-cross-org-publishing.ps1
- arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
-
- - task: PowerShell@2
- displayName: Publish
- inputs:
- filePath: eng\common\sdk-task.ps1
- arguments: -task PublishToSymbolServers -restore -msbuildEngine dotnet
- /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat)
- /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat)
- /p:PDBArtifactsDirectory='$(Build.ArtifactStagingDirectory)/PDBArtifacts/'
- /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
- /p:SymbolPublishingExclusionsFile='$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt'
- /p:Configuration=Release
- ${{ parameters.symbolPublishingAdditionalParameters }}
-
- - template: ../../steps/publish-logs.yml
- parameters:
- StageLabel: '${{ parameters.stageName }}'
- JobLabel: 'SymbolPublishing'
-
- - job: publish_assets
- displayName: Publish Assets
- dependsOn: setupMaestroVars
- timeoutInMinutes: 120
- variables:
- - name: BARBuildId
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
- - name: IsStableBuild
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.IsStableBuild'] ]
- - name: AzDOProjectName
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOProjectName'] ]
- - name: AzDOPipelineId
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOPipelineId'] ]
- - name: AzDOBuildId
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.AzDOBuildId'] ]
- - name: ArtifactsCategory
- value: ${{ coalesce(variables._DotNetArtifactsCategory, '.NETCore') }}
- condition: contains(dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'], format('[{0}]', ${{ parameters.channelId }} ))
- pool:
- vmImage: 'windows-2019'
- steps:
- - script: echo "##vso[task.logissue type=warning]Going forward, v2 Arcade publishing is no longer supported. Please read https://github.com/dotnet/arcade/blob/main/Documentation/CorePackages/Publishing.md for details, then contact dnceng if you have further questions."
- displayName: Warn about v2 Arcade Publishing Usage
-
- - task: DownloadBuildArtifacts@0
- displayName: Download Build Assets
- continueOnError: true
- inputs:
- buildType: specific
- buildVersionToDownload: specific
- project: $(AzDOProjectName)
- pipeline: $(AzDOPipelineId)
- buildId: $(AzDOBuildId)
- downloadType: 'specific'
- itemPattern: |
- PackageArtifacts/**
- BlobArtifacts/**
- AssetManifests/**
- downloadPath: '$(Build.ArtifactStagingDirectory)'
- checkDownloadedFiles: true
-
- - task: NuGetToolInstaller@1
- displayName: 'Install NuGet.exe'
-
- # This is necessary whenever we want to publish/restore to an AzDO private feed
- - task: NuGetAuthenticate@0
- displayName: 'Authenticate to AzDO Feeds'
-
- - task: PowerShell@2
- displayName: Enable cross-org publishing
- inputs:
- filePath: eng\common\enable-cross-org-publishing.ps1
- arguments: -token $(dn-bot-dnceng-artifact-feeds-rw)
-
- - task: PowerShell@2
- displayName: Publish Assets
- inputs:
- filePath: eng\common\sdk-task.ps1
- arguments: -task PublishArtifactsInManifest -restore -msbuildEngine dotnet
- /p:PublishingInfraVersion=2
- /p:ArtifactsCategory=$(ArtifactsCategory)
- /p:IsStableBuild=$(IsStableBuild)
- /p:IsInternalBuild=$(IsInternalBuild)
- /p:RepositoryName=$(Build.Repository.Name)
- /p:CommitSha=$(Build.SourceVersion)
- /p:NugetPath=$(NuGetExeToolPath)
- /p:AzdoTargetFeedPAT='$(dn-bot-dnceng-universal-packages-rw)'
- /p:AzureStorageTargetFeedPAT='$(dotnetfeed-storage-access-key-1)'
- /p:BARBuildId=$(BARBuildId)
- /p:MaestroApiEndpoint='$(MaestroApiEndPoint)'
- /p:BuildAssetRegistryToken='$(MaestroApiAccessToken)'
- /p:ManifestsBasePath='$(Build.ArtifactStagingDirectory)/AssetManifests/'
- /p:BlobBasePath='$(Build.ArtifactStagingDirectory)/BlobArtifacts/'
- /p:PackageBasePath='$(Build.ArtifactStagingDirectory)/PackageArtifacts/'
- /p:Configuration=Release
- /p:PublishInstallersAndChecksums=${{ parameters.publishInstallersAndChecksums }}
- /p:InstallersTargetStaticFeed=$(InstallersBlobFeedUrl)
- /p:InstallersAzureAccountKey=$(dotnetcli-storage-key)
- /p:ChecksumsTargetStaticFeed=$(ChecksumsBlobFeedUrl)
- /p:ChecksumsAzureAccountKey=$(dotnetclichecksums-storage-key)
- /p:AzureDevOpsStaticShippingFeed='${{ parameters.shippingFeed }}'
- /p:AzureDevOpsStaticShippingFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
- /p:AzureDevOpsStaticTransportFeed='${{ parameters.transportFeed }}'
- /p:AzureDevOpsStaticTransportFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
- /p:AzureDevOpsStaticSymbolsFeed='${{ parameters.symbolsFeed }}'
- /p:AzureDevOpsStaticSymbolsFeedKey='$(dn-bot-dnceng-artifact-feeds-rw)'
- /p:LatestLinkShortUrlPrefix=dotnet/'${{ parameters.akaMSChannelName }}'
- /p:AkaMSClientId=$(akams-client-id)
- /p:AkaMSClientSecret=$(akams-client-secret)
- ${{ parameters.artifactsPublishingAdditionalParameters }}
-
- - template: ../../steps/publish-logs.yml
- parameters:
- StageLabel: '${{ parameters.stageName }}'
- JobLabel: 'AssetsPublishing'
-
- - template: ../../steps/add-build-to-channel.yml
- parameters:
- ChannelId: ${{ parameters.channelId }}
diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml
index 4f79cf0f33703f..8985b429c85437 100644
--- a/eng/common/templates/post-build/post-build.yml
+++ b/eng/common/templates/post-build/post-build.yml
@@ -1,71 +1,89 @@
parameters:
- # Which publishing infra should be used. THIS SHOULD MATCH THE VERSION ON THE BUILD MANIFEST.
- # Publishing V2 accepts optionally outlining the publishing stages - default is inline.
- # Publishing V3 DOES NOT accept inlining the publishing stages.
- publishingInfraVersion: 2
- # When set to true the publishing templates from the repo will be used
- # otherwise Darc add-build-to-channel will be used to trigger the promotion pipeline
- inline: true
-
- # Only used if inline==false. When set to true will stall the current build until
- # the Promotion Pipeline build finishes. Otherwise, the current build will continue
- # execution concurrently with the promotion build.
- waitPublishingFinish: true
-
- BARBuildId: ''
- PromoteToChannelIds: ''
-
- enableSourceLinkValidation: false
- enableSigningValidation: true
- enableSymbolValidation: false
- enableNugetValidation: true
- publishInstallersAndChecksums: true
- SDLValidationParameters:
- enable: false
- continueOnError: false
- params: ''
- artifactNames: ''
- downloadArtifacts: true
+ # Which publishing infra should be used. THIS SHOULD MATCH THE VERSION ON THE BUILD MANIFEST.
+ # Publishing V1 is no longer supported
+ # Publishing V2 is no longer supported
+ # Publishing V3 is the default
+ - name: publishingInfraVersion
+ displayName: Which version of publishing should be used to promote the build definition?
+ type: number
+ default: 3
+ values:
+ - 3
+
+ - name: BARBuildId
+ displayName: BAR Build Id
+ type: number
+ default: 0
+
+ - name: PromoteToChannelIds
+ displayName: Channel to promote BARBuildId to
+ type: string
+ default: ''
+
+ - name: enableSourceLinkValidation
+ displayName: Enable SourceLink validation
+ type: boolean
+ default: false
+
+ - name: enableSigningValidation
+ displayName: Enable signing validation
+ type: boolean
+ default: true
+
+ - name: enableSymbolValidation
+ displayName: Enable symbol validation
+ type: boolean
+ default: false
+
+ - name: enableNugetValidation
+ displayName: Enable NuGet validation
+ type: boolean
+ default: true
+
+ - name: publishInstallersAndChecksums
+ displayName: Publish installers and checksums
+ type: boolean
+ default: true
+
+ - name: SDLValidationParameters
+ type: object
+ default:
+ enable: false
+ continueOnError: false
+ params: ''
+ artifactNames: ''
+ downloadArtifacts: true
# These parameters let the user customize the call to sdk-task.ps1 for publishing
# symbols & general artifacts as well as for signing validation
- symbolPublishingAdditionalParameters: ''
- artifactsPublishingAdditionalParameters: ''
- signingValidationAdditionalParameters: ''
+ - name: symbolPublishingAdditionalParameters
+ displayName: Symbol publishing additional parameters
+ type: string
+ default: ''
+
+ - name: artifactsPublishingAdditionalParameters
+ displayName: Artifact publishing additional parameters
+ type: string
+ default: ''
+
+ - name: signingValidationAdditionalParameters
+ displayName: Signing validation additional parameters
+ type: string
+ default: ''
# Which stages should finish execution before post-build stages start
- validateDependsOn:
- - build
- publishDependsOn:
- - Validate
+ - name: validateDependsOn
+ type: object
+ default:
+ - build
- # Channel ID's instantiated in this file.
- # When adding a new channel implementation the call to `check-channel-consistency.ps1`
- # needs to be updated with the new channel ID
- NetEngLatestChannelId: 2
- NetEngValidationChannelId: 9
- NetDev5ChannelId: 131
- NetDev6ChannelId: 1296
- GeneralTestingChannelId: 529
- NETCoreToolingDevChannelId: 548
- NETCoreToolingReleaseChannelId: 549
- NETInternalToolingChannelId: 551
- NETCoreExperimentalChannelId: 562
- NetEngServicesIntChannelId: 678
- NetEngServicesProdChannelId: 679
- NetCoreSDK313xxChannelId: 759
- NetCoreSDK313xxInternalChannelId: 760
- NetCoreSDK314xxChannelId: 921
- NetCoreSDK314xxInternalChannelId: 922
- VS166ChannelId: 1010
- VS167ChannelId: 1011
- VS168ChannelId: 1154
- VSMasterChannelId: 1012
- VS169ChannelId: 1473
- VS1610ChannelId: 1692
+ - name: publishDependsOn
+ type: object
+ default:
+ - Validate
stages:
-- ${{ if or(and(le(parameters.publishingInfraVersion, 2), eq(parameters.inline, 'true')), eq( parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}:
+- ${{ if or(eq( parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}:
- stage: Validate
dependsOn: ${{ parameters.validateDependsOn }}
displayName: Validate Build Assets
@@ -77,23 +95,6 @@ stages:
BARBuildId: ${{ parameters.BARBuildId }}
PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- - ${{ if and(le(parameters.publishingInfraVersion, 2), eq(parameters.inline, 'true')) }}:
- - job:
- displayName: Post-build Checks
- dependsOn: setupMaestroVars
- variables:
- - name: TargetChannels
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.TargetChannels'] ]
- pool:
- vmImage: 'windows-2019'
- steps:
- - task: PowerShell@2
- displayName: Maestro Channels Consistency
- inputs:
- filePath: $(Build.SourcesDirectory)/eng/common/post-build/check-channel-consistency.ps1
- arguments: -PromoteToChannels "$(TargetChannels)"
- -AvailableChannelIds ${{parameters.NetEngLatestChannelId}},${{parameters.NetEngValidationChannelId}},${{parameters.NetDev5ChannelId}},${{parameters.NetDev6ChannelId}},${{parameters.GeneralTestingChannelId}},${{parameters.NETCoreToolingDevChannelId}},${{parameters.NETCoreToolingReleaseChannelId}},${{parameters.NETInternalToolingChannelId}},${{parameters.NETCoreExperimentalChannelId}},${{parameters.NetEngServicesIntChannelId}},${{parameters.NetEngServicesProdChannelId}},${{parameters.NetCoreSDK313xxChannelId}},${{parameters.NetCoreSDK313xxInternalChannelId}},${{parameters.NetCoreSDK314xxChannelId}},${{parameters.NetCoreSDK314xxInternalChannelId}},${{parameters.VS166ChannelId}},${{parameters.VS167ChannelId}},${{parameters.VS168ChannelId}},${{parameters.VSMasterChannelId}},${{parameters.VS169ChannelId}},${{parameters.VS1610ChannelId}}
-
- job:
displayName: NuGet Validation
dependsOn: setupMaestroVars
@@ -229,361 +230,38 @@ stages:
artifactNames: ${{ parameters.SDLValidationParameters.artifactNames }}
downloadArtifacts: ${{ parameters.SDLValidationParameters.downloadArtifacts }}
-- ${{ if or(ge(parameters.publishingInfraVersion, 3), eq(parameters.inline, 'false')) }}:
- - stage: publish_using_darc
- ${{ if or(eq(parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}:
- dependsOn: ${{ parameters.publishDependsOn }}
- ${{ if and(ne(parameters.enableNugetValidation, 'true'), ne(parameters.enableSigningValidation, 'true'), ne(parameters.enableSourceLinkValidation, 'true'), ne(parameters.SDLValidationParameters.enable, 'true')) }}:
- dependsOn: ${{ parameters.validateDependsOn }}
- displayName: Publish using Darc
- variables:
- - template: common-variables.yml
- jobs:
- - template: setup-maestro-vars.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
-
- - job:
- displayName: Publish Using Darc
- dependsOn: setupMaestroVars
- timeoutInMinutes: 120
- variables:
- - name: BARBuildId
- value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
- pool:
- vmImage: 'windows-2019'
- steps:
- - task: PowerShell@2
- displayName: Publish Using Darc
- inputs:
- filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1
- arguments: -BuildId $(BARBuildId)
- -PublishingInfraVersion ${{ parameters.PublishingInfraVersion }}
- -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)'
- -MaestroToken '$(MaestroApiAccessToken)'
- -WaitPublishingFinish ${{ parameters.waitPublishingFinish }}
- -PublishInstallersAndChecksums ${{ parameters.publishInstallersAndChecksums }}
- -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}'
- -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}'
-
-- ${{ if and(le(parameters.publishingInfraVersion, 2), eq(parameters.inline, 'true')) }}:
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'NetCore_Dev5_Publish'
- channelName: '.NET 5 Dev'
- akaMSChannelName: 'net5/dev'
- channelId: ${{ parameters.NetDev5ChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-transport/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'NetCore_Dev6_Publish'
- channelName: '.NET 6 Dev'
- akaMSChannelName: 'net6/dev'
- channelId: ${{ parameters.NetDev6ChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6-transport/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
+- stage: publish_using_darc
+ ${{ if or(eq(parameters.enableNugetValidation, 'true'), eq(parameters.enableSigningValidation, 'true'), eq(parameters.enableSourceLinkValidation, 'true'), eq(parameters.SDLValidationParameters.enable, 'true')) }}:
+ dependsOn: ${{ parameters.publishDependsOn }}
+ ${{ if and(ne(parameters.enableNugetValidation, 'true'), ne(parameters.enableSigningValidation, 'true'), ne(parameters.enableSourceLinkValidation, 'true'), ne(parameters.SDLValidationParameters.enable, 'true')) }}:
+ dependsOn: ${{ parameters.validateDependsOn }}
+ displayName: Publish using Darc
+ variables:
+ - template: common-variables.yml
+ jobs:
+ - template: setup-maestro-vars.yml
parameters:
BARBuildId: ${{ parameters.BARBuildId }}
PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'Net_Eng_Latest_Publish'
- channelName: '.NET Eng - Latest'
- akaMSChannelName: 'eng/daily'
- channelId: ${{ parameters.NetEngLatestChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json'
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'Net_Eng_Validation_Publish'
- channelName: '.NET Eng - Validation'
- akaMSChannelName: 'eng/validation'
- channelId: ${{ parameters.NetEngValidationChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'General_Testing_Publish'
- channelName: 'General Testing'
- akaMSChannelName: 'generaltesting'
- channelId: ${{ parameters.GeneralTestingChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/general-testing-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'NETCore_Tooling_Dev_Publishing'
- channelName: '.NET Core Tooling Dev'
- channelId: ${{ parameters.NETCoreToolingDevChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'NETCore_Tooling_Release_Publishing'
- channelName: '.NET Core Tooling Release'
- channelId: ${{ parameters.NETCoreToolingReleaseChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-internal-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'NET_Internal_Tooling_Publishing'
- channelName: '.NET Internal Tooling'
- channelId: ${{ parameters.NETInternalToolingChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet-tools-internal-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'NETCore_Experimental_Publishing'
- channelName: '.NET Core Experimental'
- channelId: ${{ parameters.NETCoreExperimentalChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-experimental-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'Net_Eng_Services_Int_Publish'
- channelName: '.NET Eng Services - Int'
- channelId: ${{ parameters.NetEngServicesIntChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'Net_Eng_Services_Prod_Publish'
- channelName: '.NET Eng Services - Prod'
- channelId: ${{ parameters.NetEngServicesProdChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'NETCore_SDK_314xx_Publishing'
- channelName: '.NET Core SDK 3.1.4xx'
- channelId: ${{ parameters.NetCoreSDK314xxChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-internal-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'NETCore_SDK_314xx_Internal_Publishing'
- channelName: '.NET Core SDK 3.1.4xx Internal'
- channelId: ${{ parameters.NetCoreSDK314xxInternalChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'NETCore_SDK_313xx_Publishing'
- channelName: '.NET Core SDK 3.1.3xx'
- channelId: ${{ parameters.NetCoreSDK313xxChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-internal-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'NETCore_SDK_313xx_Internal_Publishing'
- channelName: '.NET Core SDK 3.1.3xx Internal'
- channelId: ${{ parameters.NetCoreSDK313xxInternalChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'VS16_6_Publishing'
- channelName: 'VS 16.6'
- channelId: ${{ parameters.VS166ChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'VS16_7_Publishing'
- channelName: 'VS 16.7'
- channelId: ${{ parameters.VS167ChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'VS16_8_Publishing'
- channelName: 'VS 16.8'
- channelId: ${{ parameters.VS168ChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'VS_Master_Publishing'
- channelName: 'VS Master'
- channelId: ${{ parameters.VSMasterChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'VS_16_9_Publishing'
- channelName: 'VS 16.9'
- channelId: ${{ parameters.VS169ChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'
-
- - template: \eng\common\templates\post-build\channels\generic-public-channel.yml
- parameters:
- BARBuildId: ${{ parameters.BARBuildId }}
- PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }}
- artifactsPublishingAdditionalParameters: ${{ parameters.artifactsPublishingAdditionalParameters }}
- dependsOn: ${{ parameters.publishDependsOn }}
- publishInstallersAndChecksums: ${{ parameters.publishInstallersAndChecksums }}
- symbolPublishingAdditionalParameters: ${{ parameters.symbolPublishingAdditionalParameters }}
- stageName: 'VS_16_10_Publishing'
- channelName: 'VS 16.10'
- channelId: ${{ parameters.VS1610ChannelId }}
- transportFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-transport/nuget/v3/index.json'
- shippingFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json'
- symbolsFeed: 'https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools-symbols/nuget/v3/index.json'
+ - job:
+ displayName: Publish Using Darc
+ dependsOn: setupMaestroVars
+ timeoutInMinutes: 120
+ variables:
+ - name: BARBuildId
+ value: $[ dependencies.setupMaestroVars.outputs['setReleaseVars.BARBuildId'] ]
+ pool:
+ vmImage: 'windows-2019'
+ steps:
+ - task: PowerShell@2
+ displayName: Publish Using Darc
+ inputs:
+ filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1
+ arguments: -BuildId $(BARBuildId)
+ -PublishingInfraVersion ${{ parameters.publishingInfraVersion }}
+ -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)'
+ -MaestroToken '$(MaestroApiAccessToken)'
+ -WaitPublishingFinish true
+ -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}'
+ -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}'
\ No newline at end of file
diff --git a/eng/common/templates/steps/execute-codeql.yml b/eng/common/templates/steps/execute-codeql.yml
new file mode 100644
index 00000000000000..3930b1630214b3
--- /dev/null
+++ b/eng/common/templates/steps/execute-codeql.yml
@@ -0,0 +1,32 @@
+parameters:
+ # Language that should be analyzed. Defaults to csharp
+ language: csharp
+ # Build Commands
+ buildCommands: ''
+ overrideParameters: '' # Optional: to override values for parameters.
+ additionalParameters: '' # Optional: parameters that need user specific values eg: '-SourceToolsList @("abc","def") -ArtifactToolsList @("ghi","jkl")'
+ # Optional: if specified, restore and use this version of Guardian instead of the default.
+ overrideGuardianVersion: ''
+ # Optional: if true, publish the '.gdn' folder as a pipeline artifact. This can help with in-depth
+ # diagnosis of problems with specific tool configurations.
+ publishGuardianDirectoryToPipeline: false
+ # The script to run to execute all SDL tools. Use this if you want to use a script to define SDL
+ # parameters rather than relying on YAML. It may be better to use a local script, because you can
+ # reproduce results locally without piecing together a command based on the YAML.
+ executeAllSdlToolsScript: 'eng/common/sdl/execute-all-sdl-tools.ps1'
+ # There is some sort of bug (has been reported) in Azure DevOps where if this parameter is named
+ # 'continueOnError', the parameter value is not correctly picked up.
+ # This can also be remedied by the caller (post-build.yml) if it does not use a nested parameter
+ # optional: determines whether to continue the build if the step errors;
+ sdlContinueOnError: false
+
+steps:
+- template: /eng/common/templates/steps/execute-sdl.yml
+ parameters:
+ overrideGuardianVersion: ${{ parameters.overrideGuardianVersion }}
+ executeAllSdlToolsScript: ${{ parameters.executeAllSdlToolsScript }}
+ overrideParameters: ${{ parameters.overrideParameters }}
+ additionalParameters: '${{ parameters.additionalParameters }}
+ -CodeQLAdditionalRunConfigParams @("BuildCommands < ${{ parameters.buildCommands }}", "Language < ${{ parameters.language }}")'
+ publishGuardianDirectoryToPipeline: ${{ parameters.publishGuardianDirectoryToPipeline }}
+ sdlContinueOnError: ${{ parameters.sdlContinueOnError }}
\ No newline at end of file
diff --git a/eng/common/templates/steps/source-build.yml b/eng/common/templates/steps/source-build.yml
index ba40dc82f1411b..d85d6d07d5c7b0 100644
--- a/eng/common/templates/steps/source-build.yml
+++ b/eng/common/templates/steps/source-build.yml
@@ -23,7 +23,7 @@ steps:
# In addition, add an msbuild argument to copy the WIP from the repo to the target build location.
# This is because SetupNuGetSources.sh will alter the current NuGet.config file, and we need to preserve those
# changes.
- $internalRestoreArgs=
+ internalRestoreArgs=
if [ '$(dn-bot-dnceng-artifact-feeds-rw)' != '$''(dn-bot-dnceng-artifact-feeds-rw)' ]; then
# Temporarily work around https://github.com/dotnet/arcade/issues/7709
chmod +x $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
diff --git a/eng/formatting/format.sh b/eng/formatting/format.sh
old mode 100644
new mode 100755
diff --git a/eng/generators.targets b/eng/generators.targets
index 4c32554b5e2195..843842937ef3f7 100644
--- a/eng/generators.targets
+++ b/eng/generators.targets
@@ -84,10 +84,6 @@
true$(DefineConstants);DLLIMPORTGENERATOR_INTERNALUNSAFE
-
-
- $(DefineConstants);DLLIMPORTGENERATOR_ENABLED
-
diff --git a/eng/liveBuilds.targets b/eng/liveBuilds.targets
index bc2e7e5dff9a01..aab934c42ae6b6 100644
--- a/eng/liveBuilds.targets
+++ b/eng/liveBuilds.targets
@@ -24,6 +24,9 @@
$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'sharedFramework'))$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'crossgen2'))
+ $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'ilc'))
+ $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'aotsdk'))
+ $([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)', 'build'))$([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)', 'cross', $(TargetOS.ToLowerInvariant())-$(TargetArchitecture.ToLowerInvariant())))
diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh
index 8f1a746752a347..373091b13a0014 100755
--- a/eng/native/build-commons.sh
+++ b/eng/native/build-commons.sh
@@ -197,7 +197,7 @@ usage()
echo ""
echo "Common Options:"
echo ""
- echo "BuildArch can be: -arm, -armel, -arm64, -s390x, x64, x86, -wasm"
+ echo "BuildArch can be: -arm, -armel, -arm64, -loongarch64, -s390x, x64, x86, -wasm"
echo "BuildType can be: -debug, -checked, -release"
echo "-os: target OS (defaults to running OS)"
echo "-bindir: output directory (defaults to $__ProjectRoot/artifacts)"
@@ -377,6 +377,10 @@ while :; do
__BuildArch=x64
;;
+ loongarch64|-loongarch64)
+ __BuildArch=loongarch64
+ ;;
+
s390x|-s390x)
__BuildArch=s390x
;;
diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake
index 5a20591cc025bb..fad1ac58d39c88 100644
--- a/eng/native/configurecompiler.cmake
+++ b/eng/native/configurecompiler.cmake
@@ -216,6 +216,9 @@ elseif (CLR_CMAKE_HOST_ARCH_ARM)
elseif (CLR_CMAKE_HOST_ARCH_ARM64)
set(ARCH_HOST_NAME arm64)
add_definitions(-DHOST_ARM64 -DHOST_64BIT)
+elseif (CLR_CMAKE_HOST_ARCH_LOONGARCH64)
+ set(ARCH_HOST_NAME loongarch64)
+ add_definitions(-DHOST_LOONGARCH64 -DHOST_64BIT)
elseif (CLR_CMAKE_HOST_ARCH_S390X)
set(ARCH_HOST_NAME s390x)
add_definitions(-DHOST_S390X -DHOST_64BIT -DBIGENDIAN)
@@ -237,6 +240,8 @@ if (CLR_CMAKE_HOST_UNIX)
message("Detected Linux ARM")
elseif(CLR_CMAKE_HOST_UNIX_ARM64)
message("Detected Linux ARM64")
+ elseif(CLR_CMAKE_HOST_UNIX_LOONGARCH64)
+ message("Detected Linux LOONGARCH64")
elseif(CLR_CMAKE_HOST_UNIX_X86)
message("Detected Linux i686")
elseif(CLR_CMAKE_HOST_UNIX_S390X)
@@ -301,6 +306,11 @@ elseif (CLR_CMAKE_TARGET_ARCH_I386)
set(ARCH_SOURCES_DIR i386)
add_compile_definitions($<$>>:TARGET_X86>)
add_compile_definitions($<$>>:TARGET_32BIT>)
+elseif (CLR_CMAKE_TARGET_ARCH_LOONGARCH64)
+ set(ARCH_TARGET_NAME loongarch64)
+ set(ARCH_SOURCES_DIR loongarch64)
+ add_compile_definitions($<$>>:TARGET_LOONGARCH64>)
+ add_compile_definitions($<$>>:TARGET_64BIT>)
elseif (CLR_CMAKE_TARGET_ARCH_S390X)
set(ARCH_TARGET_NAME s390x)
set(ARCH_SOURCES_DIR s390x)
diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake
index f5c8abe66991a0..cdf33430b49f11 100644
--- a/eng/native/configureplatform.cmake
+++ b/eng/native/configureplatform.cmake
@@ -43,6 +43,8 @@ if(CLR_CMAKE_HOST_OS STREQUAL Linux)
set(CLR_CMAKE_HOST_UNIX_ARM 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm64)
set(CLR_CMAKE_HOST_UNIX_ARM64 1)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL loongarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL loongarch64)
+ set(CLR_CMAKE_HOST_UNIX_LOONGARCH64 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686 OR CMAKE_SYSTEM_PROCESSOR STREQUAL x86)
set(CLR_CMAKE_HOST_UNIX_X86 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL s390x)
@@ -218,6 +220,9 @@ if(CLR_CMAKE_HOST_UNIX_ARM)
elseif(CLR_CMAKE_HOST_UNIX_ARM64)
set(CLR_CMAKE_HOST_ARCH_ARM64 1)
set(CLR_CMAKE_HOST_ARCH "arm64")
+elseif(CLR_CMAKE_HOST_UNIX_LOONGARCH64)
+ set(CLR_CMAKE_HOST_ARCH_LOONGARCH64 1)
+ set(CLR_CMAKE_HOST_ARCH "loongarch64")
elseif(CLR_CMAKE_HOST_UNIX_AMD64)
set(CLR_CMAKE_HOST_ARCH_AMD64 1)
set(CLR_CMAKE_HOST_ARCH "x64")
@@ -268,6 +273,8 @@ if (CLR_CMAKE_TARGET_ARCH STREQUAL x64)
set(CLR_CMAKE_TARGET_ARCH_I386 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm64)
set(CLR_CMAKE_TARGET_ARCH_ARM64 1)
+ elseif(CLR_CMAKE_TARGET_ARCH STREQUAL loongarch64)
+ set(CLR_CMAKE_TARGET_ARCH_LOONGARCH64 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm)
set(CLR_CMAKE_TARGET_ARCH_ARM 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL armel)
@@ -374,6 +381,8 @@ if(CLR_CMAKE_TARGET_UNIX)
set(CLR_CMAKE_TARGET_UNIX_ARM 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm64)
set(CLR_CMAKE_TARGET_UNIX_ARM64 1)
+ elseif(CLR_CMAKE_TARGET_ARCH STREQUAL loongarch64)
+ set(CLR_CMAKE_TARGET_UNIX_LOONGARCH64 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL x86)
set(CLR_CMAKE_TARGET_UNIX_X86 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL s390x)
diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake
index 87b4d15734bf69..c4af68ba7dc610 100644
--- a/eng/native/functions.cmake
+++ b/eng/native/functions.cmake
@@ -4,10 +4,75 @@ function(clr_unknown_arch)
elseif(CLR_CROSS_COMPONENTS_BUILD)
message(FATAL_ERROR "Only AMD64, I386 host are supported for linux cross-architecture component. Found: ${CMAKE_SYSTEM_PROCESSOR}")
else()
- message(FATAL_ERROR "Only AMD64, ARM64 and ARM are supported. Found: ${CMAKE_SYSTEM_PROCESSOR}")
+ message(FATAL_ERROR "Only AMD64, ARM64, LOONGARCH64 and ARM are supported. Found: ${CMAKE_SYSTEM_PROCESSOR}")
endif()
endfunction()
+# C to MASM include file translator
+# This is replacement for the deprecated h2inc tool that used to be part of VS.
+function(h2inc filename output)
+ file(STRINGS ${filename} lines)
+ get_filename_component(path "${filename}" DIRECTORY)
+ file(RELATIVE_PATH relative_filename "${CLR_REPO_ROOT_DIR}" "${filename}")
+
+ file(APPEND "${output}" "// File start: ${relative_filename}\n")
+
+ # Use of NEWLINE_CONSUME is needed for lines with trailing backslash
+ file(STRINGS ${filename} contents NEWLINE_CONSUME)
+ string(REGEX REPLACE "\\\\\n" "\\\\\\\\ \n" contents "${contents}")
+ string(REGEX REPLACE "\n" ";" lines "${contents}")
+
+ foreach(line IN LISTS lines)
+ string(REGEX REPLACE "\\\\\\\\ " "\\\\" line "${line}")
+
+ if(line MATCHES "^ *# pragma")
+ # Ignore pragmas
+ continue()
+ endif()
+
+ if(line MATCHES "^ *# *include *\"(.*)\"")
+ # Expand includes.
+ h2inc("${path}/${CMAKE_MATCH_1}" "${output}")
+ continue()
+ endif()
+
+ if(line MATCHES "^ *#define +([0-9A-Za-z_()]+) *(.*)")
+ # Augment #defines with their MASM equivalent
+ set(name "${CMAKE_MATCH_1}")
+ set(value "${CMAKE_MATCH_2}")
+
+ # Note that we do not handle multiline constants
+
+ # Strip comments from value
+ string(REGEX REPLACE "//.*" "" value "${value}")
+ string(REGEX REPLACE "/\\*.*\\*/" "" value "${value}")
+
+ # Strip whitespaces from value
+ string(REPLACE " +$" "" value "${value}")
+
+ # ignore #defines with arguments
+ if(NOT "${name}" MATCHES "\\(")
+ set(HEX_NUMBER_PATTERN "0x([0-9A-Fa-f]+)")
+ set(DECIMAL_NUMBER_PATTERN "(-?[0-9]+)")
+
+ if("${value}" MATCHES "${HEX_NUMBER_PATTERN}")
+ string(REGEX REPLACE "${HEX_NUMBER_PATTERN}" "0\\1h" value "${value}") # Convert hex constants
+ file(APPEND "${output}" "${name} EQU ${value}\n")
+ elseif("${value}" MATCHES "${DECIMAL_NUMBER_PATTERN}" AND (NOT "${value}" MATCHES "[G-Zg-z]+" OR "${value}" MATCHES "\\("))
+ string(REGEX REPLACE "${DECIMAL_NUMBER_PATTERN}" "\\1t" value "${value}") # Convert dec constants
+ file(APPEND "${output}" "${name} EQU ${value}\n")
+ else()
+ file(APPEND "${output}" "${name} TEXTEQU <${value}>\n")
+ endif()
+ endif()
+ endif()
+
+ file(APPEND "${output}" "${line}\n")
+ endforeach()
+
+ file(APPEND "${output}" "// File end: ${relative_filename}\n")
+endfunction()
+
# Build a list of compiler definitions by putting -D in front of each define.
function(get_compile_definitions DefinitionName)
# Get the current list of definitions
@@ -94,6 +159,10 @@ function(find_unwind_libs UnwindLibs)
find_library(UNWIND_ARCH NAMES unwind-aarch64)
endif()
+ if(CLR_CMAKE_HOST_ARCH_LOONGARCH64)
+ find_library(UNWIND_ARCH NAMES unwind-loongarch64)
+ endif()
+
if(CLR_CMAKE_HOST_ARCH_AMD64)
find_library(UNWIND_ARCH NAMES unwind-x86_64)
endif()
diff --git a/eng/native/init-os-and-arch.sh b/eng/native/init-os-and-arch.sh
index fc4078fa3a9aa4..586534be1c8aa9 100644
--- a/eng/native/init-os-and-arch.sh
+++ b/eng/native/init-os-and-arch.sh
@@ -37,6 +37,10 @@ case "$CPUName" in
arch=arm64
;;
+ loongarch64)
+ arch=loongarch64
+ ;;
+
amd64|x86_64)
arch=x64
;;
diff --git a/eng/native/tryrun.cmake b/eng/native/tryrun.cmake
index 96199969da69c9..e8a04c5698ad35 100644
--- a/eng/native/tryrun.cmake
+++ b/eng/native/tryrun.cmake
@@ -68,7 +68,7 @@ if(DARWIN)
else()
message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm64 or x64 is supported for OSX cross build!")
endif()
-elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|s390x|x86)$" OR FREEBSD OR ILLUMOS)
+elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|loongarch64|s390x|x86)$" OR FREEBSD OR ILLUMOS)
set_cache_value(FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL_EXITCODE 1)
set_cache_value(GETPWUID_R_SETS_ERRNO_EXITCODE 0)
set_cache_value(HAS_POSIX_SEMAPHORES_EXITCODE 0)
@@ -146,9 +146,9 @@ elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|s390x|x86)$" OR FREEBSD OR IL
set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
endif()
else()
- message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64, s390x and x86 are supported!")
+ message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64, loongarch64, s390x and x86 are supported!")
endif()
-if(TARGET_ARCH_NAME STREQUAL "x86" OR TARGET_ARCH_NAME STREQUAL "s390x")
+if(TARGET_ARCH_NAME STREQUAL "x86" OR TARGET_ARCH_NAME STREQUAL "s390x" OR TARGET_ARCH_NAME STREQUAL "loongarch64")
set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0)
endif()
diff --git a/eng/packaging.targets b/eng/packaging.targets
index 6d2bbce10da346..667837fbff1067 100644
--- a/eng/packaging.targets
+++ b/eng/packaging.targets
@@ -23,6 +23,10 @@
'$(PreReleaseVersionLabel)' != 'servicing' and
'$(GitHubRepositoryName)' != 'runtimelab'">true
false
+
+ true$(XmlDocFileRoot)1033\$(AssemblyName).xmltrue
@@ -259,7 +263,7 @@
diff --git a/eng/pipelines/common/global-build-job.yml b/eng/pipelines/common/global-build-job.yml
index cf30d702dda60d..c9015681d1e17c 100644
--- a/eng/pipelines/common/global-build-job.yml
+++ b/eng/pipelines/common/global-build-job.yml
@@ -3,6 +3,7 @@ parameters:
nameSuffix: ''
buildArgs: ''
archType: ''
+ hostedOs: ''
osGroup: ''
osSubgroup: ''
container: ''
@@ -35,8 +36,12 @@ parameters:
jobs:
- template: /eng/common/templates/job/job.yml
parameters:
- name: ${{ format('build_{0}{1}_{2}_{3}_{4}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig, parameters.nameSuffix) }}
- displayName: ${{ format('Build {0}{1} {2} {3} {4}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig, parameters.nameSuffix) }}
+ ${{ if eq(parameters.hostedOs, '') }}:
+ name: ${{ format('build_{0}{1}_{2}_{3}_{4}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig, parameters.nameSuffix) }}
+ displayName: ${{ format('Build {0}{1} {2} {3} {4}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig, parameters.nameSuffix) }}
+ ${{ if ne(parameters.hostedOs, '') }}:
+ name: ${{ format('build_{0}{1}_{2}_{3}_{4}_{5}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.hostedOs, parameters.buildConfig, parameters.nameSuffix) }}
+ displayName: ${{ format('Build {0}{1} {2} {3} {4} {5}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.hostedOs, parameters.buildConfig, parameters.nameSuffix) }}
pool: ${{ parameters.pool }}
container: ${{ parameters.container }}
condition: and(succeeded(), ${{ parameters.condition }})
@@ -136,7 +141,7 @@ jobs:
df -h
displayName: Disk Usage before Build
- - ${{ if contains(parameters.nameSuffix, 'Windows_wasm') }}:
+ - ${{ if eq(parameters.platform, 'Browser_wasm_win') }}:
# Update machine certs
- task: PowerShell@2
displayName: Update machine certs
diff --git a/eng/pipelines/common/platform-matrix.yml b/eng/pipelines/common/platform-matrix.yml
index ade8c7aab981b6..282fa567550812 100644
--- a/eng/pipelines/common/platform-matrix.yml
+++ b/eng/pipelines/common/platform-matrix.yml
@@ -273,7 +273,6 @@ jobs:
jobTemplate: ${{ parameters.jobTemplate }}
helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
variables: ${{ parameters.variables }}
- hostedOs: Linux
osGroup: Browser
archType: wasm
targetRid: browser-wasm
@@ -282,6 +281,7 @@ jobs:
image: ubuntu-18.04-webassembly-20210707133424-12f133e
registry: mcr
jobParameters:
+ hostedOs: Linux
runtimeFlavor: ${{ parameters.runtimeFlavor }}
stagedBuild: ${{ parameters.stagedBuild }}
buildConfig: ${{ parameters.buildConfig }}
@@ -297,12 +297,12 @@ jobs:
jobTemplate: ${{ parameters.jobTemplate }}
helixQueuesTemplate: ${{ parameters.helixQueuesTemplate }}
variables: ${{ parameters.variables }}
- hostedOs: windows
osGroup: Browser
archType: wasm
targetRid: browser-wasm
platform: Browser_wasm_win
jobParameters:
+ hostedOs: windows
runtimeFlavor: ${{ parameters.runtimeFlavor }}
stagedBuild: ${{ parameters.stagedBuild }}
buildConfig: ${{ parameters.buildConfig }}
diff --git a/eng/pipelines/common/templates/runtimes/run-test-job.yml b/eng/pipelines/common/templates/runtimes/run-test-job.yml
index 04399d26a6a22e..6aa8a54f24c0f8 100644
--- a/eng/pipelines/common/templates/runtimes/run-test-job.yml
+++ b/eng/pipelines/common/templates/runtimes/run-test-job.yml
@@ -73,7 +73,7 @@ jobs:
- ${{ if not(or(eq(parameters.runtimeVariant, 'minijit'), eq(parameters.runtimeVariant, 'monointerpreter'))) }}:
- ${{ if eq(parameters.runtimeVariant, 'llvmfullaot') }}:
- ${{ format('{0}_llvmaot_product_build_{1}{2}_{3}_{4}', parameters.runtimeFlavor, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- - ${{ if not(eq(parameters.runtimeVariant, 'llvmfullaot')) }}:
+ - ${{ if ne(parameters.runtimeVariant, 'llvmfullaot') }}:
- ${{ format('{0}_{1}_product_build_{2}{3}_{4}_{5}', parameters.runtimeFlavor, parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- ${{ if ne(parameters.liveLibrariesBuildConfig, '') }}:
- ${{ format('libraries_build_{0}{1}_{2}_{3}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.liveLibrariesBuildConfig) }}
@@ -109,7 +109,7 @@ jobs:
- name: runtimeVariantArg
value: ''
- - ${{ if not(eq(parameters.runtimeVariant, '')) }}:
+ - ${{ if ne(parameters.runtimeVariant, '') }}:
- name: runtimeVariantArg
value: '/p:RuntimeVariant=${{ parameters.runtimeVariant }}'
@@ -546,6 +546,7 @@ jobs:
- jitosr
- jitosr_stress
- jitosr_pgo
+ - jitosr_stress_random
- jitpartialcompilation
- jitpartialcompilation_osr
- jitpartialcompilation_osr_pgo
diff --git a/eng/pipelines/common/variables.yml b/eng/pipelines/common/variables.yml
index d6b84f837c3276..6e378369aa4fc6 100644
--- a/eng/pipelines/common/variables.yml
+++ b/eng/pipelines/common/variables.yml
@@ -11,19 +11,17 @@ variables:
- name: isOfficialBuild
value: ${{ and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}
-- name: isFullMatrix
+- name: isRollingBuild
value: ${{ and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}
-- name: isNotFullMatrix
- value: ${{ and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}
-- name: isNotManualAndIsPR
- value: ${{ and(not(in(variables['Build.DefinitionName'], 'runtime-staging-manual', 'runtime-manual')), eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}
-- name: isManualOrIsNotPR
- value: ${{ or(in(variables['Build.DefinitionName'], 'runtime-staging-manual', 'runtime-manual'), and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'))) }}
+- name: isExtraPlatformsBuild
+ value: ${{ eq(variables['Build.DefinitionName'], 'runtime-extra-platforms') }}
+- name: isNotExtraPlatformsBuild
+ value: ${{ ne(variables['Build.DefinitionName'], 'runtime-extra-platforms') }}
# We only run evaluate paths on runtime, runtime-staging and runtime-community pipelines on PRs
# keep in sync with /eng/pipelines/common/xplat-setup.yml
- name: dependOnEvaluatePaths
- value: ${{ and(eq(variables['Build.Reason'], 'PullRequest'), in(variables['Build.DefinitionName'], 'runtime', 'runtime-staging', 'runtime-community')) }}
+ value: ${{ and(eq(variables['Build.Reason'], 'PullRequest'), in(variables['Build.DefinitionName'], 'runtime', 'runtime-staging', 'runtime-community', 'runtime-extra-platforms')) }}
- name: debugOnPrReleaseOnRolling
${{ if ne(variables['Build.Reason'], 'PullRequest') }}:
value: Release
diff --git a/eng/pipelines/common/xplat-setup.yml b/eng/pipelines/common/xplat-setup.yml
index 05a6bc7c4a63c4..e397bcdd456a60 100644
--- a/eng/pipelines/common/xplat-setup.yml
+++ b/eng/pipelines/common/xplat-setup.yml
@@ -22,8 +22,7 @@ jobs:
shouldContinueOnError: ${{ and(endsWith(variables['Build.DefinitionName'], 'staging'), eq(variables['Build.Reason'], 'PullRequest')) }}
# keep in sync with /eng/pipelines/common/variables.yml
- nonPRBuild: ${{ and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}
- dependOnEvaluatePaths: ${{ and(eq(variables['Build.Reason'], 'PullRequest'), in(variables['Build.DefinitionName'], 'runtime', 'runtime-staging', 'runtime-community')) }}
+ dependOnEvaluatePaths: ${{ and(eq(variables['Build.Reason'], 'PullRequest'), in(variables['Build.DefinitionName'], 'runtime', 'runtime-staging', 'runtime-community', 'runtime-extra-platforms')) }}
variables:
# Disable component governance in our CI builds. These builds are not shipping nor
@@ -50,8 +49,12 @@ jobs:
value: $(buildConfigUpper)
- name: _runSmokeTestsOnlyArg
- value: '/p:RunSmokeTestsOnly=$(isNotManualAndIsPR)'
- - ${{ if or(eq(parameters.osGroup, 'windows'), eq(parameters.hostedOs, 'windows')) }}:
+ value: '/p:RunSmokeTestsOnly=$(isNotExtraPlatformsBuild)'
+
+ - name: _hostedOs
+ value: ${{ parameters.jobParameters.hostedOs }}
+
+ - ${{ if or(eq(parameters.osGroup, 'windows'), eq(parameters.jobParameters.hostedOs, 'windows')) }}:
- name: archiveExtension
value: '.zip'
- name: archiveType
@@ -69,7 +72,7 @@ jobs:
- name: logRootNameArg
value: 'log '
- - ${{ if and(ne(parameters.osGroup, 'windows'), ne(parameters.hostedOs, 'windows')) }}:
+ - ${{ if and(ne(parameters.osGroup, 'windows'), ne(parameters.jobParameters.hostedOs, 'windows')) }}:
- name: archiveExtension
value: '.tar.gz'
- name: archiveType
@@ -117,12 +120,12 @@ jobs:
${{ if eq(parameters.jobParameters.pool, '') }}:
pool:
# Public Linux Build Pool
- ${{ if and(or(in(parameters.osGroup, 'Linux', 'FreeBSD', 'Android', 'Tizen'), eq(parameters.hostedOs, 'Linux')), eq(variables['System.TeamProject'], 'public')) }}:
+ ${{ if and(or(in(parameters.osGroup, 'Linux', 'FreeBSD', 'Android', 'Tizen'), eq(parameters.jobParameters.hostedOs, 'Linux')), eq(variables['System.TeamProject'], 'public')) }}:
name: NetCore1ESPool-Public
demands: ImageOverride -equals Build.Ubuntu.1804.Amd64.Open
# Official Build Linux Pool
- ${{ if and(or(in(parameters.osGroup, 'Linux', 'FreeBSD', 'Browser', 'Android', 'Tizen'), eq(parameters.hostedOs, 'Linux')), ne(variables['System.TeamProject'], 'public')) }}:
+ ${{ if and(or(in(parameters.osGroup, 'Linux', 'FreeBSD', 'Browser', 'Android', 'Tizen'), eq(parameters.jobParameters.hostedOs, 'Linux')), ne(variables['System.TeamProject'], 'public')) }}:
name: NetCore1ESPool-Internal
demands: ImageOverride -equals Build.Ubuntu.1804.Amd64
@@ -136,7 +139,7 @@ jobs:
demands: ImageOverride -equals Build.Windows.10.Amd64.VS2019
# Public Windows Build Pool
- ${{ if and(or(eq(parameters.osGroup, 'windows'), eq(parameters.hostedOs, 'windows')), eq(variables['System.TeamProject'], 'public')) }}:
+ ${{ if and(or(eq(parameters.osGroup, 'windows'), eq(parameters.jobParameters.hostedOs, 'windows')), eq(variables['System.TeamProject'], 'public')) }}:
name: NetCore1ESPool-Public
demands: ImageOverride -equals Build.Windows.10.Amd64.VS2019.Open
diff --git a/eng/pipelines/coreclr/perf_slow.yml b/eng/pipelines/coreclr/perf_slow.yml
index e8410af6d361f9..04994eac96a44b 100644
--- a/eng/pipelines/coreclr/perf_slow.yml
+++ b/eng/pipelines/coreclr/perf_slow.yml
@@ -137,10 +137,11 @@ jobs:
buildConfig: release
container: ubuntu-18.04-cross-arm64-20211022152824-b2c2436
runtimeFlavor: mono
+ runtimeVariant: 'llvmaot'
platforms:
- Linux_arm64
jobParameters:
- buildArgs: -s mono+libs+host+packs -c $(_BuildConfig)
+ buildArgs: -s mono+libs+host+packs -c $(_BuildConfig) /p:MonoEnableLLVM=true /p:MonoBundleLLVMOptimizer=true
nameSuffix: AOT
isOfficialBuild: false
extraStepsTemplate: /eng/pipelines/common/upload-artifact-step.yml
diff --git a/eng/pipelines/coreclr/superpmi-collect.yml b/eng/pipelines/coreclr/superpmi-collect.yml
index 0d41f151d6b554..8918ee8cbfcd39 100644
--- a/eng/pipelines/coreclr/superpmi-collect.yml
+++ b/eng/pipelines/coreclr/superpmi-collect.yml
@@ -30,8 +30,7 @@ jobs:
jobTemplate: /eng/pipelines/common/build-coreclr-and-libraries-job.yml
buildConfig: checked
platforms:
- # Linux tests are built on the OSX machines.
- # - OSX_x64
+ - OSX_arm64
- Linux_arm
- Linux_arm64
- Linux_x64
@@ -46,6 +45,16 @@ jobs:
- Linux_x64
- windows_x64
+# superpmi-collect-job that targets macOS/arm64 depends on coreclr binaries produced by the macOS/x64 job
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml
+ buildConfig: checked
+ platforms:
+ - OSX_x64
+ jobParameters:
+ testGroup: outerloop
+
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml
@@ -62,6 +71,7 @@ jobs:
platforms:
# Linux tests are built on the OSX machines.
# - OSX_x64
+ - OSX_arm64
- Linux_arm
- Linux_arm64
- Linux_x64
@@ -83,6 +93,7 @@ jobs:
platforms:
# Linux tests are built on the OSX machines.
# - OSX_x64
+ - OSX_arm64
- Linux_arm
- Linux_arm64
- Linux_x64
@@ -105,6 +116,7 @@ jobs:
platforms:
# Linux tests are built on the OSX machines.
# - OSX_x64
+ - OSX_arm64
- Linux_arm
- Linux_arm64
- Linux_x64
@@ -127,6 +139,7 @@ jobs:
platforms:
# Linux tests are built on the OSX machines.
# - OSX_x64
+ - OSX_arm64
- Linux_arm
- Linux_arm64
- Linux_x64
@@ -148,6 +161,7 @@ jobs:
platforms:
# Linux tests are built on the OSX machines.
# - OSX_x64
+ - OSX_arm64
#TODO: Need special handling of running "benchmark build" from inside TMP folder on helix machine.
# - Linux_arm
# - Linux_arm64
diff --git a/eng/pipelines/coreclr/templates/build-jit-job.yml b/eng/pipelines/coreclr/templates/build-jit-job.yml
index c251c06f286793..2022a8c53a24fd 100644
--- a/eng/pipelines/coreclr/templates/build-jit-job.yml
+++ b/eng/pipelines/coreclr/templates/build-jit-job.yml
@@ -107,10 +107,10 @@ jobs:
# Build CoreCLR JIT
- ${{ if ne(parameters.osGroup, 'windows') }}:
- - script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) -ci $(compilerArg) -component alljits
+ - script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) -ci $(compilerArg) -component alljits -component spmi
displayName: Build CoreCLR JIT
- ${{ if eq(parameters.osGroup, 'windows') }}:
- - script: set __TestIntermediateDir=int&&$(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci -component alljits
+ - script: set __TestIntermediateDir=int&&$(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci -component alljits -component spmi
displayName: Build CoreCLR JIT
- ${{ if eq(parameters.uploadAs, 'azureBlob') }}:
diff --git a/eng/pipelines/coreclr/templates/build-job.yml b/eng/pipelines/coreclr/templates/build-job.yml
index b89cd621eda1ee..713882250e627a 100644
--- a/eng/pipelines/coreclr/templates/build-job.yml
+++ b/eng/pipelines/coreclr/templates/build-job.yml
@@ -132,10 +132,10 @@ jobs:
value: ''
- ${{ if ne(parameters.testGroup, 'innerloop') }}:
- name: clrRuntimeComponentsBuildArg
- value: '-component runtime -component alljits -component paltests -component nativeaot '
+ value: '-component runtime -component alljits -component paltests -component nativeaot -component spmi '
- ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.archType, 'x86')) }}:
- name: clrRuntimeComponentsBuildArg
- value: '-component runtime -component jit -component iltools '
+ value: '-component runtime -component jit -component iltools -component spmi '
- name: pgoInstrumentArg
value: ''
diff --git a/eng/pipelines/coreclr/templates/helix-queues-setup.yml b/eng/pipelines/coreclr/templates/helix-queues-setup.yml
index 1a5a3467587025..0b2e6f7f80ed2a 100644
--- a/eng/pipelines/coreclr/templates/helix-queues-setup.yml
+++ b/eng/pipelines/coreclr/templates/helix-queues-setup.yml
@@ -21,6 +21,7 @@ jobs:
archType: ${{ parameters.archType }}
container: ${{ parameters.container }}
pool: ${{ parameters.pool }}
+ platform: ${{ parameters.platform }}
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
dependOnEvaluatePaths: ${{ parameters.dependOnEvaluatePaths}}
runtimeFlavorDisplayName: ${{ parameters.runtimeFlavorDisplayName }}
diff --git a/eng/pipelines/coreclr/templates/perf-job.yml b/eng/pipelines/coreclr/templates/perf-job.yml
index dd1ff0ebd3b242..627d42fd7add18 100644
--- a/eng/pipelines/coreclr/templates/perf-job.yml
+++ b/eng/pipelines/coreclr/templates/perf-job.yml
@@ -57,7 +57,7 @@ jobs:
- ${{ if and(eq(parameters.runtimeType, 'mono'), ne(parameters.codeGenType, 'AOT')) }}:
- ${{ format('mono_{0}_product_build_{1}{2}_{3}_{4}', parameters.runtimeVariant, parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig) }}
- ${{ if eq(parameters.runtimeType, 'wasm')}}:
- - ${{ format('build_{0}{1}_{2}_{3}_{4}', 'Browser', '', 'wasm', parameters.buildConfig, parameters.runtimeType) }}
+ - ${{ format('build_{0}{1}_{2}_{3}_{4}_{5}', 'Browser', '', 'wasm', 'Linux', parameters.buildConfig, parameters.runtimeType) }}
- ${{ if and(eq(parameters.codeGenType, 'AOT'), ne(parameters.runtimeType, 'wasm'))}}:
- ${{ format('build_{0}{1}_{2}_{3}_{4}', parameters.osGroup, parameters.osSubgroup, parameters.archType, parameters.buildConfig, parameters.codeGenType) }}
- ${{ if eq(parameters.runtimeType, 'AndroidMono')}}:
diff --git a/eng/pipelines/coreclr/templates/run-superpmi-collect-job.yml b/eng/pipelines/coreclr/templates/run-superpmi-collect-job.yml
index 1ac235f6f6d08e..be05b52b6b1859 100644
--- a/eng/pipelines/coreclr/templates/run-superpmi-collect-job.yml
+++ b/eng/pipelines/coreclr/templates/run-superpmi-collect-job.yml
@@ -106,7 +106,7 @@ jobs:
steps:
- ${{ parameters.steps }}
- - script: $(PythonScript) $(Build.SourcesDirectory)/src/coreclr/scripts/superpmi_collect_setup.py -source_directory $(Build.SourcesDirectory) -core_root_directory $(Core_Root_Dir) -arch $(archType) -mch_file_tag $(MchFileTag) -input_directory $(InputDirectory) -collection_name $(CollectionName) -collection_type $(CollectionType) -max_size 50 # size in MB
+ - script: $(PythonScript) $(Build.SourcesDirectory)/src/coreclr/scripts/superpmi_collect_setup.py -source_directory $(Build.SourcesDirectory) -core_root_directory $(Core_Root_Dir) -arch $(archType) -platform $(osGroup) -mch_file_tag $(MchFileTag) -input_directory $(InputDirectory) -collection_name $(CollectionName) -collection_type $(CollectionType) -max_size 50 # size in MB
displayName: ${{ format('SuperPMI setup ({0})', parameters.osGroup) }}
# Create required directories for merged mch collection and superpmi logs
@@ -159,6 +159,10 @@ jobs:
artifactName: 'SuperPMI_Collection_$(CollectionName)_$(CollectionType)_$(osGroup)$(osSubgroup)_$(archType)_$(buildConfig)'
displayName: ${{ format('Upload artifacts SuperPMI {0}-{1} collection', parameters.collectionName, parameters.collectionType) }}
+ # Ensure the Python azure-storage-blob package is installed before doing the upload.
+ - script: $(PipScript) install --user --upgrade pip && $(PipScript) install --user azure.storage.blob==12.5.0 --force-reinstall
+ displayName: Upgrade Pip to latest and install azure-storage-blob Python package
+
- script: $(PythonScript) $(Build.SourcesDirectory)/src/coreclr/scripts/superpmi.py upload -log_level DEBUG -arch $(archType) -build_type $(buildConfig) -mch_files $(MergedMchFileLocation)$(CollectionName).$(CollectionType).$(MchFileTag).mch -core_root $(Build.SourcesDirectory)/artifacts/bin/coreclr/$(osGroup).x64.$(buildConfigUpper)
displayName: ${{ format('Upload SuperPMI {0}-{1} collection to Azure Storage', parameters.collectionName, parameters.collectionType) }}
env:
diff --git a/eng/pipelines/coreclr/templates/superpmi-collect-job.yml b/eng/pipelines/coreclr/templates/superpmi-collect-job.yml
index 6c990a25ff4aa3..652d17af08eba5 100644
--- a/eng/pipelines/coreclr/templates/superpmi-collect-job.yml
+++ b/eng/pipelines/coreclr/templates/superpmi-collect-job.yml
@@ -84,8 +84,8 @@ jobs:
- template: /eng/pipelines/common/download-artifact-step.yml
parameters:
unpackFolder: '$(Build.SourcesDirectory)/artifacts/tests/libraries_zipped/$(osGroup).$(archType).$(buildConfigUpper)'
- artifactFileName: 'libraries_test_assets_${{ parameters.osGroup }}_x64_Release$(archiveExtension)'
- artifactName: ${{ format('libraries_test_assets_{0}_x64_Release', parameters.osGroup) }}
+ artifactFileName: 'libraries_test_assets_${{ parameters.osGroup }}_$(archType)_Release$(archiveExtension)'
+ artifactName: ${{ format('libraries_test_assets_{0}_$(archType)_Release', parameters.osGroup) }}
displayName: 'generic libraries test artifacts'
# Unzip individual test projects
diff --git a/eng/pipelines/libraries/helix-queues-setup.yml b/eng/pipelines/libraries/helix-queues-setup.yml
index ac074ab9903f8f..dec87138ed4563 100644
--- a/eng/pipelines/libraries/helix-queues-setup.yml
+++ b/eng/pipelines/libraries/helix-queues-setup.yml
@@ -21,6 +21,7 @@ jobs:
archType: ${{ parameters.archType }}
container: ${{ parameters.container }}
pool: ${{ parameters.pool }}
+ platform: ${{ parameters.platform }}
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
dependOnEvaluatePaths: ${{ parameters.dependOnEvaluatePaths}}
runtimeFlavorDisplayName: ${{ parameters.runtimeFlavorDisplayName }}
@@ -28,26 +29,26 @@ jobs:
# Linux arm
- ${{ if eq(parameters.platform, 'Linux_arm') }}:
- - ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}:
+ - ${{ if or(eq(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}:
- (Debian.10.Arm32.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-arm32v7-20210304164340-6616c63
- (Debian.11.Arm32.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-arm32v7-20210304164347-5a7c380
# Linux arm64
- ${{ if eq(parameters.platform, 'Linux_arm64') }}:
- - ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}:
- - (Ubuntu.1804.ArmArch.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-helix-arm64v8-20210106155927-56c6673
+ - ${{ if or(eq(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}:
- (Ubuntu.2110.Arm64.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-21.10-helix-arm64v8-20211116135000-0f8d97e
- - ${{ if eq(parameters.jobParameters.isFullMatrix, false) }}:
+ - ${{ if or(ne(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}:
- (Ubuntu.1804.ArmArch.Open)Ubuntu.1804.ArmArch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-16.04-helix-arm64v8-20210106155927-56c6673
# Linux musl x64
- ${{ if eq(parameters.platform, 'Linux_musl_x64') }}:
- - (Alpine.314.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.14-helix-amd64-20210910135833-1848e19
- - ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}:
+ - ${{ if or(ne(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}:
+ - (Alpine.314.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.14-helix-amd64-20210910135833-1848e19
+ - ${{ if or(eq(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}:
- (Alpine.313.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.13-helix-amd64-20210910135845-8a6f4f3
# Linux musl arm64
- - ${{ if and(eq(parameters.platform, 'Linux_musl_arm64'), eq(parameters.jobParameters.isFullMatrix, true)) }}:
+ - ${{ if and(eq(parameters.platform, 'Linux_musl_arm64'), or(eq(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true))) }}:
- (Alpine.313.Arm64.Open)ubuntu.1804.armarch.open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.13-helix-arm64v8-20210910135808-8a6f4f3
- (Alpine.314.Arm64.Open)ubuntu.1804.armarch.open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.14-helix-arm64v8-20210910135810-8a6f4f3
@@ -62,21 +63,16 @@ jobs:
- (Ubuntu.2110.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-21.10-helix-amd64-20211116135132-0f8d97e
- (Debian.10.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64-bfcd90a-20200121150006
- ${{ if or(ne(parameters.jobParameters.testScope, 'outerloop'), ne(parameters.jobParameters.runtimeFlavor, 'mono')) }}:
- - ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}:
- - (Centos.7.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-mlnet-helix-20210714125435-dde38af
- - (Centos.8.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-8-helix-20201229003624-c1bf759
- - RedHat.7.Amd64.Open
- - Ubuntu.1804.Amd64.Open
- - SLES.12.Amd64.Open
+ - ${{ if or(eq(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}:
+ - (Centos.8.Amd64.Open)Ubuntu.1604.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-8-helix-20201229003624-c1bf759
- SLES.15.Amd64.Open
- - (Fedora.34.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix-20210913123654-4f64125
- - (Ubuntu.2110.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-21.10-helix-amd64-20211116135132-0f8d97e
- - (Debian.10.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64-20210304164434-56c6673
+ - (Fedora.34.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-34-helix-20210913123654-4f64125
+ - (Ubuntu.2110.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-21.04-helix-amd64-20210922170909-34a2d72
- (Debian.11.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-amd64-20210304164428-5a7c380
- - (Mariner.1.0.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-1.0-helix-20210528192219-92bf620
- - (openSUSE.15.2.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:opensuse-15.2-helix-amd64-20211018152525-9cc02fe
- - ${{ if eq(parameters.jobParameters.isFullMatrix, false) }}:
- - (Centos.7.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-mlnet-helix-20210714125435-dde38af
+ - (Mariner.1.0.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-1.0-helix-20210528192219-92bf620
+ - (openSUSE.15.2.Amd64.Open)ubuntu.1604.amd64.open@mcr.microsoft.com/dotnet-buildtools/prereqs:opensuse-15.2-helix-amd64-20211018152525-9cc02fe
+ - ${{ if or(ne(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}:
+ - (Centos.7.Amd64.Open)Ubuntu.1604.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-mlnet-helix-20210714125435-dde38af
- RedHat.7.Amd64.Open
- (Debian.10.Amd64.Open)Ubuntu.1804.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-10-helix-amd64-20210304164434-56c6673
- Ubuntu.1804.Amd64.Open
@@ -94,10 +90,9 @@ jobs:
# OSX x64
- ${{ if eq(parameters.platform, 'OSX_x64') }}:
- - ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}:
+ - ${{ if or(eq(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}:
- OSX.1014.Amd64.Open
- - OSX.1015.Amd64.Open
- - ${{ if eq(parameters.jobParameters.isFullMatrix, false) }}:
+ - ${{ if or(ne(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}:
- OSX.1015.Amd64.Open
# Android
@@ -126,18 +121,18 @@ jobs:
- ${{ if eq(parameters.platform, 'windows_x64') }}:
# netcoreapp
- ${{ if notIn(parameters.jobParameters.framework, 'net48') }}:
+ # libraries on mono outerloop
- ${{ if and(eq(parameters.jobParameters.testScope, 'outerloop'), eq(parameters.jobParameters.runtimeFlavor, 'mono')) }}:
- Windows.81.Amd64.Open
- Windows.10.Amd64.Server19H1.Open
+ # libraries on coreclr (outerloop and innerloop), or libraries on mono innerloop
- ${{ if or(ne(parameters.jobParameters.testScope, 'outerloop'), ne(parameters.jobParameters.runtimeFlavor, 'mono')) }}:
- - ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}:
- - Windows.81.Amd64.Open
+ - ${{ if or(eq(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}:
- Windows.10.Amd64.ServerRS5.Open
- - Windows.10.Amd64.Server19H1.Open
- - ${{ if ne(parameters.jobParameters.runtimeFlavor, 'mono') }}:
- - (Windows.Nano.1809.Amd64.Open)windows.10.amd64.serverrs5.open@mcr.microsoft.com/dotnet-buildtools/prereqs:nanoserver-1809-helix-amd64-08e8e40-20200107182504
+ - ${{ if ne(parameters.jobParameters.testScope, 'outerloop') }}:
+ - Windows.10.Amd64.Server19H1.Open
- (Windows.Server.Core.1909.Amd64.Open)windows.10.amd64.server20h1.open@mcr.microsoft.com/dotnet-buildtools/prereqs:windowsservercore-2004-helix-amd64-20200904200251-272704c
- - ${{ if ne(parameters.jobParameters.isFullMatrix, true) }}:
+ - ${{ if or(ne(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}:
- Windows.81.Amd64.Open
- Windows.10.Amd64.Server19H1.ES.Open
- Windows.11.Amd64.ClientPre.Open
@@ -154,20 +149,18 @@ jobs:
- ${{ if eq(parameters.platform, 'windows_x86') }}:
# netcoreapp
- ${{ if notIn(parameters.jobParameters.framework, 'net48') }}:
+ # mono outerloop
- ${{ if and(eq(parameters.jobParameters.testScope, 'outerloop'), eq(parameters.jobParameters.runtimeFlavor, 'mono')) }}:
- Windows.7.Amd64.Open
- Windows.10.Amd64.ServerRS5.Open
+ # libraries on coreclr (outerloop and innerloop), or libraries on mono innerloop
- ${{ if or(ne(parameters.jobParameters.testScope, 'outerloop'), ne(parameters.jobParameters.runtimeFlavor, 'mono')) }}:
- - ${{ if eq(parameters.jobParameters.isFullMatrix, true) }}:
- - Windows.7.Amd64.Open
+ - ${{ if or(eq(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}:
- Windows.10.Amd64.ServerRS5.Open
- Windows.10.Amd64.Server19H1.Open
- - ${{ if ne(parameters.jobParameters.isFullMatrix, true) }}:
- - ${{ if eq(parameters.jobParameters.buildConfig, 'Release') }}:
- - Windows.10.Amd64.Server19H1.ES.Open
- - ${{ if eq(parameters.jobParameters.buildConfig, 'Debug') }}:
- - Windows.7.Amd64.Open
- - Windows.10.Amd64.Server19H1.Open
+ - ${{ if or(ne(parameters.jobParameters.isExtraPlatforms, true), eq(parameters.jobParameters.includeAllPlatforms, true)) }}:
+ - Windows.10.Amd64.Server19H1.ES.Open
+ - Windows.7.Amd64.Open
# .NETFramework
- ${{ if eq(parameters.jobParameters.framework, 'net48') }}:
diff --git a/eng/pipelines/libraries/outerloop-mono.yml b/eng/pipelines/libraries/outerloop-mono.yml
index 1267cf72a62dea..17a7101e26004a 100644
--- a/eng/pipelines/libraries/outerloop-mono.yml
+++ b/eng/pipelines/libraries/outerloop-mono.yml
@@ -23,7 +23,7 @@ jobs:
platforms:
- windows_x86
- Browser_wasm
- - ${{ if eq(variables['isFullMatrix'], true) }}:
+ - ${{ if eq(variables['isRollingBuild'], true) }}:
- windows_x64
- Linux_x64
- Linux_arm
@@ -34,7 +34,7 @@ jobs:
nameSuffix: AllSubsets_Mono
buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) -testscope outerloop /p:ArchiveTests=true
timeoutInMinutes: 180
- isFullMatrix: ${{ variables['isFullMatrix'] }}
+ includeAllPlatforms: ${{ variables['isRollingBuild'] }}
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
@@ -44,7 +44,7 @@ jobs:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- - ${{ if eq(variables['isFullMatrix'], false) }}:
+ - ${{ if eq(variables['isRollingBuild'], false) }}:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
@@ -61,7 +61,7 @@ jobs:
nameSuffix: AllSubsets_Mono
buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) -testscope outerloop /p:ArchiveTests=true
timeoutInMinutes: 180
- isFullMatrix: ${{ variables['isFullMatrix'] }}
+ includeAllPlatforms: ${{ variables['isRollingBuild'] }}
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
diff --git a/eng/pipelines/libraries/outerloop.yml b/eng/pipelines/libraries/outerloop.yml
index 28932a0baff3ce..72c2de49363a25 100644
--- a/eng/pipelines/libraries/outerloop.yml
+++ b/eng/pipelines/libraries/outerloop.yml
@@ -27,7 +27,7 @@ jobs:
- ${{ if eq(variables['includeLinuxOuterloop'], true) }}:
- Linux_x64
- Linux_musl_x64
- - ${{ if eq(variables['isFullMatrix'], true) }}:
+ - ${{ if eq(variables['isRollingBuild'], true) }}:
- Linux_arm
- Linux_arm64
- Linux_musl_arm64
@@ -46,27 +46,27 @@ jobs:
platforms:
- ${{ if eq(variables['includeWindowsOuterloop'], true) }}:
- windows_x86
- - ${{ if eq(variables['isFullMatrix'], true) }}:
+ - ${{ if eq(variables['isRollingBuild'], true) }}:
- windows_x64
- ${{ if eq(variables['includeLinuxOuterloop'], true) }}:
- - ${{ if eq(variables['isFullMatrix'], true) }}:
+ - ${{ if eq(variables['isRollingBuild'], true) }}:
- Linux_x64
- Linux_arm
- Linux_arm64
- Linux_musl_x64
- Linux_musl_arm64
- - ${{ if and(eq(variables['includeOsxOuterloop'], true), eq(variables['isFullMatrix'], true)) }}:
+ - ${{ if and(eq(variables['includeOsxOuterloop'], true), eq(variables['isRollingBuild'], true)) }}:
- OSX_arm64
- OSX_x64
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
isOfficialBuild: ${{ variables['isOfficialBuild'] }}
- isFullMatrix: ${{ variables['isFullMatrix'] }}
+ includeAllPlatforms: ${{ variables['isRollingBuild'] }}
runTests: true
testScope: outerloop
liveRuntimeBuildConfig: release
- - ${{ if eq(variables['isFullMatrix'], false) }}:
+ - ${{ if eq(variables['isRollingBuild'], false) }}:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/libraries/build-job.yml
@@ -83,7 +83,7 @@ jobs:
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
isOfficialBuild: ${{ variables['isOfficialBuild'] }}
- isFullMatrix: ${{ variables['isFullMatrix'] }}
+ includeAllPlatforms: ${{ variables['isRollingBuild'] }}
runTests: true
testScope: outerloop
liveRuntimeBuildConfig: release
@@ -95,12 +95,12 @@ jobs:
buildConfig: Release
platforms:
- windows_x86
- - ${{ if eq(variables['isFullMatrix'], true) }}:
+ - ${{ if eq(variables['isRollingBuild'], true) }}:
- windows_x64
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
isOfficialBuild: ${{ variables['isOfficialBuild'] }}
- isFullMatrix: ${{ variables['isFullMatrix'] }}
+ includeAllPlatforms: ${{ variables['isRollingBuild'] }}
framework: net48
runTests: true
testScope: outerloop
diff --git a/eng/pipelines/libraries/variables.yml b/eng/pipelines/libraries/variables.yml
index 9bb89d7d493847..2abd5adabe2c9f 100644
--- a/eng/pipelines/libraries/variables.yml
+++ b/eng/pipelines/libraries/variables.yml
@@ -6,7 +6,7 @@ variables:
value: $(Build.SourcesDirectory)/src/libraries
- name: pipelinesPath
value: /eng/pipelines/libraries
- - name: isFullMatrix
+ - name: isRollingBuild
value: ${{ notIn(variables['Build.Reason'], 'PullRequest') }}
- name: includeWindowsOuterloop
value: ${{ or(endsWith(variables['Build.DefinitionName'], 'windows'), endsWith(variables['Build.DefinitionName'], 'outerloop')) }}
diff --git a/eng/pipelines/runtime-community.yml b/eng/pipelines/runtime-community.yml
index 5bebcc00a2663e..f588ad52b0f330 100644
--- a/eng/pipelines/runtime-community.yml
+++ b/eng/pipelines/runtime-community.yml
@@ -46,7 +46,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
@@ -56,4 +56,4 @@ jobs:
or(
eq(variables['librariesContainsChange'], true),
eq(variables['monoContainsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
diff --git a/eng/pipelines/runtime-manual.yml b/eng/pipelines/runtime-extra-platforms.yml
similarity index 61%
rename from eng/pipelines/runtime-manual.yml
rename to eng/pipelines/runtime-extra-platforms.yml
index a4391cff70da59..d9121f4b8027a0 100644
--- a/eng/pipelines/runtime-manual.yml
+++ b/eng/pipelines/runtime-extra-platforms.yml
@@ -1,161 +1,125 @@
+# This pipeline includes the platforms that we don't have resources to run on every PR but that we want
+# to still have test coverage, we run this pipeline on a schedule and also developers can run it
+# via /azp run command on PRs. This pipeline permits us to have the main runtime pipeline run the same
+# platforms in PRs and Scheduled builds.
+
+# Setting batch to true, triggers one build at a time.
+# if there is a push while a build in progress, it will wait,
+# until the running build finishes, and produce a build with all the changes
+# that happened during the last build.
trigger: none
+schedules:
+ - cron: "0 9,21 * * *" # run at 9:00 and 21:00 (UTC) which is 1:00 and 13:00 (PST).
+ displayName: Runtime extra main schedule
+ branches:
+ include:
+ - main
+ always: false # run only if there were changes since the last successful scheduled run.
+ - cron: "0 6,18 * * *" # run at 6:00 and 18:00 (UTC) which is 22:00 and 10:00 (PST).
+ displayName: Runtime extra release schedule
+ branches:
+ include:
+ - release/*
+ always: false # run only if there were changes since the last successful scheduled run.
+
variables:
- template: /eng/pipelines/common/variables.yml
jobs:
#
-# iOS/tvOS interp - requires AOT Compilation and Interp flags
-# Build the whole product using Mono and run libraries tests
+# Evaluate paths
#
-- template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
- buildConfig: Release
- runtimeFlavor: mono
- platforms:
- - iOSSimulator_x64
- - tvOSSimulator_x64
- - iOSSimulator_arm64
- jobParameters:
- testGroup: innerloop
- nameSuffix: AllSubsets_Mono
- buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:RunAOTCompilation=true /p:MonoForceInterpreter=true /p:BuildDarwinFrameworks=true
- timeoutInMinutes: 180
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- interpreter: true
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+- ${{ if eq(variables.dependOnEvaluatePaths, true) }}:
+ - template: /eng/pipelines/common/evaluate-default-paths.yml
#
-# MacCatalyst interp - requires AOT Compilation and Interp flags
-# Build the whole product using Mono and run libraries tests
+# Build CoreCLR release
+# Always as they are needed by Installer and we always build and test the Installer.
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
- buildConfig: Release
- runtimeFlavor: mono
+ jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml
+ buildConfig: release
platforms:
- - MacCatalyst_x64
- # don't run tests on arm64 PRs until we can get significantly more devices
- - ${{ if eq(variables['isFullMatrix'], true) }}:
- - MacCatalyst_arm64
+ - Linux_x64
+ - Linux_arm
+ - Linux_arm64
+ - Linux_musl_x64
+ - OSX_x64
+ - windows_x64
+ - windows_x86
+ - windows_arm64
jobParameters:
testGroup: innerloop
- nameSuffix: AllSubsets_Mono
- buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=adhoc /p:RunAOTCompilation=true /p:MonoForceInterpreter=true /p:BuildDarwinFrameworks=true
- timeoutInMinutes: 180
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- interpreter: true
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
#
-# MacCatalyst interp - requires AOT Compilation and Interp flags
-# Build the whole product using Mono and run libraries tests
-# The test app is built with the App Sandbox entitlement
+# Build libraries using live CoreLib
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
+ jobTemplate: /eng/pipelines/libraries/build-job.yml
buildConfig: Release
- runtimeFlavor: mono
platforms:
- - MacCatalyst_x64
- # don't run tests on arm64 PRs until we can get significantly more devices
- - ${{ if eq(variables['isFullMatrix'], true) }}:
- - MacCatalyst_arm64
- jobParameters:
- testGroup: innerloop
- nameSuffix: AllSubsets_Mono_AppSandbox
- buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=adhoc /p:RunAOTCompilation=true /p:MonoForceInterpreter=true /p:BuildDarwinFrameworks=true /p:EnableAppSandbox=true
- timeoutInMinutes: 180
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- interpreter: true
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+ - Linux_x64
+ - Linux_arm
+ - Linux_arm64
+ - Linux_musl_x64
+ - OSX_x64
+ - windows_x64
+ - windows_x86
+ - windows_arm64
#
-# iOS/tvOS devices - Full AOT + AggressiveTrimming to reduce size
-# Build the whole product using Mono and run libraries tests
+# Libraries Release Test Execution against a release coreclr runtime
+# Only when the PR contains a libraries change
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
+ jobTemplate: /eng/pipelines/libraries/run-test-job.yml
buildConfig: Release
- runtimeFlavor: mono
platforms:
- - iOS_arm64
- - tvOS_arm64
- jobParameters:
- testGroup: innerloop
- nameSuffix: AllSubsets_Mono
- buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true /p:BuildTestsOnHelix=true /p:UsePortableRuntimePack=true /p:BuildDarwinFrameworks=true
- timeoutInMinutes: 180
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- extraHelixArguments: /p:NeedsToBuildAppsOnHelix=true
-
-#
-# Build the whole product using Mono and run libraries tests
-#
-- template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
+ - Linux_x64
+ - Linux_arm
+ - Linux_arm64
+ - Linux_musl_x64
+ - OSX_x64
+ - windows_x64
+ - windows_x86
+ - windows_arm64
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
- buildConfig: Release
- runtimeFlavor: mono
- platforms:
- - Android_x86
- - Android_x64
jobParameters:
- testGroup: innerloop
- nameSuffix: AllSubsets_Mono
- buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true $(_runSmokeTestsOnlyArg)
- timeoutInMinutes: 180
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+ isOfficialBuild: false
+ isExtraPlatforms: ${{ variables.isExtraPlatformsBuild }}
+ testScope: innerloop
+ liveRuntimeBuildConfig: release
+ condition: >-
+ or(
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
+ eq(variables['isRollingBuild'], true))
+# Run net48 tests on win-x64
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
+ jobTemplate: /eng/pipelines/libraries/build-job.yml
buildConfig: Release
- runtimeFlavor: mono
platforms:
- - Android_arm
- - Android_arm64
+ - windows_x64
+ helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
- testGroup: innerloop
- nameSuffix: AllSubsets_Mono
- buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true $(_runSmokeTestsOnlyArg)
- timeoutInMinutes: 180
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+ framework: net48
+ runTests: true
+ testScope: innerloop
+ condition: >-
+ or(
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
+ eq(variables['isRollingBuild'], true))
+
+#### MONO LEGS
#
-# Build the whole product using Mono and run libraries tests
+# Build the whole product using Mono and run libraries tests, for Wasm.Build.Tests
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@@ -164,131 +128,133 @@ jobs:
buildConfig: Release
runtimeFlavor: mono
platforms:
- - Windows_x64
+ # BuildWasmApps should only happen on the extra platforms build as we already have coverage for this build on PRs.
+ - Browser_wasm
+ - Browser_wasm_win
+ variables:
+ # map dependencies variables to local variables
+ - name: wasmbuildtestsContainsChange
+ value: $[ dependencies.evaluate_paths.outputs['SetPathVars_wasmbuildtests.containsChange'] ]
jobParameters:
- testScope: innerloop
- nameSuffix: AllSubsets_Mono
- buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true
- timeoutInMinutes: 120
+ isExtraPlatforms: ${{ variables.isExtraPlatformsBuild }}
+ testGroup: innerloop
+ nameSuffix: WasmBuildTests
+ buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:TestWasmBuildTests=true /p:TestAssemblies=false /p:BrowserHost=$(_hostedOs)
+ timeoutInMinutes: 180
+ condition: >-
+ or(
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_wasmbuildtests.containsChange'], true),
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+ testRunNamePrefixSuffix: Mono_$(_BuildConfig)_$(_hostedOs)
+ extraHelixArguments: /p:BrowserHost=$(_hostedOs)
+ scenarios:
+ - buildwasmapps
+ condition: >-
+ or(
+ eq(variables['wasmbuildtestsContainsChange'], true),
+ eq(variables['isRollingBuild'], true))
#
-# Build the whole product using Mono for Android and run runtime tests with interpreter
+# Build Browser_wasm, on windows, run console and browser tests
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
- buildConfig: Release
+ helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
+ buildConfig: release
runtimeFlavor: mono
platforms:
- - Android_x64
+ - Browser_wasm_win
variables:
- - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
- - name: _HelixSource
- value: pr/dotnet/runtime/$(Build.SourceBranch)
- - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- - name: _HelixSource
- value: ci/dotnet/runtime/$(Build.SourceBranch)
- - name: timeoutPerTestInMinutes
- value: 60
- - name: timeoutPerTestCollectionInMinutes
- value: 180
+ # map dependencies variables to local variables
+ - name: librariesContainsChange
+ value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
+ - name: monoContainsChange
+ value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
jobParameters:
testGroup: innerloop
- nameSuffix: AllSubsets_Mono_RuntimeTests_Interp
- buildArgs: -s mono+libs -c $(_BuildConfig)
- timeoutInMinutes: 240
- runtimeVariant: monointerpreter
+ nameSuffix: ConsoleBrowserTests
+ buildArgs: -subset mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:BrowserHost=windows
+ timeoutInMinutes: 180
+ condition: >-
+ or(
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
- extraStepsTemplate: /eng/pipelines/common/templates/runtimes/android-runtime-and-send-to-helix.yml
+ extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+ testRunNamePrefixSuffix: Windows_wasm_$(_BuildConfig)
+ extraHelixArguments: /p:BrowserHost=windows
+ scenarios:
+ - normal
+ - wasmtestonbrowser
+ condition: >-
+ or(
+ eq(variables['librariesContainsChange'], true),
+ eq(variables['monoContainsChange'], true),
+ eq(variables['isRollingBuild'], true))
#
-# Build the whole product using Mono and run runtime tests with the JIT.
+# Build for Browser/wasm, with EnableAggressiveTrimming=true
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
+ helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
buildConfig: Release
runtimeFlavor: mono
platforms:
- - iOSSimulator_x64
+ - Browser_wasm
variables:
- - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
- - name: _HelixSource
- value: pr/dotnet/runtime/$(Build.SourceBranch)
- - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- - name: _HelixSource
- value: ci/dotnet/runtime/$(Build.SourceBranch)
- - name: timeoutPerTestInMinutes
- value: 60
- - name: timeoutPerTestCollectionInMinutes
- value: 180
+ # map dependencies variables to local variables
+ - name: librariesContainsChange
+ value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
+ - name: monoContainsChange
+ value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
jobParameters:
+ isExtraPlatforms: ${{ variables.isExtraPlatformsBuild }}
testGroup: innerloop
- nameSuffix: AllSubsets_Mono_RuntimeTests
- buildArgs: -s mono+libs -c $(_BuildConfig)
- timeoutInMinutes: 240
+ nameSuffix: AllSubsets_Mono_EAT
+ buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true $(_runSmokeTestsOnlyArg) /p:EnableAggressiveTrimming=true /p:BuildAOTTestsOnHelix=true /p:RunAOTCompilation=false
+ timeoutInMinutes: 180
+ condition: >-
+ or(
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
- extraStepsTemplate: /eng/pipelines/common/templates/runtimes/android-runtime-and-send-to-helix.yml
+ extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+ extraHelixArguments: /p:NeedsToBuildWasmAppsOnHelix=true $(_runSmokeTestsOnlyArg)
+ scenarios:
+ - normal
+ condition: >-
+ or(
+ eq(variables['librariesContainsChange'], true),
+ eq(variables['monoContainsChange'], true),
+ eq(variables['isRollingBuild'], true))
#
-# Build the whole product using Mono for Android and run runtime tests with Android devices
-#
-- template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
- buildConfig: Release
- runtimeFlavor: mono
- platforms:
- - Android_arm64
- variables:
- - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
- - name: _HelixSource
- value: pr/dotnet/runtime/$(Build.SourceBranch)
- - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- - name: _HelixSource
- value: ci/dotnet/runtime/$(Build.SourceBranch)
- - name: timeoutPerTestInMinutes
- value: 60
- - name: timeoutPerTestCollectionInMinutes
- value: 180
- jobParameters:
- testGroup: innerloop
- nameSuffix: AllSubsets_Mono_RuntimeTests
- buildArgs: -s mono+libs -c $(_BuildConfig)
- timeoutInMinutes: 240
- # don't run tests on PRs until we can get significantly more devices
- # Turn off the testing for now, until https://github.com/dotnet/xharness/issues/663 gets resolved
- # ${{ if eq(variables['isFullMatrix'], true) }}:
- # # extra steps, run tests
- # extraStepsTemplate: /eng/pipelines/common/templates/runtimes/android-runtime-and-send-to-helix.yml
- # extraStepsParameters:
- # creator: dotnet-bot
- # testRunNamePrefixSuffix: Mono_$(_BuildConfig)
-
-#
-# Build Browser_wasm, on windows, run console and browser tests
+# Build for Browser/wasm with RunAOTCompilation=true
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
- buildConfig: release
+ buildConfig: Release
runtimeFlavor: mono
platforms:
+ - Browser_wasm
- Browser_wasm_win
variables:
# map dependencies variables to local variables
@@ -297,78 +263,79 @@ jobs:
- name: monoContainsChange
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
jobParameters:
+ isExtraPlatforms: ${{ variables.isExtraPlatformsBuild }}
testGroup: innerloop
- nameSuffix: Windows_wasm
- buildArgs: -subset mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:BrowserHost=windows
+ nameSuffix: AllSubsets_Mono_AOT
+ buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true $(_runSmokeTestsOnlyArg) /p:EnableAggressiveTrimming=true /p:BuildAOTTestsOnHelix=true /p:RunAOTCompilation=true /p:BrowserHost=$(_hostedOs)
timeoutInMinutes: 180
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- extraHelixArguments: /p:BrowserHost=windows
+ testRunNamePrefixSuffix: Mono_AOT_$(_BuildConfig)_$(_hostedOs)
+ extraHelixArguments: /p:NeedsToBuildWasmAppsOnHelix=true $(_runSmokeTestsOnlyArg) /p:BrowserHost=$(_hostedOs)
scenarios:
- normal
- - WasmTestOnBrowser
- - WasmTestOnNodeJs
condition: >-
or(
eq(variables['librariesContainsChange'], true),
eq(variables['monoContainsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
+#
+# Build the whole product using Mono and run runtime tests
+#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
- buildConfig: release
+ helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
+ buildConfig: Release
runtimeFlavor: mono
platforms:
- - Browser_wasm_win
+ - Browser_wasm
variables:
- # map dependencies variables to local variables
- - name: wasmbuildtestsContainsChange
- value: $[ dependencies.evaluate_paths.outputs['SetPathVars_wasmbuildtests.containsChange'] ]
+ - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
+ - name: _HelixSource
+ value: pr/dotnet/runtime/$(Build.SourceBranch)
+ - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
+ - name: _HelixSource
+ value: ci/dotnet/runtime/$(Build.SourceBranch)
+ - name: timeoutPerTestInMinutes
+ value: 10
+ - name: timeoutPerTestCollectionInMinutes
+ value: 200
jobParameters:
testGroup: innerloop
- nameSuffix: Windows_wasm_WBT
- buildArgs: -subset mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:BrowserHost=windows /p:TestWasmBuildTests=true /p:TestAssemblies=false
+ nameSuffix: AllSubsets_Mono_RuntimeTests
+ buildArgs: -s mono+libs -c $(_BuildConfig)
timeoutInMinutes: 180
condition: >-
or(
- eq(dependencies.evaluate_paths.outputs['SetPathVars_wasmbuildtests.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
+ eq(variables['isRollingBuild'], true))
+ extraStepsTemplate: /eng/pipelines/common/templates/runtimes/wasm-runtime-and-send-to-helix.yml
extraStepsParameters:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- extraHelixArguments: /p:BrowserHost=windows
- scenarios:
- - buildwasmapps
- condition: >-
- or(
- eq(variables['wasmbuildtestsContainsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
+#
+# Build the whole product using Mono and run libraries tests
+#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
- buildConfig: release
+ buildConfig: Release
runtimeFlavor: mono
platforms:
- - Browser_wasm_win
+ - Windows_x64
variables:
# map dependencies variables to local variables
- name: librariesContainsChange
@@ -376,34 +343,30 @@ jobs:
- name: monoContainsChange
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
jobParameters:
- testGroup: innerloop
- nameSuffix: Windows_wasm_AOT
- buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:BrowserHost=windows /p:EnableAggressiveTrimming=true /p:BuildAOTTestsOnHelix=true /p:RunAOTCompilation=true $(_runSmokeTestsOnlyArg)
- timeoutInMinutes: 180
+ testScope: innerloop
+ nameSuffix: AllSubsets_Mono
+ buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true
+ timeoutInMinutes: 120
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- extraHelixArguments: /p:BrowserHost=windows /p:NeedsToBuildWasmAppsOnHelix=true $(_runSmokeTestsOnlyArg)
- scenarios:
- - normal
condition: >-
or(
eq(variables['librariesContainsChange'], true),
eq(variables['monoContainsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
-# Build for Browser/wasm, with EnableAggressiveTrimming=true
+# iOS/tvOS devices - Full AOT + AggressiveTrimming to reduce size
+# Build the whole product using Mono and run libraries tests
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@@ -412,7 +375,8 @@ jobs:
buildConfig: Release
runtimeFlavor: mono
platforms:
- - Browser_wasm
+ - iOS_arm64
+ - tvOS_arm64
variables:
# map dependencies variables to local variables
- name: librariesContainsChange
@@ -421,21 +385,26 @@ jobs:
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
jobParameters:
testGroup: innerloop
- nameSuffix: AllSubsets_Mono_EAT
- buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:RunSmokeTestsOnly=false /p:EnableAggressiveTrimming=true /p:BuildAOTTestsOnHelix=true /p:RunAOTCompilation=false
+ nameSuffix: AllSubsets_Mono
+ buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true $(_runSmokeTestsOnlyArg) /p:BuildTestsOnHelix=true /p:UsePortableRuntimePack=true /p:BuildDarwinFrameworks=true
timeoutInMinutes: 180
+ condition: >-
+ or(
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- extraHelixArguments: /p:NeedsToBuildWasmAppsOnHelix=true /p:RunSmokeTestsOnly=false
- scenarios:
- - normal
+ extraHelixArguments: /p:NeedsToBuildAppsOnHelix=true
+ condition: >-
+ or(
+ eq(variables['librariesContainsChange'], true),
+ eq(variables['monoContainsChange'], true),
+ eq(variables['isRollingBuild'], true))
-#
-# Build for Browser/wasm with RunAOTCompilation=true
-#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/common/global-build-job.yml
@@ -443,7 +412,8 @@ jobs:
buildConfig: Release
runtimeFlavor: mono
platforms:
- - Browser_wasm
+ - Android_arm
+ - Android_arm64
variables:
# map dependencies variables to local variables
- name: librariesContainsChange
@@ -452,20 +422,27 @@ jobs:
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
jobParameters:
testGroup: innerloop
- nameSuffix: AllSubsets_Mono_AOT
- buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:RunSmokeTestsOnly=false /p:EnableAggressiveTrimming=true /p:BuildAOTTestsOnHelix=true /p:RunAOTCompilation=true
+ nameSuffix: AllSubsets_Mono
+ buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true $(_runSmokeTestsOnlyArg)
timeoutInMinutes: 180
+ condition: >-
+ or(
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- extraHelixArguments: /p:NeedsToBuildWasmAppsOnHelix=true /p:RunSmokeTestsOnly=false
- scenarios:
- - normal
+ condition: >-
+ or(
+ eq(variables['librariesContainsChange'], true),
+ eq(variables['monoContainsChange'], true),
+ eq(variables['isRollingBuild'], true))
#
-# Build for Browser/wasm and test it on NodeJS
+# Build for Browser/wasm and test it on v8, browser, and nodejs
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@@ -477,8 +454,6 @@ jobs:
- Browser_wasm
variables:
# map dependencies variables to local variables
- - name: librariesContainsChange
- value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
- name: monoContainsChange
value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
jobParameters:
@@ -488,57 +463,59 @@ jobs:
timeoutInMinutes: 180
condition: >-
or(
- eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
scenarios:
+ - normal
+ - WasmTestOnBrowser
- WasmTestOnNodeJs
condition: >-
or(
- eq(variables['librariesContainsChange'], true),
eq(variables['monoContainsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Build the whole product using Mono and run runtime tests
+# Build Mono release
+# Only when libraries, mono, or the runtime tests changed
+# Currently only these architectures are needed for the runtime tests.
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/mono/templates/build-job.yml
+ runtimeFlavor: mono
+ buildConfig: release
+ platforms:
+ - Linux_arm64
+ jobParameters:
+ condition: >-
+ or(
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
+ eq(variables['isRollingBuild'], true))
+
#
+# Mono Test builds with CoreCLR runtime tests using live libraries debug build
+# Only when Mono is changed
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
- buildConfig: Release
+ jobTemplate: /eng/pipelines/common/templates/runtimes/build-test-job.yml
+ buildConfig: release
runtimeFlavor: mono
platforms:
- - Browser_wasm
- variables:
- - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
- - name: _HelixSource
- value: pr/dotnet/runtime/$(Build.SourceBranch)
- - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- - name: _HelixSource
- value: ci/dotnet/runtime/$(Build.SourceBranch)
- - name: timeoutPerTestInMinutes
- value: 10
- - name: timeoutPerTestCollectionInMinutes
- value: 200
+ - CoreClrTestBuildHost # Either OSX_x64 or Linux_x64
jobParameters:
testGroup: innerloop
- nameSuffix: AllSubsets_Mono_RuntimeTests
- buildArgs: -s mono+libs -c $(_BuildConfig)
- timeoutInMinutes: 180
- # NOTE: Per PR test execution is not recommended for mobile runtime tests
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/common/templates/runtimes/wasm-runtime-and-send-to-helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+ condition: >-
+ or(
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
+ eq(variables['isRollingBuild'], true))
# Wasm debugger tests
- template: /eng/pipelines/common/platform-matrix.yml
@@ -561,8 +538,7 @@ jobs:
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_wasmdebuggertests.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
@@ -592,8 +568,7 @@ jobs:
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_wasmdebuggertests.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
@@ -630,9 +605,100 @@ jobs:
nameSuffix: AllSubsets_Mono_RuntimeTests
buildArgs: -s mono+libs -c $(_BuildConfig)
timeoutInMinutes: 240
- # NOTE: Per PR test execution is not recommended for mobile runtime tests
+ condition: >-
+ or(
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/common/templates/runtimes/android-runtime-and-send-to-helix.yml
extraStepsParameters:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+
+#
+# Build the whole product using Mono for Android and run runtime tests with interpreter
+#
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/common/global-build-job.yml
+ helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
+ buildConfig: Release
+ runtimeFlavor: mono
+ platforms:
+ - Android_x64
+ variables:
+ - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
+ - name: _HelixSource
+ value: pr/dotnet/runtime/$(Build.SourceBranch)
+ - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
+ - name: _HelixSource
+ value: ci/dotnet/runtime/$(Build.SourceBranch)
+ - name: timeoutPerTestInMinutes
+ value: 60
+ - name: timeoutPerTestCollectionInMinutes
+ value: 180
+ jobParameters:
+ testGroup: innerloop
+ nameSuffix: AllSubsets_Mono_RuntimeTests_Interp
+ buildArgs: -s mono+libs -c $(_BuildConfig)
+ timeoutInMinutes: 240
+ runtimeVariant: monointerpreter
+ condition: >-
+ or(
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
+ eq(variables['isRollingBuild'], true))
+ # NOTE: Per PR test execution is not recommended for runtime tests
+ ${{ if eq(variables['isRollingBuild'], true) }}:
+ # extra steps, run tests
+ extraStepsTemplate: /eng/pipelines/common/templates/runtimes/android-runtime-and-send-to-helix.yml
+ extraStepsParameters:
+ creator: dotnet-bot
+ testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+
+#
+# Mono CoreCLR runtime Test executions using live libraries in jit mode
+# Only when Mono is changed
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
+ buildConfig: release
+ runtimeFlavor: mono
+ platforms:
+ - Linux_arm64
+ helixQueueGroup: pr
+ helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
+ jobParameters:
+ testGroup: innerloop
+ liveLibrariesBuildConfig: Release
+ liveRuntimeBuildConfig: release
+ runtimeVariant: minijit
+ condition: >-
+ or(
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
+ eq(variables['isRollingBuild'], true))
+
+#
+# Mono CoreCLR runtime Test executions using live libraries in interpreter mode
+# Only when Mono is changed
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/common/templates/runtimes/run-test-job.yml
+ buildConfig: release
+ runtimeFlavor: mono
+ platforms:
+ - Linux_arm64
+ helixQueueGroup: pr
+ helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
+ jobParameters:
+ testGroup: innerloop
+ liveLibrariesBuildConfig: Release
+ liveRuntimeBuildConfig: release
+ runtimeVariant: monointerpreter
+ condition: >-
+ or(
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
+ eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
+ eq(variables['isRollingBuild'], true))
diff --git a/eng/pipelines/runtime-official.yml b/eng/pipelines/runtime-official.yml
index 34b0ae68c78e25..1ad7ad72d31716 100644
--- a/eng/pipelines/runtime-official.yml
+++ b/eng/pipelines/runtime-official.yml
@@ -416,7 +416,7 @@ stages:
- Build_Android_arm64_release_AllSubsets_Mono
- Build_Android_x86_release_AllSubsets_Mono
- Build_Android_x64_release_AllSubsets_Mono
- - Build_Browser_wasm_release_AllSubsets_Mono
+ - Build_Browser_wasm_Linux_release_AllSubsets_Mono
- Build_iOS_arm_release_AllSubsets_Mono
- Build_iOS_arm64_release_AllSubsets_Mono
- Build_iOSSimulator_x64_release_AllSubsets_Mono
diff --git a/eng/pipelines/runtime-staging.yml b/eng/pipelines/runtime-staging.yml
index 4288d372433df7..42803677d00371 100644
--- a/eng/pipelines/runtime-staging.yml
+++ b/eng/pipelines/runtime-staging.yml
@@ -75,7 +75,7 @@ jobs:
- iOSSimulator_x64
- tvOSSimulator_x64
# don't run tests on arm64 PRs until we can get significantly more devices
- - ${{ if eq(variables['isManualOrIsNotPR'], true) }}:
+ - ${{ if eq(variables['isRollingBuild'], true) }}:
- iOSSimulator_arm64
variables:
# map dependencies variables to local variables
@@ -93,8 +93,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
@@ -105,8 +104,7 @@ jobs:
or(
eq(variables['librariesContainsChange'], true),
eq(variables['monoContainsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# MacCatalyst interp - requires AOT Compilation and Interp flags
@@ -121,7 +119,7 @@ jobs:
platforms:
- MacCatalyst_x64
# don't run tests on arm64 PRs until we can get significantly more devices
- - ${{ if eq(variables['isFullMatrix'], true) }}:
+ - ${{ if eq(variables['isRollingBuild'], true) }}:
- MacCatalyst_arm64
variables:
# map dependencies variables to local variables
@@ -139,8 +137,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
@@ -149,10 +146,9 @@ jobs:
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
condition: >-
or(
- eq(variables['librariesContainsChange'], true),
- eq(variables['monoContainsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['librariesContainsChange'], true),
+ eq(variables['monoContainsChange'], true),
+ eq(variables['isRollingBuild'], true))
#
# MacCatalyst interp - requires AOT Compilation and Interp flags
@@ -168,7 +164,7 @@ jobs:
platforms:
- MacCatalyst_x64
# don't run tests on arm64 PRs until we can get significantly more devices
- - ${{ if eq(variables['isFullMatrix'], true) }}:
+ - ${{ if eq(variables['isRollingBuild'], true) }}:
- MacCatalyst_arm64
variables:
# map dependencies variables to local variables
@@ -185,8 +181,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
@@ -195,53 +190,9 @@ jobs:
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
condition: >-
or(
- eq(variables['librariesContainsChange'], true),
- eq(variables['monoContainsChange'], true),
- eq(variables['isFullMatrix'], true))
-
-#
-# iOS/tvOS devices - Full AOT + AggressiveTrimming to reduce size
-# Build the whole product using Mono and run libraries tests
-#
-- template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
- buildConfig: Release
- runtimeFlavor: mono
- platforms:
- - iOS_arm64
- - tvOS_arm64
- variables:
- # map dependencies variables to local variables
- - name: librariesContainsChange
- value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
- - name: monoContainsChange
- value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
- jobParameters:
- testGroup: innerloop
- nameSuffix: AllSubsets_Mono
- buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:RunAOTCompilation=true $(_runSmokeTestsOnlyArg) /p:BuildTestsOnHelix=true /p:UsePortableRuntimePack=true /p:BuildDarwinFrameworks=true
- timeoutInMinutes: 180
- condition: >-
- or(
- eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
- eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- extraHelixArguments: /p:NeedsToBuildAppsOnHelix=true
- condition: >-
- or(
- eq(variables['librariesContainsChange'], true),
- eq(variables['monoContainsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['librariesContainsChange'], true),
+ eq(variables['monoContainsChange'], true),
+ eq(variables['isRollingBuild'], true))
#
# Build the whole product using Mono and run libraries tests
@@ -271,88 +222,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- condition: >-
- or(
- eq(variables['librariesContainsChange'], true),
- eq(variables['monoContainsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
-
-- template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
- buildConfig: Release
- runtimeFlavor: mono
- platforms:
- - Android_arm
- - Android_arm64
- variables:
- # map dependencies variables to local variables
- - name: librariesContainsChange
- value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
- - name: monoContainsChange
- value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
- jobParameters:
- testGroup: innerloop
- nameSuffix: AllSubsets_Mono
- buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true $(_runSmokeTestsOnlyArg)
- timeoutInMinutes: 180
- condition: >-
- or(
- eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
- eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- condition: >-
- or(
- eq(variables['librariesContainsChange'], true),
- eq(variables['monoContainsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
-
-#
-# Build the whole product using Mono and run libraries tests
-#
-- template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
- buildConfig: Release
- runtimeFlavor: mono
- platforms:
- - Windows_x64
- variables:
- # map dependencies variables to local variables
- - name: librariesContainsChange
- value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
- - name: monoContainsChange
- value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
- jobParameters:
- testScope: innerloop
- nameSuffix: AllSubsets_Mono
- buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true
- timeoutInMinutes: 120
- condition: >-
- or(
- eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
- eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
@@ -362,50 +232,7 @@ jobs:
or(
eq(variables['librariesContainsChange'], true),
eq(variables['monoContainsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
-
-#
-# Build the whole product using Mono for Android and run runtime tests with interpreter
-#
-- template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
- buildConfig: Release
- runtimeFlavor: mono
- platforms:
- - Android_x64
- variables:
- - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
- - name: _HelixSource
- value: pr/dotnet/runtime/$(Build.SourceBranch)
- - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- - name: _HelixSource
- value: ci/dotnet/runtime/$(Build.SourceBranch)
- - name: timeoutPerTestInMinutes
- value: 60
- - name: timeoutPerTestCollectionInMinutes
- value: 180
- jobParameters:
- testGroup: innerloop
- nameSuffix: AllSubsets_Mono_RuntimeTests_Interp
- buildArgs: -s mono+libs -c $(_BuildConfig)
- timeoutInMinutes: 240
- runtimeVariant: monointerpreter
- condition: >-
- or(
- eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
- eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
- # NOTE: Per PR test execution is not recommended for runtime tests
- ${{ if eq(variables['isManualOrIsNotPR'], true) }}:
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/common/templates/runtimes/android-runtime-and-send-to-helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
+ eq(variables['isRollingBuild'], true))
#
# Build the whole product using Mono and run runtime tests with the JIT.
@@ -438,9 +265,8 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
- ${{ if eq(variables['isManualOrIsNotPR'], true) }}:
+ eq(variables['isRollingBuild'], true))
+ ${{ if eq(variables['isRollingBuild'], true) }}:
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/common/templates/runtimes/android-runtime-and-send-to-helix.yml
extraStepsParameters:
@@ -478,205 +304,16 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# don't run tests on PRs until we can get significantly more devices
# Turn off the testing for now, until https://github.com/dotnet/runtime/issues/60128 gets resolved
- # ${{ if eq(variables['isFullMatrix'], true) }}:
+ # ${{ if eq(variables['isRollingBuild'], true) }}:
# # extra steps, run tests
# extraStepsTemplate: /eng/pipelines/common/templates/runtimes/android-runtime-and-send-to-helix.yml
# extraStepsParameters:
# creator: dotnet-bot
# testRunNamePrefixSuffix: Mono_$(_BuildConfig)
-#
-# Build Browser_wasm, on windows, run console and browser tests
-#
-- template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
- buildConfig: release
- runtimeFlavor: mono
- platforms:
- - Browser_wasm_win
- variables:
- # map dependencies variables to local variables
- - name: librariesContainsChange
- value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
- - name: monoContainsChange
- value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
- jobParameters:
- testGroup: innerloop
- nameSuffix: Windows_wasm
- buildArgs: -subset mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:BrowserHost=windows $(_runSmokeTestsOnlyArg)
- timeoutInMinutes: 180
- condition: >-
- or(
- eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
- eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- extraHelixArguments: /p:BrowserHost=windows $(_runSmokeTestsOnlyArg)
- scenarios:
- - normal
- - WasmTestOnBrowser
- condition: >-
- or(
- eq(variables['librariesContainsChange'], true),
- eq(variables['monoContainsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
-
-#
-# Build Browser_wasm, on windows, and run tests with AOT
-#
-# Disabled due to https://github.com/dotnet/runtime/issues/61721
-- template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
- buildConfig: release
- runtimeFlavor: mono
- platforms:
- - Browser_wasm_win
- variables:
- # map dependencies variables to local variables
- - name: librariesContainsChange
- value: $[ dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'] ]
- - name: monoContainsChange
- value: $[ dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'] ]
- jobParameters:
- testGroup: innerloop
- nameSuffix: Windows_wasm_AOT
- buildArgs: -s mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:BrowserHost=windows /p:EnableAggressiveTrimming=true /p:BuildAOTTestsOnHelix=true /p:RunAOTCompilation=true $(_runSmokeTestsOnlyArg)
- timeoutInMinutes: 180
- condition: >-
- or(
- eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
- eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- extraHelixArguments: /p:BrowserHost=windows /p:NeedsToBuildWasmAppsOnHelix=true $(_runSmokeTestsOnlyArg)
- scenarios:
- - normal
- condition: >-
- or(
- eq(variables['librariesContainsChange'], true),
- eq(variables['monoContainsChange'], true),
- eq(variables['isFullMatrix'], true))
-
-#
-# Build Browser_wasm, on windows, and run Wasm.Build.Tests
-#
-- template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
- buildConfig: release
- runtimeFlavor: mono
- platforms:
- - Browser_wasm_win
- variables:
- # map dependencies variables to local variables
- - name: wasmbuildtestsContainsChange
- value: $[ dependencies.evaluate_paths.outputs['SetPathVars_wasmbuildtests.containsChange'] ]
- jobParameters:
- testGroup: innerloop
- nameSuffix: Windows_wasm_WBT
- buildArgs: -subset mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:BrowserHost=windows /p:TestWasmBuildTests=true /p:TestAssemblies=false
- timeoutInMinutes: 180
- condition: >-
- or(
- eq(dependencies.evaluate_paths.outputs['SetPathVars_wasmbuildtests.containsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- extraHelixArguments: /p:BrowserHost=windows
- scenarios:
- - buildwasmapps
- condition: >-
- or(
- eq(variables['wasmbuildtestsContainsChange'], true),
- eq(variables['isManualOrIsNotPR'], true),
- eq(variables['isFullMatrix'], true))
-
-# Wasm debugger tests
-- template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
- buildConfig: Release
- runtimeFlavor: mono
- platforms:
- - Browser_wasm
- variables:
- # map dependencies variables to local variables
- - name: wasmdebuggertestsContainsChange
- value: $[ dependencies.evaluate_paths.outputs['SetPathVars_wasmdebuggertests.containsChange'] ]
- jobParameters:
- testGroup: innerloop
- nameSuffix: Mono_DebuggerTests
- buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:TestWasmDebuggerTests=true /p:TestAssemblies=false
- timeoutInMinutes: 180
- condition: >-
- or(
- eq(dependencies.evaluate_paths.outputs['SetPathVars_wasmdebuggertests.containsChange'], true),
- eq(variables['isFullMatrix'], true))
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- scenarios:
- - wasmdebuggertests
-
-# Wasm debugger tests - windows
-- template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
- buildConfig: Release
- runtimeFlavor: mono
- platforms:
- - Browser_wasm_win
- variables:
- # map dependencies variables to local variables
- - name: wasmdebuggertestsContainsChange
- value: $[ dependencies.evaluate_paths.outputs['SetPathVars_wasmdebuggertests.containsChange'] ]
- jobParameters:
- testGroup: innerloop
- nameSuffix: Windows_wasm_DebuggerTests
- buildArgs: -s mono+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:TestWasmDebuggerTests=true /p:TestAssemblies=false /p:BrowserHost=windows
- timeoutInMinutes: 180
- condition: >-
- or(
- eq(dependencies.evaluate_paths.outputs['SetPathVars_wasmdebuggertests.containsChange'], true),
- eq(variables['isFullMatrix'], true))
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/libraries/helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
- extraHelixArguments: /p:BrowserHost=windows
- scenarios:
- - wasmdebuggertests
-
#
# CoreCLR Build for running Apple Silicon libraries-innerloop
#
@@ -685,7 +322,7 @@ jobs:
jobTemplate: /eng/pipelines/coreclr/templates/build-job.yml
buildConfig: release
platforms:
- - ${{ if eq(variables['isFullMatrix'], true) }}:
+ - ${{ if eq(variables['isRollingBuild'], true) }}:
- OSX_arm64
jobParameters:
testGroup: innerloop
@@ -697,12 +334,11 @@ jobs:
jobTemplate: /eng/pipelines/libraries/build-job.yml
buildConfig: Release
platforms:
- - ${{ if eq(variables['isFullMatrix'], true) }}:
+ - ${{ if eq(variables['isRollingBuild'], true) }}:
- OSX_arm64
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
isOfficialBuild: ${{ variables['isOfficialBuild'] }}
- isFullMatrix: ${{ variables['isFullMatrix'] }}
runTests: true
testScope: innerloop
liveRuntimeBuildConfig: release
diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml
index 5d7f3ffde2f81b..cfc899e8d808de 100644
--- a/eng/pipelines/runtime.yml
+++ b/eng/pipelines/runtime.yml
@@ -91,7 +91,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Build the whole product using GNU compiler toolchain
@@ -114,7 +114,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Build CoreCLR OSX_x64 checked
@@ -133,7 +133,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Build CoreCLR release
@@ -178,7 +178,7 @@ jobs:
#
# Build CoreCLR Formatting Job
# Only when CoreCLR is changed, and only in the 'main' branch (no release branches;
-# both CI and PR builds).
+# both Rolling and PR builds).
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@@ -194,7 +194,7 @@ jobs:
eq(variables['System.PullRequest.TargetBranch'], 'main')),
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr_jit.containsChange'], true),
- eq(variables['isFullMatrix'], true)))
+ eq(variables['isRollingBuild'], true)))
#
# CoreCLR NativeAOT debug build and smoke tests
@@ -277,7 +277,7 @@ jobs:
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# Build Mono AOT offset headers once, for consumption elsewhere
# Only when mono changed
@@ -297,7 +297,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# Build the whole product using Mono runtime
# Only when libraries, mono or installer are changed
@@ -323,7 +323,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@@ -343,7 +343,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Build the whole product using Mono and run libraries tests, multi-scenario
@@ -372,7 +372,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
@@ -385,7 +385,7 @@ jobs:
or(
eq(variables['librariesContainsChange'], true),
eq(variables['monoContainsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Build the whole product using Mono and run libraries tests, for Wasm.Build.Tests
@@ -410,7 +410,7 @@ jobs:
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_wasmbuildtests.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
@@ -420,8 +420,8 @@ jobs:
- buildwasmapps
condition: >-
or(
- eq(variables['wasmbuildtestsContainsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['wasmbuildtestsContainsChange'], true),
+ eq(variables['isRollingBuild'], true))
#
# Build for Browser/wasm, with EnableAggressiveTrimming=true
@@ -450,7 +450,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
@@ -463,7 +463,7 @@ jobs:
or(
eq(variables['librariesContainsChange'], true),
eq(variables['monoContainsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Build for Browser/wasm with RunAOTCompilation=true
@@ -492,7 +492,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# extra steps, run tests
extraStepsTemplate: /eng/pipelines/libraries/helix.yml
extraStepsParameters:
@@ -505,7 +505,7 @@ jobs:
or(
eq(variables['librariesContainsChange'], true),
eq(variables['monoContainsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
# Build and test libraries under single-file publishing
- template: /eng/pipelines/common/platform-matrix.yml
@@ -518,7 +518,6 @@ jobs:
- Linux_x64
jobParameters:
testGroup: innerloop
- isFullMatrix: ${{ variables.isFullMatrix }}
isSingleFile: true
nameSuffix: SingleFile
buildArgs: -s clr+libs+libs.tests -c $(_BuildConfig) /p:TestSingleFile=true /p:ArchiveTests=true
@@ -529,78 +528,6 @@ jobs:
creator: dotnet-bot
testRunNamePrefixSuffix: SingleFile_$(_BuildConfig)
-#
-# Build the whole product using Mono and run runtime tests
-#
-- template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
- buildConfig: Release
- runtimeFlavor: mono
- platforms:
- - Browser_wasm
- variables:
- - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
- - name: _HelixSource
- value: pr/dotnet/runtime/$(Build.SourceBranch)
- - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- - name: _HelixSource
- value: ci/dotnet/runtime/$(Build.SourceBranch)
- - name: timeoutPerTestInMinutes
- value: 10
- - name: timeoutPerTestCollectionInMinutes
- value: 200
- jobParameters:
- testGroup: innerloop
- nameSuffix: AllSubsets_Mono_RuntimeTests
- buildArgs: -s mono+libs -c $(_BuildConfig)
- timeoutInMinutes: 180
- condition: >-
- eq(variables['isFullMatrix'], true)
- # NOTE: Per PR test execution is not recommended for mobile runtime tests
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/common/templates/runtimes/wasm-runtime-and-send-to-helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
-
-#
-# Build the whole product using Mono for Android and run runtime tests with Android emulator
-#
-- template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/common/global-build-job.yml
- helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
- buildConfig: Release
- runtimeFlavor: mono
- platforms:
- - Android_x64
- variables:
- - ${{ if and(eq(variables['System.TeamProject'], 'public'), eq(variables['Build.Reason'], 'PullRequest')) }}:
- - name: _HelixSource
- value: pr/dotnet/runtime/$(Build.SourceBranch)
- - ${{ if and(eq(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- - name: _HelixSource
- value: ci/dotnet/runtime/$(Build.SourceBranch)
- - name: timeoutPerTestInMinutes
- value: 60
- - name: timeoutPerTestCollectionInMinutes
- value: 180
- jobParameters:
- testGroup: innerloop
- nameSuffix: AllSubsets_Mono_RuntimeTests
- buildArgs: -s mono+libs -c $(_BuildConfig)
- timeoutInMinutes: 240
- condition: >-
- eq(variables['isFullMatrix'], true)
- # NOTE: Per PR test execution is not recommended for mobile runtime tests
- # extra steps, run tests
- extraStepsTemplate: /eng/pipelines/common/templates/runtimes/android-runtime-and-send-to-helix.yml
- extraStepsParameters:
- creator: dotnet-bot
- testRunNamePrefixSuffix: Mono_$(_BuildConfig)
-
#
# Build Mono and Installer on LLVMJIT mode
#
@@ -621,7 +548,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@@ -641,7 +568,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Build Mono and Installer on LLVMAOT mode
@@ -664,7 +591,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@@ -683,7 +610,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Build Mono debug
@@ -709,7 +636,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Build Mono release AOT cross-compilers
@@ -740,7 +667,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@@ -767,7 +694,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_installer.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Build Mono release
@@ -790,7 +717,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Build Mono release
@@ -810,7 +737,7 @@ jobs:
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Build Mono release with LLVM AOT
@@ -830,7 +757,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Build libraries using live CoreLib
@@ -849,8 +776,6 @@ jobs:
- windows_arm
- windows_arm64
- windows_x86
- jobParameters:
- liveRuntimeBuildConfig: release
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@@ -864,9 +789,12 @@ jobs:
- OSX_x64
- windows_x64
- FreeBSD_x64
+ - ${{ if eq(variables['isRollingBuild'], false) }}:
+ # we need to build windows_x86 for debug on PRs in order to test
+ # against a checked runtime when the PR contains coreclr changes
+ - windows_x86
jobParameters:
testScope: innerloop
- liveRuntimeBuildConfig: release
#
# Libraries Build that only run when coreclr is changed
@@ -874,7 +802,7 @@ jobs:
# and those are already built above
#
-- ${{ if eq(variables['isFullMatrix'], false) }}:
+- ${{ if eq(variables['isRollingBuild'], false) }}:
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/libraries/build-job.yml
@@ -884,45 +812,24 @@ jobs:
- Linux_musl_arm
- Linux_musl_arm64
jobParameters:
- liveRuntimeBuildConfig: release
condition: >-
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true)
-#
-# Libraries Build that only run when libraries is changed
-#
-- template: /eng/pipelines/common/platform-matrix.yml
- parameters:
- jobTemplate: /eng/pipelines/libraries/build-job.yml
- buildConfig: ${{ variables.debugOnPrReleaseOnRolling }}
- platforms:
- - ${{ if eq(variables['isFullMatrix'], false) }}:
- - windows_x86
- jobParameters:
- liveRuntimeBuildConfig: release
- condition: >-
- or(
- eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
- eq(variables['isFullMatrix'], true))
-
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/libraries/build-job.yml
buildConfig: Release
platforms:
- windows_x86
- - ${{ if eq(variables['isFullMatrix'], true) }}:
- - windows_x64
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
- isFullMatrix: ${{ variables.isFullMatrix }}
framework: net48
runTests: true
testScope: innerloop
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@@ -931,14 +838,13 @@ jobs:
platforms:
- windows_x64
jobParameters:
- isFullMatrix: ${{ variables.isFullMatrix }}
framework: allConfigurations
runTests: true
useHelix: false
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Installer Build and Test
@@ -1006,7 +912,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# CoreCLR Test executions using live libraries
@@ -1029,7 +935,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@@ -1049,7 +955,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@@ -1065,7 +971,7 @@ jobs:
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr_AppleSilicon.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Mono Test builds with CoreCLR runtime tests using live libraries debug build
@@ -1083,7 +989,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Mono CoreCLR runtime Test executions using live libraries in jit mode
@@ -1095,8 +1001,6 @@ jobs:
runtimeFlavor: mono
platforms:
- OSX_x64
- - ${{ if eq(variables['isFullMatrix'], true) }}:
- - Linux_arm64
helixQueueGroup: pr
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
jobParameters:
@@ -1108,7 +1012,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Mono CoreCLR runtime Test executions using live libraries in interpreter mode
@@ -1120,8 +1024,6 @@ jobs:
runtimeFlavor: mono
platforms:
- OSX_x64
- - ${{ if eq(variables['isFullMatrix'], true) }}:
- - Linux_arm64
helixQueueGroup: pr
helixQueuesTemplate: /eng/pipelines/coreclr/templates/helix-queues-setup.yml
jobParameters:
@@ -1133,7 +1035,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Mono CoreCLR runtime Test executions using live libraries and LLVM AOT
# Only when Mono is changed
@@ -1158,7 +1060,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Mono CoreCLR runtime Test executions using live libraries and LLVM Full AOT
@@ -1184,7 +1086,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_runtimetests.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Libraries Release Test Execution against a release mono runtime.
@@ -1203,7 +1105,6 @@ jobs:
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
isOfficialBuild: false
- isFullMatrix: ${{ variables.isFullMatrix }}
runtimeDisplayName: mono
testScope: innerloop
liveRuntimeBuildConfig: release
@@ -1211,7 +1112,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Libraries Release Test Execution against a release mono interpreter runtime.
@@ -1229,7 +1130,6 @@ jobs:
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
isOfficialBuild: false
- isFullMatrix: ${{ variables.isFullMatrix }}
interpreter: true
runtimeDisplayName: mono_interpreter
testScope: innerloop
@@ -1238,7 +1138,7 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_mono.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Libraries Release Test Execution against a release coreclr runtime
@@ -1250,18 +1150,15 @@ jobs:
buildConfig: Release
platforms:
- windows_x86
- - ${{ if eq(variables['isFullMatrix'], true) }}:
- - windows_arm64
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
isOfficialBuild: false
- isFullMatrix: ${{ variables.isFullMatrix }}
testScope: innerloop
liveRuntimeBuildConfig: release
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Libraries Debug Test Execution against a release coreclr runtime
@@ -1276,20 +1173,15 @@ jobs:
- OSX_x64
- Linux_x64
- Linux_musl_x64
- - ${{ if eq(variables['isFullMatrix'], true) }}:
- - Linux_arm64
- - ${{ if eq(variables['isFullMatrix'], false) }}:
- - windows_x86
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
isOfficialBuild: false
- isFullMatrix: ${{ variables.isFullMatrix }}
testScope: innerloop
liveRuntimeBuildConfig: release
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Libraries Test Execution against a checked runtime
@@ -1313,7 +1205,7 @@ jobs:
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
#
# Libraries Test Execution against a checked runtime
@@ -1335,7 +1227,7 @@ jobs:
condition: >-
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@@ -1352,4 +1244,4 @@ jobs:
or(
eq(dependencies.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'], true),
eq(dependencies.evaluate_paths.outputs['SetPathVars_libraries.containsChange'], true),
- eq(variables['isFullMatrix'], true))
+ eq(variables['isRollingBuild'], true))
diff --git a/eng/pipelines/runtimelab.yml b/eng/pipelines/runtimelab.yml
index 9f1cd90822e832..27e954a9a70267 100644
--- a/eng/pipelines/runtimelab.yml
+++ b/eng/pipelines/runtimelab.yml
@@ -190,7 +190,7 @@ stages:
- Linux_x64
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
- isFullMatrix: false
+ isRollingBuild: false
isOfficialBuild: false
testScope: innerloop
liveRuntimeBuildConfig: Release
@@ -207,7 +207,7 @@ stages:
- windows_x64
helixQueuesTemplate: /eng/pipelines/libraries/helix-queues-setup.yml
jobParameters:
- isFullMatrix: false
+ isRollingBuild: false
isOfficialBuild: false
testScope: innerloop
liveRuntimeBuildConfig: Release
diff --git a/eng/run-test.sh b/eng/run-test.sh
index 64474cc435af16..0475cff40cd839 100644
--- a/eng/run-test.sh
+++ b/eng/run-test.sh
@@ -31,7 +31,7 @@ usage()
echo " default: Debug"
echo " --os OS to run (FreeBSD, Linux, NetBSD, illumos or Solaris)"
echo " default: detect current OS"
- echo " --arch Architecture to run (x64, arm, armel, x86, arm64)"
+ echo " --arch Architecture to run (x64, arm, armel, x86, arm64, loongarch64)"
echo " default: detect current architecture"
echo
echo "Execution options:"
diff --git a/eng/targetingpacks.targets b/eng/targetingpacks.targets
index 9dd37bef8fa1c3..4213c84e709d9c 100644
--- a/eng/targetingpacks.targets
+++ b/eng/targetingpacks.targets
@@ -33,7 +33,7 @@
LatestRuntimeFrameworkVersion="$(ProductVersion)"
RuntimeFrameworkName="$(LocalFrameworkOverrideName)"
RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.**RID**"
- RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64"
+ RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-loongarch64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;tizen.4.0.0-armel;tizen.5.0.0-armel;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64"
TargetFramework="$(NetCoreAppCurrent)"
TargetingPackName="$(LocalFrameworkOverrideName).Ref"
TargetingPackVersion="$(ProductVersion)"
@@ -43,13 +43,13 @@
RuntimeFrameworkName="$(LocalFrameworkOverrideName)"
LatestRuntimeFrameworkVersion="$(ProductVersion)"
RuntimePackNamePatterns="$(LocalFrameworkOverrideName).Runtime.Mono.**RID**"
- RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86"
+ RuntimePackRuntimeIdentifiers="linux-arm;linux-arm64;linux-musl-arm64;linux-loongarch64;linux-musl-x64;linux-x64;osx-x64;rhel.6-x64;win-arm;win-arm64;win-x64;win-x86;linux-musl-arm;osx-arm64;maccatalyst-x64;maccatalyst-arm64;browser-wasm;ios-arm64;ios-arm;iossimulator-arm64;iossimulator-x64;iossimulator-x86;tvos-arm64;tvossimulator-arm64;tvossimulator-x64;android-arm64;android-arm;android-x64;android-x86"
RuntimePackLabels="Mono"
Condition="'@(KnownRuntimePack)' == '' or !@(KnownRuntimePack->AnyHaveMetadataValue('TargetFramework', '$(NetCoreAppCurrent)'))"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/eng/testing/tests.ioslike.targets b/eng/testing/tests.ioslike.targets
index 8c7a6a44a5d22f..c41a0d28e03375 100644
--- a/eng/testing/tests.ioslike.targets
+++ b/eng/testing/tests.ioslike.targets
@@ -130,7 +130,6 @@
-
@@ -169,6 +168,7 @@
+
diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets
index 192363c4b170a1..da8da1d2f4bfa9 100644
--- a/eng/testing/tests.mobile.targets
+++ b/eng/testing/tests.mobile.targets
@@ -198,7 +198,8 @@
+ AfterTargets="ComputeResolvedFilesToPublishList"
+ Condition="'$(TestFramework)' == 'xunit'">
<_runnerFilesToPublish Include="$(AndroidTestRunnerDir)*" Condition="'$(TargetOS)' == 'Android'" />
<_runnerFilesToPublish Include="$(AppleTestRunnerDir)*" Condition="'$(TargetOS)' == 'MacCatalyst' or '$(TargetOS)' == 'iOS' or '$(TargetOS)' == 'iOSSimulator' or '$(TargetOS)' == 'tvOS' or '$(TargetOS)' == 'tvOSSimulator'" />
diff --git a/eng/testing/tests.props b/eng/testing/tests.props
index a6a9034a8099d2..3025ab62335049 100644
--- a/eng/testing/tests.props
+++ b/eng/testing/tests.props
@@ -7,6 +7,7 @@
$(TestDependsOn);GenerateRunScript;RunTeststrue$(MSBuildThisFileDirectory)ILLinkDescriptors\
+ true
@@ -38,6 +39,10 @@
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/eng/testing/tests.targets b/eng/testing/tests.targets
index 6706d6e6d64529..5874fa58f8a5ec 100644
--- a/eng/testing/tests.targets
+++ b/eng/testing/tests.targets
@@ -110,13 +110,18 @@
-
+ "$(RunScriptOutputPath)"$(RunTestsCommand) --runtime-path "$(NetCoreAppCurrentTestHostPath.TrimEnd('\/'))"$(RunTestsCommand) --rsp-file "$(TestRspFile)"
- "$(RunScriptOutputPath)" $(AssemblyName) $(TargetArchitecture) $(TargetOS.ToLowerInvariant()) $(TestProjectName) $(AdditionalXHarnessArguments)
+
+
+
+ "$(RunScriptOutputPath)" $(AssemblyName) $(TargetArchitecture) $(TargetOS.ToLowerInvariant()) $(TestProjectName)
+ $(RunTestsCommand) $(Configuration) $(AdditionalXHarnessArguments)
+ $(RunTestsCommand) $(AdditionalXHarnessArguments)"$(RunScriptOutputPath)" $(JSEngine) $(AssemblyName).dll $(Scenario)
diff --git a/eng/testing/tests.wasm.targets b/eng/testing/tests.wasm.targets
index 273ab76ef90a3f..bed571a3064021 100644
--- a/eng/testing/tests.wasm.targets
+++ b/eng/testing/tests.wasm.targets
@@ -29,13 +29,13 @@
See also eng\testing\WasmRunnerTemplate.sh
-->
-
+
-
+
@@ -47,7 +47,8 @@
<_XHarnessArgs Condition="'$(IsFunctionalTest)' == 'true'" >$(_XHarnessArgs) --expected-exit-code=$(ExpectedExitCode)
<_XHarnessArgs Condition="'$(WasmXHarnessArgs)' != ''" >$(_XHarnessArgs) $(WasmXHarnessArgs)
- <_AppArgs Condition="'$(IsFunctionalTest)' != 'true' and '$(Scenario)' != 'BuildWasmApps'">--run WasmTestRunner.dll $(AssemblyName).dll
+ <_AppArgs Condition="'$(IsFunctionalTest)' != 'true' and '$(Scenario)' != 'BuildWasmApps' and '$(WasmMainAssemblyFileName)' == ''">--run WasmTestRunner.dll $(AssemblyName).dll
+ <_AppArgs Condition="'$(IsFunctionalTest)' != 'true' and '$(WasmMainAssemblyFileName)' != ''">--run $(WasmMainAssemblyFileName)
<_AppArgs Condition="'$(IsFunctionalTest)' == 'true'">--run $(AssemblyName).dll
<_AppArgs Condition="'$(WasmTestAppArgs)' != ''">$(_AppArgs) $(WasmTestAppArgs)
diff --git a/eng/testing/xunit/xunit.props b/eng/testing/xunit/xunit.props
index 3f9c4b67141a2f..a2ed68f1ecbc96 100644
--- a/eng/testing/xunit/xunit.props
+++ b/eng/testing/xunit/xunit.props
@@ -10,6 +10,7 @@
+
diff --git a/global.json b/global.json
index e2c9f881274f55..6e753c749b04a4 100644
--- a/global.json
+++ b/global.json
@@ -12,12 +12,12 @@
"python3": "3.7.1"
},
"msbuild-sdks": {
- "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "7.0.0-beta.21621.3",
- "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.21621.3",
- "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.21621.3",
- "Microsoft.DotNet.SharedFramework.Sdk": "7.0.0-beta.21621.3",
+ "Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "7.0.0-beta.22068.3",
+ "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22068.3",
+ "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.22068.3",
+ "Microsoft.DotNet.SharedFramework.Sdk": "7.0.0-beta.22068.3",
"Microsoft.Build.NoTargets": "3.1.0",
"Microsoft.Build.Traversal": "3.0.23",
- "Microsoft.NET.Sdk.IL": "7.0.0-alpha.1.21620.1"
+ "Microsoft.NET.Sdk.IL": "7.0.0-alpha.1.22066.4"
}
}
diff --git a/src/coreclr/.nuget/Microsoft.ILVerification/Microsoft.ILVerification.pkgproj b/src/coreclr/.nuget/Microsoft.ILVerification/Microsoft.ILVerification.pkgproj
index db820d395a1256..685f9415101950 100644
--- a/src/coreclr/.nuget/Microsoft.ILVerification/Microsoft.ILVerification.pkgproj
+++ b/src/coreclr/.nuget/Microsoft.ILVerification/Microsoft.ILVerification.pkgproj
@@ -15,7 +15,7 @@
lib\netstandard2.0\ILVerification.dll
- 1.8.1
+ $(SystemReflectionMetadataVersion)netstandard2.0Build,Analyzers
diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt
index 2440f6ca999cad..38e5488938b6d7 100644
--- a/src/coreclr/CMakeLists.txt
+++ b/src/coreclr/CMakeLists.txt
@@ -247,7 +247,6 @@ add_subdirectory(debug)
add_subdirectory(binder)
add_subdirectory(classlibnative)
add_subdirectory(dlls)
-add_subdirectory(ToolBox)
add_subdirectory(tools)
add_subdirectory(unwinder)
add_subdirectory(interop)
diff --git a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj
index f62c8b95b7c143..e1230d59401d86 100644
--- a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj
+++ b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj
@@ -78,6 +78,10 @@
AnyCPU$(DefineConstants);TARGET_ARM64
+
+ AnyCPU
+ $(DefineConstants);TARGET_LOONGARCH64
+
diff --git a/src/coreclr/System.Private.CoreLib/src/System/Math.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/Math.CoreCLR.cs
index c86aa1b2e62bfe..a619dc4b1ca795 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/Math.CoreCLR.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/Math.CoreCLR.cs
@@ -16,14 +16,6 @@ namespace System
{
public static partial class Math
{
- [Intrinsic]
- [MethodImpl(MethodImplOptions.InternalCall)]
- public static extern double Abs(double value);
-
- [Intrinsic]
- [MethodImpl(MethodImplOptions.InternalCall)]
- public static extern float Abs(float value);
-
[Intrinsic]
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern double Acos(double d);
diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs
index 44884c129e2374..fe5da8367cdd43 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs
@@ -46,7 +46,7 @@ internal static string UnmangleTypeName(string typeName)
while (true)
{
i = typeName.LastIndexOf('+', i);
- if (i == -1)
+ if (i < 0)
{
break;
}
@@ -626,7 +626,7 @@ internal Type[] GetTypesNoLock()
{
// Are there any possible special characters left?
int i = className.AsSpan(startIndex).IndexOfAny('[', '*', '&');
- if (i == -1)
+ if (i < 0)
{
// No, type name is simple.
baseName = className;
diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
index 36fe011d10d4f5..6d9b8121fa6b42 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilder.cs
@@ -527,7 +527,7 @@ internal TypeBuilder(
}
int iLast = fullname.LastIndexOf('.');
- if (iLast == -1 || iLast == 0)
+ if (iLast <= 0)
{
// no name space
m_strNameSpace = string.Empty;
diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs
index dd9c22987203a8..cba7d80fa15b09 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs
@@ -523,7 +523,7 @@ public override string Name
int i = s.LastIndexOf(System.IO.Path.DirectorySeparatorChar);
- if (i == -1)
+ if (i < 0)
return s;
return s.Substring(i + 1);
diff --git a/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs b/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs
index 240a78ecfdde75..977d73e5c3b990 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs
@@ -15,7 +15,7 @@
namespace System
{
[NonVersionable]
- public unsafe partial struct RuntimeTypeHandle : ISerializable
+ public unsafe partial struct RuntimeTypeHandle : IEquatable, ISerializable
{
// Returns handle for interop with EE. The handle is guaranteed to be non-null.
internal RuntimeTypeHandle GetNativeHandle()
@@ -814,7 +814,7 @@ RuntimeMethodHandleInternal Value
}
[NonVersionable]
- public unsafe partial struct RuntimeMethodHandle : ISerializable
+ public unsafe partial struct RuntimeMethodHandle : IEquatable, ISerializable
{
// Returns handle for interop with EE. The handle is guaranteed to be non-null.
internal static IRuntimeMethodInfo EnsureNonNullMethodInfo(IRuntimeMethodInfo method)
@@ -1139,7 +1139,7 @@ internal sealed class RuntimeFieldInfoStub : IRuntimeFieldInfo
}
[NonVersionable]
- public unsafe struct RuntimeFieldHandle : ISerializable
+ public unsafe struct RuntimeFieldHandle : IEquatable, ISerializable
{
// Returns handle for interop with EE. The handle is guaranteed to be non-null.
internal RuntimeFieldHandle GetNativeHandle()
diff --git a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
index 2c7bb900641aaf..a0d7026b544078 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
@@ -1992,8 +1992,8 @@ private static void SplitName(string? fullname, out string? name, out string? ns
return;
// Get namespace
- int nsDelimiter = fullname.LastIndexOf(".", StringComparison.Ordinal);
- if (nsDelimiter != -1)
+ int nsDelimiter = fullname.LastIndexOf('.');
+ if (nsDelimiter >= 0)
{
ns = fullname.Substring(0, nsDelimiter);
int nameLength = fullname.Length - ns.Length - 1;
diff --git a/src/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs b/src/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs
index 406e1dc8c533da..d51fca9673e39c 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs
@@ -184,7 +184,7 @@ internal static unsafe void ConvertFixedToNative(int flags, string strManaged, I
internal static unsafe string ConvertFixedToManaged(IntPtr cstr, int length)
{
int end = SpanHelpers.IndexOf(ref *(byte*)cstr, 0, length);
- if (end != -1)
+ if (end >= 0)
{
length = end;
}
@@ -512,7 +512,7 @@ internal static unsafe void ConvertToNative(string? strManaged, IntPtr nativeHom
internal static unsafe string ConvertToManaged(IntPtr nativeHome, int length)
{
int end = SpanHelpers.IndexOf(ref *(char*)nativeHome, '\0', length);
- if (end != -1)
+ if (end >= 0)
{
length = end;
}
diff --git a/src/coreclr/ToolBox/CMakeLists.txt b/src/coreclr/ToolBox/CMakeLists.txt
deleted file mode 100644
index 4e7f4368681d1d..00000000000000
--- a/src/coreclr/ToolBox/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-add_subdirectory(SOS)
-add_subdirectory(superpmi)
diff --git a/src/coreclr/binder/assemblybindercommon.cpp b/src/coreclr/binder/assemblybindercommon.cpp
index 830c673ea06a63..7b48a0a90ce831 100644
--- a/src/coreclr/binder/assemblybindercommon.cpp
+++ b/src/coreclr/binder/assemblybindercommon.cpp
@@ -972,7 +972,7 @@ namespace BINDER_SPACE
{
// Search Assembly.ni.dll, then Assembly.dll
// The Assembly.ni.dll paths are rare, and intended for supporting managed C++ R2R assemblies.
- SString candidates[] = { W(".ni.dll"), W(".dll") };
+ const WCHAR* const candidates[] = { W(".ni.dll"), W(".dll") };
// Loop through the binding paths looking for a matching assembly
for (int i = 0; i < 2; i++)
diff --git a/src/coreclr/binder/bindertracing.cpp b/src/coreclr/binder/bindertracing.cpp
index 499e20d928887f..e349b99b3c14e0 100644
--- a/src/coreclr/binder/bindertracing.cpp
+++ b/src/coreclr/binder/bindertracing.cpp
@@ -176,8 +176,8 @@ namespace BinderTracing
{
static thread_local bool t_AssemblyLoadStartInProgress = false;
- AssemblyBindOperation::AssemblyBindOperation(AssemblySpec *assemblySpec, const WCHAR *assemblyPath)
- : m_bindRequest { assemblySpec, nullptr, assemblyPath }
+ AssemblyBindOperation::AssemblyBindOperation(AssemblySpec *assemblySpec, const SString& assemblyPath)
+ : m_bindRequest { assemblySpec, SString::Empty(), assemblyPath }
, m_populatedBindRequest { false }
, m_checkedIgnoreBind { false }
, m_ignoreBind { false }
diff --git a/src/coreclr/binder/inc/bindertracing.h b/src/coreclr/binder/inc/bindertracing.h
index 75d8270b8eee51..ca28c045196388 100644
--- a/src/coreclr/binder/inc/bindertracing.h
+++ b/src/coreclr/binder/inc/bindertracing.h
@@ -27,7 +27,7 @@ namespace BinderTracing
{
public:
// This class assumes the assembly spec will have a longer lifetime than itself
- AssemblyBindOperation(AssemblySpec *assemblySpec, const WCHAR *assemblyPath = nullptr);
+ AssemblyBindOperation(AssemblySpec *assemblySpec, const SString& assemblyPath = SString::Empty());
~AssemblyBindOperation();
void SetResult(PEAssembly *assembly, bool cached = false);
diff --git a/src/coreclr/binder/textualidentityparser.cpp b/src/coreclr/binder/textualidentityparser.cpp
index 5d85a0a71cf377..f69e0bf66b202b 100644
--- a/src/coreclr/binder/textualidentityparser.cpp
+++ b/src/coreclr/binder/textualidentityparser.cpp
@@ -77,7 +77,7 @@ namespace BINDER_SPACE
}
}
- inline void BinToUnicodeHex(const BYTE *pSrc, UINT cSrc, __out_ecount(2*cSrc) LPWSTR pDst)
+ inline void BinToUnicodeHex(const BYTE *pSrc, UINT cSrc, _Out_writes_(2*cSrc) LPWSTR pDst)
{
UINT x;
UINT y;
diff --git a/src/coreclr/build-runtime.cmd b/src/coreclr/build-runtime.cmd
index ed9d735a7d4285..30cd7d2785267a 100644
--- a/src/coreclr/build-runtime.cmd
+++ b/src/coreclr/build-runtime.cmd
@@ -345,6 +345,9 @@ for /f "delims=" %%a in ("-%__RequestedBuildComponents%-") do (
if not "!string:-nativeaot-=!"=="!string!" (
set __CMakeTarget=!__CMakeTarget! nativeaot
)
+ if not "!string:-spmi-=!"=="!string!" (
+ set __CMakeTarget=!__CMakeTarget! spmi
+ )
)
if [!__CMakeTarget!] == [] (
set __CMakeTarget=install
@@ -745,7 +748,7 @@ echo -all: Builds all configurations and platforms.
echo Build architecture: one of -x64, -x86, -arm, -arm64 ^(default: -x64^).
echo Build type: one of -Debug, -Checked, -Release ^(default: -Debug^).
echo -component ^ : specify this option one or more times to limit components built to those specified.
-echo Allowed ^: hosts jit alljits runtime paltests iltools
+echo Allowed ^: hosts jit alljits runtime paltests iltools nativeaot spmi
echo -enforcepgo: verify after the build that PGO was used for key DLLs, and fail the build if not
echo -pgoinstrument: generate instrumented code for profile guided optimization enabled binaries.
echo -cmakeargs: user-settable additional arguments passed to CMake.
diff --git a/src/coreclr/build-runtime.sh b/src/coreclr/build-runtime.sh
index 09529929492821..a1e03198ac6dff 100755
--- a/src/coreclr/build-runtime.sh
+++ b/src/coreclr/build-runtime.sh
@@ -22,7 +22,7 @@ usage_list+=("-pgodatapath: path to profile guided optimization data.")
usage_list+=("-pgoinstrument: generate instrumented code for profile guided optimization enabled binaries.")
usage_list+=("-skipcrossarchnative: Skip building cross-architecture native binaries.")
usage_list+=("-staticanalyzer: use scan_build static analyzer.")
-usage_list+=("-component: Build individual components instead of the full project. Available options are 'hosts', 'jit', 'runtime', 'paltests', 'alljits', 'iltools', and 'nativeaot'. Can be specified multiple times.")
+usage_list+=("-component: Build individual components instead of the full project. Available options are 'hosts', 'jit', 'runtime', 'paltests', 'alljits', 'iltools', 'nativeaot', and 'spmi'. Can be specified multiple times.")
setup_dirs_local()
{
@@ -50,6 +50,8 @@ build_cross_architecture_components()
__SkipCrossArchBuild=0
elif [[ "$__BuildArch" == "arm64" && "$__CrossArch" == "x64" ]]; then
__SkipCrossArchBuild=0
+ elif [[ "$__BuildArch" == "loongarch64" && "$__CrossArch" == "x64" ]]; then
+ __SkipCrossArchBuild=0
else
# not supported
return
diff --git a/src/coreclr/classlibnative/bcltype/arraynative.cpp b/src/coreclr/classlibnative/bcltype/arraynative.cpp
index 738fd98c7f9e76..ca60fa978a626c 100644
--- a/src/coreclr/classlibnative/bcltype/arraynative.cpp
+++ b/src/coreclr/classlibnative/bcltype/arraynative.cpp
@@ -1154,23 +1154,25 @@ FCIMPL2_IV(void, ArrayNative::InitializeArray, ArrayBase* pArrayRef, FCALLRuntim
}
FCIMPLEND
-FCIMPL3(void*, ArrayNative::GetSpanDataFrom, FCALLRuntimeFieldHandle structField, FCALLRuntimeTypeHandle targetType, INT32* count)
+FCIMPL3_VVI(void*, ArrayNative::GetSpanDataFrom, FCALLRuntimeFieldHandle structField, FCALLRuntimeTypeHandle targetTypeUnsafe, INT32* count)
{
FCALL_CONTRACT;
struct
{
REFLECTFIELDREF refField;
+ REFLECTCLASSBASEREF refClass;
} gc;
gc.refField = (REFLECTFIELDREF)ObjectToOBJECTREF(FCALL_RFH_TO_REFLECTFIELD(structField));
+ gc.refClass = (REFLECTCLASSBASEREF)ObjectToOBJECTREF(FCALL_RTH_TO_REFLECTCLASS(targetTypeUnsafe));
void* data;
- HELPER_METHOD_FRAME_BEGIN_RET_1(gc);
+ HELPER_METHOD_FRAME_BEGIN_RET_PROTECT(gc);
FieldDesc* pField = (FieldDesc*)gc.refField->GetField();
if (!pField->IsRVA())
COMPlusThrow(kArgumentException);
- TypeHandle targetTypeHandle = FCALL_RTH_TO_REFLECTCLASS(targetType)->GetType();
+ TypeHandle targetTypeHandle = gc.refClass->GetType();
if (!CorTypeInfo::IsPrimitiveType(targetTypeHandle.GetSignatureCorElementType()) && !targetTypeHandle.IsEnum())
COMPlusThrow(kArgumentException);
@@ -1180,8 +1182,9 @@ FCIMPL3(void*, ArrayNative::GetSpanDataFrom, FCALLRuntimeFieldHandle structField
// Report the RVA field to the logger.
g_IBCLogger.LogRVADataAccess(pField);
- _ASSERTE(data != NULL && count != NULL);
data = pField->GetStaticAddressHandle(NULL);
+ _ASSERTE(data != NULL);
+ _ASSERTE(count != NULL);
if (AlignUp((UINT_PTR)data, targetTypeSize) != (UINT_PTR)data)
COMPlusThrow(kArgumentException);
diff --git a/src/coreclr/classlibnative/bcltype/arraynative.h b/src/coreclr/classlibnative/bcltype/arraynative.h
index 6a1c8979525cdb..bd74be3d3ea6ac 100644
--- a/src/coreclr/classlibnative/bcltype/arraynative.h
+++ b/src/coreclr/classlibnative/bcltype/arraynative.h
@@ -48,7 +48,7 @@ class ArrayNative
// This method will acquire data to create a span from a TypeHandle
// to a field.
- static FCDECL3(void*, GetSpanDataFrom, FCALLRuntimeFieldHandle structField, FCALLRuntimeTypeHandle targetType, INT32* count);
+ static FCDECL3_VVI(void*, GetSpanDataFrom, FCALLRuntimeFieldHandle structField, FCALLRuntimeTypeHandle targetTypeUnsafe, INT32* count);
private:
// Helper for CreateInstance
diff --git a/src/coreclr/classlibnative/float/floatdouble.cpp b/src/coreclr/classlibnative/float/floatdouble.cpp
index 67aceb60ea13e6..d20b772eb2207c 100644
--- a/src/coreclr/classlibnative/float/floatdouble.cpp
+++ b/src/coreclr/classlibnative/float/floatdouble.cpp
@@ -42,15 +42,6 @@
#pragma float_control(precise, off)
#endif
-/*=====================================Abs======================================
-**
-==============================================================================*/
-FCIMPL1_V(double, COMDouble::Abs, double x)
- FCALL_CONTRACT;
-
- return fabs(x);
-FCIMPLEND
-
/*=====================================Acos=====================================
**
==============================================================================*/
diff --git a/src/coreclr/classlibnative/float/floatsingle.cpp b/src/coreclr/classlibnative/float/floatsingle.cpp
index 965998fbaa2ba3..1694fd78cb8467 100644
--- a/src/coreclr/classlibnative/float/floatsingle.cpp
+++ b/src/coreclr/classlibnative/float/floatsingle.cpp
@@ -8,18 +8,6 @@
#include "floatsingle.h"
-// Windows x86 and Windows ARM/ARM64 may not define _isnanf() or _copysignf() but they do
-// define _isnan() and _copysign(). We will redirect the macros to these other functions if
-// the macro is not defined for the platform. This has the side effect of a possible implicit
-// upcasting for arguments passed in and an explicit downcasting for the _copysign() call.
-#if (defined(TARGET_X86) || defined(TARGET_ARM) || defined(TARGET_ARM64)) && !defined(TARGET_UNIX)
-
-#if !defined(_copysignf)
-#define _copysignf (float)_copysign
-#endif
-
-#endif
-
// The default compilation mode is /fp:precise, which disables floating-point intrinsics. This
// default compilation mode has previously caused performance regressions in floating-point code.
// We enable /fp:fast semantics for the majority of the math functions, as it will speed up performance
@@ -40,15 +28,6 @@
#pragma float_control(precise, off)
#endif
-/*=====================================Abs=====================================
-**
-==============================================================================*/
-FCIMPL1_V(float, COMSingle::Abs, float x)
- FCALL_CONTRACT;
-
- return fabsf(x);
-FCIMPLEND
-
/*=====================================Acos=====================================
**
==============================================================================*/
diff --git a/src/coreclr/classlibnative/inc/floatdouble.h b/src/coreclr/classlibnative/inc/floatdouble.h
index 9163349127ca14..43fecbd47431f3 100644
--- a/src/coreclr/classlibnative/inc/floatdouble.h
+++ b/src/coreclr/classlibnative/inc/floatdouble.h
@@ -9,7 +9,6 @@
class COMDouble {
public:
- FCDECL1_V(static double, Abs, double x);
FCDECL1_V(static double, Acos, double x);
FCDECL1_V(static double, Acosh, double x);
FCDECL1_V(static double, Asin, double x);
diff --git a/src/coreclr/classlibnative/inc/floatsingle.h b/src/coreclr/classlibnative/inc/floatsingle.h
index 09a0512b230dbd..765032ce6371e4 100644
--- a/src/coreclr/classlibnative/inc/floatsingle.h
+++ b/src/coreclr/classlibnative/inc/floatsingle.h
@@ -9,7 +9,6 @@
class COMSingle {
public:
- FCDECL1_V(static float, Abs, float x);
FCDECL1_V(static float, Acos, float x);
FCDECL1_V(static float, Acosh, float x);
FCDECL1_V(static float, Asin, float x);
diff --git a/src/coreclr/clrdefinitions.cmake b/src/coreclr/clrdefinitions.cmake
index 50aab221c8032e..d5fc9f5e1ee8e5 100644
--- a/src/coreclr/clrdefinitions.cmake
+++ b/src/coreclr/clrdefinitions.cmake
@@ -191,12 +191,12 @@ if (CLR_CMAKE_TARGET_ARCH_AMD64)
add_definitions(-DUNIX_AMD64_ABI_ITF)
endif (CLR_CMAKE_TARGET_ARCH_AMD64)
add_definitions(-DFEATURE_USE_ASM_GC_WRITE_BARRIERS)
-if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
+if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_LOONGARCH64)
add_definitions(-DFEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP)
-endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
-if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
+endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_LOONGARCH64)
+if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_LOONGARCH64)
add_definitions(-DFEATURE_MANUALLY_MANAGED_CARD_BUNDLES)
-endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64)
+endif(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_LOONGARCH64)
if(NOT CLR_CMAKE_TARGET_UNIX)
add_definitions(-DFEATURE_WIN32_REGISTRY)
@@ -240,6 +240,7 @@ function(set_target_definitions_to_custom_os_and_arch)
elseif (TARGETDETAILS_ARCH STREQUAL "x86")
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE UNIX_X86_ABI)
elseif (TARGETDETAILS_ARCH STREQUAL "arm64")
+ elseif (TARGETDETAILS_ARCH STREQUAL "loongarch64")
endif()
if ((TARGETDETAILS_ARCH STREQUAL "arm64") AND (TARGETDETAILS_OS STREQUAL "unix_osx"))
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE OSX_ARM64_ABI)
@@ -260,6 +261,10 @@ function(set_target_definitions_to_custom_os_and_arch)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_64BIT)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_ARM64)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_MULTIREG_RETURN)
+ elseif(TARGETDETAILS_ARCH STREQUAL "loongarch64")
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_64BIT)
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_LOONGARCH64)
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE FEATURE_MULTIREG_RETURN)
elseif((TARGETDETAILS_ARCH STREQUAL "arm") OR (TARGETDETAILS_ARCH STREQUAL "armel"))
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_ARM)
endif()
diff --git a/src/coreclr/components.cmake b/src/coreclr/components.cmake
index c23a38539247e9..3eaa2c966bf32e 100644
--- a/src/coreclr/components.cmake
+++ b/src/coreclr/components.cmake
@@ -6,6 +6,7 @@ add_component(runtime)
add_component(paltests paltests_install)
add_component(iltools)
add_component(nativeaot)
+add_component(spmi)
# Define coreclr_all as the fallback component and make every component depend on this component.
# iltools and paltests should be minimal subsets, so don't add a dependency on coreclr_misc
diff --git a/src/coreclr/debug/createdump/crashinfomac.cpp b/src/coreclr/debug/createdump/crashinfomac.cpp
index ad9c247e37dfdc..3ada3bd767c964 100644
--- a/src/coreclr/debug/createdump/crashinfomac.cpp
+++ b/src/coreclr/debug/createdump/crashinfomac.cpp
@@ -277,6 +277,9 @@ void CrashInfo::VisitSegment(MachOModule& module, const segment_command_64& segm
uint64_t start = segment.vmaddr + module.LoadBias();
uint64_t end = start + segment.vmsize;
+ // Add this module segment to the set used by the thread unwinding to lookup the module base address for an ip.
+ AddModuleAddressRange(start, end, module.BaseAddress());
+
// Round to page boundary
start = start & PAGE_MASK;
_ASSERTE(start > 0);
@@ -297,9 +300,6 @@ void CrashInfo::VisitSegment(MachOModule& module, const segment_command_64& segm
}
// Add this module segment to the module mappings list
m_moduleMappings.insert(moduleRegion);
-
- // Add this module segment to the set used by the thread unwinding to lookup the module base address for an ip.
- AddModuleAddressRange(start, end, module.BaseAddress());
}
else
{
diff --git a/src/coreclr/debug/createdump/stackframe.h b/src/coreclr/debug/createdump/stackframe.h
index 75e20d93120c0c..00c3a1cfb7fd8f 100644
--- a/src/coreclr/debug/createdump/stackframe.h
+++ b/src/coreclr/debug/createdump/stackframe.h
@@ -66,9 +66,16 @@ struct StackFrame
}
}
+// See comment in threadinfo.cpp UnwindNativeFrames function
+#if defined(__aarch64__)
+ #define STACK_POINTER_MASK ~0x7
+#else
+ #define STACK_POINTER_MASK ~0x0
+#endif
+
inline uint64_t ModuleAddress() const { return m_moduleAddress; }
inline uint64_t InstructionPointer() const { return m_instructionPointer; }
- inline uint64_t StackPointer() const { return m_stackPointer; }
+ inline uint64_t StackPointer() const { return m_stackPointer & STACK_POINTER_MASK; }
inline uint32_t NativeOffset() const { return m_nativeOffset; }
inline uint32_t Token() const { return m_token; }
inline uint32_t ILOffset() const { return m_ilOffset; }
diff --git a/src/coreclr/debug/createdump/threadinfo.cpp b/src/coreclr/debug/createdump/threadinfo.cpp
index 82509f52750653..e64eafc8d29a96 100644
--- a/src/coreclr/debug/createdump/threadinfo.cpp
+++ b/src/coreclr/debug/createdump/threadinfo.cpp
@@ -53,6 +53,16 @@ ThreadInfo::UnwindNativeFrames(CONTEXT* pContext)
uint64_t ip = 0, sp = 0;
GetFrameLocation(pContext, &ip, &sp);
+#if defined(__aarch64__)
+ // ARM64 can have frames with the same SP but different IPs. Increment sp so it gets added to the stack
+ // frames in the correct order and to prevent the below loop termination on non-increasing sp. Since stack
+ // pointers are always 8 byte align, this increase is masked off in StackFrame::StackPointer() to get the
+ // original stack pointer.
+ if (sp == previousSp && ip != previousIp)
+ {
+ sp++;
+ }
+#endif
if (ip == 0 || sp <= previousSp) {
TRACE_VERBOSE("Unwind: sp not increasing or ip == 0 sp %p ip %p\n", (void*)sp, (void*)ip);
break;
diff --git a/src/coreclr/debug/daccess/daccess.cpp b/src/coreclr/debug/daccess/daccess.cpp
index f9ec95c1f41838..9aaf6e6e4cb171 100644
--- a/src/coreclr/debug/daccess/daccess.cpp
+++ b/src/coreclr/debug/daccess/daccess.cpp
@@ -92,10 +92,10 @@ BOOL WINAPI DllMain(HANDLE instance, DWORD reason, LPVOID reserved)
}
HRESULT
-ConvertUtf8(__in LPCUTF8 utf8,
+ConvertUtf8(_In_ LPCUTF8 utf8,
ULONG32 bufLen,
ULONG32* nameLen,
- __out_ecount_part_opt(bufLen, *nameLen) PWSTR buffer)
+ _Out_writes_to_opt_(bufLen, *nameLen) PWSTR buffer)
{
if (nameLen)
{
@@ -118,9 +118,9 @@ ConvertUtf8(__in LPCUTF8 utf8,
}
HRESULT
-AllocUtf8(__in_opt LPCWSTR wstr,
+AllocUtf8(_In_opt_ LPCWSTR wstr,
ULONG32 srcChars,
- __deref_out LPUTF8* utf8)
+ _Outptr_ LPUTF8* utf8)
{
ULONG32 chars = WszWideCharToMultiByte(CP_UTF8, 0, wstr, srcChars,
NULL, 0, NULL, NULL);
@@ -165,7 +165,7 @@ HRESULT
GetFullClassNameFromMetadata(IMDInternalImport* mdImport,
mdTypeDef classToken,
ULONG32 bufferChars,
- __inout_ecount(bufferChars) LPUTF8 buffer)
+ _Inout_updates_(bufferChars) LPUTF8 buffer)
{
HRESULT hr;
LPCUTF8 baseName, namespaceName;
@@ -179,7 +179,7 @@ HRESULT
GetFullMethodNameFromMetadata(IMDInternalImport* mdImport,
mdMethodDef methodToken,
ULONG32 bufferChars,
- __inout_ecount(bufferChars) LPUTF8 buffer)
+ _Inout_updates_(bufferChars) LPUTF8 buffer)
{
HRESULT status;
HRESULT hr;
@@ -228,13 +228,13 @@ GetFullMethodNameFromMetadata(IMDInternalImport* mdImport,
}
HRESULT
-SplitFullName(__in_z __in PCWSTR fullName,
+SplitFullName(_In_z_ PCWSTR fullName,
SplitSyntax syntax,
ULONG32 memberDots,
- __deref_out_opt LPUTF8* namespaceName,
- __deref_out_opt LPUTF8* typeName,
- __deref_out_opt LPUTF8* memberName,
- __deref_out_opt LPUTF8* params)
+ _Outptr_opt_ LPUTF8* namespaceName,
+ _Outptr_opt_ LPUTF8* typeName,
+ _Outptr_opt_ LPUTF8* memberName,
+ _Outptr_opt_ LPUTF8* params)
{
HRESULT status;
PCWSTR paramsStart, memberStart, memberEnd, typeStart;
@@ -401,7 +401,7 @@ SplitFullName(__in_z __in PCWSTR fullName,
}
int
-CompareUtf8(__in LPCUTF8 str1, __in LPCUTF8 str2, __in ULONG32 nameFlags)
+CompareUtf8(_In_ LPCUTF8 str1, _In_ LPCUTF8 str2, _In_ ULONG32 nameFlags)
{
if (nameFlags & CLRDATA_BYNAME_CASE_INSENSITIVE)
{
@@ -469,8 +469,8 @@ MetaEnum::End(void)
HRESULT
MetaEnum::NextToken(mdToken* token,
- __deref_opt_out_opt LPCUTF8* namespaceName,
- __deref_opt_out_opt LPCUTF8* name)
+ _Outptr_opt_result_maybenull_ LPCUTF8* namespaceName,
+ _Outptr_opt_result_maybenull_ LPCUTF8* name)
{
HRESULT hr;
if (!m_mdImport)
@@ -584,8 +584,8 @@ MetaEnum::NextDomainToken(AppDomain** appDomain,
}
HRESULT
-MetaEnum::NextTokenByName(__in_opt LPCUTF8 namespaceName,
- __in_opt LPCUTF8 name,
+MetaEnum::NextTokenByName(_In_opt_ LPCUTF8 namespaceName,
+ _In_opt_ LPCUTF8 name,
ULONG32 nameFlags,
mdToken* token)
{
@@ -617,8 +617,8 @@ MetaEnum::NextTokenByName(__in_opt LPCUTF8 namespaceName,
}
HRESULT
-MetaEnum::NextDomainTokenByName(__in_opt LPCUTF8 namespaceName,
- __in_opt LPCUTF8 name,
+MetaEnum::NextDomainTokenByName(_In_opt_ LPCUTF8 namespaceName,
+ _In_opt_ LPCUTF8 name,
ULONG32 nameFlags,
AppDomain** appDomain, mdToken* token)
{
@@ -755,7 +755,7 @@ SplitName::Clear(void)
}
HRESULT
-SplitName::SplitString(__in_opt PCWSTR fullName)
+SplitName::SplitString(_In_opt_ PCWSTR fullName)
{
if (m_syntax == SPLIT_NO_NAME)
{
@@ -800,7 +800,7 @@ WCHAR* wcrscan(LPCWSTR beg, LPCWSTR end, WCHAR ch)
// sepName to point to the second '+' character in the string. When sepName
// points to the first '+' character this function will return "Outer" in
// pResult and sepName will point one WCHAR before fullName.
-HRESULT NextEnclosingClasName(LPCWSTR fullName, __deref_inout LPWSTR& sepName, __deref_out LPUTF8 *pResult)
+HRESULT NextEnclosingClasName(LPCWSTR fullName, _Outref_ LPWSTR& sepName, _Outptr_ LPUTF8 *pResult)
{
if (sepName < fullName)
{
@@ -994,7 +994,7 @@ SplitName::FindField(IMDInternalImport* mdInternal)
}
HRESULT
-SplitName::AllocAndSplitString(__in_opt PCWSTR fullName,
+SplitName::AllocAndSplitString(_In_opt_ PCWSTR fullName,
SplitSyntax syntax,
ULONG32 nameFlags,
ULONG32 memberDots,
@@ -1024,7 +1024,7 @@ SplitName::AllocAndSplitString(__in_opt PCWSTR fullName,
}
HRESULT
-SplitName::CdStartMethod(__in_opt PCWSTR fullName,
+SplitName::CdStartMethod(_In_opt_ PCWSTR fullName,
ULONG32 nameFlags,
Module* mod,
mdTypeDef typeToken,
@@ -1138,7 +1138,7 @@ SplitName::CdNextDomainMethod(CLRDATA_ENUM* handle,
}
HRESULT
-SplitName::CdStartField(__in_opt PCWSTR fullName,
+SplitName::CdStartField(_In_opt_ PCWSTR fullName,
ULONG32 nameFlags,
ULONG32 fieldFlags,
IXCLRDataTypeInstance* fromTypeInst,
@@ -1241,7 +1241,7 @@ SplitName::CdNextField(ClrDataAccess* dac,
IXCLRDataValue** value,
ULONG32 nameBufRetLen,
ULONG32* nameLenRet,
- __out_ecount_part_opt(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
+ _Out_writes_to_opt_(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
IXCLRDataModule** tokenScopeRet,
mdFieldDef* tokenRet)
{
@@ -1419,7 +1419,7 @@ SplitName::CdNextDomainField(ClrDataAccess* dac,
}
HRESULT
-SplitName::CdStartType(__in_opt PCWSTR fullName,
+SplitName::CdStartType(_In_opt_ PCWSTR fullName,
ULONG32 nameFlags,
Module* mod,
AppDomain* appDomain,
@@ -3698,7 +3698,7 @@ ClrDataAccess::GetRuntimeNameByAddress(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *symbolLen,
- /* [size_is][out] */ __out_ecount_opt(bufLen) WCHAR symbolBuf[ ],
+ /* [size_is][out] */ _Out_writes_bytes_opt_(bufLen) WCHAR symbolBuf[ ],
/* [out] */ CLRDATA_ADDRESS* displacement)
{
HRESULT status;
@@ -4317,7 +4317,7 @@ ClrDataAccess::GetDataByAddress(
/* [in] */ IXCLRDataTask* tlsTask,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataValue **value,
/* [out] */ CLRDATA_ADDRESS *displacement)
{
@@ -5642,7 +5642,7 @@ ClrDataAccess::GetFullMethodName(
IN MethodDesc* methodDesc,
IN ULONG32 symbolChars,
OUT ULONG32* symbolLen,
- __out_ecount_part_opt(symbolChars, *symbolLen) LPWSTR symbol
+ _Out_writes_to_opt_(symbolChars, *symbolLen) LPWSTR symbol
)
{
StackSString s;
@@ -5690,7 +5690,7 @@ ClrDataAccess::GetJitHelperName(
#define JITHELPER(code,fn,sig) #code,
#include
};
- static_assert_no_msg(COUNTOF(s_rgHelperNames) == CORINFO_HELP_COUNT);
+ static_assert_no_msg(ARRAY_SIZE(s_rgHelperNames) == CORINFO_HELP_COUNT);
#ifdef TARGET_UNIX
if (!dynamicHelpersOnly)
@@ -5737,7 +5737,7 @@ ClrDataAccess::RawGetMethodName(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *symbolLen,
- /* [size_is][out] */ __out_ecount_opt(bufLen) WCHAR symbolBuf[ ],
+ /* [size_is][out] */ _Out_writes_bytes_opt_(bufLen) WCHAR symbolBuf[ ],
/* [out] */ CLRDATA_ADDRESS* displacement)
{
#ifdef TARGET_ARM
@@ -5745,7 +5745,7 @@ ClrDataAccess::RawGetMethodName(
address &= ~THUMB_CODE;
#endif
- const UINT k_cch64BitHexFormat = COUNTOF("1234567812345678");
+ const UINT k_cch64BitHexFormat = ARRAY_SIZE("1234567812345678");
HRESULT status;
if (flags != 0)
@@ -5887,7 +5887,7 @@ ClrDataAccess::RawGetMethodName(
// Printf failed. Estimate a size that will be at least big enough to hold the name
if (symbolLen)
{
- size_t cchSymbol = COUNTOF(s_wszFormatNameWithStubManager) +
+ size_t cchSymbol = ARRAY_SIZE(s_wszFormatNameWithStubManager) +
wcslen(wszStubManagerName) +
k_cch64BitHexFormat +
1;
@@ -5950,7 +5950,7 @@ ClrDataAccess::RawGetMethodName(
// Printf failed. Estimate a size that will be at least big enough to hold the name
if (symbolLen)
{
- size_t cchSymbol = COUNTOF(s_wszFormatNameAddressOnly) +
+ size_t cchSymbol = ARRAY_SIZE(s_wszFormatNameAddressOnly) +
k_cch64BitHexFormat +
1;
@@ -6460,7 +6460,7 @@ ClrDataAccess::GetMetaDataFileInfoFromPEFile(PEAssembly *pPEAssembly,
DWORD &dwDataSize,
DWORD &dwRvaHint,
bool &isNGEN,
- __out_ecount(cchFilePath) LPWSTR wszFilePath,
+ _Out_writes_(cchFilePath) LPWSTR wszFilePath,
const DWORD cchFilePath)
{
SUPPORTS_DAC_HOST_ONLY;
@@ -6524,7 +6524,7 @@ ClrDataAccess::GetMetaDataFileInfoFromPEFile(PEAssembly *pPEAssembly,
bool ClrDataAccess::GetILImageInfoFromNgenPEFile(PEAssembly *pPEAssembly,
DWORD &dwTimeStamp,
DWORD &dwSize,
- __out_ecount(cchFilePath) LPWSTR wszFilePath,
+ _Out_writes_(cchFilePath) LPWSTR wszFilePath,
const DWORD cchFilePath)
{
SUPPORTS_DAC_HOST_ONLY;
@@ -6548,7 +6548,7 @@ bool ClrDataAccess::GetILImageInfoFromNgenPEFile(PEAssembly *pPEAssembly,
// In the end we add given ilExtension.
// This dependecy is based on Apollo installer behavior.
bool ClrDataAccess::GetILImageNameFromNgenImage( LPCWSTR ilExtension,
- __out_ecount(cchFilePath) LPWSTR wszFilePath,
+ _Out_writes_(cchFilePath) LPWSTR wszFilePath,
const DWORD cchFilePath)
{
if (wszFilePath == NULL || cchFilePath == 0)
@@ -7565,9 +7565,9 @@ typedef struct _WER_RUNTIME_EXCEPTION_INFORMATION
// else detailed error code.
//
//----------------------------------------------------------------------------
-STDAPI OutOfProcessExceptionEventGetWatsonBucket(__in PDWORD pContext,
- __in const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
- __out GenericModeBlock * pGMB)
+STDAPI OutOfProcessExceptionEventGetWatsonBucket(_In_ PDWORD pContext,
+ _In_ const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
+ _Out_ GenericModeBlock * pGMB)
{
HANDLE hProcess = pExceptionInformation->hProcess;
HANDLE hThread = pExceptionInformation->hThread;
@@ -7656,12 +7656,12 @@ STDAPI OutOfProcessExceptionEventGetWatsonBucket(__in PDWORD pContext,
// Since this is called by external modules it's important that we don't let any exceptions leak out (see Win8 95224).
//
//----------------------------------------------------------------------------
-STDAPI OutOfProcessExceptionEventCallback(__in PDWORD pContext,
- __in const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
- __out BOOL * pbOwnershipClaimed,
- __out_ecount(*pchSize) PWSTR pwszEventName,
+STDAPI OutOfProcessExceptionEventCallback(_In_ PDWORD pContext,
+ _In_ const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
+ _Out_ BOOL * pbOwnershipClaimed,
+ _Out_writes_(*pchSize) PWSTR pwszEventName,
__inout PDWORD pchSize,
- __out PDWORD pdwSignatureCount)
+ _Out_ PDWORD pdwSignatureCount)
{
SUPPORTS_DAC_HOST_ONLY;
@@ -7748,12 +7748,12 @@ STDAPI OutOfProcessExceptionEventCallback(__in PDWORD pContext,
// Since this is called by external modules it's important that we don't let any exceptions leak out (see Win8 95224).
//
//----------------------------------------------------------------------------
-STDAPI OutOfProcessExceptionEventSignatureCallback(__in PDWORD pContext,
- __in const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
- __in DWORD dwIndex,
- __out_ecount(*pchName) PWSTR pwszName,
+STDAPI OutOfProcessExceptionEventSignatureCallback(_In_ PDWORD pContext,
+ _In_ const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
+ _In_ DWORD dwIndex,
+ _Out_writes_(*pchName) PWSTR pwszName,
__inout PDWORD pchName,
- __out_ecount(*pchValue) PWSTR pwszValue,
+ _Out_writes_(*pchValue) PWSTR pwszValue,
__inout PDWORD pchValue)
{
SUPPORTS_DAC_HOST_ONLY;
@@ -7873,12 +7873,12 @@ STDAPI OutOfProcessExceptionEventSignatureCallback(__in PDWORD pContext,
// this function are of the pwszName and pwszValue buffers.
//
//----------------------------------------------------------------------------
-STDAPI OutOfProcessExceptionEventDebuggerLaunchCallback(__in PDWORD pContext,
- __in const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
- __out BOOL * pbCustomDebuggerNeeded,
- __out_ecount_opt(*pchSize) PWSTR pwszDebuggerLaunch,
+STDAPI OutOfProcessExceptionEventDebuggerLaunchCallback(_In_ PDWORD pContext,
+ _In_ const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
+ _Out_ BOOL * pbCustomDebuggerNeeded,
+ _Out_writes_opt_(*pchSize) PWSTR pwszDebuggerLaunch,
__inout PDWORD pchSize,
- __out BOOL * pbAutoLaunchDebugger)
+ _Out_ BOOL * pbAutoLaunchDebugger)
{
SUPPORTS_DAC_HOST_ONLY;
diff --git a/src/coreclr/debug/daccess/dacdbiimpl.cpp b/src/coreclr/debug/daccess/dacdbiimpl.cpp
index ebb5d12c0ce3aa..4efcd8a8323b4f 100644
--- a/src/coreclr/debug/daccess/dacdbiimpl.cpp
+++ b/src/coreclr/debug/daccess/dacdbiimpl.cpp
@@ -5428,6 +5428,16 @@ GENERICS_TYPE_TOKEN DacDbiInterfaceImpl::ResolveExactGenericArgsToken(DWORD
if (dwExactGenericArgsTokenIndex == 0)
{
+ // In a rare case of VS4Mac debugging VS4Mac ARM64 optimized code we get a null generics argument token. We aren't sure
+ // why the token is null, it may be a bug or it may be by design in the runtime. In the interest of time we are working
+ // around the issue rather than investigating the root cause. This workaround should only cause us to degrade generic
+ // types from exact type parameters to approximate or canonical type parameters. In the future if we discover this issue
+ // is happening more frequently than we expect or the workaround is more impactful than we expect we may need to remove
+ // this workaround and resolve the underlying issue.
+ if (rawToken == 0)
+ {
+ return rawToken;
+ }
// In this case the real generics type token is the MethodTable of the "this" object.
// Note that we want the target address here.
diff --git a/src/coreclr/debug/daccess/dacfn.cpp b/src/coreclr/debug/daccess/dacfn.cpp
index e1b83aba17e20c..11f798ed04c199 100644
--- a/src/coreclr/debug/daccess/dacfn.cpp
+++ b/src/coreclr/debug/daccess/dacfn.cpp
@@ -89,7 +89,7 @@ DacExceptionFilter(Exception* ex, ClrDataAccess* access,
}
void __cdecl
-DacWarning(__in char* format, ...)
+DacWarning(_In_ char* format, ...)
{
char text[256];
va_list args;
diff --git a/src/coreclr/debug/daccess/dacimpl.h b/src/coreclr/debug/daccess/dacimpl.h
index 948bef16e498da..57a4dc1bbab8fc 100644
--- a/src/coreclr/debug/daccess/dacimpl.h
+++ b/src/coreclr/debug/daccess/dacimpl.h
@@ -222,22 +222,22 @@ struct METH_EXTENTS
CLRDATA_ADDRESS_RANGE extents[1];
};
-HRESULT ConvertUtf8(__in LPCUTF8 utf8,
+HRESULT ConvertUtf8(_In_ LPCUTF8 utf8,
ULONG32 bufLen,
ULONG32* nameLen,
- __out_ecount_part_opt(bufLen, *nameLen) PWSTR buffer);
-HRESULT AllocUtf8(__in_opt LPCWSTR wstr,
+ _Out_writes_to_opt_(bufLen, *nameLen) PWSTR buffer);
+HRESULT AllocUtf8(_In_opt_ LPCWSTR wstr,
ULONG32 srcChars,
- __deref_out LPUTF8* utf8);
+ _Outptr_ LPUTF8* utf8);
HRESULT GetFullClassNameFromMetadata(IMDInternalImport* mdImport,
mdTypeDef classToken,
ULONG32 bufferChars,
- __inout_ecount(bufferChars) LPUTF8 buffer);
+ _Inout_updates_(bufferChars) LPUTF8 buffer);
HRESULT GetFullMethodNameFromMetadata(IMDInternalImport* mdImport,
mdMethodDef methodToken,
ULONG32 bufferChars,
- __inout_ecount(bufferChars) LPUTF8 buffer);
+ _Inout_updates_(bufferChars) LPUTF8 buffer);
enum SplitSyntax
{
@@ -247,15 +247,15 @@ enum SplitSyntax
SPLIT_NO_NAME,
};
-HRESULT SplitFullName(__in_z __in PCWSTR fullName,
+HRESULT SplitFullName(_In_z_ PCWSTR fullName,
SplitSyntax syntax,
ULONG32 memberDots,
- __deref_out_opt LPUTF8* namespaceName,
- __deref_out_opt LPUTF8* typeName,
- __deref_out_opt LPUTF8* memberName,
- __deref_out_opt LPUTF8* params);
+ _Outptr_opt_ LPUTF8* namespaceName,
+ _Outptr_opt_ LPUTF8* typeName,
+ _Outptr_opt_ LPUTF8* memberName,
+ _Outptr_opt_ LPUTF8* params);
-int CompareUtf8(__in LPCUTF8 str1, __in LPCUTF8 str2, __in ULONG32 nameFlags);
+int CompareUtf8(_In_ LPCUTF8 str1, _In_ LPCUTF8 str2, _In_ ULONG32 nameFlags);
#define INH_STATIC \
(CLRDATA_VALUE_ALL_KINDS | \
@@ -304,16 +304,16 @@ class MetaEnum
void End(void);
HRESULT NextToken(mdToken* token,
- __deref_opt_out_opt LPCUTF8* namespaceName,
- __deref_opt_out_opt LPCUTF8* name);
+ _Outptr_opt_result_maybenull_ LPCUTF8* namespaceName,
+ _Outptr_opt_result_maybenull_ LPCUTF8* name);
HRESULT NextDomainToken(AppDomain** appDomain,
mdToken* token);
- HRESULT NextTokenByName(__in_opt LPCUTF8 namespaceName,
- __in_opt LPCUTF8 name,
+ HRESULT NextTokenByName(_In_opt_ LPCUTF8 namespaceName,
+ _In_opt_ LPCUTF8 name,
ULONG32 nameFlags,
mdToken* token);
- HRESULT NextDomainTokenByName(__in_opt LPCUTF8 namespaceName,
- __in_opt LPCUTF8 name,
+ HRESULT NextDomainTokenByName(_In_opt_ LPCUTF8 namespaceName,
+ _In_opt_ LPCUTF8 name,
ULONG32 nameFlags,
AppDomain** appDomain, mdToken* token);
@@ -410,7 +410,7 @@ class SplitName
void Delete(void);
void Clear(void);
- HRESULT SplitString(__in_opt PCWSTR fullName);
+ HRESULT SplitString(_In_opt_ PCWSTR fullName);
bool FindType(IMDInternalImport* mdInternal);
bool FindMethod(IMDInternalImport* mdInternal);
@@ -421,13 +421,13 @@ class SplitName
return CompareUtf8(str1, str2, m_nameFlags);
}
- static HRESULT AllocAndSplitString(__in_opt PCWSTR fullName,
+ static HRESULT AllocAndSplitString(_In_opt_ PCWSTR fullName,
SplitSyntax syntax,
ULONG32 nameFlags,
ULONG32 memberDots,
SplitName** split);
- static HRESULT CdStartMethod(__in_opt PCWSTR fullName,
+ static HRESULT CdStartMethod(_In_opt_ PCWSTR fullName,
ULONG32 nameFlags,
Module* mod,
mdTypeDef typeToken,
@@ -441,7 +441,7 @@ class SplitName
AppDomain** appDomain,
mdMethodDef* token);
- static HRESULT CdStartField(__in_opt PCWSTR fullName,
+ static HRESULT CdStartField(_In_opt_ PCWSTR fullName,
ULONG32 nameFlags,
ULONG32 fieldFlags,
IXCLRDataTypeInstance* fromTypeInst,
@@ -462,14 +462,14 @@ class SplitName
IXCLRDataValue** value,
ULONG32 nameBufRetLen,
ULONG32* nameLenRet,
- __out_ecount_part_opt(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
+ _Out_writes_to_opt_(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
IXCLRDataModule** tokenScopeRet,
mdFieldDef* tokenRet);
static HRESULT CdNextDomainField(ClrDataAccess* dac,
CLRDATA_ENUM* handle,
IXCLRDataValue** value);
- static HRESULT CdStartType(__in_opt PCWSTR fullName,
+ static HRESULT CdStartType(_In_opt_ PCWSTR fullName,
ULONG32 nameFlags,
Module* mod,
AppDomain* appDomain,
@@ -901,7 +901,7 @@ class ClrDataAccess
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_opt(bufLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_bytes_opt_(bufLen) WCHAR nameBuf[ ],
/* [out] */ CLRDATA_ADDRESS* displacement);
virtual HRESULT STDMETHODCALLTYPE StartEnumAppDomains(
@@ -972,7 +972,7 @@ class ClrDataAccess
/* [in] */ IXCLRDataTask* tlsTask,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataValue **value,
/* [out] */ CLRDATA_ADDRESS *displacement);
@@ -1080,10 +1080,10 @@ class ClrDataAccess
virtual HRESULT STDMETHODCALLTYPE GetAppDomainStoreData(struct DacpAppDomainStoreData *data);
virtual HRESULT STDMETHODCALLTYPE GetAppDomainList(unsigned int count, CLRDATA_ADDRESS values[], unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetAppDomainData(CLRDATA_ADDRESS addr, struct DacpAppDomainData *data);
- virtual HRESULT STDMETHODCALLTYPE GetAppDomainName(CLRDATA_ADDRESS addr, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetAppDomainName(CLRDATA_ADDRESS addr, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetAssemblyList(CLRDATA_ADDRESS appDomain, int count, CLRDATA_ADDRESS values[], int *fetched);
virtual HRESULT STDMETHODCALLTYPE GetAssemblyData(CLRDATA_ADDRESS baseDomainPtr, CLRDATA_ADDRESS assembly, struct DacpAssemblyData *data);
- virtual HRESULT STDMETHODCALLTYPE GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetThreadData(CLRDATA_ADDRESS thread, struct DacpThreadData *data);
virtual HRESULT STDMETHODCALLTYPE GetThreadFromThinlockID(UINT thinLockId, CLRDATA_ADDRESS *pThread);
virtual HRESULT STDMETHODCALLTYPE GetStackLimits(CLRDATA_ADDRESS threadPtr, CLRDATA_ADDRESS *lower, CLRDATA_ADDRESS *upper, CLRDATA_ADDRESS *fp);
@@ -1091,27 +1091,27 @@ class ClrDataAccess
virtual HRESULT STDMETHODCALLTYPE GetMethodDescData(CLRDATA_ADDRESS methodDesc, CLRDATA_ADDRESS ip, struct DacpMethodDescData *data, ULONG cRevertedRejitVersions, DacpReJitData * rgRevertedRejitData, ULONG * pcNeededRevertedRejitData);
virtual HRESULT STDMETHODCALLTYPE GetMethodDescPtrFromIP(CLRDATA_ADDRESS ip, CLRDATA_ADDRESS * ppMD);
- virtual HRESULT STDMETHODCALLTYPE GetMethodDescName(CLRDATA_ADDRESS methodDesc, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetMethodDescName(CLRDATA_ADDRESS methodDesc, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetMethodDescPtrFromFrame(CLRDATA_ADDRESS frameAddr, CLRDATA_ADDRESS * ppMD);
virtual HRESULT STDMETHODCALLTYPE GetCodeHeaderData(CLRDATA_ADDRESS ip, struct DacpCodeHeaderData *data);
virtual HRESULT STDMETHODCALLTYPE GetThreadpoolData(struct DacpThreadpoolData *data);
virtual HRESULT STDMETHODCALLTYPE GetWorkRequestData(CLRDATA_ADDRESS addrWorkRequest, struct DacpWorkRequestData *data);
virtual HRESULT STDMETHODCALLTYPE GetObjectData(CLRDATA_ADDRESS objAddr, struct DacpObjectData *data);
- virtual HRESULT STDMETHODCALLTYPE GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, __out_z __inout_ecount(count) WCHAR *stringData, unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetObjectClassName(CLRDATA_ADDRESS obj, unsigned int count, __out_z __inout_ecount(count) WCHAR *className, unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetMethodTableName(CLRDATA_ADDRESS mt, unsigned int count, __out_z __inout_ecount(count) WCHAR *mtName, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, _Inout_updates_z_(count) WCHAR *stringData, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetObjectClassName(CLRDATA_ADDRESS obj, unsigned int count, _Inout_updates_z_(count) WCHAR *className, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetMethodTableName(CLRDATA_ADDRESS mt, unsigned int count, _Inout_updates_z_(count) WCHAR *mtName, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetMethodTableData(CLRDATA_ADDRESS mt, struct DacpMethodTableData *data);
virtual HRESULT STDMETHODCALLTYPE GetMethodTableFieldData(CLRDATA_ADDRESS mt, struct DacpMethodTableFieldData *data);
virtual HRESULT STDMETHODCALLTYPE GetMethodTableTransparencyData(CLRDATA_ADDRESS mt, struct DacpMethodTableTransparencyData *data);
virtual HRESULT STDMETHODCALLTYPE GetMethodTableForEEClass(CLRDATA_ADDRESS eeClass, CLRDATA_ADDRESS *value);
virtual HRESULT STDMETHODCALLTYPE GetFieldDescData(CLRDATA_ADDRESS fieldDesc, struct DacpFieldDescData *data);
- virtual HRESULT STDMETHODCALLTYPE GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, __out_z __inout_ecount(count) WCHAR *frameName, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, _Inout_updates_z_(count) WCHAR *frameName, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetModule(CLRDATA_ADDRESS addr, IXCLRDataModule **mod);
virtual HRESULT STDMETHODCALLTYPE GetModuleData(CLRDATA_ADDRESS moduleAddr, struct DacpModuleData *data);
virtual HRESULT STDMETHODCALLTYPE TraverseModuleMap(ModuleMapType mmt, CLRDATA_ADDRESS moduleAddr, MODULEMAPTRAVERSE pCallback, LPVOID token);
virtual HRESULT STDMETHODCALLTYPE GetMethodDescFromToken(CLRDATA_ADDRESS moduleAddr, mdToken token, CLRDATA_ADDRESS *methodDesc);
virtual HRESULT STDMETHODCALLTYPE GetPEFileBase(CLRDATA_ADDRESS addr, CLRDATA_ADDRESS *base);
- virtual HRESULT STDMETHODCALLTYPE GetPEFileName(CLRDATA_ADDRESS addr, unsigned int count, __out_z __inout_ecount(count) WCHAR *fileName, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetPEFileName(CLRDATA_ADDRESS addr, unsigned int count, _Inout_updates_z_(count) WCHAR *fileName, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetAssemblyModuleList(CLRDATA_ADDRESS assembly, unsigned int count, CLRDATA_ADDRESS modules[], unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetGCHeapData(struct DacpGcHeapData *data);
virtual HRESULT STDMETHODCALLTYPE GetGCHeapList(unsigned int count, CLRDATA_ADDRESS heaps[], unsigned int *pNeeded);
@@ -1127,7 +1127,7 @@ class ClrDataAccess
virtual HRESULT STDMETHODCALLTYPE TraverseEHInfo(CLRDATA_ADDRESS ip, DUMPEHINFO pCallback, LPVOID token);
virtual HRESULT STDMETHODCALLTYPE GetStressLogAddress(CLRDATA_ADDRESS *stressLog);
virtual HRESULT STDMETHODCALLTYPE GetJitManagerList(unsigned int count, struct DacpJitManagerInfo managers[], unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetJitHelperFunctionName(CLRDATA_ADDRESS ip, unsigned int count, __out_z __inout_ecount(count) char *name, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetJitHelperFunctionName(CLRDATA_ADDRESS ip, unsigned int count, _Inout_updates_z_(count) char *name, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetJumpThunkTarget(T_CONTEXT *ctx, CLRDATA_ADDRESS *targetIP, CLRDATA_ADDRESS *targetMD);
virtual HRESULT STDMETHODCALLTYPE TraverseLoaderHeap(CLRDATA_ADDRESS loaderHeapAddr, VISITHEAP pCallback);
virtual HRESULT STDMETHODCALLTYPE GetCodeHeapList(CLRDATA_ADDRESS jitManager, unsigned int count, struct DacpJitCodeHeapInfo codeHeaps[], unsigned int *pNeeded);
@@ -1152,17 +1152,17 @@ class ClrDataAccess
virtual HRESULT STDMETHODCALLTYPE GetDacModuleHandle(HMODULE *phModule);
virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyList(CLRDATA_ADDRESS appDomain, int count, CLRDATA_ADDRESS values[], unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetPrivateBinPaths(CLRDATA_ADDRESS appDomain, int count, __out_z __inout_ecount(count) WCHAR *paths, unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetAssemblyLocation(CLRDATA_ADDRESS assembly, int count, __out_z __inout_ecount(count) WCHAR *location, unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetAppDomainConfigFile(CLRDATA_ADDRESS appDomain, int count, __out_z __inout_ecount(count) WCHAR *configFile, unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetApplicationBase(CLRDATA_ADDRESS appDomain, int count, __out_z __inout_ecount(count) WCHAR *base, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetPrivateBinPaths(CLRDATA_ADDRESS appDomain, int count, _Inout_updates_z_(count) WCHAR *paths, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetAssemblyLocation(CLRDATA_ADDRESS assembly, int count, _Inout_updates_z_(count) WCHAR *location, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetAppDomainConfigFile(CLRDATA_ADDRESS appDomain, int count, _Inout_updates_z_(count) WCHAR *configFile, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetApplicationBase(CLRDATA_ADDRESS appDomain, int count, _Inout_updates_z_(count) WCHAR *base, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyData(CLRDATA_ADDRESS assembly, unsigned int *pContext, HRESULT *pResult);
- virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyLocation(CLRDATA_ADDRESS assembly, unsigned int count, __out_z __inout_ecount(count) WCHAR *location, unsigned int *pNeeded);
- virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyDisplayName(CLRDATA_ADDRESS assembly, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyLocation(CLRDATA_ADDRESS assembly, unsigned int count, _Inout_updates_z_(count) WCHAR *location, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetFailedAssemblyDisplayName(CLRDATA_ADDRESS assembly, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetStackReferences(DWORD osThreadID, ISOSStackRefEnum **ppEnum);
- virtual HRESULT STDMETHODCALLTYPE GetRegisterName(int regNum, unsigned int count, __out_z __inout_ecount(count) WCHAR *buffer, unsigned int *pNeeded);
+ virtual HRESULT STDMETHODCALLTYPE GetRegisterName(int regNum, unsigned int count, _Inout_updates_z_(count) WCHAR *buffer, unsigned int *pNeeded);
virtual HRESULT STDMETHODCALLTYPE GetHandleEnum(ISOSHandleEnum **ppHandleEnum);
virtual HRESULT STDMETHODCALLTYPE GetHandleEnumForTypes(unsigned int types[], unsigned int count, ISOSHandleEnum **ppHandleEnum);
@@ -1244,12 +1244,12 @@ class ClrDataAccess
HRESULT GetFullMethodName(IN MethodDesc* methodDesc,
IN ULONG32 symbolChars,
IN ULONG32* symbolLen,
- __out_ecount_part_opt(symbolChars, *symbolLen) LPWSTR symbol);
+ _Out_writes_to_opt_(symbolChars, *symbolLen) LPWSTR symbol);
HRESULT RawGetMethodName(/* [in] */ CLRDATA_ADDRESS address,
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_opt(bufLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_bytes_opt_(bufLen) WCHAR nameBuf[ ],
/* [out] */ CLRDATA_ADDRESS* displacement);
HRESULT FollowStubStep(
@@ -1512,17 +1512,17 @@ class ClrDataAccess
DWORD &dwDataSize,
DWORD &dwRvaHint,
bool &isNGEN,
- __out_ecount(cchFilePath) LPWSTR wszFilePath,
+ _Out_writes_(cchFilePath) LPWSTR wszFilePath,
DWORD cchFilePath);
static bool GetILImageInfoFromNgenPEFile(PEAssembly *pPEAssembly,
DWORD &dwTimeStamp,
DWORD &dwSize,
- __out_ecount(cchPath) LPWSTR wszPath,
+ _Out_writes_(cchPath) LPWSTR wszPath,
const DWORD cchPath);
#if defined(FEATURE_CORESYSTEM)
static bool GetILImageNameFromNgenImage(LPCWSTR ilExtension,
- __out_ecount(cchFilePath) LPWSTR wszFilePath,
+ _Out_writes_(cchFilePath) LPWSTR wszFilePath,
const DWORD cchFilePath);
#endif // FEATURE_CORESYSTEM
};
@@ -2348,7 +2348,7 @@ class ClrDataAppDomain : public IXCLRDataAppDomain
virtual HRESULT STDMETHODCALLTYPE GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetUniqueID(
/* [out] */ ULONG64 *id);
@@ -2429,17 +2429,17 @@ class ClrDataAssembly : public IXCLRDataAssembly
virtual HRESULT STDMETHODCALLTYPE GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetFileName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetDisplayName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetFlags(
/* [out] */ ULONG32 *flags);
@@ -2601,12 +2601,12 @@ class ClrDataModule : public IXCLRDataModule, IXCLRDataModule2
virtual HRESULT STDMETHODCALLTYPE GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetFileName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetVersionId(
/* [out] */ GUID* vid);
@@ -2747,7 +2747,7 @@ class ClrDataTypeDefinition : public IXCLRDataTypeDefinition
/* [out][in] */ CLRDATA_ENUM *handle,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32 *flags,
/* [out] */ mdFieldDef *token);
@@ -2756,7 +2756,7 @@ class ClrDataTypeDefinition : public IXCLRDataTypeDefinition
/* [out][in] */ CLRDATA_ENUM *handle,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32 *flags,
/* [out] */ IXCLRDataModule** tokenScope,
@@ -2791,7 +2791,7 @@ class ClrDataTypeDefinition : public IXCLRDataTypeDefinition
/* [in] */ mdFieldDef token,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32* flags);
@@ -2800,7 +2800,7 @@ class ClrDataTypeDefinition : public IXCLRDataTypeDefinition
/* [in] */ mdFieldDef token,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32* flags);
@@ -2808,7 +2808,7 @@ class ClrDataTypeDefinition : public IXCLRDataTypeDefinition
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ]);
virtual HRESULT STDMETHODCALLTYPE GetTokenAndScope(
/* [out] */ mdTypeDef *token,
@@ -2918,7 +2918,7 @@ class ClrDataTypeInstance : public IXCLRDataTypeInstance
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ mdFieldDef *token);
virtual HRESULT STDMETHODCALLTYPE StartEnumStaticFieldsByName(
@@ -2952,7 +2952,7 @@ class ClrDataTypeInstance : public IXCLRDataTypeInstance
/* [out] */ IXCLRDataValue **value,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataModule** tokenScope,
/* [out] */ mdFieldDef *token);
@@ -2985,7 +2985,7 @@ class ClrDataTypeInstance : public IXCLRDataTypeInstance
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ]);
virtual HRESULT STDMETHODCALLTYPE GetStaticFieldByToken2(
/* [in] */ IXCLRDataModule* tokenScope,
@@ -2994,13 +2994,13 @@ class ClrDataTypeInstance : public IXCLRDataTypeInstance
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ]);
virtual HRESULT STDMETHODCALLTYPE GetName(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ]);
virtual HRESULT STDMETHODCALLTYPE GetModule(
/* [out] */ IXCLRDataModule **mod);
@@ -3095,7 +3095,7 @@ class ClrDataMethodDefinition : public IXCLRDataMethodDefinition
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetTokenAndScope(
/* [out] */ mdMethodDef *token,
@@ -3200,7 +3200,7 @@ class ClrDataMethodInstance : public IXCLRDataMethodInstance
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetFlags(
/* [out] */ ULONG32 *flags);
@@ -3304,7 +3304,7 @@ class ClrDataTask : public IXCLRDataTask
virtual HRESULT STDMETHODCALLTYPE GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetUniqueID(
/* [out] */ ULONG64 *id);
@@ -3500,7 +3500,7 @@ class ClrDataFrame : public IXCLRDataFrame,
/* [out] */ IXCLRDataValue **arg,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetNumLocalVariables(
/* [out] */ ULONG32 *numLocals);
@@ -3510,7 +3510,7 @@ class ClrDataFrame : public IXCLRDataFrame,
/* [out] */ IXCLRDataValue **localVariable,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ]);
virtual HRESULT STDMETHODCALLTYPE GetNumTypeArguments(
/* [out] */ ULONG32 *numTypeArgs);
@@ -3523,7 +3523,7 @@ class ClrDataFrame : public IXCLRDataFrame,
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_opt(bufLen) WCHAR nameBuf[ ]);
+ /* [size_is][out] */ _Out_writes_bytes_opt_(bufLen) WCHAR nameBuf[ ]);
virtual HRESULT STDMETHODCALLTYPE GetMethodInstance(
/* [out] */ IXCLRDataMethodInstance **method);
@@ -3620,7 +3620,7 @@ class ClrDataExceptionState : public IXCLRDataExceptionState
virtual HRESULT STDMETHODCALLTYPE GetString(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *strLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *strLen) WCHAR str[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *strLen) WCHAR str[ ]);
virtual HRESULT STDMETHODCALLTYPE IsSameState(
/* [in] */ EXCEPTION_RECORD64 *exRecord,
@@ -3724,7 +3724,7 @@ class ClrDataValue : public IXCLRDataValue
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ mdFieldDef *token);
virtual HRESULT STDMETHODCALLTYPE GetNumFields2(
@@ -3742,7 +3742,7 @@ class ClrDataValue : public IXCLRDataValue
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ mdFieldDef *token);
virtual HRESULT STDMETHODCALLTYPE EnumField2(
@@ -3750,7 +3750,7 @@ class ClrDataValue : public IXCLRDataValue
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataModule** tokenScope,
/* [out] */ mdFieldDef *token);
@@ -3783,7 +3783,7 @@ class ClrDataValue : public IXCLRDataValue
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ]);
virtual HRESULT STDMETHODCALLTYPE GetFieldByToken2(
/* [in] */ IXCLRDataModule* tokenScope,
@@ -3791,7 +3791,7 @@ class ClrDataValue : public IXCLRDataValue
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ]);
virtual HRESULT STDMETHODCALLTYPE GetAssociatedValue(
/* [out] */ IXCLRDataValue **assocValue);
@@ -3802,7 +3802,7 @@ class ClrDataValue : public IXCLRDataValue
virtual HRESULT STDMETHODCALLTYPE GetString(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *strLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *strLen) WCHAR str[ ]);
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *strLen) WCHAR str[ ]);
virtual HRESULT STDMETHODCALLTYPE GetArrayProperties(
/* [out] */ ULONG32 *rank,
@@ -3844,7 +3844,7 @@ class ClrDataValue : public IXCLRDataValue
IXCLRDataValue** pubValue,
ULONG32 nameBufRetLen,
ULONG32* nameLenRet,
- __out_ecount_part_opt(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
+ _Out_writes_to_opt_(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
IXCLRDataModule** tokenScopeRet,
mdFieldDef* tokenRet);
@@ -3854,7 +3854,7 @@ class ClrDataValue : public IXCLRDataValue
IXCLRDataValue** pubValue,
ULONG32 nameBufRetLen,
ULONG32* nameLenRet,
- __out_ecount_part_opt(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
+ _Out_writes_to_opt_(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
IXCLRDataModule** tokenScopeRet,
mdFieldDef* tokenRet)
{
diff --git a/src/coreclr/debug/daccess/inspect.cpp b/src/coreclr/debug/daccess/inspect.cpp
index 21afb220103cb6..0a3138c5b77dbd 100644
--- a/src/coreclr/debug/daccess/inspect.cpp
+++ b/src/coreclr/debug/daccess/inspect.cpp
@@ -574,7 +574,7 @@ ClrDataValue::GetFieldByIndex(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ mdFieldDef *token)
{
// XXX Microsoft - Obsolete method, never implemented.
@@ -661,7 +661,7 @@ ClrDataValue::EnumField(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ mdFieldDef *token)
{
return EnumField2(handle, field, nameBufLen, nameLen, nameBuf,
@@ -674,7 +674,7 @@ ClrDataValue::EnumField2(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataModule** tokenScope,
/* [out] */ mdFieldDef *token)
{
@@ -839,7 +839,7 @@ ClrDataValue::GetFieldByToken(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ])
{
return GetFieldByToken2(NULL, token, field, bufLen, nameLen, nameBuf);
}
@@ -851,7 +851,7 @@ ClrDataValue::GetFieldByToken2(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ])
{
HRESULT status;
@@ -1029,7 +1029,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataValue::GetString(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *strLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *strLen) WCHAR str[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *strLen) WCHAR str[ ])
{
HRESULT status;
@@ -1381,7 +1381,7 @@ ClrDataValue::NewFromFieldDesc(ClrDataAccess* dac,
IXCLRDataValue** pubValue,
ULONG32 nameBufRetLen,
ULONG32 *nameLenRet,
- __out_ecount_part_opt(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
+ _Out_writes_to_opt_(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
IXCLRDataModule** tokenScopeRet,
mdFieldDef *tokenRet)
{
@@ -1991,7 +1991,7 @@ ClrDataTypeDefinition::EnumField(
/* [out][in] */ CLRDATA_ENUM *handle,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32 *flags,
/* [out] */ mdFieldDef *token)
@@ -2005,7 +2005,7 @@ ClrDataTypeDefinition::EnumField2(
/* [out][in] */ CLRDATA_ENUM *handle,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32 *flags,
/* [out] */ IXCLRDataModule** tokenScope,
@@ -2180,7 +2180,7 @@ ClrDataTypeDefinition::GetFieldByToken(
/* [in] */ mdFieldDef token,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32 *flags)
{
@@ -2194,7 +2194,7 @@ ClrDataTypeDefinition::GetFieldByToken2(
/* [in] */ mdFieldDef token,
/* [in] */ ULONG32 nameBufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(nameBufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(nameBufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataTypeDefinition **type,
/* [out] */ ULONG32 *flags)
{
@@ -2276,7 +2276,7 @@ ClrDataTypeDefinition::GetName(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ])
{
HRESULT status = S_OK;
@@ -3014,7 +3014,7 @@ ClrDataTypeInstance::GetStaticFieldByIndex(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ mdFieldDef *token)
{
HRESULT status;
@@ -3186,7 +3186,7 @@ ClrDataTypeInstance::EnumStaticField2(
/* [out] */ IXCLRDataValue **value,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataModule** tokenScope,
/* [out] */ mdFieldDef *token)
{
@@ -3351,7 +3351,7 @@ ClrDataTypeInstance::GetStaticFieldByToken(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ])
{
return GetStaticFieldByToken2(NULL, token, tlsTask, field,
bufLen, nameLen, nameBuf);
@@ -3365,7 +3365,7 @@ ClrDataTypeInstance::GetStaticFieldByToken2(
/* [out] */ IXCLRDataValue **field,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ])
{
HRESULT status;
@@ -3430,7 +3430,7 @@ ClrDataTypeInstance::GetName(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ])
{
HRESULT status = S_OK;
diff --git a/src/coreclr/debug/daccess/request.cpp b/src/coreclr/debug/daccess/request.cpp
index fe66a8b30b4212..1e327721f4a92d 100644
--- a/src/coreclr/debug/daccess/request.cpp
+++ b/src/coreclr/debug/daccess/request.cpp
@@ -580,7 +580,7 @@ ClrDataAccess::GetStackLimits(CLRDATA_ADDRESS threadPtr, CLRDATA_ADDRESS *lower,
}
HRESULT
-ClrDataAccess::GetRegisterName(int regNum, unsigned int count, __out_z __inout_ecount(count) WCHAR *buffer, unsigned int *pNeeded)
+ClrDataAccess::GetRegisterName(int regNum, unsigned int count, _Inout_updates_z_(count) WCHAR *buffer, unsigned int *pNeeded)
{
if (!buffer && !pNeeded)
return E_POINTER;
@@ -1322,7 +1322,7 @@ ClrDataAccess::GetMethodDescPtrFromIP(CLRDATA_ADDRESS ip, CLRDATA_ADDRESS * ppMD
}
HRESULT
-ClrDataAccess::GetMethodDescName(CLRDATA_ADDRESS methodDesc, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded)
+ClrDataAccess::GetMethodDescName(CLRDATA_ADDRESS methodDesc, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded)
{
if (methodDesc == 0)
return E_INVALIDARG;
@@ -1426,7 +1426,7 @@ ClrDataAccess::GetDomainFromContext(CLRDATA_ADDRESS contextAddr, CLRDATA_ADDRESS
HRESULT
-ClrDataAccess::GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, __out_z __inout_ecount(count) WCHAR *stringData, unsigned int *pNeeded)
+ClrDataAccess::GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, _Inout_updates_z_(count) WCHAR *stringData, unsigned int *pNeeded)
{
if (obj == 0)
return E_INVALIDARG;
@@ -1478,7 +1478,7 @@ ClrDataAccess::GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, __ou
}
HRESULT
-ClrDataAccess::GetObjectClassName(CLRDATA_ADDRESS obj, unsigned int count, __out_z __inout_ecount(count) WCHAR *className, unsigned int *pNeeded)
+ClrDataAccess::GetObjectClassName(CLRDATA_ADDRESS obj, unsigned int count, _Inout_updates_z_(count) WCHAR *className, unsigned int *pNeeded)
{
if (obj == 0)
return E_INVALIDARG;
@@ -1740,7 +1740,7 @@ ClrDataAccess::GetMethodTableData(CLRDATA_ADDRESS mt, struct DacpMethodTableData
}
HRESULT
-ClrDataAccess::GetMethodTableName(CLRDATA_ADDRESS mt, unsigned int count, __out_z __inout_ecount(count) WCHAR *mtName, unsigned int *pNeeded)
+ClrDataAccess::GetMethodTableName(CLRDATA_ADDRESS mt, unsigned int count, _Inout_updates_z_(count) WCHAR *mtName, unsigned int *pNeeded)
{
if (mt == 0)
return E_INVALIDARG;
@@ -2003,7 +2003,7 @@ ClrDataAccess::GetMethodTableForEEClass(CLRDATA_ADDRESS eeClass, CLRDATA_ADDRESS
}
HRESULT
-ClrDataAccess::GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, __out_z __inout_ecount(count) WCHAR *frameName, unsigned int *pNeeded)
+ClrDataAccess::GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, _Inout_updates_z_(count) WCHAR *frameName, unsigned int *pNeeded)
{
if (vtable == 0)
return E_INVALIDARG;
@@ -2043,7 +2043,7 @@ ClrDataAccess::GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, __out_z
}
HRESULT
-ClrDataAccess::GetPEFileName(CLRDATA_ADDRESS addr, unsigned int count, __out_z __inout_ecount(count) WCHAR *fileName, unsigned int *pNeeded)
+ClrDataAccess::GetPEFileName(CLRDATA_ADDRESS addr, unsigned int count, _Inout_updates_z_(count) WCHAR *fileName, unsigned int *pNeeded)
{
if (addr == 0 || (fileName == NULL && pNeeded == NULL) || (fileName != NULL && count == 0))
return E_INVALIDARG;
@@ -2369,7 +2369,7 @@ ClrDataAccess::GetFailedAssemblyData(CLRDATA_ADDRESS assembly, unsigned int *pCo
HRESULT
ClrDataAccess::GetFailedAssemblyLocation(CLRDATA_ADDRESS assembly, unsigned int count,
- __out_z __inout_ecount(count) WCHAR *location, unsigned int *pNeeded)
+ _Inout_updates_z_(count) WCHAR *location, unsigned int *pNeeded)
{
if (assembly == NULL || (location == NULL && pNeeded == NULL) || (location != NULL && count == 0))
return E_INVALIDARG;
@@ -2399,7 +2399,7 @@ ClrDataAccess::GetFailedAssemblyLocation(CLRDATA_ADDRESS assembly, unsigned int
}
HRESULT
-ClrDataAccess::GetFailedAssemblyDisplayName(CLRDATA_ADDRESS assembly, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded)
+ClrDataAccess::GetFailedAssemblyDisplayName(CLRDATA_ADDRESS assembly, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded)
{
if (assembly == NULL || (name == NULL && pNeeded == NULL) || (name != NULL && count == 0))
return E_INVALIDARG;
@@ -2509,7 +2509,7 @@ ClrDataAccess::GetFailedAssemblyList(CLRDATA_ADDRESS appDomain, int count,
}
HRESULT
-ClrDataAccess::GetAppDomainName(CLRDATA_ADDRESS addr, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded)
+ClrDataAccess::GetAppDomainName(CLRDATA_ADDRESS addr, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded)
{
SOSDacEnter();
@@ -2550,7 +2550,7 @@ ClrDataAccess::GetAppDomainName(CLRDATA_ADDRESS addr, unsigned int count, __out_
HRESULT
ClrDataAccess::GetApplicationBase(CLRDATA_ADDRESS appDomain, int count,
- __out_z __inout_ecount(count) WCHAR *base, unsigned int *pNeeded)
+ _Inout_updates_z_(count) WCHAR *base, unsigned int *pNeeded)
{
// Method is not supported on CoreCLR
@@ -2559,7 +2559,7 @@ ClrDataAccess::GetApplicationBase(CLRDATA_ADDRESS appDomain, int count,
HRESULT
ClrDataAccess::GetPrivateBinPaths(CLRDATA_ADDRESS appDomain, int count,
- __out_z __inout_ecount(count) WCHAR *paths, unsigned int *pNeeded)
+ _Inout_updates_z_(count) WCHAR *paths, unsigned int *pNeeded)
{
// Method is not supported on CoreCLR
@@ -2568,7 +2568,7 @@ ClrDataAccess::GetPrivateBinPaths(CLRDATA_ADDRESS appDomain, int count,
HRESULT
ClrDataAccess::GetAppDomainConfigFile(CLRDATA_ADDRESS appDomain, int count,
- __out_z __inout_ecount(count) WCHAR *configFile, unsigned int *pNeeded)
+ _Inout_updates_z_(count) WCHAR *configFile, unsigned int *pNeeded)
{
// Method is not supported on CoreCLR
@@ -2620,7 +2620,7 @@ ClrDataAccess::GetAssemblyData(CLRDATA_ADDRESS cdBaseDomainPtr, CLRDATA_ADDRESS
}
HRESULT
-ClrDataAccess::GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, __out_z __inout_ecount(count) WCHAR *name, unsigned int *pNeeded)
+ClrDataAccess::GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, _Inout_updates_z_(count) WCHAR *name, unsigned int *pNeeded)
{
SOSDacEnter();
Assembly* pAssembly = PTR_Assembly(TO_TADDR(assembly));
@@ -2661,7 +2661,7 @@ ClrDataAccess::GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, __o
}
HRESULT
-ClrDataAccess::GetAssemblyLocation(CLRDATA_ADDRESS assembly, int count, __out_z __inout_ecount(count) WCHAR *location, unsigned int *pNeeded)
+ClrDataAccess::GetAssemblyLocation(CLRDATA_ADDRESS assembly, int count, _Inout_updates_z_(count) WCHAR *location, unsigned int *pNeeded)
{
if ((assembly == NULL) || (location == NULL && pNeeded == NULL) || (location != NULL && count == 0))
{
@@ -3636,7 +3636,7 @@ ClrDataAccess::GetSyncBlockCleanupData(CLRDATA_ADDRESS syncBlock, struct DacpSyn
}
HRESULT
-ClrDataAccess::GetJitHelperFunctionName(CLRDATA_ADDRESS ip, unsigned int count, __out_z __inout_ecount(count) char *name, unsigned int *pNeeded)
+ClrDataAccess::GetJitHelperFunctionName(CLRDATA_ADDRESS ip, unsigned int count, _Inout_updates_z_(count) char *name, unsigned int *pNeeded)
{
SOSDacEnter();
diff --git a/src/coreclr/debug/daccess/stack.cpp b/src/coreclr/debug/daccess/stack.cpp
index 6ced6d60b35391..dfcb16c31523f3 100644
--- a/src/coreclr/debug/daccess/stack.cpp
+++ b/src/coreclr/debug/daccess/stack.cpp
@@ -787,7 +787,7 @@ ClrDataFrame::GetArgumentByIndex(
/* [out] */ IXCLRDataValue **arg,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -942,7 +942,7 @@ ClrDataFrame::GetLocalVariableByIndex(
/* [out] */ IXCLRDataValue **localVariable,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -1111,7 +1111,7 @@ ClrDataFrame::GetCodeName(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *symbolLen,
- /* [size_is][out] */ __out_ecount_opt(bufLen) WCHAR symbolBuf[ ])
+ /* [size_is][out] */ _Out_writes_bytes_opt_(bufLen) WCHAR symbolBuf[ ])
{
HRESULT status = E_FAIL;
diff --git a/src/coreclr/debug/daccess/task.cpp b/src/coreclr/debug/daccess/task.cpp
index 42c4e0becce1c1..30abc5e090cc9e 100644
--- a/src/coreclr/debug/daccess/task.cpp
+++ b/src/coreclr/debug/daccess/task.cpp
@@ -149,7 +149,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataTask::GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -713,7 +713,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataAppDomain::GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status = S_OK;
@@ -1132,7 +1132,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataAssembly::GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -1160,7 +1160,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataAssembly::GetFileName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -1201,7 +1201,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataAssembly::GetDisplayName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -2376,7 +2376,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataModule::GetName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -2404,7 +2404,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataModule::GetFileName(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -3115,7 +3115,7 @@ ClrDataMethodDefinition::GetName(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -3858,7 +3858,7 @@ ClrDataMethodInstance::GetName(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *nameLen) WCHAR name[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR name[ ])
{
HRESULT status;
@@ -4735,7 +4735,7 @@ HRESULT STDMETHODCALLTYPE
ClrDataExceptionState::GetString(
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *strLen,
- /* [size_is][out] */ __out_ecount_part(bufLen, *strLen) WCHAR str[ ])
+ /* [size_is][out] */ _Out_writes_to_opt_(bufLen, *strLen) WCHAR str[ ])
{
HRESULT status = E_FAIL;
diff --git a/src/coreclr/debug/dbgutil/machoreader.cpp b/src/coreclr/debug/dbgutil/machoreader.cpp
index d2801547cb9ba9..7fef34e1afb16d 100644
--- a/src/coreclr/debug/dbgutil/machoreader.cpp
+++ b/src/coreclr/debug/dbgutil/machoreader.cpp
@@ -229,9 +229,8 @@ MachOModule::ReadLoadCommands()
m_segments.push_back(segment);
// Calculate the load bias for the module. This is the value to add to the vmaddr of a
- // segment to get the actual address. For shared modules, this is 0 since those segments
- // are absolute address.
- if (segment->fileoff == 0 && segment->filesize > 0)
+ // segment to get the actual address.
+ if (strcmp(segment->segname, SEG_TEXT) == 0)
{
m_loadBias = m_baseAddress - segment->vmaddr;
}
diff --git a/src/coreclr/debug/di/cordb.cpp b/src/coreclr/debug/di/cordb.cpp
index 2c11397fcd3bc7..e195f3731a9e6f 100644
--- a/src/coreclr/debug/di/cordb.cpp
+++ b/src/coreclr/debug/di/cordb.cpp
@@ -443,10 +443,10 @@ STDAPI GetRequestedRuntimeInfo(LPCWSTR pExe,
LPCWSTR pConfigurationFile,
DWORD startupFlags,
DWORD runtimeInfoFlags,
- __out_ecount_opt(dwDirectory) LPWSTR pDirectory,
+ _Out_writes_bytes_opt_(dwDirectory) LPWSTR pDirectory,
DWORD dwDirectory,
DWORD *dwDirectoryLength,
- __out_ecount_opt(cchBuffer) LPWSTR pVersion,
+ _Out_writes_bytes_opt_(cchBuffer) LPWSTR pVersion,
DWORD cchBuffer,
DWORD* dwlength)
{
diff --git a/src/coreclr/debug/di/divalue.cpp b/src/coreclr/debug/di/divalue.cpp
index 2e70a306180c59..b8c9e745260db2 100644
--- a/src/coreclr/debug/di/divalue.cpp
+++ b/src/coreclr/debug/di/divalue.cpp
@@ -2320,7 +2320,7 @@ HRESULT CordbObjectValue::GetLength(ULONG32 *pcchString)
// Return Value: S_OK or CORDBG_E_INVALID_OBJECT, CORDBG_E_OBJECT_NEUTERED, or E_INVALIDARG on failure
HRESULT CordbObjectValue::GetString(ULONG32 cchString,
ULONG32 *pcchString,
- __out_ecount_opt(cchString) WCHAR szString[])
+ _Out_writes_bytes_opt_(cchString) WCHAR szString[])
{
PUBLIC_REENTRANT_API_ENTRY(this);
FAIL_IF_NEUTERED(this);
diff --git a/src/coreclr/debug/di/module.cpp b/src/coreclr/debug/di/module.cpp
index 9951d4a6af305f..6d6a7a55befa2e 100644
--- a/src/coreclr/debug/di/module.cpp
+++ b/src/coreclr/debug/di/module.cpp
@@ -1256,7 +1256,7 @@ HRESULT CordbModule::GetAssembly(ICorDebugAssembly **ppAssembly)
// Public implementation of ICorDebugModule::GetName,
// wrapper around code:GetNameWorker (which throws).
-HRESULT CordbModule::GetName(ULONG32 cchName, ULONG32 *pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+HRESULT CordbModule::GetName(ULONG32 cchName, ULONG32 *pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
@@ -1324,7 +1324,7 @@ HRESULT CordbModule::GetName(ULONG32 cchName, ULONG32 *pcchName, __out_ecount_pa
// Note:
// Filename isn't necessarily the same as the module name in the metadata.
//
-HRESULT CordbModule::GetNameWorker(ULONG32 cchName, ULONG32 *pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+HRESULT CordbModule::GetNameWorker(ULONG32 cchName, ULONG32 *pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
CONTRACTL
{
diff --git a/src/coreclr/debug/di/process.cpp b/src/coreclr/debug/di/process.cpp
index 9b21fa47e67285..59af4cc8d9c649 100644
--- a/src/coreclr/debug/di/process.cpp
+++ b/src/coreclr/debug/di/process.cpp
@@ -1111,7 +1111,7 @@ HRESULT ShimProcess::CreateProcess(
Cordb * pCordb,
ICorDebugRemoteTarget * pRemoteTarget,
LPCWSTR szProgramName,
- __in_z LPWSTR szProgramArgs,
+ _In_z_ LPWSTR szProgramArgs,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL fInheritHandles,
@@ -8624,7 +8624,7 @@ HRESULT CordbProcess::EnableLogMessages(BOOL fOnOff)
/*
* ModifyLogSwitch modifies the specified switch's severity level.
*/
-COM_METHOD CordbProcess::ModifyLogSwitch(__in_z WCHAR *pLogSwitchName, LONG lLevel)
+COM_METHOD CordbProcess::ModifyLogSwitch(_In_z_ WCHAR *pLogSwitchName, LONG lLevel)
{
PUBLIC_API_ENTRY(this);
FAIL_IF_NEUTERED(this);
@@ -13674,7 +13674,7 @@ void CordbWin32EventThread::ForceDbgContinue(CordbProcess *pProcess, CordbUnmana
HRESULT CordbWin32EventThread::SendCreateProcessEvent(
MachineInfo machineInfo,
LPCWSTR programName,
- __in_z LPWSTR programArgs,
+ _In_z_ LPWSTR programArgs,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
diff --git a/src/coreclr/debug/di/publish.cpp b/src/coreclr/debug/di/publish.cpp
index 23003b980ad9f1..1d7741fb9ea75b 100644
--- a/src/coreclr/debug/di/publish.cpp
+++ b/src/coreclr/debug/di/publish.cpp
@@ -658,7 +658,7 @@ HRESULT AllocateAndReadRemoteString(
HANDLE hProcess,
void * pRemotePtr,
SIZE_T cbSize, // size of buffer to allocate + copy.
- __deref_out_bcount(cbSize) WCHAR * * ppNewLocalBuffer
+ _Outptr_result_bytebuffer_(cbSize) WCHAR * * ppNewLocalBuffer
)
{
// Make sure buffer has right geometry.
@@ -902,7 +902,7 @@ HRESULT CorpubProcess::GetProcessID(unsigned *pid)
*/
HRESULT CorpubProcess::GetDisplayName(ULONG32 cchName,
ULONG32 *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
VALIDATE_POINTER_TO_OBJECT_ARRAY_OR_NULL(szName, WCHAR, cchName, true, true);
VALIDATE_POINTER_TO_OBJECT_OR_NULL(pcchName, ULONG32 *);
@@ -928,7 +928,7 @@ HRESULT CorpubProcess::GetDisplayName(ULONG32 cchName,
// CorpubAppDomain
// ******************************************
-CorpubAppDomain::CorpubAppDomain (__in LPWSTR szAppDomainName, ULONG Id)
+CorpubAppDomain::CorpubAppDomain (_In_ LPWSTR szAppDomainName, ULONG Id)
: CordbCommonBase (0, enumCorpubAppDomain),
m_pNext (NULL),
m_szAppDomainName (szAppDomainName),
@@ -976,7 +976,7 @@ HRESULT CorpubAppDomain::GetID (ULONG32 *pId)
*/
HRESULT CorpubAppDomain::GetName(ULONG32 cchName,
ULONG32 *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
VALIDATE_POINTER_TO_OBJECT_ARRAY_OR_NULL(szName, WCHAR, cchName, true, true);
VALIDATE_POINTER_TO_OBJECT_OR_NULL(pcchName, ULONG32 *);
diff --git a/src/coreclr/debug/di/rsappdomain.cpp b/src/coreclr/debug/di/rsappdomain.cpp
index 6b4da4ee206027..081baa95216d5b 100644
--- a/src/coreclr/debug/di/rsappdomain.cpp
+++ b/src/coreclr/debug/di/rsappdomain.cpp
@@ -700,7 +700,7 @@ HRESULT CordbAppDomain::Attach()
*/
HRESULT CordbAppDomain::GetName(ULONG32 cchName,
ULONG32 *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
diff --git a/src/coreclr/debug/di/rsassembly.cpp b/src/coreclr/debug/di/rsassembly.cpp
index b7b7d6756391d7..73c864f6e2159a 100644
--- a/src/coreclr/debug/di/rsassembly.cpp
+++ b/src/coreclr/debug/di/rsassembly.cpp
@@ -202,7 +202,7 @@ HRESULT CordbAssembly::EnumerateModules(ICorDebugModuleEnum **ppModules)
*/
HRESULT CordbAssembly::GetCodeBase(ULONG32 cchName,
ULONG32 *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
PUBLIC_API_ENTRY(this);
FAIL_IF_NEUTERED(this);
@@ -232,7 +232,7 @@ HRESULT CordbAssembly::GetCodeBase(ULONG32 cchName,
//
HRESULT CordbAssembly::GetName(ULONG32 cchName,
ULONG32 *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
PUBLIC_API_ENTRY(this);
FAIL_IF_NEUTERED(this);
diff --git a/src/coreclr/debug/di/rsmain.cpp b/src/coreclr/debug/di/rsmain.cpp
index ff49f2186a40ca..5594b299e2d125 100644
--- a/src/coreclr/debug/di/rsmain.cpp
+++ b/src/coreclr/debug/di/rsmain.cpp
@@ -595,7 +595,7 @@ namespace
COM_METHOD CreateConnection(ICorDebugProcess *pProcess,
CONNID dwConnectionId,
- __in_z WCHAR* pConnectionName);
+ _In_z_ WCHAR* pConnectionName);
COM_METHOD ChangeConnection(ICorDebugProcess *pProcess, CONNID dwConnectionId);
COM_METHOD DestroyConnection(ICorDebugProcess *pProcess, CONNID dwConnectionId);
@@ -725,7 +725,7 @@ namespace
HRESULT
DefaultManagedCallback2::CreateConnection(ICorDebugProcess *pProcess,
CONNID dwConnectionId,
- __in_z WCHAR* pConnectionName)
+ _In_z_ WCHAR* pConnectionName)
{
_ASSERTE(!"DefaultManagedCallback2::CreateConnection not implemented");
return E_NOTIMPL;
@@ -1572,7 +1572,7 @@ bool Cordb::IsInteropDebuggingSupported()
//
//---------------------------------------------------------------------------------------
HRESULT Cordb::CreateProcess(LPCWSTR lpApplicationName,
- __in_z LPWSTR lpCommandLine,
+ _In_z_ LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
@@ -1601,7 +1601,7 @@ HRESULT Cordb::CreateProcess(LPCWSTR lpApplicationName,
HRESULT Cordb::CreateProcessCommon(ICorDebugRemoteTarget * pRemoteTarget,
LPCWSTR lpApplicationName,
- __in_z LPWSTR lpCommandLine,
+ _In_z_ LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
@@ -1735,7 +1735,7 @@ HRESULT Cordb::CreateProcessCommon(ICorDebugRemoteTarget * pRemoteTarget,
HRESULT Cordb::CreateProcessEx(ICorDebugRemoteTarget * pRemoteTarget,
LPCWSTR lpApplicationName,
- __in_z LPWSTR lpCommandLine,
+ _In_z_ LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
diff --git a/src/coreclr/debug/di/rsmda.cpp b/src/coreclr/debug/di/rsmda.cpp
index 517e6dcfdeb015..822e9824a1d417 100644
--- a/src/coreclr/debug/di/rsmda.cpp
+++ b/src/coreclr/debug/di/rsmda.cpp
@@ -102,7 +102,7 @@ HRESULT CordbMDA::QueryInterface(REFIID riid, void **ppInterface)
//
// Returns: S_OK on success.
//-----------------------------------------------------------------------------
-HRESULT CopyOutString(LPCWSTR pInputString, ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+HRESULT CopyOutString(LPCWSTR pInputString, ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
_ASSERTE(pInputString != NULL);
ULONG32 len = (ULONG32) wcslen(pInputString) + 1;
@@ -144,7 +144,7 @@ HRESULT CopyOutString(LPCWSTR pInputString, ULONG32 cchName, ULONG32 * pcchName,
// the type from that based off the schema.
// See CopyOutString for parameter details.
//-----------------------------------------------------------------------------
-HRESULT CordbMDA::GetName(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+HRESULT CordbMDA::GetName(ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
@@ -159,7 +159,7 @@ HRESULT CordbMDA::GetName(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part
// Get a string description of the MDA. This may be empty (0-length).
// See CopyOutString for parameter details.
//-----------------------------------------------------------------------------
-HRESULT CordbMDA::GetDescription(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+HRESULT CordbMDA::GetDescription(ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
@@ -176,7 +176,7 @@ HRESULT CordbMDA::GetDescription(ULONG32 cchName, ULONG32 * pcchName, __out_ecou
// See the MDA documentation for the schema for this XML stream.
// See CopyOutString for parameter details.
//-----------------------------------------------------------------------------
-HRESULT CordbMDA::GetXML(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[])
+HRESULT CordbMDA::GetXML(ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[])
{
HRESULT hr = S_OK;
PUBLIC_API_BEGIN(this)
diff --git a/src/coreclr/debug/di/rspriv.h b/src/coreclr/debug/di/rspriv.h
index a34dd0e6a07288..690917c2795a91 100644
--- a/src/coreclr/debug/di/rspriv.h
+++ b/src/coreclr/debug/di/rspriv.h
@@ -2211,7 +2211,7 @@ class Cordb : public CordbBase, public ICorDebug, public ICorDebugRemote
COM_METHOD SetManagedHandler(ICorDebugManagedCallback *pCallback);
COM_METHOD SetUnmanagedHandler(ICorDebugUnmanagedCallback *pCallback);
COM_METHOD CreateProcess(LPCWSTR lpApplicationName,
- __in_z LPWSTR lpCommandLine,
+ _In_z_ LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
@@ -2243,7 +2243,7 @@ class Cordb : public CordbBase, public ICorDebug, public ICorDebugRemote
COM_METHOD CreateProcessEx(ICorDebugRemoteTarget * pRemoteTarget,
LPCWSTR lpApplicationName,
- __in_z LPWSTR lpCommandLine,
+ _In_z_ LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
@@ -2267,7 +2267,7 @@ class Cordb : public CordbBase, public ICorDebug, public ICorDebugRemote
HRESULT CreateProcessCommon(ICorDebugRemoteTarget * pRemoteTarget,
LPCWSTR lpApplicationName,
- __in_z LPWSTR lpCommandLine,
+ _In_z_ LPWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
@@ -2463,7 +2463,7 @@ class CordbAppDomain : public CordbBase,
// Returns the friendly name of the AppDomain
COM_METHOD GetName(ULONG32 cchName,
ULONG32 * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
/*
* GetObject returns the runtime app domain object.
@@ -2646,12 +2646,12 @@ class CordbAssembly : public CordbBase, public ICorDebugAssembly, ICorDebugAssem
*/
COM_METHOD GetCodeBase(ULONG32 cchName,
ULONG32 * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
// returns the filename of the assembly, or "" for in-memory assemblies
COM_METHOD GetName(ULONG32 cchName,
ULONG32 * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
//-----------------------------------------------------------
@@ -3079,7 +3079,7 @@ class CordbProcess :
/*
* ModifyLogSwitch modifies the specified switch's severity level.
*/
- COM_METHOD ModifyLogSwitch(__in_z WCHAR *pLogSwitchName, LONG lLevel);
+ COM_METHOD ModifyLogSwitch(_In_z_ WCHAR *pLogSwitchName, LONG lLevel);
COM_METHOD EnumerateAppDomains(ICorDebugAppDomainEnum **ppAppDomains);
COM_METHOD GetObject(ICorDebugValue **ppObject);
@@ -4180,7 +4180,7 @@ class CordbModule : public CordbBase,
COM_METHOD GetProcess(ICorDebugProcess **ppProcess);
COM_METHOD GetBaseAddress(CORDB_ADDRESS *pAddress);
COM_METHOD GetAssembly(ICorDebugAssembly **ppAssembly);
- COM_METHOD GetName(ULONG32 cchName, ULONG32 *pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ COM_METHOD GetName(ULONG32 cchName, ULONG32 *pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
COM_METHOD EnableJITDebugging(BOOL bTrackJITInfo, BOOL bAllowJitOpts);
COM_METHOD EnableClassLoadCallbacks(BOOL bClassLoadCallbacks);
@@ -4252,7 +4252,7 @@ class CordbModule : public CordbBase,
#endif // _DEBUG
// Internal help to get the "name" (filename or pretty name) of the module.
- HRESULT GetNameWorker(ULONG32 cchName, ULONG32 *pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ HRESULT GetNameWorker(ULONG32 cchName, ULONG32 *pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
// Marks that the module's metadata has become invalid and needs to be refetched.
void RefreshMetaData();
@@ -4484,15 +4484,15 @@ class CordbMDA : public CordbBase, public ICorDebugMDA
// Get the string for the type of the MDA. Never empty.
// This is a convenient performant alternative to getting the XML stream and extracting
// the type from that based off the schema.
- COM_METHOD GetName(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ COM_METHOD GetName(ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
// Get a string description of the MDA. This may be empty (0-length).
- COM_METHOD GetDescription(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ COM_METHOD GetDescription(ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
// Get the full associated XML for the MDA. This may be empty.
// This could be a potentially expensive operation if the xml stream is large.
// See the MDA documentation for the schema for this XML stream.
- COM_METHOD GetXML(ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ COM_METHOD GetXML(ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
COM_METHOD GetFlags(CorDebugMDAFlags * pFlags);
@@ -9292,7 +9292,7 @@ class CordbObjectValue : public CordbValue,
COM_METHOD GetLength(ULONG32 * pcchString);
COM_METHOD GetString(ULONG32 cchString,
ULONG32 * ppcchStrin,
- __out_ecount_opt(cchString) WCHAR szString[]);
+ _Out_writes_bytes_opt_(cchString) WCHAR szString[]);
//-----------------------------------------------------------
// ICorDebugExceptionObjectValue
@@ -10120,7 +10120,7 @@ class CordbWin32EventThread
HRESULT SendCreateProcessEvent(MachineInfo machineInfo,
LPCWSTR programName,
- __in_z LPWSTR programArgs,
+ _In_z_ LPWSTR programArgs,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
@@ -10811,7 +10811,7 @@ class CorpubProcess : public CordbCommonBase, public ICorPublishProcess
*/
COM_METHOD GetDisplayName(ULONG32 cchName,
ULONG32 *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
CorpubProcess *GetNextProcess () { return m_pNext;}
void SetNext (CorpubProcess *pNext) { m_pNext = pNext;}
@@ -10838,7 +10838,7 @@ class CorpubProcess : public CordbCommonBase, public ICorPublishProcess
class CorpubAppDomain : public CordbCommonBase, public ICorPublishAppDomain
{
public:
- CorpubAppDomain (__in LPWSTR szAppDomainName, ULONG Id);
+ CorpubAppDomain (_In_ LPWSTR szAppDomainName, ULONG Id);
virtual ~CorpubAppDomain();
#ifdef _DEBUG
@@ -10873,7 +10873,7 @@ class CorpubAppDomain : public CordbCommonBase, public ICorPublishAppDomain
*/
COM_METHOD GetName (ULONG32 cchName,
ULONG32 *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
CorpubAppDomain *GetNextAppDomain () { return m_pNext;}
void SetNext (CorpubAppDomain *pNext) { m_pNext = pNext;}
@@ -11142,7 +11142,7 @@ class CordbEnumFilter : public CordbBase,
void CheckAgainstDAC(CordbFunction * pFunc, void * pIP, mdMethodDef mdExpected);
#endif
-HRESULT CopyOutString(const WCHAR * pInputString, ULONG32 cchName, ULONG32 * pcchName, __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[]);
+HRESULT CopyOutString(const WCHAR * pInputString, ULONG32 cchName, ULONG32 * pcchName, _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[]);
diff --git a/src/coreclr/debug/di/shimcallback.cpp b/src/coreclr/debug/di/shimcallback.cpp
index ba5f0771fca49a..4e8f029209def7 100644
--- a/src/coreclr/debug/di/shimcallback.cpp
+++ b/src/coreclr/debug/di/shimcallback.cpp
@@ -659,7 +659,7 @@ HRESULT ShimProxyCallback::DebuggerError(ICorDebugProcess * pProcess, HRESULT er
// Implementation of ICorDebugManagedCallback::LogMessage
-HRESULT ShimProxyCallback::LogMessage(ICorDebugAppDomain * pAppDomain, ICorDebugThread * pThread, LONG lLevel, __in LPWSTR pLogSwitchName, __in LPWSTR pMessage)
+HRESULT ShimProxyCallback::LogMessage(ICorDebugAppDomain * pAppDomain, ICorDebugThread * pThread, LONG lLevel, _In_ LPWSTR pLogSwitchName, _In_ LPWSTR pMessage)
{
m_pShim->PreDispatchEvent();
class LogMessageEvent : public ManagedEvent
@@ -695,7 +695,7 @@ HRESULT ShimProxyCallback::LogMessage(ICorDebugAppDomain * pAppDomain, ICorDebug
// Implementation of ICorDebugManagedCallback::LogSwitch
-HRESULT ShimProxyCallback::LogSwitch(ICorDebugAppDomain * pAppDomain, ICorDebugThread * pThread, LONG lLevel, ULONG ulReason, __in LPWSTR pLogSwitchName, __in LPWSTR pParentName)
+HRESULT ShimProxyCallback::LogSwitch(ICorDebugAppDomain * pAppDomain, ICorDebugThread * pThread, LONG lLevel, ULONG ulReason, _In_ LPWSTR pLogSwitchName, _In_ LPWSTR pParentName)
{
m_pShim->PreDispatchEvent();
class LogSwitchEvent : public ManagedEvent
@@ -1060,7 +1060,7 @@ HRESULT ShimProxyCallback::FunctionRemapOpportunity(ICorDebugAppDomain * pAppDom
// Implementation of ICorDebugManagedCallback2::CreateConnection
-HRESULT ShimProxyCallback::CreateConnection(ICorDebugProcess * pProcess, CONNID dwConnectionId, __in LPWSTR pConnectionName)
+HRESULT ShimProxyCallback::CreateConnection(ICorDebugProcess * pProcess, CONNID dwConnectionId, _In_ LPWSTR pConnectionName)
{
m_pShim->PreDispatchEvent();
class CreateConnectionEvent : public ManagedEvent
diff --git a/src/coreclr/debug/di/shimpriv.h b/src/coreclr/debug/di/shimpriv.h
index 89a0c0d0c79374..26a939ee8a3a8e 100644
--- a/src/coreclr/debug/di/shimpriv.h
+++ b/src/coreclr/debug/di/shimpriv.h
@@ -128,15 +128,15 @@ class ShimProxyCallback :
COM_METHOD LogMessage( ICorDebugAppDomain *pAppDomain,
ICorDebugThread *pThread,
LONG lLevel,
- __in LPWSTR pLogSwitchName,
- __in LPWSTR pMessage);
+ _In_ LPWSTR pLogSwitchName,
+ _In_ LPWSTR pMessage);
COM_METHOD LogSwitch( ICorDebugAppDomain *pAppDomain,
ICorDebugThread *pThread,
LONG lLevel,
ULONG ulReason,
- __in LPWSTR pLogSwitchName,
- __in LPWSTR pParentName);
+ _In_ LPWSTR pLogSwitchName,
+ _In_ LPWSTR pParentName);
COM_METHOD CreateAppDomain(ICorDebugProcess *pProcess,
ICorDebugAppDomain *pAppDomain);
@@ -178,7 +178,7 @@ class ShimProxyCallback :
ICorDebugFunction *pNewFunction,
ULONG32 oldILOffset);
- COM_METHOD CreateConnection(ICorDebugProcess *pProcess, CONNID dwConnectionId, __in LPWSTR pConnName);
+ COM_METHOD CreateConnection(ICorDebugProcess *pProcess, CONNID dwConnectionId, _In_ LPWSTR pConnName);
COM_METHOD ChangeConnection(ICorDebugProcess *pProcess, CONNID dwConnectionId );
@@ -368,7 +368,7 @@ class ShimProcess
Cordb * pCordb,
ICorDebugRemoteTarget * pRemoteTarget,
LPCWSTR programName,
- __in_z LPWSTR programArgs,
+ _In_z_ LPWSTR programArgs,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
diff --git a/src/coreclr/debug/di/symbolinfo.cpp b/src/coreclr/debug/di/symbolinfo.cpp
index 452adbe71f3a7e..37cff967d02fea 100644
--- a/src/coreclr/debug/di/symbolinfo.cpp
+++ b/src/coreclr/debug/di/symbolinfo.cpp
@@ -231,7 +231,7 @@ STDMETHODIMP_(ULONG) SymbolInfo::Release ()
STDMETHODIMP SymbolInfo::GetTypeDefProps ( // S_OK or error.
mdTypeDef td, // [IN] TypeDef token for inquiry.
- __out_ecount_part_opt(cchTypeDef, pchTypeDef)
+ _Out_writes_to_opt_(cchTypeDef, pchTypeDef)
LPWSTR szTypeDef, // [OUT] Put name here.
ULONG cchTypeDef, // [IN] size of name buffer in wide chars.
ULONG *pchTypeDef, // [OUT] put size of name (wide chars) here.
@@ -278,7 +278,7 @@ STDMETHODIMP SymbolInfo::GetTypeDefProps ( // S_OK or error.
STDMETHODIMP SymbolInfo::GetMethodProps (
mdMethodDef mb, // The method for which to get props.
mdTypeDef *pClass, // Put method's class here.
- __out_ecount_part_opt(cchMethod, *pchMethod)
+ _Out_writes_to_opt_(cchMethod, *pchMethod)
LPWSTR szMethod, // Put method's name here.
ULONG cchMethod, // Size of szMethod buffer in wide chars.
ULONG *pchMethod, // Put actual size here
@@ -419,7 +419,7 @@ STDMETHODIMP SymbolInfo::FindTypeDefByName ( // S_OK or error.
}
STDMETHODIMP SymbolInfo::GetScopeProps ( // S_OK or error.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] Put the name here.
ULONG cchName, // [IN] Size of name buffer in wide chars.
ULONG *pchName, // [OUT] Put size of name (wide chars) here.
@@ -449,7 +449,7 @@ STDMETHODIMP SymbolInfo::GetInterfaceImplProps ( // S_OK or error.
STDMETHODIMP SymbolInfo::GetTypeRefProps ( // S_OK or error.
mdTypeRef tr, // [IN] TypeRef token.
mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] Name of the TypeRef.
ULONG cchName, // [IN] Size of buffer.
ULONG *pchName) // [OUT] Size of Name.
@@ -629,7 +629,7 @@ STDMETHODIMP SymbolInfo::FindMemberRef (
STDMETHODIMP SymbolInfo::GetMemberRefProps ( // S_OK or error.
mdMemberRef mr, // [IN] given memberref
mdToken *ptk, // [OUT] Put classref or classdef here.
- __out_ecount_part_opt(cchMember, *pchMember)
+ _Out_writes_to_opt_(cchMember, *pchMember)
LPWSTR szMember, // [OUT] buffer to fill for member's name
ULONG cchMember, // [IN] the count of char of szMember
ULONG *pchMember, // [OUT] actual count of char in member name
@@ -752,7 +752,7 @@ STDMETHODIMP SymbolInfo::GetSigFromToken ( // S_OK or error.
STDMETHODIMP SymbolInfo::GetModuleRefProps ( // S_OK or error.
mdModuleRef mur, // [IN] moduleref token.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] buffer to fill with the moduleref name.
ULONG cchName, // [IN] size of szName in wide characters.
ULONG *pchName) // [OUT] actual count of characters in the name.
@@ -800,7 +800,7 @@ STDMETHODIMP SymbolInfo::EnumUnresolvedMethods ( // S_OK, S_FALSE, or erro
STDMETHODIMP SymbolInfo::GetUserString ( // S_OK or error.
mdString stk, // [IN] String token.
- __out_ecount_part_opt(cchString, *pchString)
+ _Out_writes_to_opt_(cchString, *pchString)
LPWSTR szString, // [OUT] Copy of string.
ULONG cchString, // [IN] Max chars of room in szString.
ULONG *pchString) // [OUT] How many chars in actual string.
@@ -812,7 +812,7 @@ STDMETHODIMP SymbolInfo::GetUserString ( // S_OK or error.
STDMETHODIMP SymbolInfo::GetPinvokeMap ( // S_OK or error.
mdToken tk, // [IN] FieldDef or MethodDef.
DWORD *pdwMappingFlags, // [OUT] Flags used for mapping.
- __out_ecount_part_opt(cchImportName, *pchImportName)
+ _Out_writes_to_opt_(cchImportName, *pchImportName)
LPWSTR szImportName, // [OUT] Import name.
ULONG cchImportName, // [IN] Size of the name buffer.
ULONG *pchImportName, // [OUT] Actual number of characters stored.
@@ -896,7 +896,7 @@ STDMETHODIMP SymbolInfo::FindTypeRef (
STDMETHODIMP SymbolInfo::GetMemberProps (
mdToken mb, // The member for which to get props.
mdTypeDef *pClass, // Put member's class here.
- __out_ecount_part_opt(cchMember, *pchMember)
+ _Out_writes_to_opt_(cchMember, *pchMember)
LPWSTR szMember, // Put member's name here.
ULONG cchMember, // Size of szMember buffer in wide chars.
ULONG *pchMember, // Put actual size here
@@ -916,7 +916,7 @@ STDMETHODIMP SymbolInfo::GetMemberProps (
STDMETHODIMP SymbolInfo::GetFieldProps (
mdFieldDef mb, // The field for which to get props.
mdTypeDef *pClass, // Put field's class here.
- __out_ecount_part_opt(cchField, *pchField)
+ _Out_writes_to_opt_(cchField, *pchField)
LPWSTR szField, // Put field's name here.
ULONG cchField, // Size of szField buffer in wide chars.
ULONG *pchField, // Put actual size here
@@ -957,7 +957,7 @@ STDMETHODIMP SymbolInfo::GetParamProps ( // S_OK or error.
mdParamDef tk, // [IN]The Parameter.
mdMethodDef *pmd, // [OUT] Parent Method token.
ULONG *pulSequence, // [OUT] Parameter sequence.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] Put name here.
ULONG cchName, // [OUT] Size of name buffer.
ULONG *pchName, // [OUT] Put actual size of name here.
diff --git a/src/coreclr/debug/di/symbolinfo.h b/src/coreclr/debug/di/symbolinfo.h
index 22deafaaf5d516..5b1291f4cfe598 100644
--- a/src/coreclr/debug/di/symbolinfo.h
+++ b/src/coreclr/debug/di/symbolinfo.h
@@ -104,7 +104,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
mdTypeDef *ptd); // [OUT] Put the TypeDef token here.
STDMETHOD(GetScopeProps)( // S_OK or error.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] Put the name here.
ULONG cchName, // [IN] Size of name buffer in wide chars.
ULONG *pchName, // [OUT] Put size of name (wide chars) here.
@@ -115,7 +115,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetTypeDefProps)( // S_OK or error.
mdTypeDef td, // [IN] TypeDef token for inquiry.
- __out_ecount_part_opt(cchTypeDef, *pchTypeDef)
+ _Out_writes_to_opt_(cchTypeDef, *pchTypeDef)
LPWSTR szTypeDef, // [OUT] Put name here.
ULONG cchTypeDef, // [IN] size of name buffer in wide chars.
ULONG *pchTypeDef, // [OUT] put size of name (wide chars) here.
@@ -130,7 +130,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetTypeRefProps)( // S_OK or error.
mdTypeRef tr, // [IN] TypeRef token.
mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] Name of the TypeRef.
ULONG cchName, // [IN] Size of buffer.
ULONG *pchName); // [OUT] Size of Name.
@@ -244,7 +244,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD (GetMethodProps)(
mdMethodDef mb, // The method for which to get props.
mdTypeDef *pClass, // Put method's class here.
- __out_ecount_part_opt(cchMethod, *pchMethod)
+ _Out_writes_to_opt_(cchMethod, *pchMethod)
LPWSTR szMethod, // Put method's name here.
ULONG cchMethod, // Size of szMethod buffer in wide chars.
ULONG *pchMethod, // Put actual size here
@@ -257,7 +257,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetMemberRefProps)( // S_OK or error.
mdMemberRef mr, // [IN] given memberref
mdToken *ptk, // [OUT] Put classref or classdef here.
- __out_ecount_part_opt(cchMember, *pchMember)
+ _Out_writes_to_opt_(cchMember, *pchMember)
LPWSTR szMember, // [OUT] buffer to fill for member's name
ULONG cchMember, // [IN] the count of char of szMember
ULONG *pchMember, // [OUT] actual count of char in member name
@@ -336,7 +336,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetModuleRefProps)( // S_OK or error.
mdModuleRef mur, // [IN] moduleref token.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] buffer to fill with the moduleref name.
ULONG cchName, // [IN] size of szName in wide characters.
ULONG *pchName); // [OUT] actual count of characters in the name.
@@ -364,7 +364,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetUserString)( // S_OK or error.
mdString stk, // [IN] String token.
- __out_ecount_part_opt(cchString, *pchString)
+ _Out_writes_to_opt_(cchString, *pchString)
LPWSTR szString, // [OUT] Copy of string.
ULONG cchString, // [IN] Max chars of room in szString.
ULONG *pchString); // [OUT] How many chars in actual string.
@@ -372,7 +372,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetPinvokeMap)( // S_OK or error.
mdToken tk, // [IN] FieldDef or MethodDef.
DWORD *pdwMappingFlags, // [OUT] Flags used for mapping.
- __out_ecount_part_opt(cchImportName, *pchImportName)
+ _Out_writes_to_opt_(cchImportName, *pchImportName)
LPWSTR szImportName, // [OUT] Import name.
ULONG cchImportName, // [IN] Size of the name buffer.
ULONG *pchImportName, // [OUT] Actual number of characters stored.
@@ -424,7 +424,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetMemberProps)(
mdToken mb, // The member for which to get props.
mdTypeDef *pClass, // Put member's class here.
- __out_ecount_part_opt(cchMember, *pchMember)
+ _Out_writes_to_opt_(cchMember, *pchMember)
LPWSTR szMember, // Put member's name here.
ULONG cchMember, // Size of szMember buffer in wide chars.
ULONG *pchMember, // Put actual size here
@@ -440,7 +440,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
STDMETHOD(GetFieldProps)(
mdFieldDef mb, // The field for which to get props.
mdTypeDef *pClass, // Put field's class here.
- __out_ecount_part_opt(cchField, *pchField)
+ _Out_writes_to_opt_(cchField, *pchField)
LPWSTR szField, // Put field's name here.
ULONG cchField, // Size of szField buffer in wide chars.
ULONG *pchField, // Put actual size here
@@ -473,7 +473,7 @@ class SymbolInfo: IMetaDataEmit, IMetaDataImport
mdParamDef tk, // [IN]The Parameter.
mdMethodDef *pmd, // [OUT] Parent Method token.
ULONG *pulSequence, // [OUT] Parameter sequence.
- __out_ecount_part_opt(cchName, *pchName)
+ _Out_writes_to_opt_(cchName, *pchName)
LPWSTR szName, // [OUT] Put name here.
ULONG cchName, // [OUT] Size of name buffer.
ULONG *pchName, // [OUT] Put actual size of name here.
diff --git a/src/coreclr/debug/ee/debugger.cpp b/src/coreclr/debug/ee/debugger.cpp
index 8e5200d37d5097..1e326e724250b6 100644
--- a/src/coreclr/debug/ee/debugger.cpp
+++ b/src/coreclr/debug/ee/debugger.cpp
@@ -14341,8 +14341,8 @@ void Debugger::SendRawLogMessage(
// the creation/modification of a LogSwitch
void Debugger::SendLogSwitchSetting(int iLevel,
int iReason,
- __in_z LPCWSTR pLogSwitchName,
- __in_z LPCWSTR pParentSwitchName)
+ _In_z_ LPCWSTR pLogSwitchName,
+ _In_z_ LPCWSTR pParentSwitchName)
{
CONTRACTL
{
@@ -15854,7 +15854,7 @@ BOOL Debugger::IsThreadContextInvalid(Thread *pThread, CONTEXT *pCtx)
// notification when a SQL connection begins
-void Debugger::CreateConnection(CONNID dwConnectionId, __in_z WCHAR *wzName)
+void Debugger::CreateConnection(CONNID dwConnectionId, _In_z_ WCHAR *wzName)
{
CONTRACTL
{
diff --git a/src/coreclr/debug/ee/debugger.h b/src/coreclr/debug/ee/debugger.h
index 3fd9edf68f5d86..084f1da6a5c93f 100644
--- a/src/coreclr/debug/ee/debugger.h
+++ b/src/coreclr/debug/ee/debugger.h
@@ -2201,7 +2201,7 @@ class Debugger : public DebugInterface
void SendInterceptExceptionComplete(Thread *thread);
HRESULT AttachDebuggerForBreakpoint(Thread *thread,
- __in_opt WCHAR *wszLaunchReason);
+ _In_opt_ WCHAR *wszLaunchReason);
void ThreadIsSafe(Thread *thread);
@@ -2424,8 +2424,8 @@ class Debugger : public DebugInterface
void SendLogSwitchSetting (int iLevel,
int iReason,
- __in_z LPCWSTR pLogSwitchName,
- __in_z LPCWSTR pParentSwitchName);
+ _In_z_ LPCWSTR pLogSwitchName,
+ _In_z_ LPCWSTR pParentSwitchName);
bool IsLoggingEnabled (void)
{
@@ -2507,7 +2507,7 @@ class Debugger : public DebugInterface
BOOL IsThreadContextInvalid(Thread *pThread, T_CONTEXT *pCtx);
// notification for SQL fiber debugging support
- void CreateConnection(CONNID dwConnectionId, __in_z WCHAR *wzName);
+ void CreateConnection(CONNID dwConnectionId, _In_z_ WCHAR *wzName);
void DestroyConnection(CONNID dwConnectionId);
void ChangeConnection(CONNID dwConnectionId);
@@ -3704,7 +3704,7 @@ void DbgLogHelper(DebuggerIPCEventType event);
// Helpers for cleanup
// These are various utility functions, mainly where we factor out code.
//-----------------------------------------------------------------------------
-void GetPidDecoratedName(__out_ecount(cBufSizeInChars) WCHAR * pBuf,
+void GetPidDecoratedName(_Out_writes_(cBufSizeInChars) WCHAR * pBuf,
int cBufSizeInChars,
const WCHAR * pPrefix);
diff --git a/src/coreclr/debug/ee/rcthread.cpp b/src/coreclr/debug/ee/rcthread.cpp
index 18c840edbb6984..0f48eb2c95e188 100644
--- a/src/coreclr/debug/ee/rcthread.cpp
+++ b/src/coreclr/debug/ee/rcthread.cpp
@@ -116,7 +116,7 @@ void DebuggerRCThread::CloseIPCHandles()
// cBufSizeInChars - the size of the buffer in characters, including the null.
// pPrefx - The undecorated name of the event.
//-----------------------------------------------------------------------------
-void GetPidDecoratedName(__out_ecount(cBufSizeInChars) WCHAR * pBuf,
+void GetPidDecoratedName(_Out_writes_(cBufSizeInChars) WCHAR * pBuf,
int cBufSizeInChars,
const WCHAR * pPrefix)
{
diff --git a/src/coreclr/debug/inc/common.h b/src/coreclr/debug/inc/common.h
index 2baec963e14f2f..cb8474c7373856 100644
--- a/src/coreclr/debug/inc/common.h
+++ b/src/coreclr/debug/inc/common.h
@@ -45,7 +45,7 @@ void InitEventForDebuggerNotification(DEBUG_EVENT * pDebugEvent,
#endif // (FEATURE_DBGIPC_TRANSPORT_DI || FEATURE_DBGIPC_TRANSPORT_VM)
-void GetPidDecoratedName(__out_z __out_ecount(cBufSizeInChars) WCHAR * pBuf,
+void GetPidDecoratedName(_Out_writes_z_(cBufSizeInChars) WCHAR * pBuf,
int cBufSizeInChars,
const WCHAR * pPrefix,
DWORD pid);
diff --git a/src/coreclr/debug/inc/dbgipcevents.h b/src/coreclr/debug/inc/dbgipcevents.h
index db4a00fca1c865..ddef09554cf80d 100644
--- a/src/coreclr/debug/inc/dbgipcevents.h
+++ b/src/coreclr/debug/inc/dbgipcevents.h
@@ -990,7 +990,7 @@ extern const size_t nameCount;
struct MSLAYOUT IPCENames // We use a class/struct so that the function can remain in a shared header file
{
- static DebuggerIPCEventType GetEventType(__in_z char * strEventType)
+ static DebuggerIPCEventType GetEventType(_In_z_ char * strEventType)
{
// pass in the string of event name and find the matching enum value
// This is a linear search which is pretty slow. However, this is only used
diff --git a/src/coreclr/debug/shared/dbgtransportsession.cpp b/src/coreclr/debug/shared/dbgtransportsession.cpp
index 85fb7901b01c1a..6d3ed5b345cf7c 100644
--- a/src/coreclr/debug/shared/dbgtransportsession.cpp
+++ b/src/coreclr/debug/shared/dbgtransportsession.cpp
@@ -1143,7 +1143,7 @@ DbgTransportSession::Message * DbgTransportSession::RemoveMessageFromSendQueue(D
// Check read and optionally write memory access to the specified range of bytes. Used to check
// ReadProcessMemory and WriteProcessMemory requests.
-HRESULT DbgTransportSession::CheckBufferAccess(__in_ecount(cbBuffer) PBYTE pbBuffer, DWORD cbBuffer, bool fWriteAccess)
+HRESULT DbgTransportSession::CheckBufferAccess(_In_reads_(cbBuffer) PBYTE pbBuffer, DWORD cbBuffer, bool fWriteAccess)
{
// check for integer overflow
if ((pbBuffer + cbBuffer) < pbBuffer)
diff --git a/src/coreclr/debug/shared/utils.cpp b/src/coreclr/debug/shared/utils.cpp
index 85f17b50c44e78..be967b1d1b7fa2 100644
--- a/src/coreclr/debug/shared/utils.cpp
+++ b/src/coreclr/debug/shared/utils.cpp
@@ -126,7 +126,7 @@ void InitEventForDebuggerNotification(DEBUG_EVENT * pDebugEvent,
// cBufSizeInChars - the size of the buffer in characters, including the null.
// pPrefx - The undecorated name of the event.
//-----------------------------------------------------------------------------
-void GetPidDecoratedName(__out_z __out_ecount(cBufSizeInChars) WCHAR * pBuf, int cBufSizeInChars, const WCHAR * pPrefix, DWORD pid)
+void GetPidDecoratedName(_Out_writes_z_(cBufSizeInChars) WCHAR * pBuf, int cBufSizeInChars, const WCHAR * pPrefix, DWORD pid)
{
const WCHAR szGlobal[] = W("Global\\");
int szGlobalLen;
diff --git a/src/coreclr/debug/shim/debugshim.cpp b/src/coreclr/debug/shim/debugshim.cpp
index b86c8eb0cfcc3a..3dcfbcc2510785 100644
--- a/src/coreclr/debug/shim/debugshim.cpp
+++ b/src/coreclr/debug/shim/debugshim.cpp
@@ -427,11 +427,11 @@ HRESULT CLRDebuggingImpl::GetCLRInfo(ICorDebugDataTarget* pDataTarget,
CLR_DEBUGGING_VERSION* pVersion,
DWORD* pdwDbiTimeStamp,
DWORD* pdwDbiSizeOfImage,
- __out_z __inout_ecount(dwDbiNameCharCount) WCHAR* pDbiName,
+ _Inout_updates_z_(dwDbiNameCharCount) WCHAR* pDbiName,
DWORD dwDbiNameCharCount,
DWORD* pdwDacTimeStamp,
DWORD* pdwDacSizeOfImage,
- __out_z __inout_ecount(dwDacNameCharCount) WCHAR* pDacName,
+ _Inout_updates_z_(dwDacNameCharCount) WCHAR* pDacName,
DWORD dwDacNameCharCount)
{
#ifdef HOST_WINDOWS
@@ -629,7 +629,7 @@ HRESULT CLRDebuggingImpl::GetCLRInfo(ICorDebugDataTarget* pDataTarget,
}
// Formats the long name for DAC
-HRESULT CLRDebuggingImpl::FormatLongDacModuleName(__out_z __inout_ecount(cchBuffer) WCHAR * pBuffer,
+HRESULT CLRDebuggingImpl::FormatLongDacModuleName(_Inout_updates_z_(cchBuffer) WCHAR * pBuffer,
DWORD cchBuffer,
DWORD targetImageFileMachine,
VS_FIXEDFILEINFO * pVersion)
diff --git a/src/coreclr/debug/shim/debugshim.h b/src/coreclr/debug/shim/debugshim.h
index 5055d5a11b47d1..93df463867feb5 100644
--- a/src/coreclr/debug/shim/debugshim.h
+++ b/src/coreclr/debug/shim/debugshim.h
@@ -69,14 +69,14 @@ class CLRDebuggingImpl : public ICLRDebugging
CLR_DEBUGGING_VERSION * pVersion,
DWORD * pdwDbiTimeStamp,
DWORD * pdwDbiSizeOfImage,
- __out_z __inout_ecount(dwDbiNameCharCount) WCHAR * pDbiName,
+ _Inout_updates_z_(dwDbiNameCharCount) WCHAR * pDbiName,
DWORD dwDbiNameCharCount,
DWORD * pdwDacTimeStamp,
DWORD * pdwDacSizeOfImage,
- __out_z __inout_ecount(dwDacNameCharCount) WCHAR * pDacName,
+ _Inout_updates_z_(dwDacNameCharCount) WCHAR * pDacName,
DWORD dwDacNameCharCount);
- HRESULT FormatLongDacModuleName(__out_z __inout_ecount(cchBuffer) WCHAR * pBuffer,
+ HRESULT FormatLongDacModuleName(_Inout_updates_z_(cchBuffer) WCHAR * pBuffer,
DWORD cchBuffer,
DWORD targetImageFileMachine,
VS_FIXEDFILEINFO * pVersion);
diff --git a/src/coreclr/dlls/dbgshim/dbgshim.cpp b/src/coreclr/dlls/dbgshim/dbgshim.cpp
index ac1e2d7fe189ac..40e4d7dea4bf26 100644
--- a/src/coreclr/dlls/dbgshim/dbgshim.cpp
+++ b/src/coreclr/dlls/dbgshim/dbgshim.cpp
@@ -79,12 +79,12 @@ if it exists, it will:
DLLEXPORT
HRESULT
CreateProcessForLaunch(
- __in LPWSTR lpCommandLine,
- __in BOOL bSuspendProcess,
- __in LPVOID lpEnvironment,
- __in LPCWSTR lpCurrentDirectory,
- __out PDWORD pProcessId,
- __out HANDLE *pResumeHandle)
+ _In_ LPWSTR lpCommandLine,
+ _In_ BOOL bSuspendProcess,
+ _In_ LPVOID lpEnvironment,
+ _In_ LPCWSTR lpCurrentDirectory,
+ _Out_ PDWORD pProcessId,
+ _Out_ HANDLE *pResumeHandle)
{
PUBLIC_CONTRACT;
@@ -140,7 +140,7 @@ CreateProcessForLaunch(
DLLEXPORT
HRESULT
ResumeProcess(
- __in HANDLE hResumeHandle)
+ _In_ HANDLE hResumeHandle)
{
PUBLIC_CONTRACT;
if (ResumeThread(hResumeHandle) == (DWORD)-1)
@@ -159,7 +159,7 @@ ResumeProcess(
DLLEXPORT
HRESULT
CloseResumeHandle(
- __in HANDLE hResumeHandle)
+ _In_ HANDLE hResumeHandle)
{
PUBLIC_CONTRACT;
if (!CloseHandle(hResumeHandle))
@@ -190,7 +190,7 @@ HRESULT
GetContinueStartupEvent(
DWORD debuggeePID,
LPCWSTR szTelestoFullPath,
- __out HANDLE *phContinueStartupEvent);
+ _Out_ HANDLE *phContinueStartupEvent);
#endif // TARGET_UNIX
@@ -697,10 +697,10 @@ StartupHelperThread(LPVOID p)
DLLEXPORT
HRESULT
RegisterForRuntimeStartup(
- __in DWORD dwProcessId,
- __in PSTARTUP_CALLBACK pfnCallback,
- __in PVOID parameter,
- __out PVOID *ppUnregisterToken)
+ _In_ DWORD dwProcessId,
+ _In_ PSTARTUP_CALLBACK pfnCallback,
+ _In_ PVOID parameter,
+ _Out_ PVOID *ppUnregisterToken)
{
return RegisterForRuntimeStartupEx(dwProcessId, NULL, pfnCallback, parameter, ppUnregisterToken);
}
@@ -738,11 +738,11 @@ RegisterForRuntimeStartup(
DLLEXPORT
HRESULT
RegisterForRuntimeStartupEx(
- __in DWORD dwProcessId,
- __in LPCWSTR lpApplicationGroupId,
- __in PSTARTUP_CALLBACK pfnCallback,
- __in PVOID parameter,
- __out PVOID *ppUnregisterToken)
+ _In_ DWORD dwProcessId,
+ _In_ LPCWSTR lpApplicationGroupId,
+ _In_ PSTARTUP_CALLBACK pfnCallback,
+ _In_ PVOID parameter,
+ _Out_ PVOID *ppUnregisterToken)
{
PUBLIC_CONTRACT;
@@ -787,7 +787,7 @@ RegisterForRuntimeStartupEx(
DLLEXPORT
HRESULT
UnregisterForRuntimeStartup(
- __in PVOID pUnregisterToken)
+ _In_ PVOID pUnregisterToken)
{
PUBLIC_CONTRACT;
@@ -824,8 +824,8 @@ const int cchEventNameBufferSize = (sizeof(StartupNotifyEventNamePrefix) + sizeo
DLLEXPORT
HRESULT
GetStartupNotificationEvent(
- __in DWORD debuggeePID,
- __out HANDLE* phStartupEvent)
+ _In_ DWORD debuggeePID,
+ _Out_ HANDLE* phStartupEvent)
{
PUBLIC_CONTRACT;
@@ -1220,9 +1220,9 @@ DLLEXPORT
HRESULT
EnumerateCLRs(
DWORD debuggeePID,
- __out HANDLE** ppHandleArrayOut,
- __out LPWSTR** ppStringArrayOut,
- __out DWORD* pdwArrayLengthOut)
+ _Out_ HANDLE** ppHandleArrayOut,
+ _Out_ LPWSTR** ppStringArrayOut,
+ _Out_ DWORD* pdwArrayLengthOut)
{
PUBLIC_CONTRACT;
@@ -1357,9 +1357,9 @@ EnumerateCLRs(
DLLEXPORT
HRESULT
CloseCLREnumeration(
- __in HANDLE* pHandleArray,
- __in LPWSTR* pStringArray,
- __in DWORD dwArrayLength)
+ _In_ HANDLE* pHandleArray,
+ _In_ LPWSTR* pStringArray,
+ _In_ DWORD dwArrayLength)
{
PUBLIC_CONTRACT;
@@ -1484,11 +1484,11 @@ const WCHAR *c_versionStrFormat = W("%08x;%08x;%p");
DLLEXPORT
HRESULT
CreateVersionStringFromModule(
- __in DWORD pidDebuggee,
- __in LPCWSTR szModuleName,
- __out_ecount_part(cchBuffer, *pdwLength) LPWSTR pBuffer,
- __in DWORD cchBuffer,
- __out DWORD* pdwLength)
+ _In_ DWORD pidDebuggee,
+ _In_ LPCWSTR szModuleName,
+ _Out_writes_to_opt_(cchBuffer, *pdwLength) LPWSTR pBuffer,
+ _In_ DWORD cchBuffer,
+ _Out_ DWORD* pdwLength)
{
PUBLIC_CONTRACT;
@@ -1719,9 +1719,9 @@ CheckDbiAndRuntimeVersion(
DLLEXPORT
HRESULT
CreateDebuggingInterfaceFromVersionEx(
- __in int iDebuggerVersion,
- __in LPCWSTR szDebuggeeVersion,
- __out IUnknown ** ppCordb)
+ _In_ int iDebuggerVersion,
+ _In_ LPCWSTR szDebuggeeVersion,
+ _Out_ IUnknown ** ppCordb)
{
return CreateDebuggingInterfaceFromVersion2(iDebuggerVersion, szDebuggeeVersion, NULL, ppCordb);
}
@@ -1748,10 +1748,10 @@ CreateDebuggingInterfaceFromVersionEx(
DLLEXPORT
HRESULT
CreateDebuggingInterfaceFromVersion2(
- __in int iDebuggerVersion,
- __in LPCWSTR szDebuggeeVersion,
- __in LPCWSTR szApplicationGroupId,
- __out IUnknown ** ppCordb)
+ _In_ int iDebuggerVersion,
+ _In_ LPCWSTR szDebuggeeVersion,
+ _In_ LPCWSTR szApplicationGroupId,
+ _Out_ IUnknown ** ppCordb)
{
PUBLIC_CONTRACT;
@@ -1880,8 +1880,8 @@ CreateDebuggingInterfaceFromVersion2(
DLLEXPORT
HRESULT
CreateDebuggingInterfaceFromVersion(
- __in LPCWSTR szDebuggeeVersion,
- __out IUnknown ** ppCordb
+ _In_ LPCWSTR szDebuggeeVersion,
+ _Out_ IUnknown ** ppCordb
)
{
PUBLIC_CONTRACT;
@@ -1907,7 +1907,7 @@ HRESULT
GetContinueStartupEvent(
DWORD debuggeePID,
LPCWSTR szTelestoFullPath,
- __out HANDLE* phContinueStartupEvent)
+ _Out_ HANDLE* phContinueStartupEvent)
{
if ((phContinueStartupEvent == NULL) || (szTelestoFullPath == NULL))
return E_INVALIDARG;
diff --git a/src/coreclr/dlls/dbgshim/dbgshim.h b/src/coreclr/dlls/dbgshim/dbgshim.h
index 392cd7b9286a85..004fd2a38128f2 100644
--- a/src/coreclr/dlls/dbgshim/dbgshim.h
+++ b/src/coreclr/dlls/dbgshim/dbgshim.h
@@ -11,81 +11,81 @@ typedef VOID (*PSTARTUP_CALLBACK)(IUnknown *pCordb, PVOID parameter, HRESULT hr)
EXTERN_C HRESULT
CreateProcessForLaunch(
- __in LPWSTR lpCommandLine,
- __in BOOL bSuspendProcess,
- __in LPVOID lpEnvironment,
- __in LPCWSTR lpCurrentDirectory,
- __out PDWORD pProcessId,
- __out HANDLE *pResumeHandle);
+ _In_ LPWSTR lpCommandLine,
+ _In_ BOOL bSuspendProcess,
+ _In_ LPVOID lpEnvironment,
+ _In_ LPCWSTR lpCurrentDirectory,
+ _Out_ PDWORD pProcessId,
+ _Out_ HANDLE *pResumeHandle);
EXTERN_C HRESULT
ResumeProcess(
- __in HANDLE hResumeHandle);
+ _In_ HANDLE hResumeHandle);
EXTERN_C HRESULT
CloseResumeHandle(
- __in HANDLE hResumeHandle);
+ _In_ HANDLE hResumeHandle);
EXTERN_C HRESULT
RegisterForRuntimeStartup(
- __in DWORD dwProcessId,
- __in PSTARTUP_CALLBACK pfnCallback,
- __in PVOID parameter,
- __out PVOID *ppUnregisterToken);
+ _In_ DWORD dwProcessId,
+ _In_ PSTARTUP_CALLBACK pfnCallback,
+ _In_ PVOID parameter,
+ _Out_ PVOID *ppUnregisterToken);
EXTERN_C HRESULT
RegisterForRuntimeStartupEx(
- __in DWORD dwProcessId,
- __in LPCWSTR szApplicationGroupId,
- __in PSTARTUP_CALLBACK pfnCallback,
- __in PVOID parameter,
- __out PVOID *ppUnregisterToken);
+ _In_ DWORD dwProcessId,
+ _In_ LPCWSTR szApplicationGroupId,
+ _In_ PSTARTUP_CALLBACK pfnCallback,
+ _In_ PVOID parameter,
+ _Out_ PVOID *ppUnregisterToken);
EXTERN_C HRESULT
UnregisterForRuntimeStartup(
- __in PVOID pUnregisterToken);
+ _In_ PVOID pUnregisterToken);
EXTERN_C HRESULT
GetStartupNotificationEvent(
- __in DWORD debuggeePID,
- __out HANDLE* phStartupEvent);
+ _In_ DWORD debuggeePID,
+ _Out_ HANDLE* phStartupEvent);
EXTERN_C HRESULT
EnumerateCLRs(DWORD debuggeePID,
- __out HANDLE** ppHandleArrayOut,
- __out LPWSTR** ppStringArrayOut,
- __out DWORD* pdwArrayLengthOut);
+ _Out_ HANDLE** ppHandleArrayOut,
+ _Out_ LPWSTR** ppStringArrayOut,
+ _Out_ DWORD* pdwArrayLengthOut);
EXTERN_C HRESULT
CloseCLREnumeration(
- __in HANDLE* pHandleArray,
- __in LPWSTR* pStringArray,
- __in DWORD dwArrayLength);
+ _In_ HANDLE* pHandleArray,
+ _In_ LPWSTR* pStringArray,
+ _In_ DWORD dwArrayLength);
EXTERN_C HRESULT
CreateVersionStringFromModule(
- __in DWORD pidDebuggee,
- __in LPCWSTR szModuleName,
- __out_ecount_part(cchBuffer, *pdwLength) LPWSTR pBuffer,
- __in DWORD cchBuffer,
- __out DWORD* pdwLength);
+ _In_ DWORD pidDebuggee,
+ _In_ LPCWSTR szModuleName,
+ _Out_writes_to_opt_(cchBuffer, *pdwLength) LPWSTR pBuffer,
+ _In_ DWORD cchBuffer,
+ _Out_ DWORD* pdwLength);
EXTERN_C HRESULT
CreateDebuggingInterfaceFromVersionEx(
- __in int iDebuggerVersion,
- __in LPCWSTR szDebuggeeVersion,
- __out IUnknown ** ppCordb);
+ _In_ int iDebuggerVersion,
+ _In_ LPCWSTR szDebuggeeVersion,
+ _Out_ IUnknown ** ppCordb);
EXTERN_C
DLLEXPORT
HRESULT
CreateDebuggingInterfaceFromVersion2(
- __in int iDebuggerVersion,
- __in LPCWSTR szDebuggeeVersion,
- __in LPCWSTR szApplicationGroupId,
- __out IUnknown ** ppCordb);
+ _In_ int iDebuggerVersion,
+ _In_ LPCWSTR szDebuggeeVersion,
+ _In_ LPCWSTR szApplicationGroupId,
+ _Out_ IUnknown ** ppCordb);
EXTERN_C HRESULT
CreateDebuggingInterfaceFromVersion(
- __in LPCWSTR szDebuggeeVersion,
- __out IUnknown ** ppCordb);
+ _In_ LPCWSTR szDebuggeeVersion,
+ _Out_ IUnknown ** ppCordb);
diff --git a/src/coreclr/dlls/mscordac/CMakeLists.txt b/src/coreclr/dlls/mscordac/CMakeLists.txt
index 8d04b34e48aad7..25c2532358774b 100644
--- a/src/coreclr/dlls/mscordac/CMakeLists.txt
+++ b/src/coreclr/dlls/mscordac/CMakeLists.txt
@@ -47,7 +47,7 @@ else(CLR_CMAKE_HOST_WIN32)
set(REDEFINES_FILE_SCRIPT ${CMAKE_SOURCE_DIR}/generateredefinesfile.sh)
- if (CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64)
+ if (CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64 OR CLR_CMAKE_HOST_ARCH_LOONGARCH64)
set(JUMP_INSTRUCTION b)
else()
set(JUMP_INSTRUCTION jmp)
diff --git a/src/coreclr/dlls/mscordac/mscordac_unixexports.src b/src/coreclr/dlls/mscordac/mscordac_unixexports.src
index 2a529b2f4a779d..334d1b90c93082 100644
--- a/src/coreclr/dlls/mscordac/mscordac_unixexports.src
+++ b/src/coreclr/dlls/mscordac/mscordac_unixexports.src
@@ -65,7 +65,6 @@ nativeStringResourceTable_mscorrc
#PAL_wcsrchr
#PAL_wcscmp
#PAL_wcschr
-#PAL_wcscspn
#PAL_wcscat
#PAL_wcsstr
#PAL__open
@@ -140,8 +139,6 @@ nativeStringResourceTable_mscorrc
#LoadLibraryA
#LoadLibraryW
#LoadLibraryExW
-#LocalAlloc
-#LocalFree
#MapViewOfFile
#MapViewOfFileEx
#MoveFileExW
diff --git a/src/coreclr/dlls/mscoree/mscoree.cpp b/src/coreclr/dlls/mscoree/mscoree.cpp
index 4e2d87906ad309..c985b88ab30c2e 100644
--- a/src/coreclr/dlls/mscoree/mscoree.cpp
+++ b/src/coreclr/dlls/mscoree/mscoree.cpp
@@ -218,7 +218,7 @@ STDAPI ReOpenMetaDataWithMemoryEx(
static DWORD g_dwSystemDirectory = 0;
static WCHAR * g_pSystemDirectory = NULL;
-HRESULT GetInternalSystemDirectory(__out_ecount_part_opt(*pdwLength,*pdwLength) LPWSTR buffer, __inout DWORD* pdwLength)
+HRESULT GetInternalSystemDirectory(_Out_writes_to_opt_(*pdwLength,*pdwLength) LPWSTR buffer, __inout DWORD* pdwLength)
{
CONTRACTL {
NOTHROW;
@@ -252,7 +252,7 @@ HRESULT GetInternalSystemDirectory(__out_ecount_part_opt(*pdwLength,*pdwLength)
}
-LPCWSTR GetInternalSystemDirectory(__out DWORD* pdwLength)
+LPCWSTR GetInternalSystemDirectory(_Out_ DWORD* pdwLength)
{
LIMITED_METHOD_CONTRACT;
diff --git a/src/coreclr/dlls/mscorpe/ceefilegenwriter.cpp b/src/coreclr/dlls/mscorpe/ceefilegenwriter.cpp
index 6a0ba5a2499475..623f0087d400c0 100644
--- a/src/coreclr/dlls/mscorpe/ceefilegenwriter.cpp
+++ b/src/coreclr/dlls/mscorpe/ceefilegenwriter.cpp
@@ -487,7 +487,7 @@ HRESULT CeeFileGenWriter::generateImage(void **ppImage)
return hr;
} // HRESULT CeeFileGenWriter::generateImage()
-HRESULT CeeFileGenWriter::setOutputFileName(__in LPWSTR fileName)
+HRESULT CeeFileGenWriter::setOutputFileName(_In_ LPWSTR fileName)
{
if (m_outputFileName)
delete[] m_outputFileName;
@@ -498,7 +498,7 @@ HRESULT CeeFileGenWriter::setOutputFileName(__in LPWSTR fileName)
return S_OK;
} // HRESULT CeeFileGenWriter::setOutputFileName()
-HRESULT CeeFileGenWriter::setResourceFileName(__in LPWSTR fileName)
+HRESULT CeeFileGenWriter::setResourceFileName(_In_ LPWSTR fileName)
{
if (m_resourceFileName)
delete[] m_resourceFileName;
@@ -1294,7 +1294,7 @@ HRESULT CeeFileGenWriter::setVTableEntry(ULONG size, ULONG offset)
return setVTableEntry64(size,(void*)(ULONG_PTR)offset);
} // HRESULT CeeFileGenWriter::setVTableEntry()
-HRESULT CeeFileGenWriter::computeSectionOffset(CeeSection §ion, __in char *ptr,
+HRESULT CeeFileGenWriter::computeSectionOffset(CeeSection §ion, _In_ char *ptr,
unsigned *offset)
{
*offset = section.computeOffset(ptr);
@@ -1302,7 +1302,7 @@ HRESULT CeeFileGenWriter::computeSectionOffset(CeeSection §ion, __in char *p
return S_OK;
} // HRESULT CeeFileGenWriter::computeSectionOffset()
-HRESULT CeeFileGenWriter::computeOffset(__in char *ptr,
+HRESULT CeeFileGenWriter::computeOffset(_In_ char *ptr,
CeeSection **pSection, unsigned *offset)
{
TESTANDRETURNPOINTER(pSection);
diff --git a/src/coreclr/dlls/mscorpe/iceefilegen.cpp b/src/coreclr/dlls/mscorpe/iceefilegen.cpp
index 6714d355d0bfc3..6c40d9699fce91 100644
--- a/src/coreclr/dlls/mscorpe/iceefilegen.cpp
+++ b/src/coreclr/dlls/mscorpe/iceefilegen.cpp
@@ -183,7 +183,7 @@ HRESULT ICeeFileGen::AddSectionReloc (HCEESECTION section, ULONG offset, HCEESEC
}
}
-HRESULT ICeeFileGen::SetOutputFileName (HCEEFILE ceeFile, __in LPWSTR outputFileName)
+HRESULT ICeeFileGen::SetOutputFileName (HCEEFILE ceeFile, _In_ LPWSTR outputFileName)
{
TESTANDRETURNPOINTER(ceeFile);
TESTANDRETURNPOINTER(outputFileName);
@@ -192,7 +192,7 @@ HRESULT ICeeFileGen::SetOutputFileName (HCEEFILE ceeFile, __in LPWSTR outputFile
return(gen->setOutputFileName(outputFileName));
}
-__success(return == S_OK) HRESULT ICeeFileGen::GetOutputFileName (HCEEFILE ceeFile, __out LPWSTR *outputFileName)
+__success(return == S_OK) HRESULT ICeeFileGen::GetOutputFileName (HCEEFILE ceeFile, _Out_ LPWSTR *outputFileName)
{
TESTANDRETURNPOINTER(ceeFile);
TESTANDRETURNPOINTER(outputFileName);
@@ -204,7 +204,7 @@ __success(return == S_OK) HRESULT ICeeFileGen::GetOutputFileName (HCEEFILE ceeFi
}
-HRESULT ICeeFileGen::SetResourceFileName (HCEEFILE ceeFile, __in LPWSTR resourceFileName)
+HRESULT ICeeFileGen::SetResourceFileName (HCEEFILE ceeFile, _In_ LPWSTR resourceFileName)
{
TESTANDRETURNPOINTER(ceeFile);
TESTANDRETURNPOINTER(resourceFileName);
@@ -214,7 +214,7 @@ HRESULT ICeeFileGen::SetResourceFileName (HCEEFILE ceeFile, __in LPWSTR resource
}
__success(return == S_OK)
-HRESULT ICeeFileGen::GetResourceFileName (HCEEFILE ceeFile, __out LPWSTR *resourceFileName)
+HRESULT ICeeFileGen::GetResourceFileName (HCEEFILE ceeFile, _Out_ LPWSTR *resourceFileName)
{
TESTANDRETURNPOINTER(ceeFile);
TESTANDRETURNPOINTER(resourceFileName);
@@ -277,7 +277,7 @@ HRESULT ICeeFileGen::GetMethodRVA(HCEEFILE ceeFile, ULONG codeOffset, ULONG *cod
return S_OK;
}
-HRESULT ICeeFileGen::EmitString(HCEEFILE ceeFile, __in LPWSTR strValue, ULONG *strRef)
+HRESULT ICeeFileGen::EmitString(HCEEFILE ceeFile, _In_ LPWSTR strValue, ULONG *strRef)
{
TESTANDRETURNPOINTER(ceeFile);
@@ -429,7 +429,7 @@ HRESULT ICeeFileGen::SetStrongNameEntry(HCEEFILE ceeFile, ULONG size, ULONG offs
return gen->setStrongNameEntry(size, offset);
}
-HRESULT ICeeFileGen::ComputeSectionOffset(HCEESECTION section, __in char *ptr,
+HRESULT ICeeFileGen::ComputeSectionOffset(HCEESECTION section, _In_ char *ptr,
unsigned *offset)
{
TESTANDRETURNPOINTER(section);
@@ -443,7 +443,7 @@ HRESULT ICeeFileGen::ComputeSectionOffset(HCEESECTION section, __in char *ptr,
__success(return == S_OK)
HRESULT ICeeFileGen::ComputeSectionPointer(HCEESECTION section, ULONG offset,
- __out char **ptr)
+ _Out_ char **ptr)
{
TESTANDRETURNPOINTER(section);
@@ -454,7 +454,7 @@ HRESULT ICeeFileGen::ComputeSectionPointer(HCEESECTION section, ULONG offset,
return S_OK;
}
-HRESULT ICeeFileGen::ComputeOffset(HCEEFILE ceeFile, __in char *ptr,
+HRESULT ICeeFileGen::ComputeOffset(HCEEFILE ceeFile, _In_ char *ptr,
HCEESECTION *pSection, unsigned *offset)
{
TESTANDRETURNPOINTER(pSection);
diff --git a/src/coreclr/dlls/mscorpe/pewriter.cpp b/src/coreclr/dlls/mscorpe/pewriter.cpp
index 9add4b56d13b80..b78b00c2853ffb 100644
--- a/src/coreclr/dlls/mscorpe/pewriter.cpp
+++ b/src/coreclr/dlls/mscorpe/pewriter.cpp
@@ -1829,7 +1829,7 @@ HRESULT PEWriter::fixup(CeeGenTokenMapper *pMapper)
return(S_OK); // SUCCESS
}
-HRESULT PEWriter::Open(__in LPCWSTR fileName)
+HRESULT PEWriter::Open(_In_ LPCWSTR fileName)
{
_ASSERTE(m_file == INVALID_HANDLE_VALUE);
HRESULT hr = NOERROR;
@@ -1913,7 +1913,7 @@ HRESULT PEWriter::Close()
}
/******************************************************************/
-HRESULT PEWriter::write(__in LPCWSTR fileName) {
+HRESULT PEWriter::write(_In_ LPCWSTR fileName) {
HRESULT hr;
diff --git a/src/coreclr/dlls/mscorpe/pewriter.h b/src/coreclr/dlls/mscorpe/pewriter.h
index 21817b1d5efc45..84ec61f9275eca 100644
--- a/src/coreclr/dlls/mscorpe/pewriter.h
+++ b/src/coreclr/dlls/mscorpe/pewriter.h
@@ -41,7 +41,7 @@ class PEWriter : public PESectionMan
HRESULT link();
HRESULT fixup(CeeGenTokenMapper *pMapper);
- HRESULT write(__in LPCWSTR fileName);
+ HRESULT write(_In_ LPCWSTR fileName);
HRESULT write(void **ppImage);
// calling these functions is optional
@@ -174,7 +174,7 @@ class PEWriter : public PESectionMan
HRESULT linkPlaceSections(entry * entries, unsigned iEntries);
void setSectionIndex(IMAGE_SECTION_HEADER * h, unsigned sectionIndex);
- HRESULT Open(__in LPCWSTR fileName);
+ HRESULT Open(_In_ LPCWSTR fileName);
HRESULT Write(const void *data, int size);
HRESULT Seek(int offset);
HRESULT Pad(int align);
@@ -257,8 +257,8 @@ class PESeedSection : public PEWriterSection {
int getDirEntry() { _ASSERTE(!"PESeedSection"); return 0; }
HRESULT directoryEntry(unsigned num) { _ASSERTE(!"PESeedSection"); return E_FAIL; }
char * computePointer(unsigned offset) const { _ASSERTE(!"PESeedSection"); return NULL; }
- BOOL containsPointer(__in char *ptr) const { _ASSERTE(!"PESeedSection"); return FALSE; }
- unsigned computeOffset(__in char *ptr) const { _ASSERTE(!"PESeedSection"); return 0; }
+ BOOL containsPointer(_In_ char *ptr) const { _ASSERTE(!"PESeedSection"); return FALSE; }
+ unsigned computeOffset(_In_ char *ptr) const { _ASSERTE(!"PESeedSection"); return 0; }
HRESULT cloneInstance(PESection *destination) { _ASSERTE(!"PESeedSection"); return E_FAIL; }
// PEWriterSection
diff --git a/src/coreclr/dlls/mscorrc/mscorrc.rc b/src/coreclr/dlls/mscorrc/mscorrc.rc
index 2175566c10b610..d2c7bff988cc87 100644
--- a/src/coreclr/dlls/mscorrc/mscorrc.rc
+++ b/src/coreclr/dlls/mscorrc/mscorrc.rc
@@ -194,6 +194,10 @@ BEGIN
IDS_EE_NDIRECT_GETPROCADDR_WIN_DLL "Unable to find an entry point named '%1' in DLL."
IDS_EE_NDIRECT_GETPROCADDR_UNIX_SO "Unable to find an entry point named '%1' in shared library."
IDS_EE_NDIRECT_GETPROCADDRESS_NONAME "A library name must be specified in a DllImport attribute applied to non-IJW methods."
+ IDS_EE_NDIRECT_DISABLEDMARSHAL_SETLASTERROR "Setting SetLastError to 'true' is not supported when runtime marshalling is disabled."
+ IDS_EE_NDIRECT_DISABLEDMARSHAL_LCID "The LCIDConversionAttribute is not supported when runtime marshalling is disabled."
+ IDS_EE_NDIRECT_DISABLEDMARSHAL_PRESERVESIG "Setting PreserveSig to false for a P/Invoke is not supported when runtime marshalling is disabled."
+ IDS_EE_NDIRECT_DISABLEDMARSHAL_VARARGS "Using a variable argument list in a P/Invoke is not supported when runtime marshalling is disabled."
IDS_EE_CLASS_CONSTRAINTS_VIOLATION "GenericArguments[%1], '%2', on '%3' violates the constraint of type parameter '%4'."
IDS_EE_METHOD_CONSTRAINTS_VIOLATION "Method %1.%2: type argument '%3' violates the constraint of type parameter '%4'."
IDS_EE_NOSYNCHRONIZED "Synchronized attribute cannot be used with this method type."
@@ -297,6 +301,7 @@ BEGIN
IDS_EE_BADMARSHAL_GENERICS_RESTRICTION "Non-blittable generic types cannot be marshaled."
IDS_EE_BADMARSHAL_AUTOLAYOUT "Structures marked with [StructLayout(LayoutKind.Auto)] cannot be marshaled."
IDS_EE_BADMARSHAL_STRING_OUT "Cannot marshal a string by-value with the [Out] attribute."
+ IDS_EE_BADMARSHAL_MARSHAL_DISABLED "Cannot marshal managed types when the runtime marshalling system is disabled."
IDS_EE_BADMARSHALPARAM_STRINGBUILDER "Invalid managed/unmanaged type combination (StringBuilders must be paired with LPStr, LPWStr, or LPTStr)."
IDS_EE_BADMARSHALPARAM_NO_LPTSTR "Invalid managed/unmanaged type combination (Strings cannot be paired with LPTStr for parameters and return types of methods in interfaces exposed to COM)."
@@ -580,13 +585,13 @@ BEGIN
IDS_ER_FRAMEWORK_VERSION "CoreCLR Version: "
IDS_ER_UNHANDLEDEXCEPTION "Description: The process was terminated due to an unhandled exception."
IDS_ER_UNHANDLEDEXCEPTIONMSG "Exception Info: "
- IDS_ER_MANAGEDFAILFAST "Description: The application requested process termination through System.Environment.FailFast(string message)."
+ IDS_ER_MANAGEDFAILFAST "Description: The application requested process termination through System.Environment.FailFast."
IDS_ER_MANAGEDFAILFASTMSG "Message: "
IDS_ER_UNMANAGEDFAILFAST "Description: The process was terminated due to an internal error in the .NET Runtime "
IDS_ER_STACK_OVERFLOW "Description: The process was terminated due to stack overflow."
IDS_ER_STACK "Stack:"
IDS_ER_WORDAT "at"
- IDS_ER_UNMANAGEDFAILFASTMSG "at IP %1 (%2) with exit code %3."
+ IDS_ER_UNMANAGEDFAILFASTMSG "at IP 0x%x (0x%x) with exit code 0x%x."
IDS_ER_UNHANDLEDEXCEPTIONINFO "exception code %1, exception address %2"
IDS_ER_MESSAGE_TRUNCATE "The remainder of the message was truncated."
IDS_ER_CODECONTRACT_FAILED "Description: The application encountered a bug. A managed code contract (precondition, postcondition, object invariant, or assert) failed."
diff --git a/src/coreclr/dlls/mscorrc/resource.h b/src/coreclr/dlls/mscorrc/resource.h
index 05b31799ec5c47..7a8f148456a831 100644
--- a/src/coreclr/dlls/mscorrc/resource.h
+++ b/src/coreclr/dlls/mscorrc/resource.h
@@ -588,3 +588,8 @@
#define IDS_EE_BADMARSHAL_DELEGATE_TLB_INTERFACE 0x2649
#define IDS_EE_THREAD_APARTMENT_NOT_SUPPORTED 0x264A
#define IDS_EE_NO_IINSPECTABLE 0x264B
+#define IDS_EE_BADMARSHAL_MARSHAL_DISABLED 0x264C
+#define IDS_EE_NDIRECT_DISABLEDMARSHAL_SETLASTERROR 0x264D
+#define IDS_EE_NDIRECT_DISABLEDMARSHAL_LCID 0x264E
+#define IDS_EE_NDIRECT_DISABLEDMARSHAL_PRESERVESIG 0x264F
+#define IDS_EE_NDIRECT_DISABLEDMARSHAL_VARARGS 0x2650
diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp
index ace66eac266709..e270bcdc91ee47 100644
--- a/src/coreclr/gc/gc.cpp
+++ b/src/coreclr/gc/gc.cpp
@@ -2522,6 +2522,8 @@ size_t gc_heap::bgc_loh_size_increased = 0;
size_t gc_heap::bgc_poh_size_increased = 0;
+size_t gc_heap::background_soh_size_end_mark = 0;
+
size_t gc_heap::background_soh_alloc_count = 0;
size_t gc_heap::background_uoh_alloc_count = 0;
@@ -9402,7 +9404,7 @@ void gc_heap::remove_ro_segment (heap_segment* seg)
enter_spin_lock (&gc_heap::gc_lock);
- seg_table->remove ((uint8_t*)seg);
+ seg_table->remove (heap_segment_mem (seg));
seg_mapping_table_remove_ro_segment (seg);
// Locate segment (and previous segment) in the list.
@@ -10890,7 +10892,7 @@ void gc_heap::seg_clear_mark_array_bits_soh (heap_segment* seg)
}
}
-void gc_heap::clear_batch_mark_array_bits (uint8_t* start, uint8_t* end)
+void gc_heap::bgc_clear_batch_mark_array_bits (uint8_t* start, uint8_t* end)
{
if ((start < background_saved_highest_address) &&
(end > background_saved_lowest_address))
@@ -10914,8 +10916,15 @@ void gc_heap::clear_batch_mark_array_bits (uint8_t* start, uint8_t* end)
if (startwrd == endwrd)
{
- unsigned int wrd = firstwrd | lastwrd;
- mark_array[startwrd] &= wrd;
+ if (startbit != endbit)
+ {
+ unsigned int wrd = firstwrd | lastwrd;
+ mark_array[startwrd] &= wrd;
+ }
+ else
+ {
+ assert (start == end);
+ }
return;
}
@@ -10938,18 +10947,6 @@ void gc_heap::clear_batch_mark_array_bits (uint8_t* start, uint8_t* end)
}
}
}
-
-void gc_heap::bgc_clear_batch_mark_array_bits (uint8_t* start, uint8_t* end)
-{
- if ((start < background_saved_highest_address) &&
- (end > background_saved_lowest_address))
- {
- start = max (start, background_saved_lowest_address);
- end = min (end, background_saved_highest_address);
-
- clear_batch_mark_array_bits (start, end);
- }
-}
#endif //BACKGROUND_GC
inline
@@ -28892,6 +28889,14 @@ void gc_heap::plan_phase (int condemned_gen_number)
{
dprintf (2,( "**** Doing Compacting GC ****"));
+#if defined(USE_REGIONS) && defined(BACKGROUND_GC)
+ if (should_update_end_mark_size())
+ {
+ background_soh_size_end_mark += generation_end_seg_allocated (older_gen) -
+ r_older_gen_end_seg_allocated;
+ }
+#endif //USE_REGIONS && BACKGROUND_GC
+
#ifndef USE_REGIONS
if (should_expand)
{
@@ -29396,6 +29401,13 @@ void gc_heap::fix_generation_bounds (int condemned_gen_number,
}
}
#endif //MULTIPLE_HEAPS
+
+#ifdef BACKGROUND_GC
+ if (should_update_end_mark_size())
+ {
+ background_soh_size_end_mark = generation_size (max_generation);
+ }
+#endif //BACKGROUND_GC
#endif //!USE_REGIONS
{
@@ -29614,6 +29626,14 @@ void gc_heap::thread_final_regions (bool compact_p)
generation_final_regions[gen_idx].tail = generation_tail_region (gen);
}
+#ifdef BACKGROUND_GC
+ heap_segment* max_gen_tail_region = 0;
+ if (should_update_end_mark_size())
+ {
+ max_gen_tail_region = generation_final_regions[max_generation].tail;
+ }
+#endif //BACKGROUND_GC
+
// Step 2: for each region in the condemned generations, we thread it onto its planned generation
// in our generation_final_regions array.
for (int gen_idx = condemned_gen_number; gen_idx >= 0; gen_idx--)
@@ -29664,6 +29684,21 @@ void gc_heap::thread_final_regions (bool compact_p)
}
}
+#ifdef BACKGROUND_GC
+ if (max_gen_tail_region)
+ {
+ max_gen_tail_region = heap_segment_next (max_gen_tail_region);
+
+ while (max_gen_tail_region)
+ {
+ background_soh_size_end_mark += heap_segment_allocated (max_gen_tail_region) -
+ heap_segment_mem (max_gen_tail_region);
+
+ max_gen_tail_region = heap_segment_next (max_gen_tail_region);
+ }
+ }
+#endif //BACKGROUND_GC
+
// Step 4: if a generation doesn't have any regions, we need to get a new one for it;
// otherwise we just set the head region as the start region for that generation.
for (int gen_idx = 0; gen_idx <= max_generation; gen_idx++)
@@ -29701,7 +29736,7 @@ void gc_heap::thread_final_regions (bool compact_p)
}
}
- verify_regions (true);
+ verify_regions (true, false);
}
void gc_heap::thread_start_region (generation* gen, heap_segment* region)
@@ -29752,7 +29787,7 @@ heap_segment* gc_heap::get_new_region (int gen_number, size_t size)
heap_segment_next (generation_tail_region (gen)) = new_region;
generation_tail_region (gen) = new_region;
- verify_regions (gen_number, false);
+ verify_regions (gen_number, false, settings.concurrent);
}
return new_region;
@@ -29779,6 +29814,12 @@ heap_segment* gc_heap::allocate_new_region (gc_heap* hp, int gen_num, bool uoh_p
heap_segment* res = make_heap_segment (start, (end - start), hp, gen_num);
dprintf (REGIONS_LOG, ("got a new region %Ix %Ix->%Ix", (size_t)res, start, end));
+
+ if (res == nullptr)
+ {
+ global_region_allocator.delete_region (start);
+ }
+
return res;
}
@@ -29815,7 +29856,7 @@ void gc_heap::update_start_tail_regions (generation* gen,
(size_t)prev_region, heap_segment_mem (prev_region)));
}
- verify_regions (false);
+ verify_regions (false, settings.concurrent);
}
// There's one complication with deciding whether we can make a region SIP or not - if the plan_gen_num of
@@ -30090,6 +30131,8 @@ inline
void gc_heap::check_demotion_helper_sip (uint8_t** pval, int parent_gen_num, uint8_t* parent_loc)
{
uint8_t* child_object = *pval;
+ if (!is_in_heap_range (child_object))
+ return;
if (!child_object) return;
int child_object_plan_gen = get_region_plan_gen_num (child_object);
@@ -32927,6 +32970,11 @@ void gc_heap::decommit_mark_array_by_seg (heap_segment* seg)
}
}
+bool gc_heap::should_update_end_mark_size()
+{
+ return ((settings.condemned_generation == (max_generation - 1)) && (current_c_gc_state == c_gc_state_planning));
+}
+
void gc_heap::background_mark_phase ()
{
verify_mark_array_cleared();
@@ -33001,6 +33049,7 @@ void gc_heap::background_mark_phase ()
bgc_begin_poh_size = total_poh_size;
bgc_loh_size_increased = 0;
bgc_poh_size_increased = 0;
+ background_soh_size_end_mark = 0;
dprintf (GTC_LOG, ("BM: h%d: loh: %Id, soh: %Id, poh: %Id", heap_number, total_loh_size, total_soh_size, total_poh_size));
@@ -33481,6 +33530,8 @@ void gc_heap::background_mark_phase ()
heap_segment_background_allocated (seg) = heap_segment_allocated (seg);
}
+ background_soh_size_end_mark += heap_segment_background_allocated (seg) - heap_segment_mem (seg);
+
dprintf (3333, ("h%d gen%d seg %Ix (%Ix) background allocated is %Ix",
heap_number, i, (size_t)(seg), heap_segment_mem (seg),
heap_segment_background_allocated (seg)));
@@ -42103,7 +42154,7 @@ gc_heap::verify_free_lists ()
}
}
-void gc_heap::verify_regions (int gen_number, bool can_verify_gen_num)
+void gc_heap::verify_regions (int gen_number, bool can_verify_gen_num, bool can_verify_tail)
{
#ifdef USE_REGIONS
// For the given generation, verify that
@@ -42166,7 +42217,7 @@ void gc_heap::verify_regions (int gen_number, bool can_verify_gen_num)
FATAL_GC_ERROR();
}
- if (tail_region != prev_region_in_gen)
+ if (can_verify_tail && (tail_region != prev_region_in_gen))
{
dprintf (REGIONS_LOG, ("h%d gen%d tail region is %Ix(%Ix), diff from last region %Ix(%Ix)!!",
heap_number, gen_number,
@@ -42177,12 +42228,18 @@ void gc_heap::verify_regions (int gen_number, bool can_verify_gen_num)
#endif //USE_REGIONS
}
-void gc_heap::verify_regions (bool can_verify_gen_num)
+inline bool is_user_alloc_gen (int gen_number)
+{
+ return ((gen_number == soh_gen0) || (gen_number == loh_generation) || (gen_number == poh_generation));
+}
+
+void gc_heap::verify_regions (bool can_verify_gen_num, bool concurrent_p)
{
#ifdef USE_REGIONS
for (int i = 0; i < total_generation_count; i++)
{
- verify_regions (i, can_verify_gen_num);
+ bool can_verify_tail = (concurrent_p ? !is_user_alloc_gen (i) : true);
+ verify_regions (i, can_verify_gen_num, can_verify_tail);
}
#endif //USE_REGIONS
}
@@ -42313,7 +42370,7 @@ void gc_heap::verify_heap (BOOL begin_gc_p)
//verify that the generation structures makes sense
{
#ifdef USE_REGIONS
- verify_regions (true);
+ verify_regions (true, settings.concurrent);
#else //USE_REGIONS
generation* gen = generation_of (max_generation);
@@ -43374,8 +43431,15 @@ void GCHeap::SetYieldProcessorScalingFactor (float scalingFactor)
unsigned int GCHeap::WhichGeneration (Object* object)
{
- gc_heap* hp = gc_heap::heap_of ((uint8_t*)object);
- unsigned int g = hp->object_gennum ((uint8_t*)object);
+ uint8_t* o = (uint8_t*)object;
+#ifdef FEATURE_BASICFREEZE
+ if (!((o < g_gc_highest_address) && (o >= g_gc_lowest_address)))
+ {
+ return max_generation;
+ }
+#endif //FEATURE_BASICFREEZE
+ gc_heap* hp = gc_heap::heap_of (o);
+ unsigned int g = hp->object_gennum (o);
dprintf (3, ("%Ix is in gen %d", (size_t)object, g));
return g;
}
@@ -45097,11 +45161,11 @@ size_t GCHeap::GetTotalBytesInUse ()
for (int i = 0; i < gc_heap::n_heaps; i++)
{
GCHeap* Hp = gc_heap::g_heaps [i]->vm_heap;
- tot_size += Hp->ApproxTotalBytesInUse (FALSE);
+ tot_size += Hp->ApproxTotalBytesInUse();
}
return tot_size;
#else
- return ApproxTotalBytesInUse ();
+ return ApproxTotalBytesInUse();
#endif //MULTIPLE_HEAPS
}
@@ -45156,58 +45220,58 @@ size_t GCHeap::ApproxTotalBytesInUse(BOOL small_heap_only)
size_t totsize = 0;
enter_spin_lock (&pGenGCHeap->gc_lock);
- // the complication with the following code is that background GC may
- // remove the ephemeral segment while we are iterating
- // if so, we retry a couple times and ultimately may report a slightly wrong result
- for (int tries = 1; tries <= 3; tries++)
+ // For gen0 it's a bit complicated because we are currently allocating in it. We get the fragmentation first
+ // just so that we don't give a negative number for the resulting size.
+ generation* gen = pGenGCHeap->generation_of (0);
+ size_t gen0_frag = generation_free_list_space (gen) + generation_free_obj_space (gen);
+ uint8_t* current_alloc_allocated = pGenGCHeap->alloc_allocated;
+ heap_segment* current_eph_seg = pGenGCHeap->ephemeral_heap_segment;
+ size_t gen0_size = 0;
+#ifdef USE_REGIONS
+ heap_segment* gen0_seg = generation_start_segment (gen);
+ while (gen0_seg)
{
- heap_segment* eph_seg = generation_allocation_segment (pGenGCHeap->generation_of (0));
- // Get small block heap size info
- totsize = (pGenGCHeap->alloc_allocated - heap_segment_mem (eph_seg));
- heap_segment* seg1 = generation_start_segment (pGenGCHeap->generation_of (max_generation));
- while ((seg1 != eph_seg) && (seg1 != nullptr)
-#ifdef BACKGROUND_GC
- && (seg1 != pGenGCHeap->freeable_soh_segment)
-#endif //BACKGROUND_GC
- )
+ uint8_t* end = in_range_for_segment (current_alloc_allocated, gen0_seg) ?
+ current_alloc_allocated : heap_segment_allocated (gen0_seg);
+ gen0_size += end - heap_segment_mem (gen0_seg);
+
+ if (gen0_seg == current_eph_seg)
{
-#ifdef BACKGROUND_GC
- if (!heap_segment_decommitted_p (seg1))
-#endif //BACKGROUND_GC
- {
- totsize += heap_segment_allocated (seg1) -
- heap_segment_mem (seg1);
- }
- seg1 = heap_segment_next (seg1);
- }
- if (seg1 == eph_seg)
break;
+ }
+
+ gen0_seg = heap_segment_next (gen0_seg);
+ }
+#else //USE_REGIONS
+ // For segments ephemeral seg does not change.
+ gen0_size = current_alloc_allocated - heap_segment_mem (current_eph_seg);
+#endif //USE_REGIONS
+
+ totsize = gen0_size - gen0_frag;
+
+ int stop_gen_index = max_generation;
+
+ if (gc_heap::current_c_gc_state == c_gc_state_planning)
+ {
+ // During BGC sweep since we can be deleting SOH segments, we avoid walking the segment
+ // list.
+ generation* oldest_gen = pGenGCHeap->generation_of (max_generation);
+ totsize = pGenGCHeap->background_soh_size_end_mark - generation_free_list_space (oldest_gen) - generation_free_obj_space (oldest_gen);
+ stop_gen_index--;
}
- //discount the fragmentation
- for (int i = 0; i <= max_generation; i++)
+ for (int i = (max_generation - 1); i <= stop_gen_index; i++)
{
generation* gen = pGenGCHeap->generation_of (i);
- totsize -= (generation_free_list_space (gen) + generation_free_obj_space (gen));
+ totsize += pGenGCHeap->generation_size (i) - generation_free_list_space (gen) - generation_free_obj_space (gen);
}
if (!small_heap_only)
{
for (int i = uoh_start_generation; i < total_generation_count; i++)
{
- heap_segment* seg2 = generation_start_segment (pGenGCHeap->generation_of (i));
-
- while (seg2 != 0)
- {
- totsize += heap_segment_allocated (seg2) -
- heap_segment_mem (seg2);
- seg2 = heap_segment_next (seg2);
- }
-
- //discount the fragmentation
- generation* uoh_gen = pGenGCHeap->generation_of (i);
- size_t frag = generation_free_list_space (uoh_gen) + generation_free_obj_space (uoh_gen);
- totsize -= frag;
+ generation* gen = pGenGCHeap->generation_of (i);
+ totsize += pGenGCHeap->generation_size (i) - generation_free_list_space (gen) - generation_free_obj_space (gen);
}
}
leave_spin_lock (&pGenGCHeap->gc_lock);
diff --git a/src/coreclr/gc/gcinterface.dac.h b/src/coreclr/gc/gcinterface.dac.h
index cfffcf1221a811..c7d72c7145baf4 100644
--- a/src/coreclr/gc/gcinterface.dac.h
+++ b/src/coreclr/gc/gcinterface.dac.h
@@ -111,7 +111,7 @@ enum oom_reason
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
/* If you modify failure_get_memory and */
/* oom_reason be sure to make the corresponding */
-/* changes in toolbox\sos\strike\strike.cpp. */
+/* changes in tools\sos\strike\strike.cpp. */
/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
enum failure_get_memory
{
diff --git a/src/coreclr/gc/gcpriv.h b/src/coreclr/gc/gcpriv.h
index 081b9a539c073c..baa0272db1368d 100644
--- a/src/coreclr/gc/gcpriv.h
+++ b/src/coreclr/gc/gcpriv.h
@@ -51,7 +51,7 @@ inline void FATAL_GC_ERROR()
//
// This means any empty regions can be freely used for any generation. For
// Server GC we will balance regions between heaps.
-// For now enable regions by default for only StandAlone GC builds
+// For now disable regions outside of StandAlone GC builds
#if defined (HOST_64BIT) && defined (BUILD_AS_STANDALONE)
#define USE_REGIONS
#endif //HOST_64BIT && BUILD_AS_STANDALONE
@@ -1286,9 +1286,9 @@ class gc_heap
PER_HEAP
void verify_free_lists();
PER_HEAP
- void verify_regions (int gen_number, bool can_verify_gen_num);
+ void verify_regions (int gen_number, bool can_verify_gen_num, bool can_verify_tail);
PER_HEAP
- void verify_regions (bool can_verify_gen_num);
+ void verify_regions (bool can_verify_gen_num, bool concurrent_p);
PER_HEAP_ISOLATED
void enter_gc_lock_for_verify_heap();
PER_HEAP_ISOLATED
@@ -2156,8 +2156,6 @@ class gc_heap
PER_HEAP
void seg_clear_mark_array_bits_soh (heap_segment* seg);
PER_HEAP
- void clear_batch_mark_array_bits (uint8_t* start, uint8_t* end);
- PER_HEAP
void bgc_clear_batch_mark_array_bits (uint8_t* start, uint8_t* end);
#ifdef VERIFY_HEAP
PER_HEAP
@@ -3440,6 +3438,9 @@ class gc_heap
PER_HEAP
void decommit_mark_array_by_seg (heap_segment* seg);
+ PER_HEAP_ISOLATED
+ bool should_update_end_mark_size();
+
PER_HEAP
void background_mark_phase();
@@ -4268,6 +4269,9 @@ class gc_heap
PER_HEAP
size_t bgc_poh_size_increased;
+ PER_HEAP
+ size_t background_soh_size_end_mark;
+
PER_HEAP
size_t background_soh_alloc_count;
diff --git a/src/coreclr/gc/unix/gcenv.unix.cpp b/src/coreclr/gc/unix/gcenv.unix.cpp
index 895d2afdf395a9..2d979c395610e9 100644
--- a/src/coreclr/gc/unix/gcenv.unix.cpp
+++ b/src/coreclr/gc/unix/gcenv.unix.cpp
@@ -28,6 +28,10 @@
#undef min
#undef max
+#ifndef __has_cpp_attribute
+#define __has_cpp_attribute(x) (0)
+#endif
+
#if __has_cpp_attribute(fallthrough)
#define FALLTHROUGH [[fallthrough]]
#else
@@ -98,7 +102,7 @@ extern "C"
# define __NR_membarrier 389
# elif defined(__aarch64__)
# define __NR_membarrier 283
-# elif
+# else
# error Unknown architecture
# endif
# endif
diff --git a/src/coreclr/hosts/corerun/dotenv.cpp b/src/coreclr/hosts/corerun/dotenv.cpp
index ba22f5004713d0..0e0e37c7919b0a 100644
--- a/src/coreclr/hosts/corerun/dotenv.cpp
+++ b/src/coreclr/hosts/corerun/dotenv.cpp
@@ -4,10 +4,13 @@
#include "dotenv.hpp"
#include
#include
-#include
#include
#include
+#ifdef TARGET_WINDOWS
+#include
+#endif
+
namespace
{
pal::string_t convert_to_string_t(std::string str)
diff --git a/src/coreclr/hosts/coreshim/CoreShim.cpp b/src/coreclr/hosts/coreshim/CoreShim.cpp
index 62ab011df12155..23265e5872b3f6 100644
--- a/src/coreclr/hosts/coreshim/CoreShim.cpp
+++ b/src/coreclr/hosts/coreshim/CoreShim.cpp
@@ -375,7 +375,7 @@ HRESULT coreclr::Initialize(
HMODULE mod = ::GetModuleHandleW(W("CoreRun.exe"));
if (mod != NULL)
{
- using GetCurrentClrDetailsFunc = HRESULT(*)(void **clrInstance, unsigned int *appDomainId);
+ using GetCurrentClrDetailsFunc = HRESULT(__cdecl *)(void **clrInstance, unsigned int *appDomainId);
auto getCurrentClrDetails = (GetCurrentClrDetailsFunc)::GetProcAddress(mod, "GetCurrentClrDetails");
RETURN_IF_FAILED(getCurrentClrDetails(&_clrInst, &_appDomainId));
if (_clrInst != nullptr)
diff --git a/src/coreclr/ilasm/asmman.cpp b/src/coreclr/ilasm/asmman.cpp
index 7b5fd474b65157..447267d0b4d252 100644
--- a/src/coreclr/ilasm/asmman.cpp
+++ b/src/coreclr/ilasm/asmman.cpp
@@ -49,7 +49,7 @@ BinStr* BinStrToUnicode(BinStr* pSource, bool Swap)
return NULL;
}
-AsmManFile* AsmMan::GetFileByName(__in __nullterminated char* szFileName)
+AsmManFile* AsmMan::GetFileByName(_In_ __nullterminated char* szFileName)
{
AsmManFile* ret = NULL;
if(szFileName)
@@ -63,14 +63,14 @@ AsmManFile* AsmMan::GetFileByName(__in __nullterminated char* szFileName
return ret;
}
-mdToken AsmMan::GetFileTokByName(__in __nullterminated char* szFileName)
+mdToken AsmMan::GetFileTokByName(_In_ __nullterminated char* szFileName)
{
AsmManFile* tmp = GetFileByName(szFileName);
return(tmp ? tmp->tkTok : mdFileNil);
}
-AsmManComType* AsmMan::GetComTypeByName(__in_opt __nullterminated char* szComTypeName,
- __in_opt __nullterminated char* szComEnclosingTypeName)
+AsmManComType* AsmMan::GetComTypeByName(_In_opt_z_ char* szComTypeName,
+ _In_opt_z_ char* szComEnclosingTypeName)
{
AsmManComType* ret = NULL;
if(szComTypeName)
@@ -102,14 +102,14 @@ AsmManComType* AsmMan::GetComTypeByName(__in_opt __nullterminated char*
}
mdToken AsmMan::GetComTypeTokByName(
- __in_opt __nullterminated char* szComTypeName,
- __in_opt __nullterminated char* szComEnclosingTypeName)
+ _In_opt_z_ char* szComTypeName,
+ _In_opt_z_ char* szComEnclosingTypeName)
{
AsmManComType* tmp = GetComTypeByName(szComTypeName, szComEnclosingTypeName);
return(tmp ? tmp->tkTok : mdExportedTypeNil);
}
-AsmManAssembly* AsmMan::GetAsmRefByName(__in __nullterminated const char* szAsmRefName)
+AsmManAssembly* AsmMan::GetAsmRefByName(_In_ __nullterminated const char* szAsmRefName)
{
AsmManAssembly* ret = NULL;
if(szAsmRefName)
@@ -124,12 +124,12 @@ AsmManAssembly* AsmMan::GetAsmRefByName(__in __nullterminated const char* sz
}
return ret;
}
-mdToken AsmMan::GetAsmRefTokByName(__in __nullterminated const char* szAsmRefName)
+mdToken AsmMan::GetAsmRefTokByName(_In_ __nullterminated const char* szAsmRefName)
{
AsmManAssembly* tmp = GetAsmRefByName(szAsmRefName);
return(tmp ? tmp->tkTok : mdAssemblyRefNil);
}
-AsmManAssembly* AsmMan::GetAsmRefByAsmName(__in __nullterminated const char* szAsmName)
+AsmManAssembly* AsmMan::GetAsmRefByAsmName(_In_ __nullterminated const char* szAsmName)
{
AsmManAssembly* ret = NULL;
if(szAsmName)
@@ -160,7 +160,7 @@ void AsmMan::SetModuleName(__inout_opt __nullterminated char* szName)
}
//==============================================================================================================
-void AsmMan::AddFile(__in __nullterminated char* szName, DWORD dwAttr, BinStr* pHashBlob)
+void AsmMan::AddFile(_In_ __nullterminated char* szName, DWORD dwAttr, BinStr* pHashBlob)
{
AsmManFile* tmp = GetFileByName(szName);
Assembler* pAsm = (Assembler*)m_pAssembler;
@@ -244,7 +244,7 @@ void AsmMan::EmitFiles()
} //end for(i = 0; tmp=m_FileLst.PEEK(i); i++)
}
-void AsmMan::StartAssembly(__in __nullterminated char* szName, __in_opt __nullterminated char* szAlias, DWORD dwAttr, BOOL isRef)
+void AsmMan::StartAssembly(_In_ __nullterminated char* szName, _In_opt_z_ char* szAlias, DWORD dwAttr, BOOL isRef)
{
if(!isRef && (0==strcmp(szName, "mscorlib"))) ((Assembler*)m_pAssembler)->m_fIsMscorlib = TRUE;
if(!isRef && (m_pAssembly != NULL))
@@ -674,7 +674,7 @@ void AsmMan::SetAssemblyAutodetect()
}
}
-void AsmMan::StartComType(__in __nullterminated char* szName, DWORD dwAttr)
+void AsmMan::StartComType(_In_ __nullterminated char* szName, DWORD dwAttr)
{
if((m_pCurComType = new AsmManComType))
{
@@ -732,7 +732,7 @@ void AsmMan::EndComType()
}
}
-void AsmMan::SetComTypeFile(__in __nullterminated char* szFileName)
+void AsmMan::SetComTypeFile(_In_ __nullterminated char* szFileName)
{
if(m_pCurComType)
{
@@ -740,7 +740,7 @@ void AsmMan::SetComTypeFile(__in __nullterminated char* szFileName)
}
}
-void AsmMan::SetComTypeAsmRef(__in __nullterminated char* szAsmRefName)
+void AsmMan::SetComTypeAsmRef(_In_ __nullterminated char* szAsmRefName)
{
if(m_pCurComType)
{
@@ -748,7 +748,7 @@ void AsmMan::SetComTypeAsmRef(__in __nullterminated char* szAsmRefName)
}
}
-void AsmMan::SetComTypeComType(__in __nullterminated char* szComTypeName)
+void AsmMan::SetComTypeComType(_In_ __nullterminated char* szComTypeName)
{
if(m_pCurComType)
{
@@ -780,7 +780,7 @@ BOOL AsmMan::SetComTypeClassTok(mdToken tkClass)
return FALSE;
}
-void AsmMan::StartManifestRes(__in __nullterminated char* szName, __in __nullterminated char* szAlias, DWORD dwAttr)
+void AsmMan::StartManifestRes(_In_ __nullterminated char* szName, _In_ __nullterminated char* szAlias, DWORD dwAttr)
{
if((m_pCurManRes = new AsmManRes))
{
@@ -808,7 +808,7 @@ void AsmMan::EndManifestRes()
}
-void AsmMan::SetManifestResFile(__in __nullterminated char* szFileName, ULONG ulOffset)
+void AsmMan::SetManifestResFile(_In_ __nullterminated char* szFileName, ULONG ulOffset)
{
if(m_pCurManRes)
{
@@ -817,7 +817,7 @@ void AsmMan::SetManifestResFile(__in __nullterminated char* szFileName, ULONG
}
}
-void AsmMan::SetManifestResAsmRef(__in __nullterminated char* szAsmRefName)
+void AsmMan::SetManifestResAsmRef(_In_ __nullterminated char* szAsmRefName)
{
if(m_pCurManRes)
{
diff --git a/src/coreclr/ilasm/asmman.hpp b/src/coreclr/ilasm/asmman.hpp
index 1290c9b2707c8a..972c8382434f8e 100644
--- a/src/coreclr/ilasm/asmman.hpp
+++ b/src/coreclr/ilasm/asmman.hpp
@@ -193,12 +193,12 @@ class AsmMan
ErrorReporter* report;
void* m_pAssembler;
- AsmManFile* GetFileByName(__in __nullterminated char* szFileName);
- AsmManAssembly* GetAsmRefByName(__in __nullterminated const char* szAsmRefName);
- AsmManComType* GetComTypeByName(__in_opt __nullterminated char* szComTypeName,
- __in_opt __nullterminated char* szComEnclosingTypeName = NULL);
- mdToken GetComTypeTokByName(__in_opt __nullterminated char* szComTypeName,
- __in_opt __nullterminated char* szComEnclosingTypeName = NULL);
+ AsmManFile* GetFileByName(_In_ __nullterminated char* szFileName);
+ AsmManAssembly* GetAsmRefByName(_In_ __nullterminated const char* szAsmRefName);
+ AsmManComType* GetComTypeByName(_In_opt_z_ char* szComTypeName,
+ _In_opt_z_ char* szComEnclosingTypeName = NULL);
+ mdToken GetComTypeTokByName(_In_opt_z_ char* szComTypeName,
+ _In_opt_z_ char* szComEnclosingTypeName = NULL);
IMetaDataEmit* m_pEmitter;
@@ -241,11 +241,11 @@ class AsmMan
void SetModuleName(__inout_opt __nullterminated char* szName);
- void AddFile(__in __nullterminated char* szName, DWORD dwAttr, BinStr* pHashBlob);
+ void AddFile(_In_ __nullterminated char* szName, DWORD dwAttr, BinStr* pHashBlob);
void EmitFiles();
void EmitDebuggableAttribute(mdToken tkOwner);
- void StartAssembly(__in __nullterminated char* szName, __in_opt __nullterminated char* szAlias, DWORD dwAttr, BOOL isRef);
+ void StartAssembly(_In_ __nullterminated char* szName, _In_opt_z_ char* szAlias, DWORD dwAttr, BOOL isRef);
void EndAssembly();
void EmitAssemblyRefs();
void EmitAssembly();
@@ -257,27 +257,27 @@ class AsmMan
void SetAssemblyHashBlob(BinStr* pHashBlob);
void SetAssemblyAutodetect();
- void StartComType(__in __nullterminated char* szName, DWORD dwAttr);
+ void StartComType(_In_ __nullterminated char* szName, DWORD dwAttr);
void EndComType();
- void SetComTypeFile(__in __nullterminated char* szFileName);
- void SetComTypeAsmRef(__in __nullterminated char* szAsmRefName);
- void SetComTypeComType(__in __nullterminated char* szComTypeName);
+ void SetComTypeFile(_In_ __nullterminated char* szFileName);
+ void SetComTypeAsmRef(_In_ __nullterminated char* szAsmRefName);
+ void SetComTypeComType(_In_ __nullterminated char* szComTypeName);
BOOL SetComTypeImplementationTok(mdToken tk);
BOOL SetComTypeClassTok(mdToken tkClass);
- void StartManifestRes(__in __nullterminated char* szName, __in __nullterminated char* szAlias, DWORD dwAttr);
+ void StartManifestRes(_In_ __nullterminated char* szName, _In_ __nullterminated char* szAlias, DWORD dwAttr);
void EndManifestRes();
- void SetManifestResFile(__in __nullterminated char* szFileName, ULONG ulOffset);
- void SetManifestResAsmRef(__in __nullterminated char* szAsmRefName);
+ void SetManifestResFile(_In_ __nullterminated char* szFileName, ULONG ulOffset);
+ void SetManifestResAsmRef(_In_ __nullterminated char* szAsmRefName);
- AsmManAssembly* GetAsmRefByAsmName(__in __nullterminated const char* szAsmName);
+ AsmManAssembly* GetAsmRefByAsmName(_In_ __nullterminated const char* szAsmName);
- mdToken GetFileTokByName(__in __nullterminated char* szFileName);
- mdToken GetAsmRefTokByName(__in __nullterminated const char* szAsmRefName);
- mdToken GetAsmTokByName(__in __nullterminated const char* szAsmName)
+ mdToken GetFileTokByName(_In_ __nullterminated char* szFileName);
+ mdToken GetAsmRefTokByName(_In_ __nullterminated const char* szAsmRefName);
+ mdToken GetAsmTokByName(_In_ __nullterminated const char* szAsmName)
{ return (m_pAssembly && (strcmp(m_pAssembly->szName,szAsmName)==0)) ? m_pAssembly->tkTok : 0; };
- mdToken GetModuleRefTokByName(__in __nullterminated char* szName)
+ mdToken GetModuleRefTokByName(_In_ __nullterminated char* szName)
{
if(szName && *szName)
{
diff --git a/src/coreclr/ilasm/asmparse.h b/src/coreclr/ilasm/asmparse.h
index ef377b5e430d7c..e5479202730033 100644
--- a/src/coreclr/ilasm/asmparse.h
+++ b/src/coreclr/ilasm/asmparse.h
@@ -20,11 +20,11 @@ class ReadStream {
virtual ~ReadStream() = default;
- virtual unsigned getAll(__out char** ppch) = 0;
+ virtual unsigned getAll(_Out_ char** ppch) = 0;
// read at most 'buffLen' bytes into 'buff', Return the
// number of characters read. On EOF return 0
- virtual unsigned read(__out_ecount(buffLen) char* buff, unsigned buffLen) = 0;
+ virtual unsigned read(_Out_writes_(buffLen) char* buff, unsigned buffLen) = 0;
// Return the name of the stream, (for error reporting).
//virtual const char* name() = 0;
@@ -49,12 +49,12 @@ class BinStrStream : public ReadStream {
//if(m_pBS)
// delete m_pBS;
};
- unsigned getAll(__out char **ppbuff)
+ unsigned getAll(_Out_ char **ppbuff)
{
*ppbuff = m_pStart;
return m_pBS->length();
};
- unsigned read(__out_ecount(buffLen) char* buff, unsigned buffLen)
+ unsigned read(_Out_writes_(buffLen) char* buff, unsigned buffLen)
{
_ASSERTE(m_pStart != NULL);
unsigned Remainder = (unsigned)(m_pEnd - m_pCurr);
@@ -95,7 +95,7 @@ class BinStrStream : public ReadStream {
/**************************************************************************/
class MappedFileStream : public ReadStream {
public:
- MappedFileStream(__in __nullterminated WCHAR* wFileName)
+ MappedFileStream(_In_ __nullterminated WCHAR* wFileName)
{
fileNameW = wFileName;
m_hFile = INVALID_HANDLE_VALUE;
@@ -124,12 +124,12 @@ class MappedFileStream : public ReadStream {
fileNameW = NULL;
}
}
- unsigned getAll(__out char** pbuff)
+ unsigned getAll(_Out_ char** pbuff)
{
*pbuff = m_pStart;
return m_FileSize;
}
- unsigned read(__out_ecount(buffLen) char* buff, unsigned buffLen)
+ unsigned read(_Out_writes_(buffLen) char* buff, unsigned buffLen)
{
_ASSERTE(m_pStart != NULL);
unsigned Remainder = (unsigned)(m_pEnd - m_pCurr);
@@ -214,29 +214,29 @@ typedef LIFO ARG_NAME_LIST_STACK;
/*--------------------------------------------------------------------------*/
typedef char*(*PFN_NEXTCHAR)(char*);
-char* nextcharU(__in __nullterminated char* pos);
-char* nextcharW(__in __nullterminated char* pos);
+char* nextcharU(_In_ __nullterminated char* pos);
+char* nextcharW(_In_ __nullterminated char* pos);
/*--------------------------------------------------------------------------*/
typedef unsigned(*PFN_SYM)(char*);
-unsigned SymAU(__in __nullterminated char* curPos);
-unsigned SymW(__in __nullterminated char* curPos);
+unsigned SymAU(_In_ __nullterminated char* curPos);
+unsigned SymW(_In_ __nullterminated char* curPos);
/*--------------------------------------------------------------------------*/
typedef char*(*PFN_NEWSTRFROMTOKEN)(char*,size_t);
-char* NewStrFromTokenAU(__in_ecount(tokLen) char* curTok, size_t tokLen);
-char* NewStrFromTokenW(__in_ecount(tokLen) char* curTok, size_t tokLen);
+char* NewStrFromTokenAU(_In_reads_(tokLen) char* curTok, size_t tokLen);
+char* NewStrFromTokenW(_In_reads_(tokLen) char* curTok, size_t tokLen);
/*--------------------------------------------------------------------------*/
typedef char*(*PFN_NEWSTATICSTRFROMTOKEN)(char*,size_t,char*,size_t);
-char* NewStaticStrFromTokenAU(__in_ecount(tokLen) char* curTok, size_t tokLen, __out_ecount(bufSize) char* staticBuf, size_t bufSize);
-char* NewStaticStrFromTokenW(__in_ecount(tokLen) char* curTok, size_t tokLen, __out_ecount(bufSize) char* staticBuf, size_t bufSize);
+char* NewStaticStrFromTokenAU(_In_reads_(tokLen) char* curTok, size_t tokLen, _Out_writes_(bufSize) char* staticBuf, size_t bufSize);
+char* NewStaticStrFromTokenW(_In_reads_(tokLen) char* curTok, size_t tokLen, _Out_writes_(bufSize) char* staticBuf, size_t bufSize);
/*--------------------------------------------------------------------------*/
typedef unsigned(*PFN_GETDOUBLE)(char*,unsigned,double**);
-unsigned GetDoubleAU(__in __nullterminated char* begNum, unsigned L, double** ppRes);
-unsigned GetDoubleW(__in __nullterminated char* begNum, unsigned L, double** ppRes);
+unsigned GetDoubleAU(_In_ __nullterminated char* begNum, unsigned L, double** ppRes);
+unsigned GetDoubleW(_In_ __nullterminated char* begNum, unsigned L, double** ppRes);
/*--------------------------------------------------------------------------*/
struct PARSING_ENVIRONMENT
{
@@ -284,9 +284,9 @@ class AsmParse : public ErrorReporter
virtual void warn(const char* fmt, ...);
virtual void msg(const char* fmt, ...);
char *getLine(int lineNum) { return penv->in->getLine(lineNum); };
- unsigned getAll(__out char** pbuff) { return penv->in->getAll(pbuff); };
+ unsigned getAll(_Out_ char** pbuff) { return penv->in->getAll(pbuff); };
bool Success() {return success; };
- void SetIncludePath(__in WCHAR* wz) { wzIncludePath = wz; };
+ void SetIncludePath(_In_ WCHAR* wz) { wzIncludePath = wz; };
ARG_NAME_LIST_STACK m_ANSFirst;
ARG_NAME_LIST_STACK m_ANSLast;
@@ -298,20 +298,20 @@ class AsmParse : public ErrorReporter
BinStr* MakeTypeClass(CorElementType kind, mdToken tk);
BinStr* MakeTypeArray(CorElementType kind, BinStr* elemType, BinStr* bounds);
- char* fillBuff(__in_opt __nullterminated char* curPos); // refill the input buffer
+ char* fillBuff(_In_opt_z_ char* curPos); // refill the input buffer
HANDLE hstdout;
HANDLE hstderr;
private:
- friend void yyerror(__in __nullterminated const char* str);
+ friend void yyerror(_In_ __nullterminated const char* str);
friend int parse_literal(unsigned curSym, __inout __nullterminated char* &curPos, BOOL translate_escapes);
friend int yyparse();
friend int yylex();
friend Instr* SetupInstr(unsigned short opcode);
friend int findKeyword(const char* name, size_t nameLen, unsigned short* opcode);
- friend TypeDefDescr* findTypedef(__in_ecount(nameLen) char* name, size_t nameLen);
- friend char* skipBlanks(__in __nullterminated char*,unsigned*);
- friend char* nextBlank(__in __nullterminated char*);
+ friend TypeDefDescr* findTypedef(_In_reads_(nameLen) char* name, size_t nameLen);
+ friend char* skipBlanks(_In_ __nullterminated char*,unsigned*);
+ friend char* nextBlank(_In_ __nullterminated char*);
friend int ProcessEOF();
friend unsigned __int8* skipType(unsigned __int8* ptr, BOOL fFixupType);
friend void FixupConstraints();
diff --git a/src/coreclr/ilasm/assem.cpp b/src/coreclr/ilasm/assem.cpp
index e8044d16ab2b7f..e58b8e569d8d34 100644
--- a/src/coreclr/ilasm/assem.cpp
+++ b/src/coreclr/ilasm/assem.cpp
@@ -1039,7 +1039,7 @@ BOOL Assembler::EmitProp(PropDescriptor* pPD)
return TRUE;
}
-Class *Assembler::FindCreateClass(__in __nullterminated const char *pszFQN)
+Class *Assembler::FindCreateClass(_In_ __nullterminated const char *pszFQN)
{
Class *pSearch = NULL;
@@ -1186,7 +1186,7 @@ BOOL Assembler::DoGlobalFixups()
return TRUE;
}
-state_t Assembler::AddGlobalLabel(__in __nullterminated char *pszName, HCEESECTION section)
+state_t Assembler::AddGlobalLabel(_In_ __nullterminated char *pszName, HCEESECTION section)
{
if (FindGlobalLabel(pszName) != NULL)
{
@@ -1213,7 +1213,7 @@ state_t Assembler::AddGlobalLabel(__in __nullterminated char *pszName, HCEESECTI
return m_State;
}
-void Assembler::AddLabel(DWORD CurPC, __in __nullterminated char *pszName)
+void Assembler::AddLabel(DWORD CurPC, _In_ __nullterminated char *pszName)
{
if (m_pCurMethod->FindLabel(pszName) != NULL)
{
@@ -1478,7 +1478,7 @@ acceptable. Do NOT use for cryptographic purposes.
*/
unsigned hash(
- __in_ecount(length) const BYTE *k, /* the key */
+ _In_reads_(length) const BYTE *k, /* the key */
unsigned length, /* the length of the key */
unsigned initval) /* the previous hash, or an arbitrary value */
{
diff --git a/src/coreclr/ilasm/assembler.cpp b/src/coreclr/ilasm/assembler.cpp
index 48f9487656f7cf..85183bfae7542b 100644
--- a/src/coreclr/ilasm/assembler.cpp
+++ b/src/coreclr/ilasm/assembler.cpp
@@ -15,7 +15,7 @@
#define FAIL_UNLESS(x, y) if (!(x)) { report->error y; return; }
/**************************************************************************/
-void Assembler::StartNameSpace(__in __nullterminated char* name)
+void Assembler::StartNameSpace(_In_ __nullterminated char* name)
{
m_NSstack.PUSH(m_szNamespace);
m_szNamespace = name;
@@ -91,7 +91,7 @@ void Assembler::ClearBoundList(void)
m_TyParList = NULL;
}
/**************************************************************************/
-mdToken Assembler::ResolveClassRef(mdToken tkResScope, __in __nullterminated const char *pszFullClassName, Class** ppClass)
+mdToken Assembler::ResolveClassRef(mdToken tkResScope, _In_ __nullterminated const char *pszFullClassName, Class** ppClass)
{
Class *pClass = NULL;
mdToken tkRet = mdTokenNil;
@@ -239,7 +239,7 @@ mdToken Assembler::ResolveTypeSpec(BinStr* typeSpec)
}
/**************************************************************************/
-mdToken Assembler::GetAsmRef(__in __nullterminated const char* szName)
+mdToken Assembler::GetAsmRef(_In_ __nullterminated const char* szName)
{
mdToken tkResScope = 0;
if(strcmp(szName,"*")==0) tkResScope = mdTokenNil;
@@ -330,7 +330,7 @@ mdToken Assembler::GetInterfaceImpl(mdToken tsClass, mdToken tsInterface)
}
/**************************************************************************/
-mdToken Assembler::GetModRef(__in __nullterminated char* szName)
+mdToken Assembler::GetModRef(_In_ __nullterminated char* szName)
{
mdToken tkResScope = 0;
if(!strcmp(szName,m_szScopeName))
@@ -417,7 +417,7 @@ DWORD Assembler::CheckClassFlagsIfNested(Class* pEncloser, DWORD attr)
/**************************************************************************/
-void Assembler::StartClass(__in __nullterminated char* name, DWORD attr, TyParList *typars)
+void Assembler::StartClass(_In_ __nullterminated char* name, DWORD attr, TyParList *typars)
{
Class *pEnclosingClass = m_pCurClass;
char *szFQN;
@@ -607,7 +607,7 @@ void Assembler::SetPinvoke(BinStr* DllName, int Ordinal, BinStr* Alias, int Attr
}
/**************************************************************************/
-void Assembler::StartMethod(__in __nullterminated char* name, BinStr* sig, CorMethodAttr flags, BinStr* retMarshal, DWORD retAttr, TyParList *typars)
+void Assembler::StartMethod(_In_ __nullterminated char* name, BinStr* sig, CorMethodAttr flags, BinStr* retMarshal, DWORD retAttr, TyParList *typars)
{
if (m_pCurMethod != NULL)
{
@@ -801,7 +801,7 @@ void Assembler::EndMethod()
}
/**************************************************************************/
/* rvaLabel is the optional label that indicates this field points at a particular RVA */
-void Assembler::AddField(__inout_z __inout char* name, BinStr* sig, CorFieldAttr flags, __in __nullterminated char* rvaLabel, BinStr* pVal, ULONG ulOffset)
+void Assembler::AddField(__inout_z __inout char* name, BinStr* sig, CorFieldAttr flags, _In_ __nullterminated char* rvaLabel, BinStr* pVal, ULONG ulOffset)
{
FieldDescriptor* pFD;
ULONG i,n;
@@ -1030,7 +1030,7 @@ void Assembler::NewSEHDescriptor(void) //sets m_SEHD
if(m_SEHD == NULL) report->error("Failed to allocate SEH descriptor\n");
}
/**************************************************************************/
-void Assembler::SetTryLabels(__in __nullterminated char * szFrom, __in __nullterminated char *szTo)
+void Assembler::SetTryLabels(_In_ __nullterminated char * szFrom, _In_ __nullterminated char *szTo)
{
if(!m_SEHD) return;
Label *pLbl = m_pCurMethod->FindLabel(szFrom);
@@ -1043,7 +1043,7 @@ void Assembler::SetTryLabels(__in __nullterminated char * szFrom, __in __nullter
else report->error("Undefined 1st label in 'try
@@ -39,7 +40,7 @@ The .NET Foundation licenses this file to you under the MIT license.
truetrue
- true
+ truecopyused
@@ -117,6 +118,13 @@ The .NET Foundation licenses this file to you under the MIT license.
+
+
+ $(NativeIntermediateOutputPath)\%(Filename).ilc.rsp
+ $(NativeIntermediateOutputPath)\%(Filename).$(IlcOutputFileExt)
+
+
+
@@ -187,9 +195,9 @@ The .NET Foundation licenses this file to you under the MIT license.
-
@@ -284,16 +292,21 @@ The .NET Foundation licenses this file to you under the MIT license.
-
+
+
+
-
-
+
+
@@ -356,7 +369,7 @@ The .NET Foundation licenses this file to you under the MIT license.
<_IgnoreLinkerWarnings>false
<_IgnoreLinkerWarnings Condition="'$(TargetOS)' == 'OSX'">true
-
+
diff --git a/src/coreclr/nativeaot/Runtime/CommonMacros.h b/src/coreclr/nativeaot/Runtime/CommonMacros.h
index bfa6f2e1e3fc76..271980b5c1ad71 100644
--- a/src/coreclr/nativeaot/Runtime/CommonMacros.h
+++ b/src/coreclr/nativeaot/Runtime/CommonMacros.h
@@ -5,6 +5,7 @@
#define __COMMONMACROS_H__
#include "rhassert.h"
+#include
#define EXTERN_C extern "C"
@@ -33,12 +34,6 @@
#endif // _MSC_VER
-#ifndef COUNTOF
-template
-char (*COUNTOF_helper(_CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray];
-#define COUNTOF(_Array) sizeof(*COUNTOF_helper(_Array))
-#endif // COUNTOF
-
#ifndef offsetof
#define offsetof(s,m) (uintptr_t)( (intptr_t)&reinterpret_cast((((s *)0)->m)) )
#endif // offsetof
diff --git a/src/coreclr/nativeaot/Runtime/EHHelpers.cpp b/src/coreclr/nativeaot/Runtime/EHHelpers.cpp
index b8108dfa379f96..b888d530c4c5f9 100644
--- a/src/coreclr/nativeaot/Runtime/EHHelpers.cpp
+++ b/src/coreclr/nativeaot/Runtime/EHHelpers.cpp
@@ -92,7 +92,7 @@ COOP_PINVOKE_HELPER(int32_t, RhGetModuleFileName, (HANDLE moduleHandle, _Out_ co
COOP_PINVOKE_HELPER(void, RhpCopyContextFromExInfo, (void * pOSContext, int32_t cbOSContext, PAL_LIMITED_CONTEXT * pPalContext))
{
UNREFERENCED_PARAMETER(cbOSContext);
- ASSERT(cbOSContext >= sizeof(CONTEXT));
+ ASSERT((size_t)cbOSContext >= sizeof(CONTEXT));
CONTEXT* pContext = (CONTEXT *)pOSContext;
#if defined(UNIX_AMD64_ABI)
pContext->Rip = pPalContext->IP;
diff --git a/src/coreclr/nativeaot/Runtime/IntrinsicConstants.h b/src/coreclr/nativeaot/Runtime/IntrinsicConstants.h
index d3ea7a17bc0423..8ce413315e81c6 100644
--- a/src/coreclr/nativeaot/Runtime/IntrinsicConstants.h
+++ b/src/coreclr/nativeaot/Runtime/IntrinsicConstants.h
@@ -22,6 +22,7 @@ enum XArchIntrinsicConstants
XArchIntrinsicConstants_Bmi1 = 0x0400,
XArchIntrinsicConstants_Bmi2 = 0x0800,
XArchIntrinsicConstants_Lzcnt = 0x1000,
+ XArchIntrinsicConstants_AvxVnni = 0x2000,
};
#endif //HOST_X86 || HOST_AMD64
diff --git a/src/coreclr/nativeaot/Runtime/MathHelpers.cpp b/src/coreclr/nativeaot/Runtime/MathHelpers.cpp
index dfcd1c194b8576..1209e9c5543629 100644
--- a/src/coreclr/nativeaot/Runtime/MathHelpers.cpp
+++ b/src/coreclr/nativeaot/Runtime/MathHelpers.cpp
@@ -33,7 +33,7 @@ EXTERN_C REDHAWK_API float REDHAWK_CALLCONV RhpFltRem(float dividend, float divi
if (divisor==0 || !std::isfinite(dividend))
{
- return -nanf(0);
+ return -nanf("");
}
else if (!std::isfinite(divisor) && !std::isnan(divisor))
{
@@ -57,7 +57,7 @@ EXTERN_C REDHAWK_API double REDHAWK_CALLCONV RhpDblRem(double dividend, double d
//
if (divisor==0 || !std::isfinite(dividend))
{
- return -nan(0);
+ return -nan("");
}
else if (!std::isfinite(divisor) && !std::isnan(divisor))
{
diff --git a/src/coreclr/nativeaot/Runtime/PalRedhawkFunctions.h b/src/coreclr/nativeaot/Runtime/PalRedhawkFunctions.h
index ff58a8ea0dc08d..99b6b4bdbb8c2b 100644
--- a/src/coreclr/nativeaot/Runtime/PalRedhawkFunctions.h
+++ b/src/coreclr/nativeaot/Runtime/PalRedhawkFunctions.h
@@ -80,16 +80,18 @@ inline HANDLE PalGetCurrentThread()
}
#ifdef UNICODE
-extern "C" uint32_t __stdcall GetEnvironmentVariableW(__in_z_opt LPCWSTR, __out_z_opt LPWSTR, uint32_t);
-inline uint32_t PalGetEnvironmentVariable(__in_z_opt LPCWSTR arg1, __out_z_opt LPWSTR arg2, uint32_t arg3)
+_Success_(return != 0 && return < nSize)
+extern "C" uint32_t __stdcall GetEnvironmentVariableW(_In_opt_ LPCWSTR lpName, _Out_writes_to_opt_(nSize, return + 1) LPWSTR lpBuffer, _In_ uint32_t nSize);
+inline uint32_t PalGetEnvironmentVariable(_In_opt_ LPCWSTR lpName, _Out_writes_to_opt_(nSize, return + 1) LPWSTR lpBuffer, _In_ uint32_t nSize)
{
- return GetEnvironmentVariableW(arg1, arg2, arg3);
+ return GetEnvironmentVariableW(lpName, lpBuffer, nSize);
}
#else
-extern "C" uint32_t __stdcall GetEnvironmentVariableA(__in_z_opt LPCSTR, __out_z_opt LPSTR, uint32_t);
-inline uint32_t PalGetEnvironmentVariable(__in_z_opt LPCSTR arg1, __out_z_opt LPSTR arg2, uint32_t arg3)
+_Success_(return != 0 && return < nSize)
+extern "C" uint32_t __stdcall GetEnvironmentVariableA(_In_opt_ LPCSTR lpName, _Out_writes_to_opt_(nSize, return + 1) LPSTR lpBuffer, _In_ uint32_t nSize);
+inline uint32_t PalGetEnvironmentVariable(_In_opt_ LPCSTR lpName, _Out_writes_to_opt_(nSize, return + 1) LPSTR lpBuffer, _In_ uint32_t nSize)
{
- return GetEnvironmentVariableA(arg1, arg2, arg3);
+ return GetEnvironmentVariableA(lpName, lpBuffer, nSize);
}
#endif
diff --git a/src/coreclr/nativeaot/Runtime/RhConfig.cpp b/src/coreclr/nativeaot/Runtime/RhConfig.cpp
index da618a85930e08..e68dc4eaf5d460 100644
--- a/src/coreclr/nativeaot/Runtime/RhConfig.cpp
+++ b/src/coreclr/nativeaot/Runtime/RhConfig.cpp
@@ -118,7 +118,7 @@ uint32_t RhConfig::GetConfigVariable(_In_z_ const TCHAR* configName, const Confi
uint32_t iValue;
- for (iValue = 0; (iValue < CONFIG_VAL_MAXLEN + 1) && (iValue < (int32_t)cchOutputBuffer); iValue++)
+ for (iValue = 0; (iValue < CONFIG_VAL_MAXLEN + 1) && (iValue < cchOutputBuffer); iValue++)
{
outputBuffer[iValue] = configPairs[iSettings].Value[iValue];
diff --git a/src/coreclr/nativeaot/Runtime/eventtrace.cpp b/src/coreclr/nativeaot/Runtime/eventtrace.cpp
index 9d115b2f264b74..23dd9726b5ed2d 100644
--- a/src/coreclr/nativeaot/Runtime/eventtrace.cpp
+++ b/src/coreclr/nativeaot/Runtime/eventtrace.cpp
@@ -3912,7 +3912,7 @@ void ETW::ExceptionLog::ExceptionThrown(CrawlFrame *pCf, BOOL bIsReThrownExcept
/****************************************************************************/
/* This is called by the runtime when a domain is loaded */
/****************************************************************************/
-void ETW::LoaderLog::DomainLoadReal(BaseDomain *pDomain, __in_opt LPWSTR wszFriendlyName)
+void ETW::LoaderLog::DomainLoadReal(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName)
{
CONTRACTL {
NOTHROW;
@@ -4342,7 +4342,7 @@ void ETW::MethodLog::MethodTableRestored(MethodTable *pMethodTable)
/****************************************************************************/
/* This is called by the runtime when a Strong Name Verification Starts */
/****************************************************************************/
-void ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, __in LPWSTR strFullyQualifiedAssemblyName)
+void ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, _In_ LPWSTR strFullyQualifiedAssemblyName)
{
WRAPPER_NO_CONTRACT;
#ifndef FEATURE_CORECLR
@@ -4362,7 +4362,7 @@ void ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, __in LPWSTR
/****************************************************************************/
/* This is called by the runtime when a Strong Name Verification Ends */
/****************************************************************************/
-void ETW::SecurityLog::StrongNameVerificationStop(DWORD dwInFlags,ULONG result, __in LPWSTR strFullyQualifiedAssemblyName)
+void ETW::SecurityLog::StrongNameVerificationStop(DWORD dwInFlags,ULONG result, _In_ LPWSTR strFullyQualifiedAssemblyName)
{
WRAPPER_NO_CONTRACT;
#ifndef FEATURE_CORECLR
@@ -4885,8 +4885,8 @@ void ETW::LoaderLog::SendAssemblyEvent(Assembly *pAssembly, DWORD dwEventOptions
ETW_INLINE
ULONG
ETW::LoaderLog::SendModuleRange(
- __in Module *pModule,
- __in DWORD dwEventOptions)
+ _In_ Module *pModule,
+ _In_ DWORD dwEventOptions)
{
ULONG Result = ERROR_SUCCESS;
diff --git a/src/coreclr/nativeaot/Runtime/eventtracebase.h b/src/coreclr/nativeaot/Runtime/eventtracebase.h
index afe833ef597584..79b8fac860612c 100644
--- a/src/coreclr/nativeaot/Runtime/eventtracebase.h
+++ b/src/coreclr/nativeaot/Runtime/eventtracebase.h
@@ -424,9 +424,9 @@ namespace ETW
}LoaderStructs;
- static void DomainLoadReal(BaseDomain *pDomain, __in_opt LPWSTR wszFriendlyName=NULL);
+ static void DomainLoadReal(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName=NULL);
- static void DomainLoad(BaseDomain *pDomain, __in_opt LPWSTR wszFriendlyName = NULL)
+ static void DomainLoad(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName = NULL)
{
#ifndef FEATURE_PAL
if (MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context.IsEnabled)
@@ -441,7 +441,7 @@ namespace ETW
static void ModuleLoad(Module *pModule, LONG liReportedSharedModule);
#else
public:
- static void DomainLoad(BaseDomain *pDomain, __in_opt LPWSTR wszFriendlyName=NULL) {};
+ static void DomainLoad(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName=NULL) {};
static void DomainUnload(AppDomain *pDomain) {};
static void CollectibleLoaderAllocatorUnload(AssemblyLoaderAllocator *pLoaderAllocator) {};
static void ModuleLoad(Module *pModule, LONG liReportedSharedModule) {};
@@ -505,8 +505,8 @@ namespace ETW
{
#ifdef FEATURE_EVENT_TRACE
public:
- static void StrongNameVerificationStart(DWORD dwInFlags, __in LPWSTR strFullyQualifiedAssemblyName);
- static void StrongNameVerificationStop(DWORD dwInFlags,ULONG result, __in LPWSTR strFullyQualifiedAssemblyName);
+ static void StrongNameVerificationStart(DWORD dwInFlags, _In_ LPWSTR strFullyQualifiedAssemblyName);
+ static void StrongNameVerificationStop(DWORD dwInFlags,ULONG result, _In_ LPWSTR strFullyQualifiedAssemblyName);
static void FireFieldTransparencyComputationStart(LPCWSTR wszFieldName,
LPCWSTR wszModuleName,
@@ -742,8 +742,8 @@ extern ETW::CEtwTracer * g_pEtwTracer;
FORCEINLINE
BOOLEAN __stdcall
McGenEventTracingEnabled(
- __in PMCGEN_TRACE_CONTEXT EnableInfo,
- __in PCEVENT_DESCRIPTOR EventDescriptor
+ _In_ PMCGEN_TRACE_CONTEXT EnableInfo,
+ _In_ PCEVENT_DESCRIPTOR EventDescriptor
)
{
@@ -863,9 +863,9 @@ struct CallStackFrame
FORCEINLINE
BOOLEAN __stdcall
McGenEventProviderEnabled(
- __in PMCGEN_TRACE_CONTEXT Context,
- __in UCHAR Level,
- __in ULONGLONG Keyword
+ _In_ PMCGEN_TRACE_CONTEXT Context,
+ _In_ UCHAR Level,
+ _In_ ULONGLONG Keyword
)
{
if(!Context) {
@@ -989,10 +989,10 @@ namespace ETW
ETW_INLINE
ULONG
CoMofTemplate_h(
- __in REGHANDLE RegHandle,
- __in PCEVENT_DESCRIPTOR Descriptor,
- __in_opt LPCGUID EventGuid,
- __in const unsigned short ClrInstanceID
+ _In_ REGHANDLE RegHandle,
+ _In_ PCEVENT_DESCRIPTOR Descriptor,
+ _In_opt_ LPCGUID EventGuid,
+ _In_ const unsigned short ClrInstanceID
)
{
#define ARGUMENT_COUNT_h 1
diff --git a/src/coreclr/nativeaot/Runtime/gcrhenv.cpp b/src/coreclr/nativeaot/Runtime/gcrhenv.cpp
index 7ca20c8ca8d998..2f6f6ea4f7c0c0 100644
--- a/src/coreclr/nativeaot/Runtime/gcrhenv.cpp
+++ b/src/coreclr/nativeaot/Runtime/gcrhenv.cpp
@@ -923,7 +923,7 @@ void GCToEEInterface::DisablePreemptiveGC()
Thread* GCToEEInterface::GetThread()
{
#ifndef DACCESS_COMPILE
- return ThreadStore::GetCurrentThread();
+ return ThreadStore::GetCurrentThreadIfAvailable();
#else
return NULL;
#endif
diff --git a/src/coreclr/nativeaot/Runtime/inc/daccess.h b/src/coreclr/nativeaot/Runtime/inc/daccess.h
index 8ef6bc929e133d..c68597b41b3274 100644
--- a/src/coreclr/nativeaot/Runtime/inc/daccess.h
+++ b/src/coreclr/nativeaot/Runtime/inc/daccess.h
@@ -628,7 +628,7 @@ extern "C" {
// These two functions are largely just for marking code
// that is not fully converted. DacWarning prints a debug
// message, while DacNotImpl throws a not-implemented exception.
-void __cdecl DacWarning(__in __in_z char* format, ...);
+void __cdecl DacWarning(_In_ _In_z_ char* format, ...);
void DacNotImpl(void);
void DacError(HRESULT err);
void __declspec(noreturn) DacError_NoRet(HRESULT err);
diff --git a/src/coreclr/nativeaot/Runtime/rhassert.cpp b/src/coreclr/nativeaot/Runtime/rhassert.cpp
index f69a919450b390..4ff9062578f6d4 100644
--- a/src/coreclr/nativeaot/Runtime/rhassert.cpp
+++ b/src/coreclr/nativeaot/Runtime/rhassert.cpp
@@ -52,7 +52,7 @@ void Assert(const char * expr, const char * file, uint32_t line_num, const char
char buffer[4096];
- sprintf_s(buffer, COUNTOF(buffer),
+ sprintf_s(buffer, ARRAY_SIZE(buffer),
"--------------------------------------------------\n"
"Debug Assertion Violation\n\n"
"%s%s%s"
diff --git a/src/coreclr/nativeaot/Runtime/startup.cpp b/src/coreclr/nativeaot/Runtime/startup.cpp
index af4a025050e479..ada010f8a573e6 100644
--- a/src/coreclr/nativeaot/Runtime/startup.cpp
+++ b/src/coreclr/nativeaot/Runtime/startup.cpp
@@ -198,6 +198,12 @@ bool DetectCPUFeatures()
if ((cpuidInfo[EBX] & (1 << 5)) != 0) // AVX2
{
g_cpuFeatures |= XArchIntrinsicConstants_Avx2;
+
+ __cpuidex(cpuidInfo, 0x00000007, 0x00000001);
+ if ((cpuidInfo[EAX] & (1 << 4)) != 0) // AVX-VNNI
+ {
+ g_cpuFeatures |= XArchIntrinsicConstants_AvxVnni;
+ }
}
}
}
diff --git a/src/coreclr/nativeaot/Runtime/stressLog.cpp b/src/coreclr/nativeaot/Runtime/stressLog.cpp
index 12df357966d78e..2e25b6bcfa7928 100644
--- a/src/coreclr/nativeaot/Runtime/stressLog.cpp
+++ b/src/coreclr/nativeaot/Runtime/stressLog.cpp
@@ -323,7 +323,7 @@ void ThreadStressLog::LogMsg ( uint32_t facility, int cArgs, const char* format,
// Asserts in this function cause infinite loops in the asserting mechanism.
// Just use debug breaks instead.
- ASSERT( cArgs >= 0 && cArgs <= StressMsg::maxArgCnt );
+ ASSERT( cArgs >= 0 && (size_t)cArgs <= StressMsg::maxArgCnt );
size_t offs = ((size_t)format - StressLog::theLog.moduleOffset);
@@ -373,7 +373,7 @@ void ThreadStressLog::Activate (Thread * pThread)
/* static */
void StressLog::LogMsg (unsigned facility, int cArgs, const char* format, ... )
{
- _ASSERTE ( cArgs >= 0 && cArgs <= StressMsg::maxArgCnt );
+ _ASSERTE ( cArgs >= 0 && (size_t)cArgs <= StressMsg::maxArgCnt );
va_list Args;
va_start(Args, format);
diff --git a/src/coreclr/nativeaot/Runtime/thread.cpp b/src/coreclr/nativeaot/Runtime/thread.cpp
index 2b4a6ccb83a9cf..f091318acf641c 100644
--- a/src/coreclr/nativeaot/Runtime/thread.cpp
+++ b/src/coreclr/nativeaot/Runtime/thread.cpp
@@ -607,13 +607,13 @@ static void* GcStressHijackTargets[1] =
// static
bool Thread::IsHijackTarget(void * address)
{
- for (int i = 0; i < COUNTOF(NormalHijackTargets); i++)
+ for (size_t i = 0; i < ARRAY_SIZE(NormalHijackTargets); i++)
{
if (NormalHijackTargets[i] == address)
return true;
}
#ifdef FEATURE_GC_STRESS
- for (int i = 0; i < COUNTOF(GcStressHijackTargets); i++)
+ for (size_t i = 0; i < ARRAY_SIZE(GcStressHijackTargets); i++)
{
if (GcStressHijackTargets[i] == address)
return true;
diff --git a/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp b/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp
index f7b876a6721457..410222948e18cf 100644
--- a/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp
+++ b/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp
@@ -233,7 +233,7 @@ class UnixEvent
TimeSpecAdd(&endTime, milliseconds);
}
#else
-#error Don't know how to perform timed wait on this platform
+#error "Don't know how to perform timed wait on this platform"
#endif
int st = 0;
diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Math.CoreRT.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Math.CoreRT.cs
index 8a53e1588b83d2..15b629dbee219f 100644
--- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Math.CoreRT.cs
+++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Math.CoreRT.cs
@@ -16,18 +16,6 @@ namespace System
{
public static partial class Math
{
- [Intrinsic]
- public static float Abs(float value)
- {
- return RuntimeImports.fabsf(value);
- }
-
- [Intrinsic]
- public static double Abs(double value)
- {
- return RuntimeImports.fabs(value);
- }
-
[Intrinsic]
public static double Acos(double d)
{
diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.CoreRT.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.CoreRT.cs
index 788bad4bbc1814..06c7ce9fdc1f55 100644
--- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.CoreRT.cs
+++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/ComWrappers.CoreRT.cs
@@ -213,8 +213,6 @@ private unsafe IntPtr AsRuntimeDefined(in Guid riid)
{
return (IntPtr)(Dispatches + i);
}
-
- i++;
}
return IntPtr.Zero;
diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs
index 304f7073e7ec3c..a7edbf10d819af 100644
--- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs
+++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs
@@ -679,18 +679,6 @@ internal struct ConservativelyReportedRegionDesc
[RuntimeImport(RuntimeLibrary, "RhpMemoryBarrier")]
internal static extern void MemoryBarrier();
- [Intrinsic]
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- [RuntimeImport(RuntimeLibrary, "fabs")]
- internal static extern double fabs(double x);
-
- [Intrinsic]
- internal static float fabsf(float x)
- {
- // fabsf is not a real export for some architectures
- return (float)fabs(x);
- }
-
[Intrinsic]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[RuntimeImport(RuntimeLibrary, "acos")]
diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs
index 8e060328d62eaa..3c5745bcc873a6 100644
--- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs
+++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeFieldHandle.cs
@@ -11,7 +11,7 @@
namespace System
{
[StructLayoutAttribute(LayoutKind.Sequential)]
- public struct RuntimeFieldHandle : ISerializable
+ public struct RuntimeFieldHandle : IEquatable, ISerializable
{
private IntPtr _value;
diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs
index cb1b39db71283a..b8d50df26a0f73 100644
--- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs
+++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/RuntimeMethodHandle.cs
@@ -13,7 +13,7 @@
namespace System
{
[StructLayout(LayoutKind.Sequential)]
- public struct RuntimeMethodHandle : ISerializable
+ public struct RuntimeMethodHandle : IEquatable, ISerializable
{
private IntPtr _value;
diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Thread.CoreRT.Windows.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Thread.CoreRT.Windows.cs
index e9ce1e5590ad70..9f31a0c2c6d9dc 100644
--- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Thread.CoreRT.Windows.cs
+++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Threading/Thread.CoreRT.Windows.cs
@@ -200,11 +200,10 @@ private unsafe bool CreateThread(GCHandle thisThreadHandle)
stackSize = AllocationGranularity;
}
- uint threadId;
_osHandle = Interop.Kernel32.CreateThread(IntPtr.Zero, (IntPtr)stackSize,
&ThreadEntryPoint, (IntPtr)thisThreadHandle,
Interop.Kernel32.CREATE_SUSPENDED | Interop.Kernel32.STACK_SIZE_PARAM_IS_A_RESERVATION,
- out threadId);
+ out _);
if (_osHandle.IsInvalid)
{
diff --git a/src/coreclr/nativeaot/System.Private.Interop/src/Internal/Runtime/CompilerHelpers/RuntimeInteropData.CoreRT.cs b/src/coreclr/nativeaot/System.Private.Interop/src/Internal/Runtime/CompilerHelpers/RuntimeInteropData.CoreRT.cs
index 376ee967cd4042..1f6fa5f89c83da 100644
--- a/src/coreclr/nativeaot/System.Private.Interop/src/Internal/Runtime/CompilerHelpers/RuntimeInteropData.CoreRT.cs
+++ b/src/coreclr/nativeaot/System.Private.Interop/src/Internal/Runtime/CompilerHelpers/RuntimeInteropData.CoreRT.cs
@@ -44,10 +44,9 @@ public override bool TryGetStructUnsafeStructSize(RuntimeTypeHandle structureTyp
public override bool TryGetStructFieldOffset(RuntimeTypeHandle structureTypeHandle, string fieldName, out bool structExists, out uint offset)
{
- ExternalReferencesTable externalReferences;
NativeParser entryParser;
structExists = false;
- if (TryGetStructData(structureTypeHandle, out externalReferences, out entryParser))
+ if (TryGetStructData(structureTypeHandle, out _, out entryParser))
{
structExists = true;
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/ActivatorImplementation.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/ActivatorImplementation.cs
index d5ea4c2dd34de2..4370581bd7c6e2 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/ActivatorImplementation.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/ActivatorImplementation.cs
@@ -88,8 +88,7 @@ public static object CreateInstance(
if (binder == null)
binder = Type.DefaultBinder;
- object state = null;
- MethodBase invokeMethod = binder.BindToMethod(bindingAttr, matches.ToArray(), ref args, null, culture, null, out state);
+ MethodBase invokeMethod = binder.BindToMethod(bindingAttr, matches.ToArray(), ref args, null, culture, null, out object state);
if (invokeMethod.GetParametersNoCopy().Length == 0)
{
if (args.Length != 0)
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/Assemblies/NativeFormat/NativeFormatRuntimeAssembly.GetTypeCore.CaseInsensitive.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/Assemblies/NativeFormat/NativeFormatRuntimeAssembly.GetTypeCore.CaseInsensitive.cs
index 266f6cba264005..7c5f1b5a926d95 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/Assemblies/NativeFormat/NativeFormatRuntimeAssembly.GetTypeCore.CaseInsensitive.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/Assemblies/NativeFormat/NativeFormatRuntimeAssembly.GetTypeCore.CaseInsensitive.cs
@@ -99,8 +99,7 @@ private LowLevelDictionary CreateCaseInsensitiveTypeDictionary(
foreach (TypeDefinitionHandle typeDefinitionHandle in namespaceDefinition.TypeDefinitions)
{
string fullName = ns + typeDefinitionHandle.GetTypeDefinition(reader).Name.GetString(reader).ToLowerInvariant();
- QHandle existingValue;
- if (!dict.TryGetValue(fullName, out existingValue))
+ if (!dict.TryGetValue(fullName, out _))
{
dict.Add(fullName, new QHandle(reader, typeDefinitionHandle));
}
@@ -109,8 +108,7 @@ private LowLevelDictionary CreateCaseInsensitiveTypeDictionary(
foreach (TypeForwarderHandle typeForwarderHandle in namespaceDefinition.TypeForwarders)
{
string fullName = ns + typeForwarderHandle.GetTypeForwarder(reader).Name.GetString(reader).ToLowerInvariant();
- QHandle existingValue;
- if (!dict.TryGetValue(fullName, out existingValue))
+ if (!dict.TryGetValue(fullName, out _))
{
dict.Add(fullName, new QHandle(reader, typeForwarderHandle));
}
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/BindingFlagSupport/Shared.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/BindingFlagSupport/Shared.cs
index 1f9d754916f749..4f20819d1d210a 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/BindingFlagSupport/Shared.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/BindingFlagSupport/Shared.cs
@@ -149,11 +149,9 @@ public static bool QualifiesBasedOnParameterCount(this MethodBase methodBase, Bi
public static M GetImplicitlyOverriddenBaseClassMember(this M member) where M : MemberInfo
{
MemberPolicies policies = MemberPolicies.Default;
- MethodAttributes visibility;
- bool isStatic;
bool isVirtual;
bool isNewSlot;
- policies.GetMemberAttributes(member, out visibility, out isStatic, out isVirtual, out isNewSlot);
+ policies.GetMemberAttributes(member, out _, out _, out isVirtual, out isNewSlot);
if (isNewSlot || !isVirtual)
{
return null;
@@ -174,11 +172,8 @@ public static M GetImplicitlyOverriddenBaseClassMember(this M member) where M
{
continue;
}
- MethodAttributes candidateVisibility;
- bool isCandidateStatic;
bool isCandidateVirtual;
- bool isCandidateNewSlot;
- policies.GetMemberAttributes(member, out candidateVisibility, out isCandidateStatic, out isCandidateVirtual, out isCandidateNewSlot);
+ policies.GetMemberAttributes(member, out _, out _, out isCandidateVirtual, out _);
if (!isCandidateVirtual)
{
continue;
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/CustomAttributes/RuntimeCustomAttributeData.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/CustomAttributes/RuntimeCustomAttributeData.cs
index 7db743d5e8143d..555277bed09352 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/CustomAttributes/RuntimeCustomAttributeData.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/CustomAttributes/RuntimeCustomAttributeData.cs
@@ -146,11 +146,10 @@ private static string ComputeTypedArgumentString(CustomAttributeTypedArgument ca
else if (argumentType.IsArray)
{
- string result = null;
IList array = value as IList;
Type elementType = argumentType.GetElementType();
- result = string.Format(@"new {0}[{1}] {{ ", elementType.IsEnum ? elementType.FullName : elementType.Name, array.Count);
+ string result = string.Format(@"new {0}[{1}] {{ ", elementType.IsEnum ? elementType.FullName : elementType.Name, array.Count);
for (int i = 0; i < array.Count; i++)
result += string.Format(i == 0 ? "{0}" : ", {0}", ComputeTypedArgumentString(array[i], elementType != typeof(object)));
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/NamespaceChain.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/NamespaceChain.cs
index e76abd7d0c0265..34b97186d7507e 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/NamespaceChain.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/NamespaceChain.cs
@@ -21,7 +21,7 @@ internal NamespaceChain(MetadataReader reader, NamespaceDefinitionHandle innerMo
{
NamespaceDefinition currentNamespaceDefinition = innerMostNamespaceHandle.GetNamespaceDefinition(reader);
ConstantStringValueHandle currentNameHandle = currentNamespaceDefinition.Name;
- Handle currentNamespaceHandle = innerMostNamespaceHandle.ToHandle(reader);
+ Handle currentNamespaceHandle;
LowLevelList names = new LowLevelList();
for (;;)
{
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ReflectionCoreCallbacksImplementation.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ReflectionCoreCallbacksImplementation.cs
index df5587374683db..77272d3ff2c236 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ReflectionCoreCallbacksImplementation.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/General/ReflectionCoreCallbacksImplementation.cs
@@ -164,7 +164,6 @@ private FieldInfo GetFieldInfo(RuntimeTypeHandle declaringTypeHandle, FieldHandl
{
RuntimeTypeInfo contextTypeInfo = declaringTypeHandle.GetTypeForRuntimeTypeHandle();
NativeFormatRuntimeNamedTypeInfo definingTypeInfo = contextTypeInfo.AnchoringTypeDefinitionForDeclaredMembers.CastToNativeFormatRuntimeNamedTypeInfo();
- MetadataReader reader = definingTypeInfo.Reader;
// RuntimeFieldHandles always yield FieldInfo's whose ReflectedType equals the DeclaringType.
RuntimeTypeInfo reflectedType = contextTypeInfo;
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/MethodInfos/RuntimePlainConstructorInfo.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/MethodInfos/RuntimePlainConstructorInfo.cs
index 308d09b8efcd5e..7e3825048f340d 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/MethodInfos/RuntimePlainConstructorInfo.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/MethodInfos/RuntimePlainConstructorInfo.cs
@@ -178,8 +178,7 @@ protected sealed override RuntimeParameterInfo[] RuntimeParameters
{
get
{
- RuntimeParameterInfo ignore;
- return _lazyParameters ?? (_lazyParameters = RuntimeMethodHelpers.GetRuntimeParameters(ref _common, this, Array.Empty(), out ignore));
+ return _lazyParameters ??= RuntimeMethodHelpers.GetRuntimeParameters(ref _common, this, Array.Empty(), out _);
}
}
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/ParameterInfos/RuntimeFatMethodParameterInfo.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/ParameterInfos/RuntimeFatMethodParameterInfo.cs
index 8f92256963e18c..8859a0770c4993 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/ParameterInfos/RuntimeFatMethodParameterInfo.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/ParameterInfos/RuntimeFatMethodParameterInfo.cs
@@ -50,7 +50,7 @@ public sealed override object RawDefaultValue
if (rawDefaultValueInfo == null)
{
object rawDefaultValue;
- bool dontCare = GetDefaultValueOrSentinel(raw: true, defaultValue: out rawDefaultValue);
+ GetDefaultValueOrSentinel(raw: true, defaultValue: out rawDefaultValue);
rawDefaultValueInfo = _lazyRawDefaultValueInfo = Tuple.Create(rawDefaultValue);
}
return rawDefaultValueInfo.Item1;
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.InvokeMember.cs b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.InvokeMember.cs
index 40ca73df2b1f4b..77dccda7966be1 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.InvokeMember.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.InvokeMember.cs
@@ -75,7 +75,6 @@ public sealed override object InvokeMember(
if (binder == null)
binder = DefaultBinder;
- bool bDefaultBinder = (binder == DefaultBinder);
#endregion
#region Delegate to Activator.CreateInstance
@@ -320,7 +319,7 @@ public sealed override object InvokeMember(
for (int i = 0; i < semiFinalists.Length; i++)
{
- MethodInfo semiFinalist = null;
+ MethodInfo semiFinalist;
if (isSetProperty)
{
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs
index 4439bea360a0c5..d086fbd41e9c83 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/ExecutionEnvironmentImplementation.MappingTables.cs
@@ -1038,8 +1038,8 @@ private static FunctionPointersToOffsets ComputeLdftnReverseLookup_InvokeMap(Nat
if (!hasEntrypoint)
continue;
- uint entryMethodHandleOrNameAndSigRaw = entryParser.GetUnsigned();
- uint entryDeclaringTypeRaw = entryParser.GetUnsigned();
+ entryParser.SkipInteger(); // entryMethodHandleOrNameAndSigRaw
+ entryParser.SkipInteger(); // entryDeclaringTypeRaw
IntPtr entryMethodEntrypoint = externalReferences.GetFunctionPointerFromIndex(entryParser.GetUnsigned());
functionPointers.Add(new FunctionPointerOffsetPair(entryMethodEntrypoint, parserOffset));
@@ -1401,8 +1401,7 @@ public unsafe sealed override bool TryGetMethodFromHandle(RuntimeMethodHandle ru
//
public sealed override bool TryGetMethodFromHandleAndType(RuntimeMethodHandle runtimeMethodHandle, RuntimeTypeHandle declaringTypeHandle, out QMethodDefinition methodHandle, out RuntimeTypeHandle[] genericMethodTypeArgumentHandles)
{
- RuntimeTypeHandle dummy;
- return TryGetMethodFromHandle(runtimeMethodHandle, out dummy, out methodHandle, out genericMethodTypeArgumentHandles);
+ return TryGetMethodFromHandle(runtimeMethodHandle, out _, out methodHandle, out genericMethodTypeArgumentHandles);
}
//
@@ -1410,7 +1409,6 @@ public sealed override bool TryGetMethodFromHandleAndType(RuntimeMethodHandle ru
//
public unsafe sealed override bool TryGetFieldFromHandle(RuntimeFieldHandle runtimeFieldHandle, out RuntimeTypeHandle declaringTypeHandle, out FieldHandle fieldHandle)
{
- declaringTypeHandle = default(RuntimeTypeHandle);
fieldHandle = default(FieldHandle);
string fieldName;
@@ -1446,8 +1444,7 @@ public unsafe sealed override bool TryGetFieldFromHandle(RuntimeFieldHandle runt
//
public sealed override bool TryGetFieldFromHandleAndType(RuntimeFieldHandle runtimeFieldHandle, RuntimeTypeHandle declaringTypeHandle, out FieldHandle fieldHandle)
{
- RuntimeTypeHandle dummy;
- return TryGetFieldFromHandle(runtimeFieldHandle, out dummy, out fieldHandle);
+ return TryGetFieldFromHandle(runtimeFieldHandle, out _, out fieldHandle);
}
///
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/DiagnosticMappingTables.cs b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/DiagnosticMappingTables.cs
index 0116d9a4c9e99b..d09662aad9514b 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/DiagnosticMappingTables.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/DiagnosticMappingTables.cs
@@ -62,10 +62,8 @@ public static bool TryGetDiagnosticStringForNamedType(RuntimeTypeHandle runtimeT
private static string GetTypeFullNameFromTypeRef(TypeReferenceHandle typeReferenceHandle, MetadataReader reader, List genericParameterOffsets)
{
- string s = "";
-
TypeReference typeReference = typeReferenceHandle.GetTypeReference(reader);
- s = typeReference.TypeName.GetString(reader);
+ string s = typeReference.TypeName.GetString(reader);
Handle parentHandle = typeReference.ParentNamespaceOrType;
HandleType parentHandleType = parentHandle.HandleType;
if (parentHandleType == HandleType.TypeReference)
@@ -135,7 +133,7 @@ public static string ConvertBackTickNameToNameWithReducerInputFormat(string type
private static string GetTypeFullNameFromTypeDef(TypeDefinitionHandle typeDefinitionHandle, MetadataReader reader, List genericParameterOffsets)
{
- string s = "";
+ string s;
TypeDefinition typeDefinition = typeDefinitionHandle.GetTypeDefinition(reader);
s = typeDefinition.Name.GetString(reader);
diff --git a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/MissingMetadataExceptionCreator.cs b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/MissingMetadataExceptionCreator.cs
index 37adf30ec26464..db347ad0b787ba 100644
--- a/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/MissingMetadataExceptionCreator.cs
+++ b/src/coreclr/nativeaot/System.Private.Reflection.Execution/src/Internal/Reflection/Execution/PayForPlayExperience/MissingMetadataExceptionCreator.cs
@@ -109,7 +109,7 @@ public static string ComputeUsefulPertainantIfPossible(object pertainant)
if (pertainant is MethodBase)
{
MethodBase method = (MethodBase)pertainant;
- bool first = true;
+ bool first;
// write out generic parameters
if (method.IsConstructedGenericMethod)
diff --git a/src/coreclr/nativeaot/System.Private.StackTraceMetadata/src/Internal/StackTraceMetadata/MethodNameFormatter.cs b/src/coreclr/nativeaot/System.Private.StackTraceMetadata/src/Internal/StackTraceMetadata/MethodNameFormatter.cs
index cc5dd065dac28b..ebfbab7a8e2c02 100644
--- a/src/coreclr/nativeaot/System.Private.StackTraceMetadata/src/Internal/StackTraceMetadata/MethodNameFormatter.cs
+++ b/src/coreclr/nativeaot/System.Private.StackTraceMetadata/src/Internal/StackTraceMetadata/MethodNameFormatter.cs
@@ -255,8 +255,12 @@ private void EmitTypeName(Handle typeHandle, bool namespaceQualified)
EmitString(typeHandle.ToGenericParameterHandle(_metadataReader).GetGenericParameter(_metadataReader).Name);
break;
+ case HandleType.FunctionPointerSignature:
+ EmitFunctionPointerTypeName();
+ break;
+
default:
- Debug.Assert(false);
+ Debug.Assert(false, $"Type handle {typeHandle.HandleType} was not handled");
_outputBuilder.Append("???");
break;
}
@@ -407,6 +411,14 @@ private void EmitPointerTypeName(PointerSignatureHandle pointerSigHandle)
_outputBuilder.Append('*');
}
+ ///
+ /// Emit function pointer type.
+ ///
+ private void EmitFunctionPointerTypeName()
+ {
+ _outputBuilder.Append("IntPtr");
+ }
+
///
/// Emit by-reference type.
///
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.CallConversionParameters.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.CallConversionParameters.cs
index 475b77b4820458..2d27a3f35893a3 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.CallConversionParameters.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.CallConversionParameters.cs
@@ -341,10 +341,8 @@ internal void PrepareNextMulticastDelegateCall(int currentIndex)
Delegate[] delegateArray = (Delegate[])_delegateData._helperObject;
Delegate currentDelegate = delegateArray[currentIndex];
- object helperObject;
- IntPtr extraFunctionPointerOrData;
IntPtr functionPointer;
- RuntimeAugments.GetDelegateData(currentDelegate, out _delegateData._multicastThisPointer, out helperObject, out extraFunctionPointerOrData, out functionPointer);
+ RuntimeAugments.GetDelegateData(currentDelegate, out _delegateData._multicastThisPointer, out _, out _, out functionPointer);
bool forceCalleeHasParamType = UpdateCalleeFunctionPointer(functionPointer);
_calleeArgs.SetHasParamTypeAndReset(forceCalleeHasParamType);
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.cs
index befeea82355aba..28197a93abd6ee 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallConverterThunk.cs
@@ -259,8 +259,7 @@ public static unsafe IntPtr GetDelegateThunk(Delegate delegateObject, int thunkK
Debug.Assert(RuntimeAugments.IsGenericType(delegateType));
RuntimeTypeHandle[] typeArgs;
- RuntimeTypeHandle genericTypeDefHandle;
- genericTypeDefHandle = RuntimeAugments.GetGenericInstantiation(delegateType, out typeArgs);
+ RuntimeAugments.GetGenericInstantiation(delegateType, out typeArgs);
Debug.Assert(typeArgs != null && typeArgs.Length > 0);
RuntimeSignature invokeMethodSignature;
@@ -303,9 +302,8 @@ public static unsafe IntPtr GetDelegateThunk(Delegate delegateObject, int thunkK
public static unsafe bool TryGetNonUnboxingFunctionPointerFromUnboxingAndInstantiatingStub(IntPtr potentialStub, RuntimeTypeHandle exactType, out IntPtr nonUnboxingMethod)
{
IntPtr callConversionId;
- IntPtr commonStubDataPtr;
object thunkPoolHeap = s_thunkPoolHeap;
- if (thunkPoolHeap == null || !RuntimeAugments.TryGetThunkData(thunkPoolHeap, potentialStub, out callConversionId, out commonStubDataPtr))
+ if (thunkPoolHeap == null || !RuntimeAugments.TryGetThunkData(thunkPoolHeap, potentialStub, out callConversionId, out _))
{
// This isn't a call conversion stub
nonUnboxingMethod = IntPtr.Zero;
@@ -383,9 +381,8 @@ public static unsafe bool TryGetCallConversionTargetPointerAndInstantiatingArg(I
methodTarget = instantiatingArg = IntPtr.Zero;
IntPtr callConversionId;
- IntPtr commonStubDataPtr;
object thunkPoolHeap = s_thunkPoolHeap;
- if (thunkPoolHeap == null || !RuntimeAugments.TryGetThunkData(thunkPoolHeap, potentialStub, out callConversionId, out commonStubDataPtr))
+ if (thunkPoolHeap == null || !RuntimeAugments.TryGetThunkData(thunkPoolHeap, potentialStub, out callConversionId, out _))
{
// This isn't a call conversion stub
return false;
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallingConventions.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallingConventions.cs
index d1b2421957a23e..b4388c891b17ac 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallingConventions.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/CallingConventions.cs
@@ -67,8 +67,7 @@ public static bool TypeUsesReturnBuffer(RuntimeTypeHandle returnType, bool metho
CorElementType typeReturnType = thReturnType.GetCorElementType();
bool usesReturnBuffer;
- uint fpReturnSizeIgnored;
- ArgIterator.ComputeReturnValueTreatment(typeReturnType, thReturnType, methodWithReturnTypeIsVarArg, out usesReturnBuffer, out fpReturnSizeIgnored);
+ ArgIterator.ComputeReturnValueTreatment(typeReturnType, thReturnType, methodWithReturnTypeIsVarArg, out usesReturnBuffer, out _);
return usesReturnBuffer;
}
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/EETypeCreator.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/EETypeCreator.cs
index aa65aecb53db4d..c1ff399482a52f 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/EETypeCreator.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/EETypeCreator.cs
@@ -1045,7 +1045,7 @@ public static RuntimeTypeHandle CreateEEType(TypeDesc type, TypeBuilderState sta
{
Debug.Assert(type != null && state != null);
- MethodTable* pTemplateEEType = null;
+ MethodTable* pTemplateEEType;
bool requireVtableSlotMapping = false;
if (type is PointerType || type is ByRefType)
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/ModuleList.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/ModuleList.cs
index 7a89589ed6cabf..f6e52ed013dd20 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/ModuleList.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/ModuleList.cs
@@ -673,8 +673,7 @@ public void RegisterNewModules(ModuleType moduleType)
foreach (TypeManagerHandle moduleHandle in loadedModuleHandles)
{
// Skip already registered modules.
- int oldModuleIndex;
- if (_loadedModuleMap.HandleToModuleIndex.TryGetValue(moduleHandle, out oldModuleIndex))
+ if (_loadedModuleMap.HandleToModuleIndex.TryGetValue(moduleHandle, out _))
{
continue;
}
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutFieldAlgorithm.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutFieldAlgorithm.cs
index 8d93e08b45b658..7c2d1958a40afb 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutFieldAlgorithm.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutFieldAlgorithm.cs
@@ -234,8 +234,7 @@ private static void EnsureFieldLayoutLoadedForNonUniversalType(DefType type)
// Look up the universal template for this type. Only the universal template has field layout
// information, so we have to use it to parse the field layout.
NativeLayoutInfoLoadContext universalLayoutLoadContext;
- NativeLayoutInfo universalLayoutInfo;
- NativeParser typeInfoParser = type.GetOrCreateTypeBuilderState().GetParserForUniversalNativeLayoutInfo(out universalLayoutLoadContext, out universalLayoutInfo);
+ NativeParser typeInfoParser = type.GetOrCreateTypeBuilderState().GetParserForUniversalNativeLayoutInfo(out universalLayoutLoadContext, out _);
if (typeInfoParser.IsNull)
throw new TypeBuilder.MissingTemplateException();
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutInfoLoadContext.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutInfoLoadContext.cs
index 9dcbbea70bdaad..887a9b9b062896 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutInfoLoadContext.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/NativeLayoutInfoLoadContext.cs
@@ -173,7 +173,7 @@ internal MethodDesc GetMethod(ref NativeParser parser, out RuntimeSignature meth
bool unboxingStub = (flags & MethodFlags.IsUnboxingStub) != 0;
- MethodDesc retVal = null;
+ MethodDesc retVal;
if ((flags & MethodFlags.HasInstantiation) != 0)
{
TypeDesc[] typeArguments = GetTypeSequence(ref parser);
@@ -197,9 +197,7 @@ internal MethodDesc GetMethod(ref NativeParser parser, out RuntimeSignature meth
internal MethodDesc GetMethod(ref NativeParser parser)
{
- RuntimeSignature methodSig;
- RuntimeSignature methodNameSig;
- return GetMethod(ref parser, out methodNameSig, out methodSig);
+ return GetMethod(ref parser, out _, out _);
}
internal TypeDesc[] GetTypeSequence(ref NativeParser parser)
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TemplateLocator.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TemplateLocator.cs
index 37752ef347200b..2a3fa2e363eafa 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TemplateLocator.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TemplateLocator.cs
@@ -236,8 +236,7 @@ private InstantiatedMethod TryGetGenericMethodTemplate_Internal(InstantiatedMeth
if (nativeLayoutReader == null)
continue;
- ExternalReferencesTable externalFixupsTable;
- NativeHashtable genericMethodTemplatesHashtable = LoadHashtable(moduleInfo, ReflectionMapBlob.GenericMethodsTemplateMap, out externalFixupsTable);
+ NativeHashtable genericMethodTemplatesHashtable = LoadHashtable(moduleInfo, ReflectionMapBlob.GenericMethodsTemplateMap, out _);
if (genericMethodTemplatesHashtable.IsNull)
continue;
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilder.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilder.cs
index aa1c1b918168b6..d7ba8aabd1ee85 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilder.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilder.cs
@@ -1458,8 +1458,7 @@ private void RegisterGenericTypesAndMethods()
int typesToRegisterCount = 0;
for (int i = 0; i < _typesThatNeedTypeHandles.Count; i++)
{
- DefType typeAsDefType;
- if ((typeAsDefType = _typesThatNeedTypeHandles[i] as DefType) != null)
+ if (_typesThatNeedTypeHandles[i] is DefType)
typesToRegisterCount++;
}
@@ -1637,8 +1636,6 @@ internal void BuildType(TypeDesc type)
internal bool TryComputeFieldOffset(DefType declaringType, uint fieldOrdinal, out int fieldOffset)
{
- fieldOffset = int.MinValue;
-
TypeLoaderLogger.WriteLine("Computing offset of field #" + fieldOrdinal.LowLevelToString() + " on type " + declaringType.ToString());
// Get the computed field offset result
@@ -2217,9 +2214,8 @@ internal static bool TryGetDelegateInvokeMethodSignature(RuntimeTypeHandle deleg
DefType delegateType = (DefType)context.ResolveRuntimeTypeHandle(delegateTypeHandle);
Debug.Assert(delegateType.HasInstantiation);
- NativeLayoutInfoLoadContext loadContext;
NativeLayoutInfo universalLayoutInfo;
- NativeParser parser = delegateType.GetOrCreateTypeBuilderState().GetParserForUniversalNativeLayoutInfo(out loadContext, out universalLayoutInfo);
+ NativeParser parser = delegateType.GetOrCreateTypeBuilderState().GetParserForUniversalNativeLayoutInfo(out _, out universalLayoutInfo);
if (!parser.IsNull)
{
NativeParser sigParser = parser.GetParserForBagElementKind(BagElementKind.DelegateInvokeSignature);
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilderState.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilderState.cs
index 0aa63813f9a8a0..8105f9d1687546 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilderState.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeBuilderState.cs
@@ -155,7 +155,7 @@ private void EnsureNativeLayoutInfoComputed()
if (!_templateComputed)
{
// Attempt to compute native layout through as a non-ReadyToRun template
- object temp = this.TemplateType;
+ object _ = this.TemplateType;
}
if (!_nativeLayoutTokenComputed)
{
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.ConstructedGenericMethodsLookup.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.ConstructedGenericMethodsLookup.cs
index b1f003ed8dab4c..f41f37821909dd 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.ConstructedGenericMethodsLookup.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.ConstructedGenericMethodsLookup.cs
@@ -291,8 +291,6 @@ public bool TryLookupGenericMethodDictionaryForComponents(RuntimeTypeHandle decl
public bool TryGetGenericMethodComponents(IntPtr methodDictionary, out RuntimeTypeHandle declaringType, out MethodNameAndSignature nameAndSignature, out RuntimeTypeHandle[] genericMethodArgumentHandles)
{
- nameAndSignature = null;
-
if (!TryGetDynamicGenericMethodComponents(methodDictionary, out declaringType, out nameAndSignature, out genericMethodArgumentHandles))
if (!TryGetStaticGenericMethodComponents(methodDictionary, out declaringType, out nameAndSignature, out genericMethodArgumentHandles))
return false;
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.FieldAccess.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.FieldAccess.cs
index 97d5c73f6741ed..a0a0854ec2da72 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.FieldAccess.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.FieldAccess.cs
@@ -124,8 +124,6 @@ private static unsafe bool TryGetFieldAccessMetadataFromFieldAccessMap(
ref FieldAccessMetadata fieldAccessMetadata)
{
CanonicallyEquivalentEntryLocator canonWrapper = new CanonicallyEquivalentEntryLocator(declaringTypeHandle, canonFormKind);
- TypeManagerHandle fieldHandleModule = ModuleList.Instance.GetModuleForMetadataReader(metadataReader);
- bool isDynamicType = RuntimeAugments.IsDynamicType(declaringTypeHandle);
string fieldName = null;
RuntimeTypeHandle declaringTypeHandleDefinition = Instance.GetTypeDefinition(declaringTypeHandle);
@@ -190,7 +188,7 @@ private static unsafe bool TryGetFieldAccessMetadataFromFieldAccessMap(
continue;
}
- int fieldOffset = -1;
+ int fieldOffset;
IntPtr fieldAddressCookie = IntPtr.Zero;
if (canonFormKind == CanonicalFormKind.Universal)
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.Metadata.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.Metadata.cs
index 37874b76b74579..820ea6ddb7decd 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.Metadata.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.Metadata.cs
@@ -602,9 +602,7 @@ private IntPtr TryGetDefaultConstructorForTypeViaMetadata_Inner(TypeDesc type)
MethodDesc defaultConstructor = ((MetadataType)defType).GetDefaultConstructor();
if (defaultConstructor != null)
{
- IntPtr dummyUnboxingStub;
- TypeLoaderEnvironment.MethodAddressType foundAddressType;
- TypeLoaderEnvironment.TryGetMethodAddressFromMethodDesc(defaultConstructor, out metadataLookupResult, out dummyUnboxingStub, out foundAddressType);
+ TypeLoaderEnvironment.TryGetMethodAddressFromMethodDesc(defaultConstructor, out metadataLookupResult, out _, out _);
}
}
}
@@ -1605,7 +1603,6 @@ public bool GetMethodEntryPoint(out IntPtr methodEntrypoint, out TDictionaryComp
rawMethodEntrypoint = _methodEntrypoint;
methodEntrypoint = IntPtr.Zero;
- dictionaryComponent = default(TDictionaryComponentType);
if (!GetDictionaryComponent(out dictionaryComponent) || !GetMethodEntryPointComponent(dictionaryComponent, out methodEntrypoint))
return false;
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.MetadataSignatureParsing.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.MetadataSignatureParsing.cs
index cebdf43051c454..181804eb2e2531 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.MetadataSignatureParsing.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.MetadataSignatureParsing.cs
@@ -372,7 +372,7 @@ private bool CompareTypeSigWithType(ref NativeParser parser, TypeManagerHandle m
return false;
}
- RuntimeTypeHandle type1 = default(RuntimeTypeHandle);
+ RuntimeTypeHandle type1;
if (typeSignatureKind == TypeSignatureKind.External)
{
type1 = SigParsing.GetTypeFromNativeLayoutSignature(ref parser, moduleHandle, startOffset);
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.NamedTypeLookup.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.NamedTypeLookup.cs
index 697b6c27214987..8d4eab59061d5b 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.NamedTypeLookup.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.NamedTypeLookup.cs
@@ -292,8 +292,7 @@ public void UnregisterNewNamedTypeRuntimeTypeHandle(QTypeDefinition qTypeDefinit
metadataLookupResult.VersionNumber = -1;
}
- NamedTypeLookupResult runtimeTypeHandleResult;
- if (_runtimeTypeHandleToMetadataHashtable.TryGetValue(runtimeTypeHandle, out runtimeTypeHandleResult))
+ if (_runtimeTypeHandleToMetadataHashtable.TryGetValue(runtimeTypeHandle, out _))
{
metadataLookupResult.GcStaticFields = IntPtr.Zero;
metadataLookupResult.NonGcStaticFields = IntPtr.Zero;
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.SignatureParsing.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.SignatureParsing.cs
index 3820ce7b8cd5d6..e27d2336ffcfbd 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.SignatureParsing.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.SignatureParsing.cs
@@ -123,9 +123,7 @@ public bool TryGetMethodNameAndSignatureFromNativeLayoutSignature(RuntimeSignatu
if (parser.IsNull)
return false;
- RuntimeSignature methodSig;
- RuntimeSignature methodNameSig;
- nameAndSignature = GetMethodNameAndSignature(ref parser, new TypeManagerHandle(signature.ModuleHandle), out methodNameSig, out methodSig);
+ nameAndSignature = GetMethodNameAndSignature(ref parser, new TypeManagerHandle(signature.ModuleHandle), out _, out _);
return true;
}
@@ -141,7 +139,7 @@ public bool TryGetMethodNameAndSignaturePointersFromNativeLayoutSignature(TypeMa
return false;
methodNameSig = RuntimeSignature.CreateFromNativeLayoutSignature(module, parser.Offset);
- string methodName = parser.GetString();
+ parser.SkipString(); // methodName
// Signatures are indirected to through a relative offset so that we don't have to parse them
// when not comparing signatures (parsing them requires resolving types and is tremendously
@@ -161,9 +159,7 @@ public bool TryGetMethodNameAndSignatureFromNativeLayoutOffset(TypeManagerHandle
if (parser.IsNull)
return false;
- RuntimeSignature methodSig;
- RuntimeSignature methodNameSig;
- nameAndSignature = GetMethodNameAndSignature(ref parser, moduleHandle, out methodNameSig, out methodSig);
+ nameAndSignature = GetMethodNameAndSignature(ref parser, moduleHandle, out _, out _);
return true;
}
@@ -295,9 +291,6 @@ internal bool GetCallingConverterDataFromMethodSignature_NativeLayout_Common(
out bool[] parametersWithGenericDependentLayout,
NativeReader nativeReader)
{
- hasThis = false;
- parameters = null;
-
NativeLayoutInfoLoadContext nativeLayoutContext = new NativeLayoutInfoLoadContext();
nativeLayoutContext._module = (NativeFormatModuleInfo)methodSig.GetModuleInfo();
@@ -312,7 +305,10 @@ internal bool GetCallingConverterDataFromMethodSignature_NativeLayout_Common(
MethodCallingConvention callingConvention = (MethodCallingConvention)parser.GetUnsigned();
hasThis = !callingConvention.HasFlag(MethodCallingConvention.Static);
- uint numGenArgs = callingConvention.HasFlag(MethodCallingConvention.Generic) ? parser.GetUnsigned() : 0;
+ if (callingConvention.HasFlag(MethodCallingConvention.Generic))
+ {
+ parser.SkipInteger(); // numGenArgs
+ }
uint parameterCount = parser.GetUnsigned();
parameters = new TypeDesc[parameterCount + 1];
@@ -386,7 +382,10 @@ private bool MethodSignatureHasVarsNeedingCallingConventionConverter_NativeLayou
NativeFormatModuleInfo module = ModuleList.Instance.GetModuleInfoByHandle(new TypeManagerHandle(methodSig.ModuleHandle));
MethodCallingConvention callingConvention = (MethodCallingConvention)parser.GetUnsigned();
- uint numGenArgs = callingConvention.HasFlag(MethodCallingConvention.Generic) ? parser.GetUnsigned() : 0;
+ if (callingConvention.HasFlag(MethodCallingConvention.Generic))
+ {
+ parser.SkipInteger(); // numGenArgs
+ }
uint parameterCount = parser.GetUnsigned();
// Check the return type of the method
@@ -639,7 +638,6 @@ private bool CompareTypeSigs(ref NativeParser parser1, NativeFormatModuleInfo mo
}
uint data2;
- uint startOffset2 = parser2.Offset;
var typeSignatureKind2 = parser2.GetTypeSignatureKind(out data2);
// If parser2 is a lookback type, we need to rewind parser1 to its startOffset1
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.cs
index 9004db49a1397c..361311060cd18d 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/Runtime/TypeLoader/TypeLoaderEnvironment.cs
@@ -342,7 +342,7 @@ internal unsafe NativeReader GetNativeLayoutInfoReader(TypeManagerHandle moduleH
if (t_moduleNativeReaders == null)
t_moduleNativeReaders = new LowLevelDictionary();
- NativeReader result = null;
+ NativeReader result;
if (t_moduleNativeReaders.TryGetValue(moduleHandle, out result))
return result;
diff --git a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/TypeSystem/RuntimeNoMetadataType.cs b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/TypeSystem/RuntimeNoMetadataType.cs
index 86dc00e75efc7c..a78e0a316aa054 100644
--- a/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/TypeSystem/RuntimeNoMetadataType.cs
+++ b/src/coreclr/nativeaot/System.Private.TypeLoader/src/Internal/TypeSystem/RuntimeNoMetadataType.cs
@@ -318,8 +318,7 @@ public string NamespaceForDiagnostics
{
get
{
- string name, nsName, assemblyName;
- GetTypeNameHelper(out name, out nsName, out assemblyName);
+ GetTypeNameHelper(out _, out string nsName, out _);
return nsName;
}
}
@@ -328,8 +327,7 @@ public string NameForDiagnostics
{
get
{
- string name, nsName, assemblyName;
- GetTypeNameHelper(out name, out nsName, out assemblyName);
+ GetTypeNameHelper(out string name, out _, out _);
return name;
}
}
@@ -338,8 +336,7 @@ public string DiagnosticModuleName
{
get
{
- string name, nsName, assemblyName;
- GetTypeNameHelper(out name, out nsName, out assemblyName);
+ GetTypeNameHelper(out _, out _, out string assemblyName);
return assemblyName;
}
}
diff --git a/src/coreclr/pal/inc/pal.h b/src/coreclr/pal/inc/pal.h
index 237b75275cec96..db22c68fde053a 100644
--- a/src/coreclr/pal/inc/pal.h
+++ b/src/coreclr/pal/inc/pal.h
@@ -345,6 +345,7 @@ typedef __int64 time_t;
#define PAL_INITIALIZE_DEBUGGER_EXCEPTIONS 0x10
#define PAL_INITIALIZE_ENSURE_STACK_SIZE 0x20
#define PAL_INITIALIZE_REGISTER_SIGNALS 0x40
+#define PAL_INITIALIZE_REGISTER_ACTIVATION_SIGNAL 0x80
// PAL_Initialize() flags
#define PAL_INITIALIZE (PAL_INITIALIZE_SYNC_THREAD | \
@@ -359,7 +360,8 @@ typedef __int64 time_t;
PAL_INITIALIZE_REGISTER_SIGTERM_HANDLER | \
PAL_INITIALIZE_DEBUGGER_EXCEPTIONS | \
PAL_INITIALIZE_ENSURE_STACK_SIZE | \
- PAL_INITIALIZE_REGISTER_SIGNALS)
+ PAL_INITIALIZE_REGISTER_SIGNALS | \
+ PAL_INITIALIZE_REGISTER_ACTIVATION_SIGNAL)
typedef DWORD (PALAPI_NOEXPORT *PTHREAD_START_ROUTINE)(LPVOID lpThreadParameter);
typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;
@@ -2842,24 +2844,6 @@ VirtualQuery(
#define FillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length))
#define ZeroMemory(Destination,Length) memset((Destination),0,(Length))
-#define LMEM_FIXED 0x0000
-#define LMEM_MOVEABLE 0x0002
-#define LMEM_ZEROINIT 0x0040
-#define LPTR (LMEM_FIXED | LMEM_ZEROINIT)
-
-PALIMPORT
-HLOCAL
-PALAPI
-LocalAlloc(
- IN UINT uFlags,
- IN SIZE_T uBytes);
-
-PALIMPORT
-HLOCAL
-PALAPI
-LocalFree(
- IN HLOCAL hMem);
-
PALIMPORT
BOOL
PALAPI
@@ -3261,8 +3245,8 @@ FORCEINLINE void PAL_ArmInterlockedOperationBarrier()
Function:
InterlockedAdd
-The InterlockedAdd function adds the value of the specified variable
-with another specified value. The function prevents more than one thread
+The InterlockedAdd function adds the value of the specified variable
+with another specified value. The function prevents more than one thread
from using the same variable simultaneously.
Parameters
@@ -3934,8 +3918,6 @@ PAL_GetCurrentThreadAffinitySet(SIZE_T size, UINT_PTR* data);
#define wcspbrk PAL_wcspbrk
#define wcscmp PAL_wcscmp
#define wcsncpy PAL_wcsncpy
-#define wcstok PAL_wcstok
-#define wcscspn PAL_wcscspn
#define realloc PAL_realloc
#define fopen PAL_fopen
#define strtok PAL_strtok
@@ -4125,8 +4107,6 @@ PALIMPORT DLLEXPORT const WCHAR * __cdecl PAL_wcschr(const WCHAR *, WCHAR);
PALIMPORT DLLEXPORT const WCHAR * __cdecl PAL_wcsrchr(const WCHAR *, WCHAR);
PALIMPORT WCHAR _WConst_return * __cdecl PAL_wcspbrk(const WCHAR *, const WCHAR *);
PALIMPORT DLLEXPORT WCHAR _WConst_return * __cdecl PAL_wcsstr(const WCHAR *, const WCHAR *);
-PALIMPORT WCHAR * __cdecl PAL_wcstok(WCHAR *, const WCHAR *);
-PALIMPORT DLLEXPORT size_t __cdecl PAL_wcscspn(const WCHAR *, const WCHAR *);
PALIMPORT int __cdecl PAL_swprintf(WCHAR *, const WCHAR *, ...);
PALIMPORT int __cdecl PAL_vswprintf(WCHAR *, const WCHAR *, va_list);
PALIMPORT int __cdecl PAL_swscanf(const WCHAR *, const WCHAR *, ...);
diff --git a/src/coreclr/pal/inc/palprivate.h b/src/coreclr/pal/inc/palprivate.h
index 097229eb64ef4a..f90352b32355e8 100644
--- a/src/coreclr/pal/inc/palprivate.h
+++ b/src/coreclr/pal/inc/palprivate.h
@@ -203,8 +203,6 @@ CompareFileTime(
IN CONST FILETIME *lpFileTime1,
IN CONST FILETIME *lpFileTime2);
-PALIMPORT char * __cdecl _fullpath(char *, const char *, size_t);
-
/* These are from the file in windows.
They are needed for _open_osfhandle.*/
#define _O_RDONLY 0x0000
diff --git a/src/coreclr/pal/inc/rt/sal.h b/src/coreclr/pal/inc/rt/sal.h
index 88991ce4464e43..ef976be402fdc5 100644
--- a/src/coreclr/pal/inc/rt/sal.h
+++ b/src/coreclr/pal/inc/rt/sal.h
@@ -2648,12 +2648,6 @@ buffer, use the table in the buffer annotations section.
-------------------------------------------------------------------------------
*/
-// These macros conflict with c++ headers.
-#ifndef PAL_STDCPP_COMPAT
-#define __in _SAL1_Source_(__in, (), _In_)
-#define __out _SAL1_Source_(__out, (), _Out_)
-#endif // !PAL_STDCPP_COMPAT
-
#define __ecount(size) _SAL1_Source_(__ecount, (size), __notnull __elem_writableTo(size))
#define __bcount(size) _SAL1_Source_(__bcount, (size), __notnull __byte_writableTo(size))
#define __in_ecount(size) _SAL1_Source_(__in_ecount, (size), _In_reads_(size))
@@ -2868,6 +2862,10 @@ of each annotation, see the advanced annotations section.
#define __useHeader _Use_decl_anno_impl_
#define __on_failure(annotes) _On_failure_impl_(annotes _SAL_nop_impl_)
+#ifndef __has_cpp_attribute
+#define __has_cpp_attribute(x) (0)
+#endif
+
#ifndef __fallthrough // [
#if __has_cpp_attribute(fallthrough)
#define __fallthrough [[fallthrough]]
diff --git a/src/coreclr/pal/inc/rt/specstrings.h b/src/coreclr/pal/inc/rt/specstrings.h
index 5f5e6e1cf9a4e6..749b20ff4638f6 100644
--- a/src/coreclr/pal/inc/rt/specstrings.h
+++ b/src/coreclr/pal/inc/rt/specstrings.h
@@ -97,7 +97,7 @@ __ANNOTATION(SAL_failureDefault(enum __SAL_failureKind));
#endif // ]
#define __xcount(size) __notnull __inexpressible_writableTo(size)
-#define __in_xcount(size) __in _Pre_ __inexpressible_readableTo(size)
+#define __in_xcount(size) _In_ _Pre_ __inexpressible_readableTo(size)
#define __out_xcount(size) __xcount(size) _Post_ __valid __refparam
#define __out_xcount_part(size,length) __out_xcount(size) _Post_ __inexpressible_readableTo(length)
#define __out_xcount_full(size) __out_xcount_part(size,size)
@@ -113,7 +113,7 @@ __ANNOTATION(SAL_failureDefault(enum __SAL_failureKind));
#define __inout_xcount_part_opt(size,length) __inout_xcount_part(size,length) __exceptthat __maybenull
#define __inout_xcount_full_opt(size) __inout_xcount_full(size) __exceptthat __maybenull
#define __deref_xcount(size) __ecount(1) _Post_ __elem_readableTo(1) _Post_ __deref __notnull _Post_ __deref __inexpressible_writableTo(size)
-#define __deref_in __in _Pre_ __deref __deref __readonly
+#define __deref_in _In_ _Pre_ __deref __deref __readonly
#define __deref_in_ecount(size) __deref_in _Pre_ __deref __elem_readableTo(size)
#define __deref_in_bcount(size) __deref_in _Pre_ __deref __byte_readableTo(size)
#define __deref_in_xcount(size) __deref_in _Pre_ __deref __inexpressible_readableTo(size)
@@ -125,7 +125,7 @@ __ANNOTATION(SAL_failureDefault(enum __SAL_failureKind));
#define __inout_xcount_part_opt(size,length) __inout_xcount_part(size,length) __exceptthat __maybenull
#define __inout_xcount_full_opt(size) __inout_xcount_full(size) __exceptthat __maybenull
#define __deref_xcount(size) __ecount(1) _Post_ __elem_readableTo(1) _Post_ __deref __notnull _Post_ __deref __inexpressible_writableTo(size)
-#define __deref_in __in _Pre_ __deref __deref __readonly
+#define __deref_in _In_ _Pre_ __deref __deref __readonly
#define __deref_in_ecount(size) __deref_in _Pre_ __deref __elem_readableTo(size)
#define __deref_in_bcount(size) __deref_in _Pre_ __deref __byte_readableTo(size)
#define __deref_in_xcount(size) __deref_in _Pre_ __deref __inexpressible_readableTo(size)
diff --git a/src/coreclr/pal/inc/rt/specstrings_strict.h b/src/coreclr/pal/inc/rt/specstrings_strict.h
index 7aaabd1661c6a0..816ba80298ab5f 100644
--- a/src/coreclr/pal/inc/rt/specstrings_strict.h
+++ b/src/coreclr/pal/inc/rt/specstrings_strict.h
@@ -150,11 +150,11 @@
* LWSTDAPI_(BOOL) StrToIntExA(
* LPCSTR pszString, // No annotation required, const implies __in.
* DWORD dwFlags,
-* __out int *piRet // A pointer whose dereference will be filled in.
+* _Out_ int *piRet // A pointer whose dereference will be filled in.
* );
*
* void MyPaintingFunction(
-* __in HWND hwndControl, // An initialized read-only parameter.
+* _In_ HWND hwndControl, // An initialized read-only parameter.
* __in_opt HDC hdcOptional, // An initialized read-only parameter that
* // might be NULL.
* __inout IPropertyStore *ppsStore // An initialized parameter that
@@ -192,14 +192,12 @@
#define __ecount(size) _SAL_VERSION_CHECK(__ecount)
#define __bcount(size) _SAL_VERSION_CHECK(__bcount)
#define __xcount(size) _SAL_VERSION_CHECK(__xcount)
-#define __in _SAL_VERSION_CHECK(__in)
#define __in_ecount(size) _SAL_VERSION_CHECK(__in_ecount)
#define __in_bcount(size) _SAL_VERSION_CHECK(__in_bcount)
#define __in_xcount(size) _SAL_VERSION_CHECK(__in_xcount)
#define __in_z _SAL_VERSION_CHECK(__in_z)
#define __in_ecount_z(size) _SAL_VERSION_CHECK(__in_ecount_z)
#define __in_bcount_z(size) _SAL_VERSION_CHECK(__in_bcount_z)
-#define __out _SAL_VERSION_CHECK(__out)
#define __out_ecount(size) _SAL_VERSION_CHECK(__out_ecount)
#define __out_bcount(size) _SAL_VERSION_CHECK(__out_bcount)
#define __out_xcount(size) _SAL_VERSION_CHECK(__out_xcount)
@@ -772,14 +770,14 @@
* __field_bcount_full(sz)
* char *buf;
* };
-* void InitBuf(__out struct *buf_s b,int sz) {
+* void InitBuf(_Out_ struct *buf_s b,int sz) {
* b->buf = calloc(sz,sizeof(char));
* b->sz = sz;
* }
-* void WriteBuf(__in FILE *fp,__in struct *buf_s b) {
+* void WriteBuf(_In_ FILE *fp,_In_ struct *buf_s b) {
* fwrite(b->buf,b->sz,sizeof(char),fp);
* }
-* void ReadBuf(__in FILE *fp,__inout struct *buf_s b) {
+* void ReadBuf(_In_ FILE *fp,__inout struct *buf_s b) {
* fread(b->buf,b->sz,sizeof(char),fp);
* }
*
@@ -791,10 +789,10 @@
* __field_bcount(sz)
* char buf[1];
* };
-* void WriteBuf(__in FILE *fp,__in struct *buf_s b) {
+* void WriteBuf(_In_ FILE *fp,_In_ struct *buf_s b) {
* fwrite(&(b->buf),b->sz,sizeof(char),fp);
* }
-* void ReadBuf(__in FILE *fp,__inout struct *buf_s b) {
+* void ReadBuf(_In_ FILE *fp,__inout struct *buf_s b) {
* fread(&(b->buf),b->sz,sizeof(char),fp);
* }
*
@@ -805,10 +803,10 @@
* struct buf_s {
* int sz;
* };
-* void WriteBuf(__in FILE *fp,__in struct *buf_s b) {
+* void WriteBuf(_In_ FILE *fp,_In_ struct *buf_s b) {
* fwrite(&b,b->sz,sizeof(char),fp);
* }
-* void ReadBuf(__in FILE *fp,__inout struct *buf_s b) {
+* void ReadBuf(_In_ FILE *fp,__inout struct *buf_s b) {
* fread(&b,b->sz,sizeof(char),fp);
* }
*
diff --git a/src/coreclr/pal/src/CMakeLists.txt b/src/coreclr/pal/src/CMakeLists.txt
index 4f071b21046b07..a9beb759b892ff 100644
--- a/src/coreclr/pal/src/CMakeLists.txt
+++ b/src/coreclr/pal/src/CMakeLists.txt
@@ -123,7 +123,6 @@ set(SOURCES
cruntime/malloc.cpp
cruntime/math.cpp
cruntime/misc.cpp
- cruntime/path.cpp
cruntime/printf.cpp
cruntime/printfcpp.cpp
cruntime/silent_printf.cpp
@@ -131,7 +130,6 @@ set(SOURCES
cruntime/stringtls.cpp
cruntime/thread.cpp
cruntime/wchar.cpp
- cruntime/wchartls.cpp
debug/debug.cpp
exception/seh.cpp
exception/signal.cpp
@@ -145,14 +143,12 @@ set(SOURCES
init/pal.cpp
init/sxs.cpp
loader/module.cpp
- loader/modulename.cpp
locale/unicode.cpp
locale/unicodedata.cpp
locale/utf8.cpp
map/common.cpp
map/map.cpp
map/virtual.cpp
- memory/local.cpp
misc/cgroup.cpp
misc/dbgmsg.cpp
misc/environ.cpp
diff --git a/src/coreclr/pal/src/cruntime/path.cpp b/src/coreclr/pal/src/cruntime/path.cpp
deleted file mode 100644
index c25636771bc616..00000000000000
--- a/src/coreclr/pal/src/cruntime/path.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*++
-
-
-
-Module Name:
-
- path.c
-
-Abstract:
-
- Implementation of path functions part of Windows runtime library.
-
-Revision History:
-
-
-
---*/
-
-#include "pal/palinternal.h"
-#include "pal/dbgmsg.h"
-#include "pal/file.h"
-#include "pal/printfcpp.hpp"
-
-#include
-#include
-#include
-#include
-#include
-
-SET_DEFAULT_DEBUG_CHANNEL(CRT);
-
-/*++
-Function:
- _fullpath
-
-See MSDN doc.
-
---*/
-char *
-__cdecl
-_fullpath(
- char *absPath,
- const char *relPath,
- size_t maxLength)
-{
- char realpath_buf[PATH_MAX+1];
- char path_copy[PATH_MAX+1];
- char *retval = NULL;
- DWORD cPathCopy = sizeof(path_copy)/sizeof(path_copy[0]);
- size_t min_length;
- BOOL fBufAllocated = FALSE;
-
- PERF_ENTRY(_fullpath);
- ENTRY("_fullpath (absPath=%p, relPath=%p (%s), maxLength = %lu)\n",
- absPath, relPath ? relPath:"NULL", relPath ? relPath:"NULL", maxLength);
-
- if (strncpy_s(path_copy, sizeof(path_copy), relPath ? relPath : ".", cPathCopy) != SAFECRT_SUCCESS)
- {
- TRACE("_fullpath: strncpy_s failed!\n");
- goto fullpathExit;
- }
-
- FILEDosToUnixPathA(path_copy);
-
- if(NULL == realpath(path_copy, realpath_buf))
- {
- ERROR("realpath() failed; problem path is '%s'. errno is %d (%s)\n",
- realpath_buf, errno, strerror(errno));
- goto fullpathExit;
- }
-
- TRACE("real path is %s\n", realpath_buf);
- min_length = strlen(realpath_buf)+1; // +1 for the NULL terminator
-
- if(NULL == absPath)
- {
- absPath = static_cast(
- PAL_malloc(_MAX_PATH * sizeof(char)));
- if (!absPath)
- {
- ERROR("PAL_malloc failed with error %d\n", errno);
- goto fullpathExit;
- }
- maxLength = _MAX_PATH;
- fBufAllocated = TRUE;
- }
-
- if(min_length > maxLength)
- {
- ERROR("maxLength is %lu, we need at least %lu\n",
- maxLength, min_length);
- if (fBufAllocated)
- {
- PAL_free(absPath);
- fBufAllocated = FALSE;
- }
- goto fullpathExit;
- }
-
- strcpy_s(absPath, maxLength, realpath_buf);
- retval = absPath;
-
-fullpathExit:
- LOGEXIT("_fullpath returns char * %p\n", retval);
- PERF_EXIT(_fullpath);
- return retval;
-}
-
-
-
diff --git a/src/coreclr/pal/src/cruntime/wchar.cpp b/src/coreclr/pal/src/cruntime/wchar.cpp
index 5c21d7bd015335..3d887aecdb8835 100644
--- a/src/coreclr/pal/src/cruntime/wchar.cpp
+++ b/src/coreclr/pal/src/cruntime/wchar.cpp
@@ -3,8 +3,6 @@
/*++
-
-
Module Name:
wchar.c
@@ -13,11 +11,8 @@ Module Name:
Implementation of wide char string functions.
-
-
--*/
-
#include "pal/palinternal.h"
#include "pal/cruntime.h"
#include "pal/dbgmsg.h"
@@ -25,7 +20,6 @@ Module Name:
#include "pal/thread.hpp"
#include "pal/threadsusp.hpp"
-
#if HAVE_CONFIG_H
#include "config.h"
#endif
@@ -950,46 +944,3 @@ PAL_wcstod( const wchar_16 * nptr, wchar_16 **endptr )
PERF_EXIT(wcstod);
return RetVal;
}
-
-/*++
-Function:
- PAL_wcscspn
-
-Finds the number of consecutive characters from the start of the string
-that are not in the set.
-
-Return value:
-
-The number of characters from the start of the string that are not in
-the set.
-
-Parameters:
-string String
-strCharSet Set of delimiter characters
-
---*/
-size_t
-__cdecl
-PAL_wcscspn(const wchar_16 *string, const wchar_16 *strCharSet)
-{
- const wchar_16 *temp;
- size_t count = 0;
-
- PERF_ENTRY(wcscspn);
-
- while(*string != 0)
- {
- for(temp = strCharSet; *temp != 0; temp++)
- {
- if (*string == *temp)
- {
- PERF_EXIT(wcscspn);
- return count;
- }
- }
- count++;
- string++;
- }
- PERF_EXIT(wcscspn);
- return count;
-}
diff --git a/src/coreclr/pal/src/cruntime/wchartls.cpp b/src/coreclr/pal/src/cruntime/wchartls.cpp
deleted file mode 100644
index 35b73359889a56..00000000000000
--- a/src/coreclr/pal/src/cruntime/wchartls.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*++
-
-
-
-Module Name:
-
- wchartls.c
-
-Abstract:
-
- Implementation of wide char string functions that depend on per-thread data
-
-
-
---*/
-
-#include "pal/palinternal.h"
-#include "pal/thread.hpp"
-#include "pal/dbgmsg.h"
-
-using namespace CorUnix;
-
-
-SET_DEFAULT_DEBUG_CHANNEL(CRT);
-
-/*++
-Function:
- PAL_wcstok
-
-Finds the next token in a wide character string.
-
-Return value:
-
-A pointer to the next token found in strToken. Returns NULL when no more
-tokens are found. Each call modifies strToken by substituting a NULL
-character for each delimiter that is encountered.
-
-Parameters:
-strToken String containing token(s)
-strDelimit Set of delimiter characters
-
---*/
-WCHAR *
-__cdecl
-PAL_wcstok(WCHAR *strToken, const WCHAR *strDelimit)
-{
- CPalThread *pThread = NULL;
- WCHAR *retval = NULL;
- WCHAR *delim_ptr;
- WCHAR *next_context; /* string to save in TLS for future calls */
-
- PERF_ENTRY(wcstok);
- ENTRY("PAL_wcstok (strToken=%p (%S), strDelimit=%p (%S))\n",
- strToken?strToken:W16_NULLSTRING,
- strToken?strToken:W16_NULLSTRING,
- strDelimit?strDelimit:W16_NULLSTRING,
- strDelimit?strDelimit:W16_NULLSTRING);
-
- /* Get the per-thread buffer from the thread structure. */
- pThread = InternalGetCurrentThread();
-
- if(NULL == strDelimit)
- {
- ERROR("delimiter string is NULL\n");
- goto done;
- }
-
- /* get token string from TLS if none is provided */
- if(NULL == strToken)
- {
- TRACE("wcstok() called with NULL string, using previous string\n");
- strToken = pThread->crtInfo.wcstokContext;
- if(NULL == strToken)
- {
- ERROR("wcstok called with NULL string without a previous call\n");
- goto done;
- }
- }
-
- /* first, skip all leading delimiters */
- while ((*strToken != '\0') && (PAL_wcschr(strDelimit,*strToken)))
- {
- strToken++;
- }
-
- /* if there were only delimiters, there's no string */
- if('\0' == strToken[0])
- {
- TRACE("end of string already reached, returning NULL\n");
- goto done;
- }
-
- /* we're now at the beginning of the token; look for the first delimiter */
- delim_ptr = PAL_wcspbrk(strToken,strDelimit);
- if(NULL == delim_ptr)
- {
- TRACE("no delimiters found, this is the last token\n");
- /* place the next context at the end of the string, so that subsequent
- calls will return NULL */
- next_context = strToken+PAL_wcslen(strToken);
- retval = strToken;
- }
- else
- {
- /* null-terminate current token */
- *delim_ptr=0;
-
- /* place the next context right after the delimiter */
- next_context = delim_ptr+1;
- retval = strToken;
-
- TRACE("found delimiter; next token will be %p\n",next_context);
- }
-
- pThread->crtInfo.wcstokContext = next_context;
-
-done:
- LOGEXIT("PAL_wcstok() returns %p (%S)\n", retval?retval:W16_NULLSTRING, retval?retval:W16_NULLSTRING);
- PERF_EXIT(wcstok);
- return(retval);
-}
-
diff --git a/src/coreclr/pal/src/eventprovider/CMakeLists.txt b/src/coreclr/pal/src/eventprovider/CMakeLists.txt
index aaf420458a6bc1..143206b5c34f54 100644
--- a/src/coreclr/pal/src/eventprovider/CMakeLists.txt
+++ b/src/coreclr/pal/src/eventprovider/CMakeLists.txt
@@ -1,6 +1,6 @@
set(EVENT_MANIFEST ${VM_DIR}/ClrEtwAll.man)
-if(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD)
+if(CLR_CMAKE_HOST_LINUX)
add_subdirectory(lttngprovider)
else()
add_subdirectory(dummyprovider)
diff --git a/src/coreclr/pal/src/exception/machexception.cpp b/src/coreclr/pal/src/exception/machexception.cpp
index e5aebdf652c6a5..eca89e0a204c64 100644
--- a/src/coreclr/pal/src/exception/machexception.cpp
+++ b/src/coreclr/pal/src/exception/machexception.cpp
@@ -369,19 +369,13 @@ void PAL_DispatchException(PCONTEXT pContext, PEXCEPTION_RECORD pExRecord, MachE
{
CPalThread *pThread = InternalGetCurrentThread();
- CONTEXT *contextRecord;
- EXCEPTION_RECORD *exceptionRecord;
- AllocateExceptionRecords(&exceptionRecord, &contextRecord);
+ CONTEXT *contextRecord = pContext;
+ g_hardware_exception_context_locvar_offset = (int)((char*)&contextRecord - (char*)__builtin_frame_address(0));
- *contextRecord = *pContext;
- *exceptionRecord = *pExRecord;
-
- contextRecord->ContextFlags |= CONTEXT_EXCEPTION_ACTIVE;
+ pContext->ContextFlags |= CONTEXT_EXCEPTION_ACTIVE;
bool continueExecution;
-
{
- // The exception object takes ownership of the exceptionRecord and contextRecord
- PAL_SEHException exception(exceptionRecord, contextRecord);
+ PAL_SEHException exception(pExRecord, pContext, true);
TRACE("PAL_DispatchException(EC %08x EA %p)\n", pExRecord->ExceptionCode, pExRecord->ExceptionAddress);
@@ -389,8 +383,8 @@ void PAL_DispatchException(PCONTEXT pContext, PEXCEPTION_RECORD pExRecord, MachE
if (continueExecution)
{
// Make a copy of the exception records so that we can free them before restoring the context
- *pContext = *contextRecord;
- *pExRecord = *exceptionRecord;
+ *pContext = *exception.ExceptionPointers.ContextRecord;
+ *pExRecord = *exception.ExceptionPointers.ExceptionRecord;
}
// The exception records are destroyed by the PAL_SEHException destructor now.
diff --git a/src/coreclr/pal/src/exception/remote-unwind.cpp b/src/coreclr/pal/src/exception/remote-unwind.cpp
index af0293ba5bc60c..b27fc9680bbedf 100644
--- a/src/coreclr/pal/src/exception/remote-unwind.cpp
+++ b/src/coreclr/pal/src/exception/remote-unwind.cpp
@@ -57,6 +57,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include
#include
#include "compact_unwind_encoding.h"
+#define MACOS_ARM64_POINTER_AUTH_MASK 0x7fffffffffffull
#endif
// Sub-headers included from the libunwind.h contain an empty struct
@@ -1422,25 +1423,56 @@ StepWithCompactNoEncoding(const libunwindInfo* info)
#if defined(TARGET_ARM64)
-inline static bool
+#define ARM64_SYSCALL_OPCODE 0xD4001001
+#define ARM64_BL_OPCODE_MASK 0xFC000000
+#define ARM64_BL_OPCODE 0x94000000
+#define ARM64_BLR_OPCODE_MASK 0xFFFFFC00
+#define ARM64_BLR_OPCODE 0xD63F0000
+#define ARM64_BLRA_OPCODE_MASK 0xFEFFF800
+#define ARM64_BLRA_OPCODE 0xD63F0800
+
+static bool
+StepWithCompactNoEncoding(const libunwindInfo* info)
+{
+ // Check that the function is a syscall "wrapper" and assume there is no frame and pop the return address.
+ uint32_t opcode;
+ unw_word_t addr = info->Context->Pc - sizeof(opcode);
+ if (!ReadValue32(info, &addr, &opcode)) {
+ ERROR("StepWithCompactNoEncoding: can read opcode %p\n", (void*)addr);
+ return false;
+ }
+ // Is the IP pointing just after a "syscall" opcode?
+ if (opcode != ARM64_SYSCALL_OPCODE) {
+ ERROR("StepWithCompactNoEncoding: not in syscall wrapper function\n");
+ return false;
+ }
+ // Pop the return address from the stack
+ info->Context->Pc = info->Context->Lr;
+ TRACE("StepWithCompactNoEncoding: SUCCESS new pc %p sp %p\n", (void*)info->Context->Pc, (void*)info->Context->Sp);
+ return true;
+}
+
+static bool
ReadCompactEncodingRegister(const libunwindInfo* info, unw_word_t* addr, DWORD64* reg)
{
- *addr -= sizeof(uint64_t);
- if (!ReadValue64(info, addr, (uint64_t*)reg)) {
+ uint64_t value;
+ if (!info->ReadMemory((PVOID)*addr, &value, sizeof(value))) {
return false;
}
+ *reg = VAL64(value);
+ *addr -= sizeof(uint64_t);
return true;
}
-inline static bool
-ReadCompactEncodingRegisterPair(const libunwindInfo* info, unw_word_t* addr, DWORD64*second, DWORD64* first)
+static bool
+ReadCompactEncodingRegisterPair(const libunwindInfo* info, unw_word_t* addr, DWORD64* first, DWORD64* second)
{
// Registers are effectively pushed in pairs
//
+ // *first = **addr
// *addr -= 8
- // **addr = *first
+ // *second= **addr
// *addr -= 8
- // **addr = *second
if (!ReadCompactEncodingRegister(info, addr, first)) {
return false;
}
@@ -1450,8 +1482,8 @@ ReadCompactEncodingRegisterPair(const libunwindInfo* info, unw_word_t* addr, DWO
return true;
}
-inline static bool
-ReadCompactEncodingRegisterPair(const libunwindInfo* info, unw_word_t* addr, NEON128*second, NEON128* first)
+static bool
+ReadCompactEncodingRegisterPair(const libunwindInfo* info, unw_word_t* addr, NEON128* first, NEON128* second)
{
if (!ReadCompactEncodingRegisterPair(info, addr, &first->Low, &second->Low)) {
return false;
@@ -1484,30 +1516,28 @@ static bool
StepWithCompactEncodingArm64(const libunwindInfo* info, compact_unwind_encoding_t compactEncoding, bool hasFrame)
{
CONTEXT* context = info->Context;
+ unw_word_t addr;
- unw_word_t callerSp;
-
- if (hasFrame) {
- // caller Sp is callee Fp plus saved FP and LR
- callerSp = context->Fp + 2 * sizeof(uint64_t);
- } else {
+ if (hasFrame)
+ {
+ context->Sp = context->Fp + 16;
+ addr = context->Fp + 8;
+ if (!ReadCompactEncodingRegisterPair(info, &addr, &context->Lr, &context->Fp)) {
+ return false;
+ }
+ // Strip pointer authentication bits
+ context->Lr &= MACOS_ARM64_POINTER_AUTH_MASK;
+ }
+ else
+ {
// Get the leat significant bit in UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK
uint64_t stackSizeScale = UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK & ~(UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK - 1);
- uint64_t stackSize = (compactEncoding & UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK) / stackSizeScale * 16;
+ uint64_t stackSize = ((compactEncoding & UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK) / stackSizeScale) * 16;
- callerSp = context->Sp + stackSize;
+ addr = context->Sp + stackSize;
}
- context->Sp = callerSp;
-
- unw_word_t addr = callerSp;
-
- if (hasFrame &&
- !ReadCompactEncodingRegisterPair(info, &addr, &context->Lr, &context->Fp)) {
- return false;
- }
-
- // unwound return address is stored in Lr
+ // Unwound return address is stored in Lr
context->Pc = context->Lr;
if (compactEncoding & UNWIND_ARM64_FRAME_X19_X20_PAIR &&
@@ -1546,7 +1576,10 @@ StepWithCompactEncodingArm64(const libunwindInfo* info, compact_unwind_encoding_
!ReadCompactEncodingRegisterPair(info, &addr, &context->V[14], &context->V[15])) {
return false;
}
-
+ if (!hasFrame)
+ {
+ context->Sp = addr;
+ }
TRACE("SUCCESS: compact step encoding %08x pc %p sp %p fp %p lr %p\n",
compactEncoding, (void*)context->Pc, (void*)context->Sp, (void*)context->Fp, (void*)context->Lr);
return true;
@@ -1557,11 +1590,11 @@ StepWithCompactEncodingArm64(const libunwindInfo* info, compact_unwind_encoding_
static bool
StepWithCompactEncoding(const libunwindInfo* info, compact_unwind_encoding_t compactEncoding, unw_word_t functionStart)
{
-#if defined(TARGET_AMD64)
if (compactEncoding == 0)
{
return StepWithCompactNoEncoding(info);
}
+#if defined(TARGET_AMD64)
switch (compactEncoding & UNWIND_X86_64_MODE_MASK)
{
case UNWIND_X86_64_MODE_RBP_FRAME:
@@ -1575,11 +1608,6 @@ StepWithCompactEncoding(const libunwindInfo* info, compact_unwind_encoding_t com
return false;
}
#elif defined(TARGET_ARM64)
- if (compactEncoding == 0)
- {
- TRACE("Compact unwind missing for %p\n", (void*)info->Context->Pc);
- return false;
- }
switch (compactEncoding & UNWIND_ARM64_MODE_MASK)
{
case UNWIND_ARM64_MODE_FRAME:
@@ -1717,6 +1745,12 @@ static void UnwindContextToContext(unw_cursor_t *cursor, CONTEXT *winContext)
unw_get_reg(cursor, UNW_AARCH64_X28, (unw_word_t *) &winContext->X28);
unw_get_reg(cursor, UNW_AARCH64_X29, (unw_word_t *) &winContext->Fp);
unw_get_reg(cursor, UNW_AARCH64_X30, (unw_word_t *) &winContext->Lr);
+#ifdef __APPLE__
+ // Strip pointer authentication bits which seem to be leaking out of libunwind
+ // Seems like ptrauth_strip() / __builtin_ptrauth_strip() should work, but currently
+ // errors with "this target does not support pointer authentication"
+ winContext->Pc = winContext->Pc & MACOS_ARM64_POINTER_AUTH_MASK;
+#endif // __APPLE__
TRACE("sp %p pc %p lr %p fp %p\n", winContext->Sp, winContext->Pc, winContext->Lr, winContext->Fp);
#elif defined(TARGET_S390X)
unw_get_reg(cursor, UNW_REG_IP, (unw_word_t *) &winContext->PSWAddr);
@@ -2126,6 +2160,33 @@ PAL_VirtualUnwindOutOfProc(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *cont
#elif defined(TARGET_ARM64)
TRACE("Unwind: pc %p sp %p fp %p\n", (void*)context->Pc, (void*)context->Sp, (void*)context->Fp);
result = GetProcInfo(context->Pc, &procInfo, &info, &step, false);
+ if (result && step)
+ {
+ // If the PC is at the start of the function, the previous instruction is BL and the unwind encoding is frameless
+ // with nothing on stack (0x02000000), back up PC by 1 to the previous function and get the unwind info for that
+ // function.
+ if ((context->Pc == procInfo.start_ip) &&
+ (procInfo.format & (UNWIND_ARM64_MODE_MASK | UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK)) == UNWIND_ARM64_MODE_FRAMELESS)
+ {
+ uint32_t opcode;
+ unw_word_t addr = context->Pc - sizeof(opcode);
+ if (ReadValue32(&info, &addr, &opcode))
+ {
+ // Is the previous instruction a BL opcode?
+ if ((opcode & ARM64_BL_OPCODE_MASK) == ARM64_BL_OPCODE ||
+ (opcode & ARM64_BLR_OPCODE_MASK) == ARM64_BLR_OPCODE ||
+ (opcode & ARM64_BLRA_OPCODE_MASK) == ARM64_BLRA_OPCODE)
+ {
+ TRACE("Unwind: getting unwind info for PC - 1 opcode %08x\n", opcode);
+ result = GetProcInfo(context->Pc - 1, &procInfo, &info, &step, false);
+ }
+ else
+ {
+ TRACE("Unwind: not BL* opcode %08x\n", opcode);
+ }
+ }
+ }
+ }
#else
#error Unexpected architecture
#endif
diff --git a/src/coreclr/pal/src/exception/seh-unwind.cpp b/src/coreclr/pal/src/exception/seh-unwind.cpp
index 4b149f941b5dc9..3091650ec5faa1 100644
--- a/src/coreclr/pal/src/exception/seh-unwind.cpp
+++ b/src/coreclr/pal/src/exception/seh-unwind.cpp
@@ -496,7 +496,9 @@ void GetContextPointers(unw_cursor_t *cursor, unw_context_t *unwContext, KNONVOL
#ifndef HOST_WINDOWS
-extern int g_common_signal_handler_context_locvar_offset;
+// Frame pointer relative offset of a local containing a pointer to the windows style context of a location
+// where a hardware exception occured.
+int g_hardware_exception_context_locvar_offset = 0;
BOOL PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextPointers)
{
@@ -506,19 +508,17 @@ BOOL PAL_VirtualUnwind(CONTEXT *context, KNONVOLATILE_CONTEXT_POINTERS *contextP
DWORD64 curPc = CONTEXTGetPC(context);
-#ifndef __APPLE__
- // Check if the PC is the return address from the SEHProcessException in the common_signal_handler.
- // If that's the case, extract its local variable containing the windows style context of the hardware
+ // Check if the PC is the return address from the SEHProcessException.
+ // If that's the case, extract its local variable containing a pointer to the windows style context of the hardware
// exception and return that. This skips the hardware signal handler trampoline that the libunwind
- // cannot cross on some systems.
+ // cannot cross on some systems. On macOS, it skips a similar trampoline we create in HijackFaultingThread.
if ((void*)curPc == g_SEHProcessExceptionReturnAddress)
{
- CONTEXT* signalContext = (CONTEXT*)(CONTEXTGetFP(context) + g_common_signal_handler_context_locvar_offset);
- memcpy_s(context, sizeof(CONTEXT), signalContext, sizeof(CONTEXT));
+ CONTEXT* exceptionContext = *(CONTEXT**)(CONTEXTGetFP(context) + g_hardware_exception_context_locvar_offset);
+ memcpy_s(context, sizeof(CONTEXT), exceptionContext, sizeof(CONTEXT));
return TRUE;
}
-#endif
if ((context->ContextFlags & CONTEXT_EXCEPTION_ACTIVE) != 0)
{
@@ -699,7 +699,7 @@ PAL_FreeExceptionRecords(IN EXCEPTION_RECORD *exceptionRecord, IN CONTEXT *conte
Note:
The name of this function and the name of the ExceptionRecord
parameter is used in the sos lldb plugin code to read the exception
- record. See coreclr\ToolBox\SOS\lldbplugin\services.cpp.
+ record. See coreclr\tools\SOS\lldbplugin\services.cpp.
This function must not be inlined or optimized so the below PAL_VirtualUnwind
calls end up with RaiseException caller's context and so the above debugger
diff --git a/src/coreclr/pal/src/exception/signal.cpp b/src/coreclr/pal/src/exception/signal.cpp
index 521150530fa33e..63b7ef115f26d1 100644
--- a/src/coreclr/pal/src/exception/signal.cpp
+++ b/src/coreclr/pal/src/exception/signal.cpp
@@ -116,10 +116,6 @@ struct sigaction g_previous_sigabrt;
#if !HAVE_MACH_EXCEPTIONS
-// Offset of the local variable containing pointer to windows style context in the common_signal_handler function.
-// This offset is relative to the frame pointer.
-int g_common_signal_handler_context_locvar_offset = 0;
-
// TOP of special stack for handling stack overflow
volatile void* g_stackOverflowHandlerStack = NULL;
@@ -240,8 +236,11 @@ BOOL SEHInitializeSignals(CorUnix::CPalThread *pthrCurrent, DWORD flags)
}
#ifdef INJECT_ACTIVATION_SIGNAL
- handle_signal(INJECT_ACTIVATION_SIGNAL, inject_activation_handler, &g_previous_activation);
- g_registered_activation_handler = true;
+ if (flags & PAL_INITIALIZE_REGISTER_ACTIVATION_SIGNAL)
+ {
+ handle_signal(INJECT_ACTIVATION_SIGNAL, inject_activation_handler, &g_previous_activation);
+ g_registered_activation_handler = true;
+ }
#endif
return TRUE;
@@ -939,11 +938,12 @@ static bool common_signal_handler(int code, siginfo_t *siginfo, void *sigcontext
#if !HAVE_MACH_EXCEPTIONS
sigset_t signal_set;
CONTEXT signalContextRecord;
+ CONTEXT* signalContextRecordPtr = &signalContextRecord;
EXCEPTION_RECORD exceptionRecord;
native_context_t *ucontext;
ucontext = (native_context_t *)sigcontext;
- g_common_signal_handler_context_locvar_offset = (int)((char*)&signalContextRecord - (char*)__builtin_frame_address(0));
+ g_hardware_exception_context_locvar_offset = (int)((char*)&signalContextRecordPtr - (char*)__builtin_frame_address(0));
if (code == (SIGSEGV | StackOverflowFlag))
{
diff --git a/src/coreclr/pal/src/file/file.cpp b/src/coreclr/pal/src/file/file.cpp
index 59cfd07fbdbdd8..71f35f810bcf19 100644
--- a/src/coreclr/pal/src/file/file.cpp
+++ b/src/coreclr/pal/src/file/file.cpp
@@ -1617,7 +1617,7 @@ GetFileAttributesExW(
attr_data = (LPWIN32_FILE_ATTRIBUTE_DATA)lpFileInformation;
attr_data->dwFileAttributes = GetFileAttributesW(lpFileName);
- /* assume that GetFileAttributes will call SetLastError appropriately */
+ /* assume that GetFileAttributesW will call SetLastError appropriately */
if ( attr_data->dwFileAttributes == (DWORD)-1 )
{
goto done;
@@ -1753,7 +1753,7 @@ SetFileAttributesA(
new_mode = stat_data.st_mode;
TRACE("st_mode is %#x\n", new_mode);
- /* if we can't do GetFileAttributes on it, don't do SetFileAttributes */
+ /* if we can't do GetFileAttributesA on it, don't do SetFileAttributesA */
if ( !(new_mode & S_IFREG) && !(new_mode & S_IFDIR) )
{
ERROR("Not a regular file or directory, S_IFMT is %#x\n",
@@ -3542,10 +3542,10 @@ CopyFileA(
}
/* Need to preserve the file attributes */
- dwSrcFileAttributes = GetFileAttributes(lpExistingFileName);
+ dwSrcFileAttributes = GetFileAttributesA(lpExistingFileName);
if (dwSrcFileAttributes == 0xffffffff)
{
- ERROR("GetFileAttributes failed for %s\n", lpExistingFileName);
+ ERROR("GetFileAttributesA failed for %s\n", lpExistingFileName);
goto done;
}
diff --git a/src/coreclr/pal/src/include/pal/modulename.h b/src/coreclr/pal/src/include/pal/modulename.h
deleted file mode 100644
index 87d54b77a5b95e..00000000000000
--- a/src/coreclr/pal/src/include/pal/modulename.h
+++ /dev/null
@@ -1,35 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*++
-
-
-
-Module Name:
-
- include/pal/modulename.h
-
-Abstract:
- Header file for functions to get the name of a module
-
-Revision History:
-
-
-
---*/
-
-#ifndef _PAL_MODULENAME_H_
-#define _PAL_MODULENAME_H_
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif // __cplusplus
-
-const char *PAL_dladdr(LPVOID ProcAddress);
-
-#ifdef __cplusplus
-}
-#endif // __cplusplus
-
-#endif /*_PAL_MODULENAME_H_*/
diff --git a/src/coreclr/pal/src/include/pal/palinternal.h b/src/coreclr/pal/src/include/pal/palinternal.h
index 3a12d789103647..ff3703c6ae4f7f 100644
--- a/src/coreclr/pal/src/include/pal/palinternal.h
+++ b/src/coreclr/pal/src/include/pal/palinternal.h
@@ -526,8 +526,6 @@ function_name() to call the system's implementation
#undef wcsstr
#undef wcscmp
#undef wcsncpy
-#undef wcstok
-#undef wcscspn
#undef iswupper
#undef iswspace
#undef towlower
diff --git a/src/coreclr/pal/src/include/pal/seh.hpp b/src/coreclr/pal/src/include/pal/seh.hpp
index 6ad89df0fdd650..327fe0d7fb03e2 100644
--- a/src/coreclr/pal/src/include/pal/seh.hpp
+++ b/src/coreclr/pal/src/include/pal/seh.hpp
@@ -145,5 +145,10 @@ CorUnix::PAL_ERROR SEHDisable(CorUnix::CPalThread *pthrCurrent);
}
+// Offset of the local variable containing pointer to windows style context in the common_signal_handler / PAL_DispatchException function.
+// This offset is relative to the frame pointer.
+extern int g_hardware_exception_context_locvar_offset;
+
+
#endif /* _PAL_SEH_HPP_ */
diff --git a/src/coreclr/pal/src/loader/module.cpp b/src/coreclr/pal/src/loader/module.cpp
index e792f75a2b22e1..2a559b56e2bef5 100644
--- a/src/coreclr/pal/src/loader/module.cpp
+++ b/src/coreclr/pal/src/loader/module.cpp
@@ -30,7 +30,6 @@ SET_DEFAULT_DEBUG_CHANNEL(LOADER); // some headers have code with asserts, so do
#include "pal/file.h"
#include "pal/utils.h"
#include "pal/init.h"
-#include "pal/modulename.h"
#include "pal/environ.h"
#include "pal/virtual.h"
#include "pal/map.hpp"
@@ -342,9 +341,10 @@ GetProcAddress(
/* if we don't know the module's full name yet, this is our chance to obtain it */
if (!module->lib_name && module->dl_handle)
{
- const char* libName = PAL_dladdr((LPVOID)ProcAddress);
- if (libName)
+ Dl_info dl_info;
+ if (dladdr((LPVOID)ProcAddress, &dl_info) != 0)
{
+ const char* libName = dl_info.dli_fname;
module->lib_name = UTIL_MBToWC_Alloc(libName, -1);
if (nullptr == module->lib_name)
{
@@ -356,6 +356,10 @@ GetProcAddress(
module, libName);
}
}
+ else
+ {
+ TRACE("GetProcAddress: dladdr() call failed!\n");
+ }
}
}
else
@@ -925,7 +929,7 @@ struct CopyModuleDataParam
int result;
};
-void handle_image_range(uint8_t* source_start, size_t size, struct CopyModuleDataParam* param)
+void handle_image_range(uint8_t* source_start, size_t size, struct CopyModuleDataParam* param)
{
uint8_t* source_end = source_start + size;
if (param->destination_buffer_start != NULL)
diff --git a/src/coreclr/pal/src/loader/modulename.cpp b/src/coreclr/pal/src/loader/modulename.cpp
deleted file mode 100644
index 40c1c6de5c3d64..00000000000000
--- a/src/coreclr/pal/src/loader/modulename.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*++
-
-
-
-Module Name:
-
- modulename.cpp
-
-Abstract:
-
- Implementation of internal functions to get module names
-
-
-
---*/
-
-#include "pal/thread.hpp"
-#include "pal/malloc.hpp"
-#include "pal/palinternal.h"
-#include "pal/dbgmsg.h"
-#include "pal/modulename.h"
-
-#include
-
-using namespace CorUnix;
-
-SET_DEFAULT_DEBUG_CHANNEL(LOADER);
-
-/*++
- PAL_dladdr
-
- Internal wrapper for dladder used only to get module name
-
-Parameters:
- LPVOID ProcAddress: a pointer to a function in a shared library
-
-Return value:
- Pointer to string with the fullpath to the shared library containing
- ProcAddress.
-
- NULL if error occurred.
-
-Notes:
- The string returned by this function is owned by the OS.
- If you need to keep it, strdup() it, because it is unknown how long
- this ptr will point at the string you want (over the lifetime of
- the system running) It is only safe to use it immediately after calling
- this function.
---*/
-const char *PAL_dladdr(LPVOID ProcAddress)
-{
- Dl_info dl_info;
- if (!dladdr(ProcAddress, &dl_info))
- {
- WARN("dladdr() call failed!\n");
- /* If we get an error, return NULL */
- return (NULL);
- }
- else
- {
- /* Return the module name */
- return dl_info.dli_fname;
- }
-}
-
diff --git a/src/coreclr/pal/src/memory/local.cpp b/src/coreclr/pal/src/memory/local.cpp
deleted file mode 100644
index fc62ef428b1e22..00000000000000
--- a/src/coreclr/pal/src/memory/local.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*++
-
-
-
-Module Name:
-
- local.c
-
-Abstract:
-
- Implementation of local memory management functions.
-
-Revision History:
-
-
-
---*/
-
-#include "pal/palinternal.h"
-#include "pal/dbgmsg.h"
-
-
-SET_DEFAULT_DEBUG_CHANNEL(MEM);
-
-
-/*++
-Function:
- LocalAlloc
-
-See MSDN doc.
---*/
-HLOCAL
-PALAPI
-LocalAlloc(
- IN UINT uFlags,
- IN SIZE_T uBytes)
-{
- LPVOID lpRetVal = NULL;
- PERF_ENTRY(LocalAlloc);
- ENTRY("LocalAlloc (uFlags=%#x, uBytes=%u)\n", uFlags, uBytes);
-
- if ((uFlags & ~LMEM_ZEROINIT) != 0)
- {
- ASSERT("Invalid parameter AllocFlags=0x%x\n", uFlags);
- SetLastError(ERROR_INVALID_PARAMETER);
- goto done;
- }
-
- lpRetVal = PAL_malloc(uBytes);
-
- if (lpRetVal == NULL)
- {
- ERROR("Not enough memory\n");
- SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- goto done;
- }
-
- if ((uFlags & LMEM_ZEROINIT) != 0)
- {
- memset(lpRetVal, 0, uBytes);
- }
-
-done:
- LOGEXIT( "LocalAlloc returning %p.\n", lpRetVal );
- PERF_EXIT(LocalAlloc);
- return (HLOCAL) lpRetVal;
-}
-
-/*++
-Function:
- LocalFree
-
-See MSDN doc.
---*/
-HLOCAL
-PALAPI
-LocalFree(
- IN HLOCAL hMem)
-{
- BOOL bRetVal = FALSE;
- PERF_ENTRY(LocalFree);
- ENTRY("LocalFree (hmem=%p)\n", hMem);
-
- free(hMem);
- bRetVal = TRUE;
-
- LOGEXIT( "LocalFree returning %p.\n", bRetVal == TRUE ? (HLOCAL)NULL : hMem );
- PERF_EXIT(LocalFree);
- return bRetVal == TRUE ? (HLOCAL)NULL : hMem;
-}
diff --git a/src/coreclr/pal/src/misc/fmtmessage.cpp b/src/coreclr/pal/src/misc/fmtmessage.cpp
index 81502bfc7722ed..e9d87d19c4a080 100644
--- a/src/coreclr/pal/src/misc/fmtmessage.cpp
+++ b/src/coreclr/pal/src/misc/fmtmessage.cpp
@@ -63,7 +63,7 @@ static LPWSTR FMTMSG_GetMessageString( DWORD dwErrCode )
allocChars = MAX_ERROR_STRING_LENGTH + 1;
}
- LPWSTR lpRetVal = (LPWSTR)LocalAlloc(LMEM_FIXED, allocChars * sizeof(WCHAR));
+ LPWSTR lpRetVal = (LPWSTR)PAL_malloc(allocChars * sizeof(WCHAR));
if (lpRetVal)
{
@@ -135,7 +135,7 @@ static INT FMTMSG__watoi( LPWSTR str )
UINT NumOfBytes = 0; \
nSize *= 2; \
NumOfBytes = nSize * sizeof( WCHAR ); \
- lpTemp = static_cast( LocalAlloc( LMEM_FIXED, NumOfBytes ) ); \
+ lpTemp = static_cast( PAL_malloc( NumOfBytes ) ); \
TRACE( "Growing the buffer.\n" );\
\
if ( !lpTemp ) \
@@ -149,7 +149,7 @@ static INT FMTMSG__watoi( LPWSTR str )
\
*lpWorkingString = '\0';\
PAL_wcscpy( lpTemp, lpReturnString );\
- LocalFree( lpReturnString ); \
+ free( lpReturnString ); \
lpWorkingString = lpReturnString = lpTemp; \
lpWorkingString += nCount; \
} \
@@ -341,7 +341,7 @@ FormatMessageW(
/* Parameter processing. */
if ( dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER )
{
- TRACE( "Allocated %d TCHARs. Don't forget to call LocalFree to "
+ TRACE( "Allocated %d TCHARs. Don't forget to call free to "
"free the memory when done.\n", nSize );
bIsLocalAlloced = TRUE;
}
@@ -418,7 +418,7 @@ FormatMessageW(
}
lpWorkingString = static_cast(
- LocalAlloc( LMEM_FIXED, nSize * sizeof( WCHAR ) ) );
+ PAL_malloc( nSize * sizeof( WCHAR ) ) );
if ( !lpWorkingString )
{
ERROR( "Unable to allocate memory for the working string.\n" );
@@ -675,14 +675,14 @@ FormatMessageW(
{
TRACE( "Copying the string into the buffer.\n" );
PAL_wcsncpy( lpBuffer, lpReturnString, nCount + 1 );
- LocalFree( lpReturnString );
+ free( lpReturnString );
}
}
else /* Error, something occurred. */
{
if ( lpReturnString )
{
- LocalFree( lpReturnString );
+ free( lpReturnString );
}
}
LOGEXIT( "FormatMessageW returns %d.\n", nCount );
diff --git a/src/coreclr/pal/src/misc/jitsupport.cpp b/src/coreclr/pal/src/misc/jitsupport.cpp
index 2addd1526e64c8..6dcc535f2aa14c 100644
--- a/src/coreclr/pal/src/misc/jitsupport.cpp
+++ b/src/coreclr/pal/src/misc/jitsupport.cpp
@@ -260,11 +260,26 @@ PAL_GetJitCpuCapabilityFlags(CORJIT_FLAGS *flags)
int64_t valueFromSysctl = 0;
size_t sz = sizeof(valueFromSysctl);
- if ((sysctlbyname("hw.optional.armv8_1_atomics", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
- flags->Set(InstructionSet_Atomics);
+ if ((sysctlbyname("hw.optional.arm.FEAT_AES", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
+ flags->Set(InstructionSet_Aes);
if ((sysctlbyname("hw.optional.armv8_crc32", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
flags->Set(InstructionSet_Crc32);
+
+ if ((sysctlbyname("hw.optional.arm.FEAT_DotProd", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
+ flags->Set(InstructionSet_Dp);
+
+ if ((sysctlbyname("hw.optional.arm.FEAT_RDM", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
+ flags->Set(InstructionSet_Rdm);
+
+ if ((sysctlbyname("hw.optional.arm.FEAT_SHA1", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
+ flags->Set(InstructionSet_Sha1);
+
+ if ((sysctlbyname("hw.optional.arm.FEAT_SHA256", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
+ flags->Set(InstructionSet_Sha256);
+
+ if ((sysctlbyname("hw.optional.armv8_1_atomics", &valueFromSysctl, &sz, nullptr, 0) == 0) && (valueFromSysctl != 0))
+ flags->Set(InstructionSet_Atomics);
#endif // HAVE_SYSCTLBYNAME
// CoreCLR SIMD and FP support is included in ARM64 baseline
// On exceptional basis platforms may leave out support, but CoreCLR does not
diff --git a/src/coreclr/pal/src/safecrt/internal.h b/src/coreclr/pal/src/safecrt/internal.h
index 9537f6f0957700..02f8f80091aa50 100644
--- a/src/coreclr/pal/src/safecrt/internal.h
+++ b/src/coreclr/pal/src/safecrt/internal.h
@@ -264,34 +264,34 @@ extern int _nstream;
extern void **__piob;
FILE * __cdecl _getstream(void);
-FILE * __cdecl _openfile(__in_z const char * _Filename, __in_z const char * _Mode, __in int _ShFlag, __out FILE * _File);
-FILE * __cdecl _wopenfile(__in_z const char16_t * _Filename, __in_z const char16_t * _Mode, __in int _ShFlag, __out FILE * _File);
-void __cdecl _getbuf(__out FILE * _File);
+FILE * __cdecl _openfile(_In_z_ const char * _Filename, _In_z_ const char * _Mode, _In_ int _ShFlag, _Out_ FILE * _File);
+FILE * __cdecl _wopenfile(_In_z_ const char16_t * _Filename, _In_z_ const char16_t * _Mode, _In_ int _ShFlag, _Out_ FILE * _File);
+void __cdecl _getbuf(_Out_ FILE * _File);
int __cdecl _filwbuf (__inout FILE * _File);
-int __cdecl _flswbuf(__in int _Ch, __inout FILE * _File);
+int __cdecl _flswbuf(_In_ int _Ch, __inout FILE * _File);
void __cdecl _freebuf(__inout FILE * _File);
int __cdecl _stbuf(__inout FILE * _File);
void __cdecl _ftbuf(int _Flag, __inout FILE * _File);
#ifdef _SAFECRT_IMPL
-int __cdecl _output(__inout FILE * _File, __in_z __format_string const char *_Format, va_list _ArgList);
-int __cdecl _woutput(__inout FILE * _File, __in_z __format_string const char16_t *_Format, va_list _ArgList);
-int __cdecl _output_s(__inout FILE * _File, __in_z __format_string const char *_Format, va_list _ArgList);
-int __cdecl _output_p(__inout FILE * _File, __in_z __format_string const char *_Format, va_list _ArgList);
-int __cdecl _woutput_s(__inout FILE * _File, __in_z __format_string const char16_t *_Format, va_list _ArgList);
-int __cdecl _woutput_p(__inout FILE * _File, __in_z __format_string const char16_t *_Format, va_list _ArgList);
+int __cdecl _output(__inout FILE * _File, _In_z_ __format_string const char *_Format, va_list _ArgList);
+int __cdecl _woutput(__inout FILE * _File, _In_z_ __format_string const char16_t *_Format, va_list _ArgList);
+int __cdecl _output_s(__inout FILE * _File, _In_z_ __format_string const char *_Format, va_list _ArgList);
+int __cdecl _output_p(__inout FILE * _File, _In_z_ __format_string const char *_Format, va_list _ArgList);
+int __cdecl _woutput_s(__inout FILE * _File, _In_z_ __format_string const char16_t *_Format, va_list _ArgList);
+int __cdecl _woutput_p(__inout FILE * _File, _In_z_ __format_string const char16_t *_Format, va_list _ArgList);
typedef int (*OUTPUTFN)(FILE *, const char *, va_list);
typedef int (*WOUTPUTFN)(FILE *, const char16_t *, va_list);
#else /* _SAFECRT_IMPL */
-int __cdecl _output_l(__inout FILE * _File, __in_z __format_string const char *_Format, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _woutput_l(__inout FILE * _File, __in_z __format_string const char16_t *_Format, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _output_s_l(__inout FILE * _File, __in_z __format_string const char *_Format, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _output_p_l(__inout FILE * _File, __in_z __format_string const char *_Format, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _woutput_s_l(__inout FILE * _File, __in_z __format_string const char16_t *_Format, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _woutput_p_l(__inout FILE * _File, __in_z __format_string const char16_t *_Format, __in_opt _locale_t _Locale, va_list _ArgList);
+int __cdecl _output_l(__inout FILE * _File, _In_z_ __format_string const char *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _woutput_l(__inout FILE * _File, _In_z_ __format_string const char16_t *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _output_s_l(__inout FILE * _File, _In_z_ __format_string const char *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _output_p_l(__inout FILE * _File, _In_z_ __format_string const char *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _woutput_s_l(__inout FILE * _File, _In_z_ __format_string const char16_t *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _woutput_p_l(__inout FILE * _File, _In_z_ __format_string const char16_t *_Format, _In_opt_ _locale_t _Locale, va_list _ArgList);
typedef int (*OUTPUTFN)(__inout FILE * _File, const char *, _locale_t, va_list);
typedef int (*WOUTPUTFN)(__inout FILE * _File, const char16_t *, _locale_t, va_list);
@@ -299,19 +299,19 @@ typedef int (*WOUTPUTFN)(__inout FILE * _File, const char16_t *, _locale_t, va_l
#ifdef _SAFECRT_IMPL
-int __cdecl _input(__in FILE * _File, __in_z __format_string const unsigned char * _Format, va_list _ArgList);
-int __cdecl _winput(__in FILE * _File, __in_z __format_string const char16_t * _Format, va_list _ArgList);
-int __cdecl _input_s(__in FILE * _File, __in_z __format_string const unsigned char * _Format, va_list _ArgList);
-int __cdecl _winput_s(__in FILE * _File, __in_z __format_string const char16_t * _Format, va_list _ArgList);
+int __cdecl _input(_In_ FILE * _File, _In_z_ __format_string const unsigned char * _Format, va_list _ArgList);
+int __cdecl _winput(_In_ FILE * _File, _In_z_ __format_string const char16_t * _Format, va_list _ArgList);
+int __cdecl _input_s(_In_ FILE * _File, _In_z_ __format_string const unsigned char * _Format, va_list _ArgList);
+int __cdecl _winput_s(_In_ FILE * _File, _In_z_ __format_string const char16_t * _Format, va_list _ArgList);
typedef int (*INPUTFN)(FILE *, const unsigned char *, va_list);
typedef int (*WINPUTFN)(FILE *, const char16_t *, va_list);
#else /* _SAFECRT_IMPL */
-int __cdecl _input_l(__inout FILE * _File, __in_z __format_string const unsigned char *, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _winput_l(__inout FILE * _File, __in_z __format_string const char16_t *, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _input_s_l(__inout FILE * _File, __in_z __format_string const unsigned char *, __in_opt _locale_t _Locale, va_list _ArgList);
-int __cdecl _winput_s_l(__inout FILE * _File, __in_z __format_string const char16_t *, __in_opt _locale_t _Locale, va_list _ArgList);
+int __cdecl _input_l(__inout FILE * _File, _In_z_ __format_string const unsigned char *, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _winput_l(__inout FILE * _File, _In_z_ __format_string const char16_t *, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _input_s_l(__inout FILE * _File, _In_z_ __format_string const unsigned char *, _In_opt_ _locale_t _Locale, va_list _ArgList);
+int __cdecl _winput_s_l(__inout FILE * _File, _In_z_ __format_string const char16_t *, _In_opt_ _locale_t _Locale, va_list _ArgList);
typedef int (*INPUTFN)(FILE *, const unsigned char *, _locale_t, va_list);
typedef int (*WINPUTFN)(FILE *, const char16_t *, _locale_t, va_list);
@@ -326,12 +326,12 @@ typedef int (*WINPUTFN)(FILE *, const char16_t *, _locale_t, va_list);
int __cdecl _flush(__inout FILE * _File);
void __cdecl _endstdio(void);
-errno_t __cdecl _sopen_helper(__in_z const char * _Filename,
- __in int _OFlag, __in int _ShFlag, __in int _PMode,
- __out int * _PFileHandle, int _BSecure);
-errno_t __cdecl _wsopen_helper(__in_z const char16_t * _Filename,
- __in int _OFlag, __in int _ShFlag, __in int _PMode,
- __out int * _PFileHandle, int _BSecure);
+errno_t __cdecl _sopen_helper(_In_z_ const char * _Filename,
+ _In_ int _OFlag, _In_ int _ShFlag, _In_ int _PMode,
+ _Out_ int * _PFileHandle, int _BSecure);
+errno_t __cdecl _wsopen_helper(_In_z_ const char16_t * _Filename,
+ _In_ int _OFlag, _In_ int _ShFlag, _In_ int _PMode,
+ _Out_ int * _PFileHandle, int _BSecure);
#ifndef CRTDLL
extern int _cflush;
@@ -349,8 +349,8 @@ extern char _exitflag; /* callable termination flag */
extern int _C_Termination_Done; /* termination done flag */
-char * __cdecl _getpath(__in_z const char * _Src, __out_ecount_z(_SizeInChars) char * _Dst, __in size_t _SizeInChars);
-char16_t * __cdecl _wgetpath(__in_z const char16_t * _Src, __out_ecount_z(_SizeInWords) char16_t * _Dst, __in size_t _SizeInWords);
+char * __cdecl _getpath(_In_z_ const char * _Src, _Out_writes_z_(_SizeInChars) char * _Dst, _In_ size_t _SizeInChars);
+char16_t * __cdecl _wgetpath(_In_z_ const char16_t * _Src, _Out_writes_z_(_SizeInWords) char16_t * _Dst, _In_ size_t _SizeInWords);
extern int _dowildcard; /* flag to enable argv[] wildcard expansion */
@@ -368,7 +368,7 @@ typedef int (__clrcall * __MPNH)( size_t );
/* calls the currently installed new handler */
-int __cdecl _callnewh(__in size_t _Size);
+int __cdecl _callnewh(_In_ size_t _Size);
extern int _newmode; /* malloc new() handler mode */
@@ -460,8 +460,8 @@ _MRTIMP int __cdecl _onexit_app_domain(_CPVFV);
#endif /* MRTDLL */
#ifndef _MANAGED_MAIN
-int __CRTDECL main(__in int _Argc, __in_ecount_z(_Argc) char ** _Argv, __in_z char ** _Env);
-int __CRTDECL wmain(__in int _Argc, __in_ecount_z(_Argc) char16_t ** _Argv, __in_z char16_t ** _Env);
+int __CRTDECL main(_In_ int _Argc, _In_reads_z_(_Argc) char ** _Argv, _In_z_ char ** _Env);
+int __CRTDECL wmain(_In_ int _Argc, _In_reads_z_(_Argc) char16_t ** _Argv, _In_z_ char16_t ** _Env);
#endif /* _MANAGED_MAIN */
/* helper functions for wide/multibyte environment conversion */
@@ -474,8 +474,8 @@ int __cdecl __wtomb_environ (void);
NULL out the incoming char * / char16_t * to ensure there is no
double-free
*/
-int __cdecl __crtsetenv (__deref_inout_opt char ** _POption, __in const int _Primary);
-int __cdecl __crtwsetenv (__deref_inout_opt char16_t ** _POption, __in const int _Primary);
+int __cdecl __crtsetenv(_Outptr_opt_ char ** _POption, _In_ const int _Primary);
+int __cdecl __crtwsetenv(_Outptr_opt_ char16_t ** _POption, _In_ const int _Primary);
#ifndef _M_CEE_PURE
_CRTIMP extern void (__cdecl * _aexit_rtn)(int);
@@ -491,13 +491,13 @@ typedef struct
#define _STARTUP_INFO_DEFINED
#endif /* _STARTUP_INFO_DEFINED */
-_CRTIMP int __cdecl __getmainargs(__out int * _Argc, __deref_out_ecount(*_Argc) char *** _Argv,
- __deref_out_opt char *** _Env, __in int _DoWildCard,
- __in _startupinfo * _StartInfo);
+_CRTIMP int __cdecl __getmainargs(_Out_ int * _Argc, _Outptr_result_buffer_(*_Argc) char *** _Argv,
+ _Outptr_opt_ char *** _Env, _In_ int _DoWildCard,
+ _In_ _startupinfo * _StartInfo);
-_CRTIMP int __cdecl __wgetmainargs(__out int * _Argc, __deref_out_ecount(*_Argc)char16_t *** _Argv,
- __deref_out_opt char16_t *** _Env, __in int _DoWildCard,
- __in _startupinfo * _StartInfo);
+_CRTIMP int __cdecl __wgetmainargs(_Out_ int * _Argc, _Outptr_result_buffer_(*_Argc)char16_t *** _Argv,
+ _Outptr_opt_ char16_t *** _Env, _In_ int _DoWildCard,
+ _In_ _startupinfo * _StartInfo);
#endif /* defined (_DLL) || defined (CRTDLL) */
@@ -610,15 +610,15 @@ extern int __cdecl _get_errno_from_oserr(unsigned long);
* internal routines used by the exec/spawn functions
*/
-extern intptr_t __cdecl _dospawn(__in int _Mode, __in_z_opt const char * _Name, __inout_z char * _Cmd, __in_z_opt char * _Env);
-extern intptr_t __cdecl _wdospawn(__in int _Mode, __in_z_opt const char16_t * _Name, __inout_z char16_t * _Cmd, __in_z_opt char16_t * _Env);
-extern int __cdecl _cenvarg(__in_z const char * const * _Argv, __in_z_opt const char * const * _Env,
- __deref_out_opt char ** _ArgBlk, __deref_out_opt char ** _EnvBlk, __in_z const char *_Name);
-extern int __cdecl _wcenvarg(__in_z const char16_t * const * _Argv, __in_z_opt const char16_t * const * _Env,
- __deref_out_opt char16_t ** _ArgBlk, __deref_out_opt char16_t ** _EnvBlk, __in_z const char16_t * _Name);
+extern intptr_t __cdecl _dospawn(_In_ int _Mode, _In_opt_z_ const char * _Name, __inout_z char * _Cmd, _In_opt_z_ char * _Env);
+extern intptr_t __cdecl _wdospawn(_In_ int _Mode, _In_opt_z_ const char16_t * _Name, __inout_z char16_t * _Cmd, _In_opt_z_ char16_t * _Env);
+extern int __cdecl _cenvarg(_In_z_ const char * const * _Argv, _In_opt_z_ const char * const * _Env,
+ _Outptr_opt_ char ** _ArgBlk, _Outptr_opt_ char ** _EnvBlk, _In_z_ const char *_Name);
+extern int __cdecl _wcenvarg(_In_z_ const char16_t * const * _Argv, _In_opt_z_ const char16_t * const * _Env,
+ _Outptr_opt_ char16_t ** _ArgBlk, _Outptr_opt_ char16_t ** _EnvBlk, _In_z_ const char16_t * _Name);
#ifndef _M_IX86
-extern char ** _capture_argv(__in va_list *, __in_z const char * _FirstArg, __out_ecount_z(_MaxCount) char ** _Static_argv, __in size_t _MaxCount);
-extern char16_t ** _wcapture_argv(__in va_list *, __in_z const char16_t * _FirstArg, __out_ecount_z(_MaxCount) char16_t ** _Static_argv, __in size_t _MaxCount);
+extern char ** _capture_argv(_In_ va_list *, _In_z_ const char * _FirstArg, _Out_writes_z_(_MaxCount) char ** _Static_argv, _In_ size_t _MaxCount);
+extern char16_t ** _wcapture_argv(_In_ va_list *, _In_z_ const char16_t * _FirstArg, _Out_writes_z_(_MaxCount) char16_t ** _Static_argv, _In_ size_t _MaxCount);
#endif /* _M_IX86 */
/*
@@ -680,13 +680,13 @@ extern "C++"
#endif /* !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) */
_CRTIMP
#endif /* _SAFECRT_IMPL */
-void __cdecl _invalid_parameter(__in_z_opt const char16_t *, __in_z_opt const char16_t *, __in_z_opt const char16_t *, unsigned int, uintptr_t);
+void __cdecl _invalid_parameter(_In_opt_z_ const char16_t *, _In_opt_z_ const char16_t *, _In_opt_z_ const char16_t *, unsigned int, uintptr_t);
#if !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE)
extern "C++"
#endif /* !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE) */
_CRTIMP
-void __cdecl _invoke_watson(__in_z_opt const char16_t *, __in_z_opt const char16_t *, __in_z_opt const char16_t *, unsigned int, uintptr_t);
+void __cdecl _invoke_watson(_In_opt_z_ const char16_t *, _In_opt_z_ const char16_t *, _In_opt_z_ const char16_t *, unsigned int, uintptr_t);
#ifndef _DEBUG
#if !defined (_NATIVE_char16_t_DEFINED) && defined (_M_CEE_PURE)
diff --git a/src/coreclr/pal/src/safecrt/internal_securecrt.h b/src/coreclr/pal/src/safecrt/internal_securecrt.h
index 7d5fd1e25c9b89..741989897af9d9 100644
--- a/src/coreclr/pal/src/safecrt/internal_securecrt.h
+++ b/src/coreclr/pal/src/safecrt/internal_securecrt.h
@@ -23,13 +23,18 @@
#define _INC_INTERNAL_SECURECRT
/* more VS specific goodness */
-#define __out_ecount_z( x )
-#define __out_ecount( x )
-#define __in_opt
-#define __in_z_opt
-#define __out_ecount_z_opt( x )
-#define __in_z
-#define __in
+#define _In_
+#define _In_z_
+#define _In_opt_
+#define _In_opt_z_
+#define _Out_
+#define _Out_opt_
+#define _Out_writes_(size)
+#define _Out_writes_opt_(size)
+#define _Out_writes_bytes_(size)
+#define _Out_writes_bytes_opt_(size)
+#define _Out_writes_z_(size)
+#define _Out_writes_opt_z_(size)
/*
* The original SafeCRT implemention allows runtime control over buffer checking.
diff --git a/src/coreclr/pal/src/safecrt/tmakepath_s.inl b/src/coreclr/pal/src/safecrt/tmakepath_s.inl
index d4b74ef264ad84..53517412f75e9c 100644
--- a/src/coreclr/pal/src/safecrt/tmakepath_s.inl
+++ b/src/coreclr/pal/src/safecrt/tmakepath_s.inl
@@ -12,7 +12,7 @@
*******************************************************************************/
_FUNC_PROLOGUE
-errno_t __cdecl _FUNC_NAME(__out_ecount_z(_SIZE) _CHAR *_DEST, __in_opt size_t _SIZE, __in_z_opt const _CHAR *_Drive, __in_z_opt const _CHAR *_Dir, __in_z_opt const _CHAR *_Filename, __in_z_opt const _CHAR *_Ext)
+errno_t __cdecl _FUNC_NAME(_Out_writes_z_(_SIZE) _CHAR *_DEST, _In_opt_ size_t _SIZE, _In_opt_z_ const _CHAR *_Drive, _In_opt_z_ const _CHAR *_Dir, _In_opt_z_ const _CHAR *_Filename, _In_opt_z_ const _CHAR *_Ext)
{
size_t written;
const _CHAR *p;
diff --git a/src/coreclr/pal/src/safecrt/tsplitpath_s.inl b/src/coreclr/pal/src/safecrt/tsplitpath_s.inl
index 7bbaf26a99c0e9..0884b2fb3f4a17 100644
--- a/src/coreclr/pal/src/safecrt/tsplitpath_s.inl
+++ b/src/coreclr/pal/src/safecrt/tsplitpath_s.inl
@@ -13,11 +13,11 @@
_FUNC_PROLOGUE
errno_t __cdecl _FUNC_NAME(
- __in_z const _CHAR *_Path,
- __out_ecount_z_opt(_DriveSize) _CHAR *_Drive, __in size_t _DriveSize,
- __out_ecount_z_opt(_DirSize) _CHAR *_Dir, __in size_t _DirSize,
- __out_ecount_z_opt(_FilenameSize) _CHAR *_Filename, __in size_t _FilenameSize,
- __out_ecount_z_opt(_ExtSize) _CHAR *_Ext, __in size_t _ExtSize
+ _In_z_ const _CHAR *_Path,
+ _Out_writes_opt_z_(_DriveSize) _CHAR *_Drive, _In_ size_t _DriveSize,
+ _Out_writes_opt_z_(_DirSize) _CHAR *_Dir, _In_ size_t _DirSize,
+ _Out_writes_opt_z_(_FilenameSize) _CHAR *_Filename, _In_ size_t _FilenameSize,
+ _Out_writes_opt_z_(_ExtSize) _CHAR *_Ext, _In_ size_t _ExtSize
)
{
const _CHAR *tmp;
diff --git a/src/coreclr/pal/src/thread/process.cpp b/src/coreclr/pal/src/thread/process.cpp
index 76135d655f9349..cd62cb917635d5 100644
--- a/src/coreclr/pal/src/thread/process.cpp
+++ b/src/coreclr/pal/src/thread/process.cpp
@@ -73,7 +73,7 @@ SET_DEFAULT_DEBUG_CHANNEL(PROCESS); // some headers have code with asserts, so d
# define __NR_membarrier 389
# elif defined(__aarch64__)
# define __NR_membarrier 283
-# elif
+# else
# error Unknown architecture
# endif
# endif
diff --git a/src/coreclr/pal/tests/palsuite/CMakeLists.txt b/src/coreclr/pal/tests/palsuite/CMakeLists.txt
index f58757a1f6d5fc..f14b2442afa78c 100644
--- a/src/coreclr/pal/tests/palsuite/CMakeLists.txt
+++ b/src/coreclr/pal/tests/palsuite/CMakeLists.txt
@@ -415,7 +415,6 @@ add_executable_clr(paltests
c_runtime/wcsstr/test1/test1.cpp
c_runtime/wcstod/test1/test1.cpp
c_runtime/wcstod/test2/test2.cpp
- c_runtime/wcstok/test1/test1.cpp
c_runtime/wcstoul/test1/test1.cpp
c_runtime/wcstoul/test2/test2.cpp
c_runtime/wcstoul/test3/test3.cpp
@@ -581,9 +580,6 @@ add_executable_clr(paltests
# filemapping_memmgt/GetProcAddress/test1/testlib.cpp
filemapping_memmgt/GetProcAddress/test2/test2.cpp
# filemapping_memmgt/GetProcAddress/test2/testlib.cpp
- filemapping_memmgt/LocalAlloc/test1/LocalAlloc.cpp
- filemapping_memmgt/LocalFree/test1/LocalFree.cpp
- filemapping_memmgt/LocalFree/test2/LocalFree.cpp
filemapping_memmgt/MapViewOfFile/test1/MapViewOfFile.cpp
filemapping_memmgt/MapViewOfFile/test2/MapViewOfFile.cpp
filemapping_memmgt/MapViewOfFile/test3/MapViewOfFile.cpp
diff --git a/src/coreclr/pal/tests/palsuite/c_runtime/wcstok/test1/test1.cpp b/src/coreclr/pal/tests/palsuite/c_runtime/wcstok/test1/test1.cpp
deleted file mode 100644
index 564466c2a4e7f3..00000000000000
--- a/src/coreclr/pal/tests/palsuite/c_runtime/wcstok/test1/test1.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*============================================================================
-**
-** Source: test1.c
-**
-** Purpose:
-** Search for a number of tokens within strings. Check that the return values
-** are what is expected, and also that the strings match up with our expected
-** results.
-**
-**
-**==========================================================================*/
-
-#include
-
-PALTEST(c_runtime_wcstok_test1_paltest_wcstok_test1, "c_runtime/wcstok/test1/paltest_wcstok_test1")
-{
- /* foo bar baz */
- WCHAR str[] = {'f','o','o',' ','b','a','r',' ','b','a','z','\0'};
-
- /* foo \0ar baz */
- WCHAR result1[] = {'f','o','o',' ','\0','a','r',' ','b','a','z','\0'};
-
- /* foo \0a\0 baz */
- WCHAR result2[] = {'f','o','o',' ','\0','a','\0',' ','b','a','z','\0'};
-
- WCHAR* tempString;
- int len = 0;
- WCHAR *ptr;
-
- if (PAL_Initialize(argc, argv))
- {
- return FAIL;
- }
-
- len = (wcslen(str)*sizeof(WCHAR)) + 2;
-
- /* Tokenize 'str'. It will hit the 'b' delimiter first. Check to see
- that the ptr is pointing to the start of the string and do a compare
- to ensure the tokenized string is what we expected.
- */
-
- tempString = convert("bz");
- ptr = wcstok(str, tempString);
- free(tempString);
-
- if (ptr != str)
- {
- Fail("ERROR: Expected wcstok() to return %p, got %p!\n", str, ptr);
- }
-
- if (memcmp(str, result1, len) != 0)
- {
- Fail("ERROR: wcstok altered the string in an unexpected fashion.");
- }
-
- /* If NULL is passed as the first parameter, wcstok will continue
- tokenizing the same string. Test that this works properly.
- */
- tempString = convert("r ");
- ptr = wcstok(NULL, tempString);
- free(tempString);
-
- if (ptr != str + 5)
- {
- Fail("ERROR: Expected wcstok() to return %p, got %p!\n", str+5, ptr);
- }
-
- if (memcmp(str, result2, len) != 0)
- {
- Fail("ERROR: wcstok altered the string in an unexpected fashion.");
- }
-
- /* Continue onward, and search for 'X' now, which won't be found. The
- pointer should point just after the last NULL in the string. And
- the string itself shouldn't have changed.
- */
- tempString = convert("X");
- ptr = wcstok(NULL, tempString);
- free(tempString);
-
- if (ptr != str + 7)
- {
- Fail("ERROR: Expected wcstok() to return %p, got %p!\n", str + 7, ptr);
- }
-
- if (memcmp(str, result2, len) != 0)
- {
- Fail("ERROR: wcstok altered the string in an unexpeced fashion.\n");
- }
-
- /* Call wcstok again. Now the ptr should point to the end of the
- string at NULL. And the string itself shouldn't have changed.
- */
- tempString = convert("X");
- ptr = wcstok(NULL, tempString);
- free(tempString);
-
- if (ptr != NULL)
- {
- Fail("ERROR: Expected wcstok() to return %p, got %p!\n", NULL, ptr);
- }
-
- if (memcmp(str, result2, len) != 0)
- {
- Fail("ERROR: wcstok altered the string in an unexpeced fashion.\n");
- }
-
- PAL_Terminate();
- return PASS;
-}
diff --git a/src/coreclr/pal/tests/palsuite/compilableTests.txt b/src/coreclr/pal/tests/palsuite/compilableTests.txt
index c674de294db452..a7e27f9228976c 100644
--- a/src/coreclr/pal/tests/palsuite/compilableTests.txt
+++ b/src/coreclr/pal/tests/palsuite/compilableTests.txt
@@ -348,7 +348,6 @@ c_runtime/wcsrchr/test1/paltest_wcsrchr_test1
c_runtime/wcsstr/test1/paltest_wcsstr_test1
c_runtime/wcstod/test1/paltest_wcstod_test1
c_runtime/wcstod/test2/paltest_wcstod_test2
-c_runtime/wcstok/test1/paltest_wcstok_test1
c_runtime/wcstoul/test1/paltest_wcstoul_test1
c_runtime/wcstoul/test2/paltest_wcstoul_test2
c_runtime/wcstoul/test3/paltest_wcstoul_test3
@@ -487,9 +486,6 @@ filemapping_memmgt/GetModuleFileNameW/test1/paltest_getmodulefilenamew_test1
filemapping_memmgt/GetModuleFileNameW/test2/paltest_getmodulefilenamew_test2
filemapping_memmgt/GetProcAddress/test1/paltest_getprocaddress_test1
filemapping_memmgt/GetProcAddress/test2/paltest_getprocaddress_test2
-filemapping_memmgt/LocalAlloc/test1/paltest_localalloc_test1
-filemapping_memmgt/LocalFree/test1/paltest_localfree_test1
-filemapping_memmgt/LocalFree/test2/paltest_localfree_test2
filemapping_memmgt/MapViewOfFile/test1/paltest_mapviewoffile_test1
filemapping_memmgt/MapViewOfFile/test2/paltest_mapviewoffile_test2
filemapping_memmgt/MapViewOfFile/test3/paltest_mapviewoffile_test3
diff --git a/src/coreclr/pal/tests/palsuite/filemapping_memmgt/LocalAlloc/test1/LocalAlloc.cpp b/src/coreclr/pal/tests/palsuite/filemapping_memmgt/LocalAlloc/test1/LocalAlloc.cpp
deleted file mode 100644
index 5879ed598071a7..00000000000000
--- a/src/coreclr/pal/tests/palsuite/filemapping_memmgt/LocalAlloc/test1/LocalAlloc.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*=============================================================
-**
-** Source: LocalAlloc.c
-**
-** Purpose: Positive test the LocalAlloc API.
-** Call LocalAlloc with zero as the allocation attribute
-**
-**
-**============================================================*/
-#include
-
-PALTEST(filemapping_memmgt_LocalAlloc_test1_paltest_localalloc_test1, "filemapping_memmgt/LocalAlloc/test1/paltest_localalloc_test1")
-{
- HLOCAL LocalHeap;
- HLOCAL FreeHeap;
- int err;
- const SIZE_T heapSize = 64;
-
- /*Initialize the PAL environment*/
- err = PAL_Initialize(argc, argv);
- if(0 != err)
- {
- return FAIL;
- }
-
- /*Allocate the specified number of bytes from the heap*/
- /*with allocation attribute: zero which is required by PAL Doc*/
- LocalHeap = LocalAlloc(0, heapSize);
- if(!LocalHeap)
- {
- Fail("\nFailed to call LocalAlloc API, "
- "error code=%u\n", GetLastError());
- }
-
- /*Free the allocated local heap memory*/
- FreeHeap = LocalFree(LocalHeap);
- if(FreeHeap)
- {
- Fail("Failed to call LocalFree API, "
- "error code=%u\n", GetLastError());
- }
-
- PAL_Terminate();
- return PASS;
-}
diff --git a/src/coreclr/pal/tests/palsuite/filemapping_memmgt/LocalFree/test1/LocalFree.cpp b/src/coreclr/pal/tests/palsuite/filemapping_memmgt/LocalFree/test1/LocalFree.cpp
deleted file mode 100644
index 0fcb32d6fc96fb..00000000000000
--- a/src/coreclr/pal/tests/palsuite/filemapping_memmgt/LocalFree/test1/LocalFree.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*=============================================================
-**
-** Source: LocalFree.c
-**
-** Purpose: Positive test the LocalFree API.
-** Call LocalFree to free a specified local memory object
-**
-**
-**============================================================*/
-#include
-
-PALTEST(filemapping_memmgt_LocalFree_test1_paltest_localfree_test1, "filemapping_memmgt/LocalFree/test1/paltest_localfree_test1")
-{
- HLOCAL LocalHeap;
- HLOCAL FreeHeap;
- int err;
- const SIZE_T heapSize = 64;
-
- /*Initialize the PAL environment*/
- err = PAL_Initialize(argc, argv);
- if(0 != err)
- {
- return FAIL;
- }
-
- /*Allocate the specified number of bytes from the heap*/
- /*with zero ad the allocation attribute*/
- LocalHeap = LocalAlloc(0, heapSize);
- if(!LocalHeap)
- {
- Fail("\nFailed to call LocalAlloc API, "
- "error code=%u\n", GetLastError());
- }
-
- /*Free the allocated local heap memory*/
- FreeHeap = LocalFree(LocalHeap);
- if(FreeHeap)
- {
- Fail("Failed to call LocalFree API, "
- "error code=%u\n", GetLastError());
- }
-
- PAL_Terminate();
- return PASS;
-}
diff --git a/src/coreclr/pal/tests/palsuite/filemapping_memmgt/LocalFree/test2/LocalFree.cpp b/src/coreclr/pal/tests/palsuite/filemapping_memmgt/LocalFree/test2/LocalFree.cpp
deleted file mode 100644
index 5d66077a2cfd72..00000000000000
--- a/src/coreclr/pal/tests/palsuite/filemapping_memmgt/LocalFree/test2/LocalFree.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*=============================================================
-**
-** Source: LocalFree.c
-**
-** Purpose: Positive test the LocalFree API.
-** call LocalFree by passing NULL as local memory
-** object handle
-**
-**
-**============================================================*/
-#include
-
-PALTEST(filemapping_memmgt_LocalFree_test2_paltest_localfree_test2, "filemapping_memmgt/LocalFree/test2/paltest_localfree_test2")
-{
- HLOCAL FreeHeap;
- int err;
-
- /*Initialize the PAL environment*/
- err = PAL_Initialize(argc, argv);
- if(0 != err)
- {
- return FAIL;
- }
-
- /*call LocalFree by passing NULL as local memory object handle*/
- FreeHeap = LocalFree(NULL);
- if(FreeHeap)
- {
- Fail("Failed to call LocalFree API, "
- "error code=%u\n", GetLastError());
- }
-
- PAL_Terminate();
- return PASS;
-}
diff --git a/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test6/loadlibrarya.cpp b/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test6/loadlibrarya.cpp
index d71e0ea85c333e..93363488bc61d2 100644
--- a/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test6/loadlibrarya.cpp
+++ b/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test6/loadlibrarya.cpp
@@ -7,9 +7,9 @@
**
** Purpose: Positive test the LoadLibrary API. Test will verify
** that it is unable to load the library twice. Once by
-** using the full path name and secondly by using the
+** using the full path name and secondly by using the
** short name.
-**
+**
**
**============================================================*/
@@ -25,14 +25,13 @@ typedef int (*dllfunct)();
#define GETATTACHCOUNTNAME "_GetAttachCount@0"
#endif
-
/* Helper function to test the loaded library.
*/
BOOL PALAPI TestDll(HMODULE hLib)
{
int RetVal;
char FunctName[] = GETATTACHCOUNTNAME;
- FARPROC DllFunc;
+ FARPROC DllFunc;
/* Access a function from the loaded library.
*/
@@ -45,7 +44,7 @@ BOOL PALAPI TestDll(HMODULE hLib)
return (FALSE);
}
- /* Verify that the DLL_PROCESS_ATTACH is only
+ /* Verify that the DLL_PROCESS_ATTACH is only
* accessed once.*/
RetVal = DllFunc();
if (RetVal != 1)
@@ -70,7 +69,7 @@ PALTEST(loader_LoadLibraryA_test6_paltest_loadlibrarya_test6, "loader/LoadLibrar
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
-
+
/* Initialize the PAL. */
if ((PAL_Initialize(argc, argv)) != 0)
@@ -84,15 +83,15 @@ PALTEST(loader_LoadLibraryA_test6_paltest_loadlibrarya_test6, "loader/LoadLibrar
/* Get the full path to the library (DLL).
*/
-
- if (NULL != _fullpath(fullPath,argv[0],_MAX_DIR)) {
-
+
+ if (NULL != realpath(argv[0],fullpath)) {
+
_splitpath(fullPath,drive,dir,fname,ext);
_makepath(fullPath,drive,dir,LibraryName,"");
-
-
+
+
} else {
- Fail("ERROR: conversion from relative path \" %s \" to absolute path failed. _fullpath returned NULL\n",argv[0]);
+ Fail("ERROR: conversion from relative path \" %s \" to absolute path failed. realpath returned NULL\n",argv[0]);
}
/* Call Load library with the short name of
@@ -101,11 +100,11 @@ PALTEST(loader_LoadLibraryA_test6_paltest_loadlibrarya_test6, "loader/LoadLibrar
hShortLib = LoadLibrary(LibraryName);
if(hShortLib == NULL)
{
- Fail("ERROR:%u:Unable to load library %s\n",
- GetLastError(),
+ Fail("ERROR:%u:Unable to load library %s\n",
+ GetLastError(),
LibraryName);
}
-
+
/* Test the loaded library.
*/
if (!TestDll(hShortLib))
@@ -120,8 +119,8 @@ PALTEST(loader_LoadLibraryA_test6_paltest_loadlibrarya_test6, "loader/LoadLibrar
hFullLib = LoadLibrary(fullPath);
if(hFullLib == NULL)
{
- Trace("ERROR:%u:Unable to load library %s\n",
- GetLastError(),
+ Trace("ERROR:%u:Unable to load library %s\n",
+ GetLastError(),
fullPath);
iRetVal = FAIL;
goto cleanUpTwo;
@@ -141,11 +140,11 @@ PALTEST(loader_LoadLibraryA_test6_paltest_loadlibrarya_test6, "loader/LoadLibrar
cleanUpTwo:
- /* Call the FreeLibrary API.
- */
+ /* Call the FreeLibrary API.
+ */
if (!FreeLibrary(hFullLib))
{
- Trace("ERROR:%u: Unable to free library \"%s\"\n",
+ Trace("ERROR:%u: Unable to free library \"%s\"\n",
GetLastError(),
fullPath);
iRetVal = FAIL;
@@ -153,11 +152,11 @@ PALTEST(loader_LoadLibraryA_test6_paltest_loadlibrarya_test6, "loader/LoadLibrar
cleanUpOne:
- /* Call the FreeLibrary API.
- */
+ /* Call the FreeLibrary API.
+ */
if (!FreeLibrary(hShortLib))
{
- Trace("ERROR:%u: Unable to free library \"%s\"\n",
+ Trace("ERROR:%u: Unable to free library \"%s\"\n",
GetLastError(),
LibraryName);
iRetVal = FAIL;
@@ -167,5 +166,4 @@ PALTEST(loader_LoadLibraryA_test6_paltest_loadlibrarya_test6, "loader/LoadLibrar
*/
PAL_TerminateEx(iRetVal);
return iRetVal;
-
}
diff --git a/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test8/loadlibrarya.cpp b/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test8/loadlibrarya.cpp
index b489ef27f965e7..1bbf9a6d08ad1e 100644
--- a/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test8/loadlibrarya.cpp
+++ b/src/coreclr/pal/tests/palsuite/loader/LoadLibraryA/test8/loadlibrarya.cpp
@@ -7,9 +7,9 @@
**
** Purpose: Positive test the LoadLibrary API. Test will verify
** that it is unable to load the library twice. Once by
-** using the full path name and secondly by using the
+** using the full path name and secondly by using the
** short name.
-**
+**
**
**============================================================*/
@@ -25,14 +25,13 @@ typedef int (*dllfunct)();
#define GETATTACHCOUNTNAME "_GetAttachCount@0"
#endif
-
/* Helper function to test the loaded library.
*/
BOOL PALAPI TestDll(HMODULE hLib)
{
int RetVal;
char FunctName[] = GETATTACHCOUNTNAME;
- FARPROC DllFunc;
+ FARPROC DllFunc;
/* Access a function from the loaded library.
*/
@@ -45,7 +44,7 @@ BOOL PALAPI TestDll(HMODULE hLib)
return (FALSE);
}
- /* Verify that the DLL_PROCESS_ATTACH is only
+ /* Verify that the DLL_PROCESS_ATTACH is only
* accessed once.*/
RetVal = DllFunc();
if (RetVal != 1)
@@ -72,7 +71,7 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
char relTestDir[_MAX_DIR];
char fname[_MAX_FNAME];
char ext[_MAX_EXT];
-
+
BOOL bRc = FALSE;
char relLibPath[_MAX_DIR];
@@ -89,15 +88,15 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
/* Get the full path to the library (DLL).
*/
-
- if (NULL != _fullpath(fullPath,argv[0],_MAX_DIR)) {
-
+
+ if (NULL != realpath(argv[0],fullpath)) {
+
_splitpath(fullPath,drive,dir,fname,ext);
_makepath(fullPath,drive,dir,LibraryName,"");
-
-
+
+
} else {
- Fail("ERROR: conversion from relative path \" %s \" to absolute path failed. _fullpath returned NULL\n",argv[0]);
+ Fail("ERROR: conversion from relative path \" %s \" to absolute path failed. realpath returned NULL\n",argv[0]);
}
/* Get relative path to the library
@@ -112,11 +111,11 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
hShortLib = LoadLibrary(LibraryName);
if(hShortLib == NULL)
{
- Fail("ERROR:%u:Short:Unable to load library %s\n",
- GetLastError(),
+ Fail("ERROR:%u:Short:Unable to load library %s\n",
+ GetLastError(),
LibraryName);
}
-
+
/* Test the loaded library.
*/
if (!TestDll(hShortLib))
@@ -131,8 +130,8 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
hFullLib = LoadLibrary(fullPath);
if(hFullLib == NULL)
{
- Trace("ERROR:%u:Full:Unable to load library %s\n",
- GetLastError(),
+ Trace("ERROR:%u:Full:Unable to load library %s\n",
+ GetLastError(),
fullPath);
iRetVal = FAIL;
goto cleanUpTwo;
@@ -148,14 +147,14 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
/*
** Call the load library with the relative path
- ** wrt to the directory ./testloadlibrary/..
+ ** wrt to the directory ./testloadlibrary/..
** since we don't want to make any assumptions
** regarding the type of build
*/
hRelLib = LoadLibrary(relLibPath);
if(hRelLib == NULL)
{
- Trace("ERROR:%u:Rel:Unable to load library at %s\n",
+ Trace("ERROR:%u:Rel:Unable to load library at %s\n",
GetLastError(), relLibPath);
iRetVal = FAIL;
goto cleanUpTwo;
@@ -190,12 +189,12 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
cleanUpThree:
- /* Call the FreeLibrary API.
- */
+ /* Call the FreeLibrary API.
+ */
if (!FreeLibrary(hRelLib))
{
- Trace("ERROR:%u: Unable to free library \"%s\"\n",
+ Trace("ERROR:%u: Unable to free library \"%s\"\n",
GetLastError(),
relLibPath);
iRetVal = FAIL;
@@ -203,11 +202,11 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
cleanUpTwo:
- /* Call the FreeLibrary API.
- */
+ /* Call the FreeLibrary API.
+ */
if (!FreeLibrary(hFullLib))
{
- Trace("ERROR:%u: Unable to free library \"%s\"\n",
+ Trace("ERROR:%u: Unable to free library \"%s\"\n",
GetLastError(),
fullPath);
iRetVal = FAIL;
@@ -215,20 +214,18 @@ PALTEST(loader_LoadLibraryA_test8_paltest_loadlibrarya_test8, "loader/LoadLibrar
cleanUpOne:
- /* Call the FreeLibrary API.
- */
+ /* Call the FreeLibrary API.
+ */
if (!FreeLibrary(hShortLib))
{
- Trace("ERROR:%u: Unable to free library \"%s\"\n",
+ Trace("ERROR:%u: Unable to free library \"%s\"\n",
GetLastError(),
LibraryName);
iRetVal = FAIL;
}
-
/* Terminate the PAL.
*/
PAL_TerminateEx(iRetVal);
return iRetVal;
-
}
diff --git a/src/coreclr/pal/tests/palsuite/miscellaneous/FormatMessageW/test6/test.cpp b/src/coreclr/pal/tests/palsuite/miscellaneous/FormatMessageW/test6/test.cpp
index b16b0ea27754ee..15d94411bb030d 100644
--- a/src/coreclr/pal/tests/palsuite/miscellaneous/FormatMessageW/test6/test.cpp
+++ b/src/coreclr/pal/tests/palsuite/miscellaneous/FormatMessageW/test6/test.cpp
@@ -36,9 +36,9 @@ PALTEST(miscellaneous_FormatMessageW_test6_paltest_formatmessagew_test6, "miscel
the error message it extracts is correct, only that it does place some
information into the buffer when it is called.
*/
-
+
/*
-
+
ERROR_SUCCESS (0L) is normally returned by GetLastError,
But, the ERROR_SUCCESS is removed from messages for Unix based Systems
To ensure that we have some information into the buffer we are using the message
@@ -54,25 +54,25 @@ PALTEST(miscellaneous_FormatMessageW_test6_paltest_formatmessagew_test6, "miscel
0, /* maximum size of message buffer */
NULL /* array of message inserts */
);
-
- if(ReturnResult == 0)
+
+ if(ReturnResult == 0)
{
Fail("ERROR: The return value was 0, which indicates failure. The "
"function failed when trying to Format a FROM_SYSTEM message.");
}
-
- if(wcslen(OutBuffer) <= 0)
+
+ if(wcslen(OutBuffer) <= 0)
{
Fail("ERROR: There are no characters in the buffer, and when the "
"FORMAT_MESSAGE_FROM_SYSTEM flag is used with ERROR_FILE_NOT_FOUND error, "
"something should be put into the buffer.");
}
-
- LocalFree(OutBuffer);
-
+
+ free(OutBuffer);
+
PAL_Terminate();
return PASS;
-
+
}
diff --git a/src/coreclr/pal/tests/palsuite/paltestlist.txt b/src/coreclr/pal/tests/palsuite/paltestlist.txt
index 2b9ac7ccd4eb1e..2afdf101d5b68b 100644
--- a/src/coreclr/pal/tests/palsuite/paltestlist.txt
+++ b/src/coreclr/pal/tests/palsuite/paltestlist.txt
@@ -333,7 +333,6 @@ c_runtime/wcsrchr/test1/paltest_wcsrchr_test1
c_runtime/wcsstr/test1/paltest_wcsstr_test1
c_runtime/wcstod/test1/paltest_wcstod_test1
c_runtime/wcstod/test2/paltest_wcstod_test2
-c_runtime/wcstok/test1/paltest_wcstok_test1
c_runtime/wcstoul/test1/paltest_wcstoul_test1
c_runtime/wcstoul/test2/paltest_wcstoul_test2
c_runtime/wcstoul/test3/paltest_wcstoul_test3
@@ -449,9 +448,6 @@ filemapping_memmgt/CreateFileMappingW/test9/paltest_createfilemappingw_test9
filemapping_memmgt/FreeLibrary/test2/paltest_freelibrary_test2
filemapping_memmgt/GetModuleFileNameA/test2/paltest_getmodulefilenamea_test2
filemapping_memmgt/GetModuleFileNameW/test2/paltest_getmodulefilenamew_test2
-filemapping_memmgt/LocalAlloc/test1/paltest_localalloc_test1
-filemapping_memmgt/LocalFree/test1/paltest_localfree_test1
-filemapping_memmgt/LocalFree/test2/paltest_localfree_test2
filemapping_memmgt/MapViewOfFile/test1/paltest_mapviewoffile_test1
filemapping_memmgt/MapViewOfFile/test2/paltest_mapviewoffile_test2
filemapping_memmgt/MapViewOfFile/test3/paltest_mapviewoffile_test3
diff --git a/src/coreclr/pal/tests/palsuite/runpaltests.sh b/src/coreclr/pal/tests/palsuite/runpaltests.sh
index e38f2aaa18840c..c10930e2acc391 100755
--- a/src/coreclr/pal/tests/palsuite/runpaltests.sh
+++ b/src/coreclr/pal/tests/palsuite/runpaltests.sh
@@ -19,26 +19,18 @@ echo "***** Testing PAL *****"
echo
# Store the location of the root of build directory
-BUILD_ROOT_DIR=$1
-if [ -d "$(pwd)/$BUILD_ROOT_DIR" ]; then
- BUILD_ROOT_DIR="$(pwd)/$BUILD_ROOT_DIR"
+if [ ! -e "$1" ]; then
+ echo "Core_Root not found at $1"
+ exit 1
fi
+BUILD_ROOT_DIR="$(cd "$1"; pwd -P)"
# Create path to the compiled PAL tets in the build directory
PAL_TEST_BUILD=$BUILD_ROOT_DIR
echo Running PAL tests from $PAL_TEST_BUILD
-pushd $BUILD_ROOT_DIR
-
export LD_LIBRARY_PATH=$BUILD_ROOT_DIR:$LD_LIBRARY_PATH
-# Create absolute path to the file that contains a list of PAL tests to execute.
-# This file is located next to this script in the source tree
-RELATIVE_PATH_TO_PAL_TESTS=$0
-# Remove the name of this script from the path
-RELATIVE_PATH_TO_PAL_TESTS=${RELATIVE_PATH_TO_PAL_TESTS%/*.*}
-# Change current directory to the location of this script
-cd $RELATIVE_PATH_TO_PAL_TESTS
# Environment variable PWD contains absolute path to the current folder
# so use it to create absolute path to the file with a list of tests.
PAL_TEST_LIST=$BUILD_ROOT_DIR/paltestlist.txt
@@ -79,8 +71,6 @@ then
fi
fi
-cd $PAL_TEST_OUTPUT_DIR
-
echo PAL tests will store their temporary files and output in $PAL_TEST_OUTPUT_DIR.
if [ "$COPY_TO_TEST_OUTPUT_DIR" != "$PAL_TEST_OUTPUT_DIR" ]; then
echo Output files will be copied to $COPY_TO_TEST_OUTPUT_DIR at the end.
@@ -115,7 +105,6 @@ else
COPY_TO_TEST_OUTPUT_DIR=$PAL_TEST_OUTPUT_DIR
fi
fi
-cd $PAL_TEST_OUTPUT_DIR
echo
echo "Running tests..."
@@ -133,7 +122,7 @@ do
# Create a folder with the test name, and use that as the working directory for the test. Many PAL tests don't clean up after
# themselves and may leave files/directories around, but even to handle test failures that result in a dirty state, run each
# test in its own folder.
- TEST_WORKING_DIR=$(basename $TEST_NAME)
+ TEST_WORKING_DIR=$PAL_TEST_OUTPUT_DIR/$(basename $TEST_NAME)
if [ -e $TEST_WORKING_DIR ]; then
rm -f -r $TEST_WORKING_DIR
fi
@@ -233,8 +222,6 @@ if [ "$COPY_TO_TEST_OUTPUT_DIR" != "$PAL_TEST_OUTPUT_DIR" ]; then
echo Copied PAL test output files to $COPY_TO_TEST_OUTPUT_DIR.
fi
-popd
-
# Set exit code to be equal to the number PAL tests that have failed.
# Exit code 0 indicates success.
exit $NUMBER_OF_FAILED_TESTS
diff --git a/src/coreclr/runtime-prereqs.proj b/src/coreclr/runtime-prereqs.proj
index 1127c3df8bdf3b..36ed2ce497be1e 100644
--- a/src/coreclr/runtime-prereqs.proj
+++ b/src/coreclr/runtime-prereqs.proj
@@ -7,7 +7,7 @@
-
+
diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj
index 5f062c9af2f403..26801ea8c198cf 100644
--- a/src/coreclr/runtime.proj
+++ b/src/coreclr/runtime.proj
@@ -48,6 +48,7 @@
<_CoreClrBuildArg Condition="'$(ClrAllJitsSubset)' == 'true'" Include="-component alljits" />
<_CoreClrBuildArg Condition="'$(ClrILToolsSubset)' == 'true'" Include="-component iltools" />
<_CoreClrBuildArg Condition="'$(ClrNativeAotSubset)' == 'true'" Include="-component nativeaot" />
+ <_CoreClrBuildArg Condition="'$(ClrSpmiSubset)' == 'true'" Include="-component spmi" />
diff --git a/src/coreclr/scripts/jitutil.py b/src/coreclr/scripts/jitutil.py
index c7906124b45d4b..9552869dffa979 100644
--- a/src/coreclr/scripts/jitutil.py
+++ b/src/coreclr/scripts/jitutil.py
@@ -119,15 +119,15 @@ def run_command(command_to_run, _cwd=None, _exit_on_fail=False, _output_file=Non
if proc.poll() is not None:
break
if output:
- output_str = output.strip().decode("utf-8")
+ output_str = output.strip().decode("utf-8", errors='replace')
print(output_str)
of.write(output_str + "\n")
else:
command_stdout, command_stderr = proc.communicate()
if len(command_stdout) > 0:
- print(command_stdout.decode("utf-8"))
+ print(command_stdout.decode("utf-8", errors='replace'))
if len(command_stderr) > 0:
- print(command_stderr.decode("utf-8"))
+ print(command_stderr.decode("utf-8", errors='replace'))
return_code = proc.returncode
if _exit_on_fail and return_code != 0:
diff --git a/src/coreclr/scripts/superpmi-collect.proj b/src/coreclr/scripts/superpmi-collect.proj
index 963e117688f572..046a699917fc62 100644
--- a/src/coreclr/scripts/superpmi-collect.proj
+++ b/src/coreclr/scripts/superpmi-collect.proj
@@ -54,7 +54,7 @@
%HELIX_WORKITEM_UPLOAD_ROOT%$(BUILD_SOURCESDIRECTORY)\artifacts\helixresults
- $(SuperPMIDirectory)\superpmi.py collect -log_level DEBUG --$(CollectionType) -pmi_location $(SuperPMIDirectory)\pmi.dll
+ $(SuperPMIDirectory)\superpmi.py collect -log_level DEBUG --$(CollectionType) -pmi_location $(SuperPMIDirectory)\pmi.dll -pmi_path $(SuperPMIDirectory)\crossgen2$HELIX_PYTHONPATH
@@ -68,7 +68,7 @@
$HELIX_WORKITEM_UPLOAD_ROOT$(BUILD_SOURCESDIRECTORY)/artifacts/helixresults
- $(SuperPMIDirectory)/superpmi.py collect -log_level DEBUG --$(CollectionType) -pmi_location $(SuperPMIDirectory)/pmi.dll
+ $(SuperPMIDirectory)/superpmi.py collect -log_level DEBUG --$(CollectionType) -pmi_location $(SuperPMIDirectory)/pmi.dll -pmi_path $(SuperPMIDirectory)/crossgen2
diff --git a/src/coreclr/scripts/superpmi.md b/src/coreclr/scripts/superpmi.md
index d9404dc32d7406..36e24711637aea 100644
--- a/src/coreclr/scripts/superpmi.md
+++ b/src/coreclr/scripts/superpmi.md
@@ -1,7 +1,7 @@
# Documentation for the superpmi.py tool
SuperPMI is a tool for developing and testing the JIT compiler.
-General information on SuperPMI can be found [here](../ToolBox/superpmi/readme.md).
+General information on SuperPMI can be found [here](../tools/superpmi/readme.md).
## Overview
diff --git a/src/coreclr/scripts/superpmi.py b/src/coreclr/scripts/superpmi.py
index 8433294a146d8a..3c9d417f81cc02 100755
--- a/src/coreclr/scripts/superpmi.py
+++ b/src/coreclr/scripts/superpmi.py
@@ -276,6 +276,7 @@
collect_parser.add_argument("-assemblies", dest="assemblies", nargs="+", default=[], help="A list of managed dlls or directories to recursively use while collecting with PMI or crossgen2. Required if --pmi or --crossgen2 is specified.")
collect_parser.add_argument("-exclude", dest="exclude", nargs="+", default=[], help="A list of files or directories to exclude from the files and directories specified by `-assemblies`.")
collect_parser.add_argument("-pmi_location", help="Path to pmi.dll to use during PMI run. Optional; pmi.dll will be downloaded from Azure Storage if necessary.")
+collect_parser.add_argument("-pmi_path", metavar="PMIPATH_DIR", nargs='*', help="Specify a \"load path\" where assemblies can be found during pmi.dll run. Optional; the argument values are translated to PMIPATH environment variable.")
collect_parser.add_argument("-output_mch_path", help="Location to place the final MCH file.")
collect_parser.add_argument("--merge_mch_files", action="store_true", help="Merge multiple MCH files. Use the -mch_files flag to pass a list of MCH files to merge.")
collect_parser.add_argument("-mch_files", metavar="MCH_FILE", nargs='+', help="Pass a sequence of MCH files which will be merged. Required by --merge_mch_files.")
@@ -831,7 +832,14 @@ async def run_pmi(print_prefix, assembly, self):
pmi_command_env = env_copy.copy()
pmi_complus_env = complus_env.copy()
pmi_complus_env["JitName"] = self.collection_shim_name
- set_and_report_env(pmi_command_env, root_env, pmi_complus_env)
+
+ if self.coreclr_args.pmi_path is not None:
+ pmi_root_env = root_env.copy()
+ pmi_root_env["PMIPATH"] = ";".join(self.coreclr_args.pmi_path)
+ else:
+ pmi_root_env = root_env
+
+ set_and_report_env(pmi_command_env, pmi_root_env, pmi_complus_env)
old_env = os.environ.copy()
os.environ.update(pmi_command_env)
@@ -3105,6 +3113,11 @@ def verify_replay_common_args():
lambda unused: True,
"Unable to set tiered_compilation")
+ coreclr_args.verify(args,
+ "pmi_path",
+ lambda unused: True,
+ "Unable to set pmi_path")
+
if (args.collection_command is None) and (args.pmi is False) and (args.crossgen2 is False):
print("Either a collection command or `--pmi` or `--crossgen2` must be specified")
sys.exit(1)
@@ -3121,6 +3134,12 @@ def verify_replay_common_args():
print("Specify `-assemblies` if `--pmi` or `--crossgen2` is given")
sys.exit(1)
+ if not args.pmi:
+ if args.pmi_path is not None:
+ logging.warning("Warning: -pmi_path is set but --pmi is not.")
+ if args.pmi_location is not None:
+ logging.warning("Warning: -pmi_location is set but --pmi is not.")
+
if args.collection_command is None and args.merge_mch_files is not True:
assert args.collection_args is None
assert (args.pmi is True) or (args.crossgen2 is True)
diff --git a/src/coreclr/scripts/superpmi_benchmarks.py b/src/coreclr/scripts/superpmi_benchmarks.py
index 1c15b9ae803bf9..a72747e77ee6ac 100644
--- a/src/coreclr/scripts/superpmi_benchmarks.py
+++ b/src/coreclr/scripts/superpmi_benchmarks.py
@@ -17,7 +17,7 @@
import stat
from os import path
-from os.path import isfile
+from os.path import isfile, realpath
from shutil import copyfile
from coreclr_arguments import *
from jitutil import run_command, ChangeDir, TempDir
@@ -136,6 +136,9 @@ def build_and_run(coreclr_args, output_mch_name):
project_file = path.join(performance_directory, "src", "benchmarks", "micro", "MicroBenchmarks.csproj")
benchmarks_dll = path.join(artifacts_directory, "MicroBenchmarks.dll")
+ # Workaround https://github.com/dotnet/sdk/issues/23430
+ project_file = realpath(project_file)
+
if is_windows:
shim_name = "%JitName%"
corerun_exe = "CoreRun.exe"
diff --git a/src/coreclr/scripts/superpmi_collect_setup.py b/src/coreclr/scripts/superpmi_collect_setup.py
index ce102ea0910261..9eedadb57e3cfd 100644
--- a/src/coreclr/scripts/superpmi_collect_setup.py
+++ b/src/coreclr/scripts/superpmi_collect_setup.py
@@ -22,12 +22,12 @@
# 4. Lastly, it sets the pipeline variables.
#
# Below are the helix queues it sets depending on the OS/architecture:
-# | Arch | windows | Linux |
-# |-------|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------|
-# | x86 | Windows.10.Amd64.X86.Rt | |
-# | x64 | Windows.10.Amd64.X86.Rt | Ubuntu.1804.Amd64 |
-# | arm | - | (Ubuntu.1804.Arm32)Ubuntu.1804.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440 |
-# | arm64 | Windows.10.Arm64 | (Ubuntu.1804.Arm64)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8-20210531091519-97d8652 |
+# | Arch | windows | Linux | macOS |
+# |-------|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------|----------------|
+# | x86 | Windows.10.Amd64.X86.Rt | | - |
+# | x64 | Windows.10.Amd64.X86.Rt | Ubuntu.1804.Amd64 | OSX.1014.Amd64 |
+# | arm | - | (Ubuntu.1804.Arm32)Ubuntu.1804.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440 | - |
+# | arm64 | Windows.10.Arm64 | (Ubuntu.1804.Arm64)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8-20210531091519-97d8652 | OSX.1100.ARM64 |
#
################################################################################
################################################################################
@@ -47,6 +47,7 @@
parser.add_argument("-source_directory", help="path to source directory")
parser.add_argument("-core_root_directory", help="path to core_root directory")
parser.add_argument("-arch", help="Architecture")
+parser.add_argument("-platform", help="OS platform")
parser.add_argument("-mch_file_tag", help="Tag to be used to mch files")
parser.add_argument("-collection_name", help="Name of the SPMI collection to be done (e.g., libraries, tests)")
parser.add_argument("-collection_type", help="Type of the SPMI collection to be done (crossgen, crossgen2, pmi)")
@@ -196,6 +197,11 @@ def setup_args(args):
lambda unused: True,
"Unable to set arch")
+ coreclr_args.verify(args,
+ "platform",
+ lambda unused: True,
+ "Unable to set platform")
+
coreclr_args.verify(args,
"mch_file_tag",
lambda unused: True,
@@ -383,28 +389,33 @@ def main(main_args):
superpmi_src_directory = os.path.join(source_directory, 'src', 'coreclr', 'scripts')
superpmi_dst_directory = os.path.join(correlation_payload_directory, "superpmi")
arch = coreclr_args.arch
+ platform_name = coreclr_args.platform.lower()
helix_source_prefix = "official"
creator = ""
ci = True
- if is_windows:
+ if platform_name == "windows":
helix_queue = "Windows.10.Arm64" if arch == "arm64" else "Windows.10.Amd64.X86.Rt"
- else:
+ elif platform_name == "linux":
if arch == "arm":
helix_queue = "(Ubuntu.1804.Arm32)Ubuntu.1804.Armarch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440"
elif arch == "arm64":
helix_queue = "(Ubuntu.1804.Arm64)Ubuntu.1804.ArmArch@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8-20210531091519-97d8652"
else:
helix_queue = "Ubuntu.1804.Amd64"
+ elif platform_name == "osx":
+ helix_queue = "OSX.1100.ARM64" if arch == "arm64" else "OSX.1014.Amd64"
# create superpmi directory
print('Copying {} -> {}'.format(superpmi_src_directory, superpmi_dst_directory))
copy_directory(superpmi_src_directory, superpmi_dst_directory, verbose_output=True, match_func=lambda path: any(path.endswith(extension) for extension in [".py"]))
- if is_windows:
+ if platform_name == "windows":
acceptable_copy = lambda path: any(path.endswith(extension) for extension in [".py", ".dll", ".exe", ".json"])
else:
+ acceptable_extensions = [".py", ".dll", ".json"]
+ acceptable_extensions.append(".so" if platform_name == "linux" else ".dylib")
# Need to accept files without any extension, which is how executable file's names look.
- acceptable_copy = lambda path: (os.path.basename(path).find(".") == -1) or any(path.endswith(extension) for extension in [".py", ".dll", ".so", ".json"])
+ acceptable_copy = lambda path: (os.path.basename(path).find(".") == -1) or any(path.endswith(extension) for extension in acceptable_extensions)
print('Copying {} -> {}'.format(coreclr_args.core_root_directory, superpmi_dst_directory))
copy_directory(coreclr_args.core_root_directory, superpmi_dst_directory, verbose_output=True, match_func=acceptable_copy)
diff --git a/src/coreclr/tools/CMakeLists.txt b/src/coreclr/tools/CMakeLists.txt
index a50b1e6a1afbd9..db59797e26f789 100644
--- a/src/coreclr/tools/CMakeLists.txt
+++ b/src/coreclr/tools/CMakeLists.txt
@@ -1,3 +1,6 @@
+add_subdirectory(SOS)
+add_subdirectory(superpmi)
+
if (CLR_CMAKE_TARGET_WIN32 AND NOT CLR_CMAKE_CROSS_ARCH)
add_subdirectory(GenClrDebugResource)
add_subdirectory(InjectResource)
diff --git a/src/coreclr/tools/Common/Compiler/CompilationBuilder.cs b/src/coreclr/tools/Common/Compiler/CompilationBuilder.cs
index f3c9e7ef8f8f2d..b246a9847f2274 100644
--- a/src/coreclr/tools/Common/Compiler/CompilationBuilder.cs
+++ b/src/coreclr/tools/Common/Compiler/CompilationBuilder.cs
@@ -23,6 +23,7 @@ public abstract partial class CompilationBuilder
private DependencyTrackingLevel _dependencyTrackingLevel = DependencyTrackingLevel.None;
protected IEnumerable _compilationRoots = Array.Empty();
protected OptimizationMode _optimizationMode = OptimizationMode.None;
+ protected int _parallelism = -1;
public CompilationBuilder(CompilerTypeSystemContext context, CompilationModuleGroup compilationGroup, NameMangler nameMangler)
{
@@ -41,6 +42,12 @@ public CompilationBuilder UseLogger(Logger logger)
return this;
}
+ public CompilationBuilder UseParallelism(int parallelism)
+ {
+ _parallelism = parallelism;
+ return this;
+ }
+
public CompilationBuilder UseCompilationUnitPrefix(string prefix)
{
_nameMangler.CompilationUnitPrefix = prefix;
diff --git a/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/Generator/ReaderGen.cs b/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/Generator/ReaderGen.cs
index d068f7d047704a..55b09b37b3431e 100644
--- a/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/Generator/ReaderGen.cs
+++ b/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/Generator/ReaderGen.cs
@@ -20,6 +20,7 @@ public void EmitSource()
WriteLine("#pragma warning disable 649");
WriteLine("#pragma warning disable 169");
WriteLine("#pragma warning disable 282 // There is no defined ordering between fields in multiple declarations of partial class or struct");
+ WriteLine("#pragma warning disable IDE0059");
WriteLine();
WriteLine("using System;");
diff --git a/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeFormatReaderGen.cs b/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeFormatReaderGen.cs
index 523fc0d172d521..1d92be56771488 100644
--- a/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeFormatReaderGen.cs
+++ b/src/coreclr/tools/Common/Internal/Metadata/NativeFormat/NativeFormatReaderGen.cs
@@ -6,6 +6,7 @@
#pragma warning disable 649
#pragma warning disable 169
#pragma warning disable 282 // There is no defined ordering between fields in multiple declarations of partial class or struct
+#pragma warning disable IDE0059
using System;
using System.Reflection;
diff --git a/src/coreclr/tools/Common/Internal/NativeFormat/NativeFormatReader.cs b/src/coreclr/tools/Common/Internal/NativeFormat/NativeFormatReader.cs
index 6063683a7d62e2..845dc7c95a4781 100644
--- a/src/coreclr/tools/Common/Internal/NativeFormat/NativeFormatReader.cs
+++ b/src/coreclr/tools/Common/Internal/NativeFormat/NativeFormatReader.cs
@@ -543,7 +543,7 @@ public NativeParser GetNext()
{
while (_parser.Offset < _endOffset)
{
- byte lowHashcode = _parser.GetUInt8();
+ _parser.GetUInt8();
return _parser.GetParserFromRelativeOffset();
}
diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs
index f660b55ebe192f..006409bdbb5338 100644
--- a/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs
+++ b/src/coreclr/tools/Common/JitInterface/CorInfoBase.cs
@@ -2200,20 +2200,6 @@ static uint _getFieldThreadLocalStoreID(IntPtr thisHandle, IntPtr* ppException,
}
}
- [UnmanagedCallersOnly]
- static void _setOverride(IntPtr thisHandle, IntPtr* ppException, IntPtr pOverride, CORINFO_METHOD_STRUCT_* currentMethod)
- {
- var _this = GetThis(thisHandle);
- try
- {
- _this.setOverride(pOverride, currentMethod);
- }
- catch (Exception ex)
- {
- *ppException = _this.AllocException(ex);
- }
- }
-
[UnmanagedCallersOnly]
static void _addActiveDependency(IntPtr thisHandle, IntPtr* ppException, CORINFO_MODULE_STRUCT_* moduleFrom, CORINFO_MODULE_STRUCT_* moduleTo)
{
@@ -2566,7 +2552,7 @@ static byte _doesFieldBelongToClass(IntPtr thisHandle, IntPtr* ppException, CORI
static IntPtr GetUnmanagedCallbacks()
{
- void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 173);
+ void** callbacks = (void**)Marshal.AllocCoTaskMem(sizeof(IntPtr) * 172);
callbacks[0] = (delegate* unmanaged)&_isIntrinsic;
callbacks[1] = (delegate* unmanaged)&_getMethodAttribs;
@@ -2716,31 +2702,30 @@ static IntPtr GetUnmanagedCallbacks()
callbacks[145] = (delegate* unmanaged)&_constructStringLiteral;
callbacks[146] = (delegate* unmanaged)&_emptyStringLiteral;
callbacks[147] = (delegate* unmanaged)&_getFieldThreadLocalStoreID;
- callbacks[148] = (delegate* unmanaged)&_setOverride;
- callbacks[149] = (delegate* unmanaged)&_addActiveDependency;
- callbacks[150] = (delegate* unmanaged)&_GetDelegateCtor;
- callbacks[151] = (delegate* unmanaged)&_MethodCompileComplete;
- callbacks[152] = (delegate* unmanaged)&_getTailCallHelpers;
- callbacks[153] = (delegate* unmanaged)&_convertPInvokeCalliToCall;
- callbacks[154] = (delegate* unmanaged)&_notifyInstructionSetUsage;
- callbacks[155] = (delegate* unmanaged)&_updateEntryPointForTailCall;
- callbacks[156] = (delegate* unmanaged)&_allocMem;
- callbacks[157] = (delegate* unmanaged)&_reserveUnwindInfo;
- callbacks[158] = (delegate* unmanaged)&_allocUnwindInfo;
- callbacks[159] = (delegate* unmanaged)&_allocGCInfo;
- callbacks[160] = (delegate* unmanaged)&_setEHcount;
- callbacks[161] = (delegate* unmanaged)&_setEHinfo;
- callbacks[162] = (delegate* unmanaged)&_logMsg;
- callbacks[163] = (delegate* unmanaged)&_doAssert;
- callbacks[164] = (delegate* unmanaged)&_reportFatalError;
- callbacks[165] = (delegate* unmanaged)&_getPgoInstrumentationResults;
- callbacks[166] = (delegate* unmanaged)&_allocPgoInstrumentationBySchema;
- callbacks[167] = (delegate* unmanaged)&_recordCallSite;
- callbacks[168] = (delegate* unmanaged)&_recordRelocation;
- callbacks[169] = (delegate* unmanaged)&_getRelocTypeHint;
- callbacks[170] = (delegate* unmanaged)&_getExpectedTargetArchitecture;
- callbacks[171] = (delegate* unmanaged)&_getJitFlags;
- callbacks[172] = (delegate* unmanaged)&_doesFieldBelongToClass;
+ callbacks[148] = (delegate* unmanaged)&_addActiveDependency;
+ callbacks[149] = (delegate* unmanaged)&_GetDelegateCtor;
+ callbacks[150] = (delegate* unmanaged)&_MethodCompileComplete;
+ callbacks[151] = (delegate* unmanaged)&_getTailCallHelpers;
+ callbacks[152] = (delegate* unmanaged)&_convertPInvokeCalliToCall;
+ callbacks[153] = (delegate* unmanaged)&_notifyInstructionSetUsage;
+ callbacks[154] = (delegate* unmanaged)&_updateEntryPointForTailCall;
+ callbacks[155] = (delegate* unmanaged)&_allocMem;
+ callbacks[156] = (delegate* unmanaged)&_reserveUnwindInfo;
+ callbacks[157] = (delegate* unmanaged)&_allocUnwindInfo;
+ callbacks[158] = (delegate* unmanaged)&_allocGCInfo;
+ callbacks[159] = (delegate* unmanaged)&_setEHcount;
+ callbacks[160] = (delegate* unmanaged)&_setEHinfo;
+ callbacks[161] = (delegate* unmanaged)&_logMsg;
+ callbacks[162] = (delegate* unmanaged)&_doAssert;
+ callbacks[163] = (delegate* unmanaged)&_reportFatalError;
+ callbacks[164] = (delegate* unmanaged)&_getPgoInstrumentationResults;
+ callbacks[165] = (delegate* unmanaged)&_allocPgoInstrumentationBySchema;
+ callbacks[166] = (delegate* unmanaged)&_recordCallSite;
+ callbacks[167] = (delegate* unmanaged)&_recordRelocation;
+ callbacks[168] = (delegate* unmanaged)&_getRelocTypeHint;
+ callbacks[169] = (delegate* unmanaged)&_getExpectedTargetArchitecture;
+ callbacks[170] = (delegate* unmanaged)&_getJitFlags;
+ callbacks[171] = (delegate* unmanaged)&_doesFieldBelongToClass;
return (IntPtr)callbacks;
}
diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
index f800dadf431591..cd464db7955341 100644
--- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
+++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
@@ -658,7 +658,7 @@ private bool Get_CORINFO_METHOD_INFO(MethodDesc method, MethodIL methodIL, CORIN
methodInfo->options |= CorInfoOptions.CORINFO_GENERICS_CTXT_FROM_METHODTABLE;
}
methodInfo->regionKind = CorInfoRegionKind.CORINFO_REGION_NONE;
- Get_CORINFO_SIG_INFO(method, sig: &methodInfo->args);
+ Get_CORINFO_SIG_INFO(method, sig: &methodInfo->args, methodIL);
Get_CORINFO_SIG_INFO(methodIL.GetLocals(), &methodInfo->locals);
return true;
@@ -683,9 +683,9 @@ private bool Get_CORINFO_METHOD_INFO(MethodDesc method, MethodIL methodIL, CORIN
return (CORINFO_CLASS_STRUCT_**)GetPin(jitVisibleInstantiation);
}
- private void Get_CORINFO_SIG_INFO(MethodDesc method, CORINFO_SIG_INFO* sig, bool suppressHiddenArgument = false)
+ private void Get_CORINFO_SIG_INFO(MethodDesc method, CORINFO_SIG_INFO* sig, MethodILScope scope, bool suppressHiddenArgument = false)
{
- Get_CORINFO_SIG_INFO(method.Signature, sig);
+ Get_CORINFO_SIG_INFO(method.Signature, sig, scope);
// Does the method have a hidden parameter?
bool hasHiddenParameter = !suppressHiddenArgument && method.RequiresInstArg();
@@ -845,7 +845,7 @@ private static CorInfoCallConvExtension GetMemberFunctionCallingConventionVarian
var c => c
};
- private void Get_CORINFO_SIG_INFO(MethodSignature signature, CORINFO_SIG_INFO* sig)
+ private void Get_CORINFO_SIG_INFO(MethodSignature signature, CORINFO_SIG_INFO* sig, MethodILScope scope)
{
sig->callConv = (CorInfoCallConv)(signature.Flags & MethodSignatureFlags.UnmanagedCallingConventionMask);
@@ -875,7 +875,7 @@ private void Get_CORINFO_SIG_INFO(MethodSignature signature, CORINFO_SIG_INFO* s
sig->pSig = null;
sig->cbSig = 0; // Not used by the JIT
sig->methodSignature = ObjectToHandle(signature);
- sig->scope = null;
+ sig->scope = scope is not null ? ObjectToHandle(scope) : null; // scope can be null for internal calls and COM methods.
sig->token = 0; // Not used by the JIT
}
@@ -1149,7 +1149,7 @@ private void getMethodSig(CORINFO_METHOD_STRUCT_* ftn, CORINFO_SIG_INFO* sig, CO
}
}
- Get_CORINFO_SIG_INFO(method, sig: sig);
+ Get_CORINFO_SIG_INFO(method, sig: sig, scope: null);
}
private bool getMethodInfo(CORINFO_METHOD_STRUCT_* ftn, CORINFO_METHOD_INFO* info)
@@ -1795,7 +1795,7 @@ private void findSig(CORINFO_MODULE_STRUCT_* module, uint sigTOK, CORINFO_CONTEX
var methodIL = HandleToObject(module);
var methodSig = (MethodSignature)methodIL.GetObject((int)sigTOK);
- Get_CORINFO_SIG_INFO(methodSig, sig);
+ Get_CORINFO_SIG_INFO(methodSig, sig, methodIL);
#if !READYTORUN
// Check whether we need to report this as a fat pointer call
@@ -1811,7 +1811,7 @@ private void findSig(CORINFO_MODULE_STRUCT_* module, uint sigTOK, CORINFO_CONTEX
private void findCallSiteSig(CORINFO_MODULE_STRUCT_* module, uint methTOK, CORINFO_CONTEXT_STRUCT* context, CORINFO_SIG_INFO* sig)
{
var methodIL = HandleToObject(module);
- Get_CORINFO_SIG_INFO(((MethodDesc)methodIL.GetObject((int)methTOK)), sig: sig);
+ Get_CORINFO_SIG_INFO(((MethodDesc)methodIL.GetObject((int)methTOK)), sig: sig, methodIL);
}
private CORINFO_CLASS_STRUCT_* getTokenTypeAsHandle(ref CORINFO_RESOLVED_TOKEN pResolvedToken)
@@ -3283,8 +3283,6 @@ private InfoAccessType emptyStringLiteral(ref void* ppValue)
private uint getFieldThreadLocalStoreID(CORINFO_FIELD_STRUCT_* field, ref void* ppIndirection)
{ throw new NotImplementedException("getFieldThreadLocalStoreID"); }
- private void setOverride(IntPtr pOverride, CORINFO_METHOD_STRUCT_* currentMethod)
- { throw new NotImplementedException("setOverride"); }
private void addActiveDependency(CORINFO_MODULE_STRUCT_* moduleFrom, CORINFO_MODULE_STRUCT_* moduleTo)
{ throw new NotImplementedException("addActiveDependency"); }
private CORINFO_METHOD_STRUCT_* GetDelegateCtor(CORINFO_METHOD_STRUCT_* methHnd, CORINFO_CLASS_STRUCT_* clsHnd, CORINFO_METHOD_STRUCT_* targetMethodHnd, ref DelegateCtorArgs pCtorData)
@@ -3747,7 +3745,7 @@ private uint getJitFlags(ref CORJIT_FLAGS flags, uint sizeInBytes)
#if READYTORUN
// TODO: enable this check in full AOT
- if (Marshaller.IsMarshallingRequired(this.MethodBeingCompiled.Signature, Array.Empty())) // Only blittable arguments
+ if (Marshaller.IsMarshallingRequired(this.MethodBeingCompiled.Signature, Array.Empty(), ((MetadataType)this.MethodBeingCompiled.OwningType).Module)) // Only blittable arguments
{
ThrowHelper.ThrowInvalidProgramException(ExceptionStringID.InvalidProgramNonBlittableTypes, this.MethodBeingCompiled);
}
diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs b/src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs
index f1ffa0a0cd4ebc..a7b188e0374086 100644
--- a/src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs
+++ b/src/coreclr/tools/Common/JitInterface/CorInfoInstructionSet.cs
@@ -8,6 +8,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Linq;
using System.Runtime.InteropServices;
using Internal.TypeSystem;
@@ -17,105 +18,220 @@ public enum InstructionSet
{
ILLEGAL = 0,
NONE = 63,
- ARM64_ArmBase=1,
- ARM64_AdvSimd=2,
- ARM64_Aes=3,
- ARM64_Crc32=4,
- ARM64_Dp=5,
- ARM64_Rdm=6,
- ARM64_Sha1=7,
- ARM64_Sha256=8,
- ARM64_Atomics=9,
- ARM64_Vector64=10,
- ARM64_Vector128=11,
- ARM64_Dczva=12,
- ARM64_ArmBase_Arm64=13,
- ARM64_AdvSimd_Arm64=14,
- ARM64_Aes_Arm64=15,
- ARM64_Crc32_Arm64=16,
- ARM64_Dp_Arm64=17,
- ARM64_Rdm_Arm64=18,
- ARM64_Sha1_Arm64=19,
- ARM64_Sha256_Arm64=20,
- X64_X86Base=1,
- X64_SSE=2,
- X64_SSE2=3,
- X64_SSE3=4,
- X64_SSSE3=5,
- X64_SSE41=6,
- X64_SSE42=7,
- X64_AVX=8,
- X64_AVX2=9,
- X64_AES=10,
- X64_BMI1=11,
- X64_BMI2=12,
- X64_FMA=13,
- X64_LZCNT=14,
- X64_PCLMULQDQ=15,
- X64_POPCNT=16,
- X64_Vector128=17,
- X64_Vector256=18,
- X64_AVXVNNI=19,
- X64_X86Base_X64=20,
- X64_SSE_X64=21,
- X64_SSE2_X64=22,
- X64_SSE3_X64=23,
- X64_SSSE3_X64=24,
- X64_SSE41_X64=25,
- X64_SSE42_X64=26,
- X64_AVX_X64=27,
- X64_AVX2_X64=28,
- X64_AES_X64=29,
- X64_BMI1_X64=30,
- X64_BMI2_X64=31,
- X64_FMA_X64=32,
- X64_LZCNT_X64=33,
- X64_PCLMULQDQ_X64=34,
- X64_POPCNT_X64=35,
- X64_AVXVNNI_X64=36,
- X86_X86Base=1,
- X86_SSE=2,
- X86_SSE2=3,
- X86_SSE3=4,
- X86_SSSE3=5,
- X86_SSE41=6,
- X86_SSE42=7,
- X86_AVX=8,
- X86_AVX2=9,
- X86_AES=10,
- X86_BMI1=11,
- X86_BMI2=12,
- X86_FMA=13,
- X86_LZCNT=14,
- X86_PCLMULQDQ=15,
- X86_POPCNT=16,
- X86_Vector128=17,
- X86_Vector256=18,
- X86_AVXVNNI=19,
- X86_X86Base_X64=20,
- X86_SSE_X64=21,
- X86_SSE2_X64=22,
- X86_SSE3_X64=23,
- X86_SSSE3_X64=24,
- X86_SSE41_X64=25,
- X86_SSE42_X64=26,
- X86_AVX_X64=27,
- X86_AVX2_X64=28,
- X86_AES_X64=29,
- X86_BMI1_X64=30,
- X86_BMI2_X64=31,
- X86_FMA_X64=32,
- X86_LZCNT_X64=33,
- X86_PCLMULQDQ_X64=34,
- X86_POPCNT_X64=35,
- X86_AVXVNNI_X64=36,
+ ARM64_ArmBase = InstructionSet_ARM64.ArmBase,
+ ARM64_AdvSimd = InstructionSet_ARM64.AdvSimd,
+ ARM64_Aes = InstructionSet_ARM64.Aes,
+ ARM64_Crc32 = InstructionSet_ARM64.Crc32,
+ ARM64_Dp = InstructionSet_ARM64.Dp,
+ ARM64_Rdm = InstructionSet_ARM64.Rdm,
+ ARM64_Sha1 = InstructionSet_ARM64.Sha1,
+ ARM64_Sha256 = InstructionSet_ARM64.Sha256,
+ ARM64_Atomics = InstructionSet_ARM64.Atomics,
+ ARM64_Vector64 = InstructionSet_ARM64.Vector64,
+ ARM64_Vector128 = InstructionSet_ARM64.Vector128,
+ ARM64_Dczva = InstructionSet_ARM64.Dczva,
+ ARM64_ArmBase_Arm64 = InstructionSet_ARM64.ArmBase_Arm64,
+ ARM64_AdvSimd_Arm64 = InstructionSet_ARM64.AdvSimd_Arm64,
+ ARM64_Aes_Arm64 = InstructionSet_ARM64.Aes_Arm64,
+ ARM64_Crc32_Arm64 = InstructionSet_ARM64.Crc32_Arm64,
+ ARM64_Dp_Arm64 = InstructionSet_ARM64.Dp_Arm64,
+ ARM64_Rdm_Arm64 = InstructionSet_ARM64.Rdm_Arm64,
+ ARM64_Sha1_Arm64 = InstructionSet_ARM64.Sha1_Arm64,
+ ARM64_Sha256_Arm64 = InstructionSet_ARM64.Sha256_Arm64,
+ X64_X86Base = InstructionSet_X64.X86Base,
+ X64_SSE = InstructionSet_X64.SSE,
+ X64_SSE2 = InstructionSet_X64.SSE2,
+ X64_SSE3 = InstructionSet_X64.SSE3,
+ X64_SSSE3 = InstructionSet_X64.SSSE3,
+ X64_SSE41 = InstructionSet_X64.SSE41,
+ X64_SSE42 = InstructionSet_X64.SSE42,
+ X64_AVX = InstructionSet_X64.AVX,
+ X64_AVX2 = InstructionSet_X64.AVX2,
+ X64_AES = InstructionSet_X64.AES,
+ X64_BMI1 = InstructionSet_X64.BMI1,
+ X64_BMI2 = InstructionSet_X64.BMI2,
+ X64_FMA = InstructionSet_X64.FMA,
+ X64_LZCNT = InstructionSet_X64.LZCNT,
+ X64_PCLMULQDQ = InstructionSet_X64.PCLMULQDQ,
+ X64_POPCNT = InstructionSet_X64.POPCNT,
+ X64_Vector128 = InstructionSet_X64.Vector128,
+ X64_Vector256 = InstructionSet_X64.Vector256,
+ X64_AVXVNNI = InstructionSet_X64.AVXVNNI,
+ X64_X86Base_X64 = InstructionSet_X64.X86Base_X64,
+ X64_SSE_X64 = InstructionSet_X64.SSE_X64,
+ X64_SSE2_X64 = InstructionSet_X64.SSE2_X64,
+ X64_SSE3_X64 = InstructionSet_X64.SSE3_X64,
+ X64_SSSE3_X64 = InstructionSet_X64.SSSE3_X64,
+ X64_SSE41_X64 = InstructionSet_X64.SSE41_X64,
+ X64_SSE42_X64 = InstructionSet_X64.SSE42_X64,
+ X64_AVX_X64 = InstructionSet_X64.AVX_X64,
+ X64_AVX2_X64 = InstructionSet_X64.AVX2_X64,
+ X64_AES_X64 = InstructionSet_X64.AES_X64,
+ X64_BMI1_X64 = InstructionSet_X64.BMI1_X64,
+ X64_BMI2_X64 = InstructionSet_X64.BMI2_X64,
+ X64_FMA_X64 = InstructionSet_X64.FMA_X64,
+ X64_LZCNT_X64 = InstructionSet_X64.LZCNT_X64,
+ X64_PCLMULQDQ_X64 = InstructionSet_X64.PCLMULQDQ_X64,
+ X64_POPCNT_X64 = InstructionSet_X64.POPCNT_X64,
+ X64_AVXVNNI_X64 = InstructionSet_X64.AVXVNNI_X64,
+ X86_X86Base = InstructionSet_X86.X86Base,
+ X86_SSE = InstructionSet_X86.SSE,
+ X86_SSE2 = InstructionSet_X86.SSE2,
+ X86_SSE3 = InstructionSet_X86.SSE3,
+ X86_SSSE3 = InstructionSet_X86.SSSE3,
+ X86_SSE41 = InstructionSet_X86.SSE41,
+ X86_SSE42 = InstructionSet_X86.SSE42,
+ X86_AVX = InstructionSet_X86.AVX,
+ X86_AVX2 = InstructionSet_X86.AVX2,
+ X86_AES = InstructionSet_X86.AES,
+ X86_BMI1 = InstructionSet_X86.BMI1,
+ X86_BMI2 = InstructionSet_X86.BMI2,
+ X86_FMA = InstructionSet_X86.FMA,
+ X86_LZCNT = InstructionSet_X86.LZCNT,
+ X86_PCLMULQDQ = InstructionSet_X86.PCLMULQDQ,
+ X86_POPCNT = InstructionSet_X86.POPCNT,
+ X86_Vector128 = InstructionSet_X86.Vector128,
+ X86_Vector256 = InstructionSet_X86.Vector256,
+ X86_AVXVNNI = InstructionSet_X86.AVXVNNI,
+ X86_X86Base_X64 = InstructionSet_X86.X86Base_X64,
+ X86_SSE_X64 = InstructionSet_X86.SSE_X64,
+ X86_SSE2_X64 = InstructionSet_X86.SSE2_X64,
+ X86_SSE3_X64 = InstructionSet_X86.SSE3_X64,
+ X86_SSSE3_X64 = InstructionSet_X86.SSSE3_X64,
+ X86_SSE41_X64 = InstructionSet_X86.SSE41_X64,
+ X86_SSE42_X64 = InstructionSet_X86.SSE42_X64,
+ X86_AVX_X64 = InstructionSet_X86.AVX_X64,
+ X86_AVX2_X64 = InstructionSet_X86.AVX2_X64,
+ X86_AES_X64 = InstructionSet_X86.AES_X64,
+ X86_BMI1_X64 = InstructionSet_X86.BMI1_X64,
+ X86_BMI2_X64 = InstructionSet_X86.BMI2_X64,
+ X86_FMA_X64 = InstructionSet_X86.FMA_X64,
+ X86_LZCNT_X64 = InstructionSet_X86.LZCNT_X64,
+ X86_PCLMULQDQ_X64 = InstructionSet_X86.PCLMULQDQ_X64,
+ X86_POPCNT_X64 = InstructionSet_X86.POPCNT_X64,
+ X86_AVXVNNI_X64 = InstructionSet_X86.AVXVNNI_X64,
+ }
+
+ public enum InstructionSet_ARM64
+ {
+ ILLEGAL = InstructionSet.ILLEGAL,
+ NONE = InstructionSet.NONE,
+ ArmBase = 1,
+ AdvSimd = 2,
+ Aes = 3,
+ Crc32 = 4,
+ Dp = 5,
+ Rdm = 6,
+ Sha1 = 7,
+ Sha256 = 8,
+ Atomics = 9,
+ Vector64 = 10,
+ Vector128 = 11,
+ Dczva = 12,
+ ArmBase_Arm64 = 13,
+ AdvSimd_Arm64 = 14,
+ Aes_Arm64 = 15,
+ Crc32_Arm64 = 16,
+ Dp_Arm64 = 17,
+ Rdm_Arm64 = 18,
+ Sha1_Arm64 = 19,
+ Sha256_Arm64 = 20,
+ }
+
+ public enum InstructionSet_X64
+ {
+ ILLEGAL = InstructionSet.ILLEGAL,
+ NONE = InstructionSet.NONE,
+ X86Base = 1,
+ SSE = 2,
+ SSE2 = 3,
+ SSE3 = 4,
+ SSSE3 = 5,
+ SSE41 = 6,
+ SSE42 = 7,
+ AVX = 8,
+ AVX2 = 9,
+ AES = 10,
+ BMI1 = 11,
+ BMI2 = 12,
+ FMA = 13,
+ LZCNT = 14,
+ PCLMULQDQ = 15,
+ POPCNT = 16,
+ Vector128 = 17,
+ Vector256 = 18,
+ AVXVNNI = 19,
+ X86Base_X64 = 20,
+ SSE_X64 = 21,
+ SSE2_X64 = 22,
+ SSE3_X64 = 23,
+ SSSE3_X64 = 24,
+ SSE41_X64 = 25,
+ SSE42_X64 = 26,
+ AVX_X64 = 27,
+ AVX2_X64 = 28,
+ AES_X64 = 29,
+ BMI1_X64 = 30,
+ BMI2_X64 = 31,
+ FMA_X64 = 32,
+ LZCNT_X64 = 33,
+ PCLMULQDQ_X64 = 34,
+ POPCNT_X64 = 35,
+ AVXVNNI_X64 = 36,
+ }
+ public enum InstructionSet_X86
+ {
+ ILLEGAL = InstructionSet.ILLEGAL,
+ NONE = InstructionSet.NONE,
+ X86Base = 1,
+ SSE = 2,
+ SSE2 = 3,
+ SSE3 = 4,
+ SSSE3 = 5,
+ SSE41 = 6,
+ SSE42 = 7,
+ AVX = 8,
+ AVX2 = 9,
+ AES = 10,
+ BMI1 = 11,
+ BMI2 = 12,
+ FMA = 13,
+ LZCNT = 14,
+ PCLMULQDQ = 15,
+ POPCNT = 16,
+ Vector128 = 17,
+ Vector256 = 18,
+ AVXVNNI = 19,
+ X86Base_X64 = 20,
+ SSE_X64 = 21,
+ SSE2_X64 = 22,
+ SSE3_X64 = 23,
+ SSSE3_X64 = 24,
+ SSE41_X64 = 25,
+ SSE42_X64 = 26,
+ AVX_X64 = 27,
+ AVX2_X64 = 28,
+ AES_X64 = 29,
+ BMI1_X64 = 30,
+ BMI2_X64 = 31,
+ FMA_X64 = 32,
+ LZCNT_X64 = 33,
+ PCLMULQDQ_X64 = 34,
+ POPCNT_X64 = 35,
+ AVXVNNI_X64 = 36,
}
public struct InstructionSetFlags : IEnumerable
{
- ulong _flags;
-
+ private ulong _flags;
+
+ public IEnumerable ARM64Flags => this.Select((x) => (InstructionSet_ARM64)x);
+
+ public IEnumerable X64Flags => this.Select((x) => (InstructionSet_X64)x);
+
+ public IEnumerable X86Flags => this.Select((x) => (InstructionSet_X86)x);
+
public void AddInstructionSet(InstructionSet instructionSet)
{
_flags = _flags | (((ulong)1) << (int)instructionSet);
@@ -235,6 +351,10 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target
resultflags.AddInstructionSet(InstructionSet.ARM64_ArmBase);
if (resultflags.HasInstructionSet(InstructionSet.ARM64_Sha256))
resultflags.AddInstructionSet(InstructionSet.ARM64_ArmBase);
+ if (resultflags.HasInstructionSet(InstructionSet.ARM64_Vector64))
+ resultflags.AddInstructionSet(InstructionSet.ARM64_AdvSimd);
+ if (resultflags.HasInstructionSet(InstructionSet.ARM64_Vector128))
+ resultflags.AddInstructionSet(InstructionSet.ARM64_AdvSimd);
break;
case TargetArchitecture.X64:
@@ -330,12 +450,18 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target
resultflags.AddInstructionSet(InstructionSet.X64_AVX);
if (resultflags.HasInstructionSet(InstructionSet.X64_FMA))
resultflags.AddInstructionSet(InstructionSet.X64_AVX);
+ if (resultflags.HasInstructionSet(InstructionSet.X64_LZCNT))
+ resultflags.AddInstructionSet(InstructionSet.X64_X86Base);
if (resultflags.HasInstructionSet(InstructionSet.X64_PCLMULQDQ))
resultflags.AddInstructionSet(InstructionSet.X64_SSE2);
if (resultflags.HasInstructionSet(InstructionSet.X64_POPCNT))
resultflags.AddInstructionSet(InstructionSet.X64_SSE42);
+ if (resultflags.HasInstructionSet(InstructionSet.X64_Vector128))
+ resultflags.AddInstructionSet(InstructionSet.X64_SSE);
if (resultflags.HasInstructionSet(InstructionSet.X64_Vector256))
resultflags.AddInstructionSet(InstructionSet.X64_AVX);
+ if (resultflags.HasInstructionSet(InstructionSet.X64_AVXVNNI))
+ resultflags.AddInstructionSet(InstructionSet.X64_AVX2);
break;
case TargetArchitecture.X86:
@@ -363,16 +489,22 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target
resultflags.AddInstructionSet(InstructionSet.X86_AVX);
if (resultflags.HasInstructionSet(InstructionSet.X86_FMA))
resultflags.AddInstructionSet(InstructionSet.X86_AVX);
+ if (resultflags.HasInstructionSet(InstructionSet.X86_LZCNT))
+ resultflags.AddInstructionSet(InstructionSet.X86_X86Base);
if (resultflags.HasInstructionSet(InstructionSet.X86_PCLMULQDQ))
resultflags.AddInstructionSet(InstructionSet.X86_SSE2);
if (resultflags.HasInstructionSet(InstructionSet.X86_POPCNT))
resultflags.AddInstructionSet(InstructionSet.X86_SSE42);
+ if (resultflags.HasInstructionSet(InstructionSet.X86_Vector128))
+ resultflags.AddInstructionSet(InstructionSet.X86_SSE);
if (resultflags.HasInstructionSet(InstructionSet.X86_Vector256))
resultflags.AddInstructionSet(InstructionSet.X86_AVX);
+ if (resultflags.HasInstructionSet(InstructionSet.X86_AVXVNNI))
+ resultflags.AddInstructionSet(InstructionSet.X86_AVX2);
break;
-
}
} while (!oldflags.Equals(resultflags));
+
return resultflags;
}
@@ -422,6 +554,10 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe
resultflags.AddInstructionSet(InstructionSet.ARM64_Sha1);
if (resultflags.HasInstructionSet(InstructionSet.ARM64_ArmBase))
resultflags.AddInstructionSet(InstructionSet.ARM64_Sha256);
+ if (resultflags.HasInstructionSet(InstructionSet.ARM64_AdvSimd))
+ resultflags.AddInstructionSet(InstructionSet.ARM64_Vector64);
+ if (resultflags.HasInstructionSet(InstructionSet.ARM64_AdvSimd))
+ resultflags.AddInstructionSet(InstructionSet.ARM64_Vector128);
break;
case TargetArchitecture.X64:
@@ -483,12 +619,18 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe
resultflags.AddInstructionSet(InstructionSet.X64_BMI2);
if (resultflags.HasInstructionSet(InstructionSet.X64_AVX))
resultflags.AddInstructionSet(InstructionSet.X64_FMA);
+ if (resultflags.HasInstructionSet(InstructionSet.X64_X86Base))
+ resultflags.AddInstructionSet(InstructionSet.X64_LZCNT);
if (resultflags.HasInstructionSet(InstructionSet.X64_SSE2))
resultflags.AddInstructionSet(InstructionSet.X64_PCLMULQDQ);
if (resultflags.HasInstructionSet(InstructionSet.X64_SSE42))
resultflags.AddInstructionSet(InstructionSet.X64_POPCNT);
+ if (resultflags.HasInstructionSet(InstructionSet.X64_SSE))
+ resultflags.AddInstructionSet(InstructionSet.X64_Vector128);
if (resultflags.HasInstructionSet(InstructionSet.X64_AVX))
resultflags.AddInstructionSet(InstructionSet.X64_Vector256);
+ if (resultflags.HasInstructionSet(InstructionSet.X64_AVX2))
+ resultflags.AddInstructionSet(InstructionSet.X64_AVXVNNI);
break;
case TargetArchitecture.X86:
@@ -516,16 +658,22 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe
resultflags.AddInstructionSet(InstructionSet.X86_BMI2);
if (resultflags.HasInstructionSet(InstructionSet.X86_AVX))
resultflags.AddInstructionSet(InstructionSet.X86_FMA);
+ if (resultflags.HasInstructionSet(InstructionSet.X86_X86Base))
+ resultflags.AddInstructionSet(InstructionSet.X86_LZCNT);
if (resultflags.HasInstructionSet(InstructionSet.X86_SSE2))
resultflags.AddInstructionSet(InstructionSet.X86_PCLMULQDQ);
if (resultflags.HasInstructionSet(InstructionSet.X86_SSE42))
resultflags.AddInstructionSet(InstructionSet.X86_POPCNT);
+ if (resultflags.HasInstructionSet(InstructionSet.X86_SSE))
+ resultflags.AddInstructionSet(InstructionSet.X86_Vector128);
if (resultflags.HasInstructionSet(InstructionSet.X86_AVX))
resultflags.AddInstructionSet(InstructionSet.X86_Vector256);
+ if (resultflags.HasInstructionSet(InstructionSet.X86_AVX2))
+ resultflags.AddInstructionSet(InstructionSet.X86_AVXVNNI);
break;
-
}
} while (!oldflags.Equals(resultflags));
+
return resultflags;
}
@@ -608,7 +756,6 @@ public static IEnumerable ArchitectureToValidInstructionSets
yield return new InstructionSetInfo("Vector256", "", InstructionSet.X86_Vector256, false);
yield return new InstructionSetInfo("avxvnni", "AvxVnni", InstructionSet.X86_AVXVNNI, true);
break;
-
}
}
@@ -675,7 +822,6 @@ public void Set64BitInstructionSetVariants(TargetArchitecture architecture)
case TargetArchitecture.X86:
break;
-
}
}
@@ -734,7 +880,6 @@ public void Set64BitInstructionSetVariantsUnconditionally(TargetArchitecture arc
AddInstructionSet(InstructionSet.X86_POPCNT_X64);
AddInstructionSet(InstructionSet.X86_AVXVNNI_X64);
break;
-
}
}
}
diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt
index 8bfdc9a9d86a75..02586289c003a7 100644
--- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt
+++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetDesc.txt
@@ -1,5 +1,5 @@
; Define the set of instruction sets available on a platform
-; Format is
+; Format is
;
; Add new instruction set
; instructionset,,,,, ,
@@ -72,9 +72,12 @@ implication ,X86 ,AES ,SSE2
implication ,X86 ,BMI1 ,AVX
implication ,X86 ,BMI2 ,AVX
implication ,X86 ,FMA ,AVX
+implication ,X86 ,LZCNT ,X86Base
implication ,X86 ,PCLMULQDQ ,SSE2
implication ,X86 ,POPCNT ,SSE42
+implication ,X86 ,Vector128 ,SSE
implication ,X86 ,Vector256 ,AVX
+implication ,X86 ,AVXVNNI ,AVX2
; Definition of X64 instruction sets
definearch ,X64 ,64Bit ,X64
@@ -113,3 +116,5 @@ implication ,ARM64 ,Dp ,AdvSimd
implication ,ARM64 ,Rdm ,AdvSimd
implication ,ARM64 ,Sha1 ,ArmBase
implication ,ARM64 ,Sha256 ,ArmBase
+implication ,ARM64 ,Vector64 ,AdvSimd
+implication ,ARM64 ,Vector128 ,AdvSimd
diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetGenerator.cs b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetGenerator.cs
index aeece5255661f2..a9e7ee1086e391 100644
--- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetGenerator.cs
+++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/InstructionSetGenerator.cs
@@ -355,6 +355,7 @@ public void WriteManagedJitInstructionSet(TextWriter tr)
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Linq;
using System.Runtime.InteropServices;
using Internal.TypeSystem;
@@ -365,23 +366,51 @@ public enum InstructionSet
ILLEGAL = 0,
NONE = 63,
");
+
foreach (string architecture in _architectures)
{
- int counter = 1;
foreach (var jitName in _architectureJitNames[architecture])
{
- tr.WriteLine($" {architecture}_{jitName}={counter++},");
+ tr.WriteLine($" {architecture}_{jitName} = InstructionSet_{architecture}.{jitName},");
}
}
- tr.Write(@"
- }
+ tr.Write(@" }
+
+");
+
+ foreach (string architecture in _architectures)
+ {
+ tr.WriteLine($" public enum InstructionSet_{architecture}");
+ tr.Write(@" {
+ ILLEGAL = InstructionSet.ILLEGAL,
+ NONE = InstructionSet.NONE,
+");
- public struct InstructionSetFlags : IEnumerable
+ int counter = 1;
+ foreach (var jitName in _architectureJitNames[architecture])
+ {
+ tr.WriteLine($" {jitName} = {counter++},");
+ }
+
+ tr.Write(@" }
+
+");
+ }
+
+ tr.Write(@" public struct InstructionSetFlags : IEnumerable
{
- ulong _flags;
-
- public void AddInstructionSet(InstructionSet instructionSet)
+ private ulong _flags;
+
+");
+
+ foreach (string architecture in _architectures)
+ {
+ tr.WriteLine($" public IEnumerable {architecture}Flags => this.Select((x) => (InstructionSet_{architecture})x);");
+ tr.WriteLine();
+ }
+
+ tr.Write(@" public void AddInstructionSet(InstructionSet instructionSet)
{
_flags = _flags | (((ulong)1) << (int)instructionSet);
}
@@ -475,9 +504,9 @@ public static InstructionSetFlags ExpandInstructionSetByImplicationHelper(Target
tr.WriteLine(" break;");
}
- tr.Write(@"
- }
+ tr.Write(@" }
} while (!oldflags.Equals(resultflags));
+
return resultflags;
}
@@ -515,9 +544,9 @@ private static InstructionSetFlags ExpandInstructionSetByReverseImplicationHelpe
tr.WriteLine(" break;");
}
- tr.Write(@"
- }
+ tr.Write(@" }
} while (!oldflags.Equals(resultflags));
+
return resultflags;
}
@@ -559,8 +588,8 @@ public static IEnumerable ArchitectureToValidInstructionSets
}
tr.WriteLine(" break;");
}
- tr.Write(@"
- }
+
+ tr.Write(@" }
}
public void Set64BitInstructionSetVariants(TargetArchitecture architecture)
@@ -586,8 +615,7 @@ public void Set64BitInstructionSetVariants(TargetArchitecture architecture)
tr.WriteLine(" break;");
}
- tr.Write(@"
- }
+ tr.Write(@" }
}
public void Set64BitInstructionSetVariantsUnconditionally(TargetArchitecture architecture)
@@ -610,13 +638,13 @@ public void Set64BitInstructionSetVariantsUnconditionally(TargetArchitecture arc
tr.WriteLine(" break;");
}
- tr.Write(@"
- }
+ tr.Write(@" }
}
}
}
");
return;
+
void AddReverseImplication(string architecture, string jitName, string impliedJitName)
{
AddImplication(architecture, impliedJitName, jitName);
diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt
index dbe775e1e0246e..92bc30aaf2570b 100644
--- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt
+++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/ThunkInput.txt
@@ -301,7 +301,6 @@ FUNCTIONS
InfoAccessType constructStringLiteral(CORINFO_MODULE_HANDLE module, mdToken metaTok, void **ppValue);
InfoAccessType emptyStringLiteral(void **ppValue);
uint32_t getFieldThreadLocalStoreID (CORINFO_FIELD_HANDLE field, void **ppIndirection);
- void setOverride(ICorDynamicInfo *pOverride, CORINFO_METHOD_HANDLE currentMethod);
void addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo);
CORINFO_METHOD_HANDLE GetDelegateCtor(CORINFO_METHOD_HANDLE methHnd, CORINFO_CLASS_HANDLE clsHnd, CORINFO_METHOD_HANDLE targetMethodHnd, DelegateCtorArgs * pCtorData);
void MethodCompileComplete(CORINFO_METHOD_HANDLE methHnd);
diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat
index c775755558de9c..69e3367c4e0942 100644
--- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat
+++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.bat
@@ -1,4 +1,4 @@
pushd %~dp0
-call ..\..\..\..\..\..\dotnet.cmd run -- ThunkInput.txt ..\CorInfoBase.cs ..\..\..\aot\jitinterface\jitinterface.h ..\..\..\..\jit\ICorJitInfo_API_names.h ..\..\..\..\jit\ICorJitInfo_API_wrapper.hpp ..\..\..\..\inc\icorjitinfoimpl_generated.h ..\..\..\..\ToolBox\superpmi\superpmi-shim-counter\icorjitinfo.cpp ..\..\..\..\ToolBox\superpmi\superpmi-shim-simple\icorjitinfo.cpp
+call ..\..\..\..\..\..\dotnet.cmd run -- ThunkInput.txt ..\CorInfoBase.cs ..\..\..\aot\jitinterface\jitinterface.h ..\..\..\..\jit\ICorJitInfo_API_names.h ..\..\..\..\jit\ICorJitInfo_API_wrapper.hpp ..\..\..\..\inc\icorjitinfoimpl_generated.h ..\..\..\..\tools\superpmi\superpmi-shim-counter\icorjitinfo.cpp ..\..\..\..\tools\superpmi\superpmi-shim-simple\icorjitinfo.cpp
call ..\..\..\..\..\..\dotnet.cmd run -- InstructionSetGenerator InstructionSetDesc.txt ..\..\Internal\Runtime\ReadyToRunInstructionSet.cs ..\..\Internal\Runtime\ReadyToRunInstructionSetHelper.cs ..\CorInfoInstructionSet.cs ..\..\..\..\inc\corinfoinstructionset.h ..\..\..\..\inc\readytoruninstructionset.h
popd
diff --git a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh
index 7dc71bd378d854..ca9cdcb52ef11f 100755
--- a/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh
+++ b/src/coreclr/tools/Common/JitInterface/ThunkGenerator/gen.sh
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
cd "$(dirname ${BASH_SOURCE[0]})"
-../../../../../../dotnet.sh run -- ThunkInput.txt ../CorInfoBase.cs ../../../aot/jitinterface/jitinterface.h ../../../../jit/ICorJitInfo_API_names.h ../../../../jit/ICorJitInfo_API_wrapper.hpp ../../../../inc/icorjitinfoimpl_generated.h ../../../../ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp ../../../../ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
+../../../../../../dotnet.sh run -- ThunkInput.txt ../CorInfoBase.cs ../../../aot/jitinterface/jitinterface.h ../../../../jit/ICorJitInfo_API_names.h ../../../../jit/ICorJitInfo_API_wrapper.hpp ../../../../inc/icorjitinfoimpl_generated.h ../../../../tools/superpmi/superpmi-shim-counter/icorjitinfo.cpp ../../../../tools/superpmi/superpmi-shim-simple/icorjitinfo.cpp
../../../../../../dotnet.sh run -- InstructionSetGenerator InstructionSetDesc.txt ../../Internal/Runtime/ReadyToRunInstructionSet.cs ../../Internal/Runtime/ReadyToRunInstructionSetHelper.cs ../CorInfoInstructionSet.cs ../../../../inc/corinfoinstructionset.h ../../../../inc/readytoruninstructionset.h
diff --git a/src/coreclr/tools/Common/TypeSystem/Aot/TargetDetails.Aot.cs b/src/coreclr/tools/Common/TypeSystem/Aot/TargetDetails.Aot.cs
deleted file mode 100644
index 9e9704555724d4..00000000000000
--- a/src/coreclr/tools/Common/TypeSystem/Aot/TargetDetails.Aot.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-namespace Internal.TypeSystem
-{
- // Extension to TargetDetails related to Aot
- partial class TargetDetails
- {
- ///
- /// Offset by which fat function pointers are shifted to distinguish them
- /// from real function pointers.
- /// WebAssembly uses index tables, not addresses for function pointers, so the lower bits are not free to use.
- ///
- public int FatFunctionPointerOffset => Architecture == TargetArchitecture.Wasm32 ? 1 << 31 : 2;
- }
-}
diff --git a/src/coreclr/tools/Common/TypeSystem/Canon/TypeSystemContext.Canon.cs b/src/coreclr/tools/Common/TypeSystem/Canon/TypeSystemContext.Canon.cs
index 091f26bfda510c..0a35ceeb64d254 100644
--- a/src/coreclr/tools/Common/TypeSystem/Canon/TypeSystemContext.Canon.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Canon/TypeSystemContext.Canon.cs
@@ -69,8 +69,7 @@ public bool IsCanonicalDefinitionType(TypeDesc type, CanonicalFormKind kind)
///
public Instantiation ConvertInstantiationToCanonForm(Instantiation instantiation, CanonicalFormKind kind)
{
- bool changed;
- return ConvertInstantiationToCanonForm(instantiation, kind, out changed);
+ return ConvertInstantiationToCanonForm(instantiation, kind, out _);
}
///
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/ConstructedTypeRewritingHelpers.cs b/src/coreclr/tools/Common/TypeSystem/Common/ConstructedTypeRewritingHelpers.cs
index 73c4dfd43f7b4d..42011765c379d3 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/ConstructedTypeRewritingHelpers.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/ConstructedTypeRewritingHelpers.cs
@@ -155,7 +155,7 @@ public static TypeDesc ReplaceTypesInConstructionOfType(this TypeDesc type, Type
public static MethodDesc ReplaceTypesInConstructionOfMethod(this MethodDesc method, TypeDesc[] typesToReplace, TypeDesc[] replacementTypes)
{
TypeDesc newOwningType = method.OwningType.ReplaceTypesInConstructionOfType(typesToReplace, replacementTypes);
- MethodDesc methodOnOwningType = null;
+ MethodDesc methodOnOwningType;
bool owningTypeChanged = false;
if (newOwningType == method.OwningType)
{
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/DefType.FieldLayout.cs b/src/coreclr/tools/Common/TypeSystem/Common/DefType.FieldLayout.cs
index 71c7423b8fbb04..2190f9ac1a2785 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/DefType.FieldLayout.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/DefType.FieldLayout.cs
@@ -63,6 +63,11 @@ private static class FieldLayoutFlags
/// True if type transitively has UnsafeValueTypeAttribute
///
public const int IsUnsafeValueType = 0x200;
+
+ ///
+ /// True if the type transitively has any types with LayoutKind.Auto in its layout.
+ ///
+ public const int IsAutoLayoutOrHasAutoLayoutFields = 0x400;
}
private class StaticBlockInfo
@@ -115,6 +120,21 @@ public bool IsUnsafeValueType
}
}
+ ///
+ /// Does a type have auto-layout or transitively have any fields of a type with auto-layout.
+ ///
+ public virtual bool IsAutoLayoutOrHasAutoLayoutFields
+ {
+ get
+ {
+ if (!_fieldLayoutFlags.HasFlags(FieldLayoutFlags.ComputedInstanceTypeLayout))
+ {
+ ComputeInstanceLayout(InstanceLayoutKind.TypeAndFields);
+ }
+ return _fieldLayoutFlags.HasFlags(FieldLayoutFlags.IsAutoLayoutOrHasAutoLayoutFields);
+ }
+ }
+
///
/// The number of bytes required to hold a field of this type
@@ -406,6 +426,10 @@ public void ComputeInstanceLayout(InstanceLayoutKind layoutKind)
{
_fieldLayoutFlags.AddFlags(FieldLayoutFlags.ComputedInstanceLayoutAbiUnstable);
}
+ if (computedLayout.IsAutoLayoutOrHasAutoLayoutFields)
+ {
+ _fieldLayoutFlags.AddFlags(FieldLayoutFlags.IsAutoLayoutOrHasAutoLayoutFields);
+ }
if (computedLayout.Offsets != null)
{
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/FieldLayoutAlgorithm.cs b/src/coreclr/tools/Common/TypeSystem/Common/FieldLayoutAlgorithm.cs
index 863e857a21def8..a19ec4b3603bf4 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/FieldLayoutAlgorithm.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/FieldLayoutAlgorithm.cs
@@ -82,6 +82,7 @@ public struct ComputedInstanceFieldLayout
public LayoutInt ByteCountUnaligned;
public LayoutInt ByteCountAlignment;
public bool LayoutAbiStable; // Is the layout stable such that it can safely be used in function calling conventions
+ public bool IsAutoLayoutOrHasAutoLayoutFields;
///
/// If Offsets is non-null, then all field based layout is complete.
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/GenericParameterDesc.Diagnostic.cs b/src/coreclr/tools/Common/TypeSystem/Common/GenericParameterDesc.Diagnostic.cs
index 8af9193966818b..7e8df4304dfd5c 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/GenericParameterDesc.Diagnostic.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/GenericParameterDesc.Diagnostic.cs
@@ -11,6 +11,12 @@ public abstract partial class GenericParameterDesc
///
/// Gets the name of the generic parameter as defined in the metadata. This must not throw
///
- public abstract string DiagnosticName { get; }
+ public virtual string DiagnosticName
+ {
+ get
+ {
+ return string.Concat("T", Index.ToStringInvariant());
+ }
+ }
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs b/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs
index 249faef7cd0405..9973be45ff1308 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/MetadataFieldLayoutAlgorithm.cs
@@ -112,7 +112,8 @@ out instanceByteSizeAndAlignment
ByteCountAlignment = instanceByteSizeAndAlignment.Alignment,
FieldAlignment = sizeAndAlignment.Alignment,
FieldSize = sizeAndAlignment.Size,
- LayoutAbiStable = true
+ LayoutAbiStable = true,
+ IsAutoLayoutOrHasAutoLayoutFields = false,
};
if (numInstanceFields > 0)
@@ -214,7 +215,7 @@ public override ComputedStaticFieldLayout ComputeStaticFieldLayout(DefType defTy
}
ref StaticsBlock block = ref GetStaticsBlockForField(ref result, field);
- SizeAndAlignment sizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType, hasLayout: false, context.Target.DefaultPackingSize, out bool _);
+ SizeAndAlignment sizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType, hasLayout: false, context.Target.DefaultPackingSize, out bool _, out bool _);
block.Size = LayoutInt.AlignUp(block.Size, sizeAndAlignment.Alignment, context.Target);
result.Offsets[index] = new FieldAndOffset(field, block.Size);
@@ -305,13 +306,16 @@ protected ComputedInstanceFieldLayout ComputeExplicitFieldLayout(MetadataType ty
var offsets = new FieldAndOffset[numInstanceFields];
int fieldOrdinal = 0;
bool layoutAbiStable = true;
+ bool hasAutoLayoutField = false;
foreach (var fieldAndOffset in layoutMetadata.Offsets)
{
TypeDesc fieldType = fieldAndOffset.Field.FieldType;
- var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType.UnderlyingType, hasLayout: true, packingSize, out bool fieldLayoutAbiStable);
+ var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType.UnderlyingType, hasLayout: true, packingSize, out bool fieldLayoutAbiStable, out bool fieldHasAutoLayout);
if (!fieldLayoutAbiStable)
layoutAbiStable = false;
+ if (fieldHasAutoLayout)
+ hasAutoLayoutField = true;
largestAlignmentRequired = LayoutInt.Max(fieldSizeAndAlignment.Alignment, largestAlignmentRequired);
@@ -354,7 +358,10 @@ protected ComputedInstanceFieldLayout ComputeExplicitFieldLayout(MetadataType ty
layoutMetadata.Size,
out instanceByteSizeAndAlignment);
- ComputedInstanceFieldLayout computedLayout = new ComputedInstanceFieldLayout();
+ ComputedInstanceFieldLayout computedLayout = new ComputedInstanceFieldLayout
+ {
+ IsAutoLayoutOrHasAutoLayoutFields = hasAutoLayoutField,
+ };
computedLayout.FieldAlignment = instanceSizeAndAlignment.Alignment;
computedLayout.FieldSize = instanceSizeAndAlignment.Size;
computedLayout.ByteCountUnaligned = instanceByteSizeAndAlignment.Size;
@@ -388,15 +395,18 @@ protected ComputedInstanceFieldLayout ComputeSequentialFieldLayout(MetadataType
int fieldOrdinal = 0;
int packingSize = ComputePackingSize(type, layoutMetadata);
bool layoutAbiStable = true;
+ bool hasAutoLayoutField = false;
foreach (var field in type.GetFields())
{
if (field.IsStatic)
continue;
- var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(field.FieldType.UnderlyingType, hasLayout: true, packingSize, out bool fieldLayoutAbiStable);
+ var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(field.FieldType.UnderlyingType, hasLayout: true, packingSize, out bool fieldLayoutAbiStable, out bool fieldHasAutoLayout);
if (!fieldLayoutAbiStable)
layoutAbiStable = false;
+ if (fieldHasAutoLayout)
+ hasAutoLayoutField = true;
largestAlignmentRequirement = LayoutInt.Max(fieldSizeAndAlignment.Alignment, largestAlignmentRequirement);
@@ -415,7 +425,10 @@ protected ComputedInstanceFieldLayout ComputeSequentialFieldLayout(MetadataType
layoutMetadata.Size,
out instanceByteSizeAndAlignment);
- ComputedInstanceFieldLayout computedLayout = new ComputedInstanceFieldLayout();
+ ComputedInstanceFieldLayout computedLayout = new ComputedInstanceFieldLayout
+ {
+ IsAutoLayoutOrHasAutoLayoutFields = hasAutoLayoutField,
+ };
computedLayout.FieldAlignment = instanceSizeAndAlignment.Alignment;
computedLayout.FieldSize = instanceSizeAndAlignment.Size;
computedLayout.ByteCountUnaligned = instanceByteSizeAndAlignment.Size;
@@ -470,7 +483,7 @@ protected ComputedInstanceFieldLayout ComputeAutoFieldLayout(MetadataType type,
{
Debug.Assert(fieldType.IsPrimitive || fieldType.IsPointer || fieldType.IsFunctionPointer || fieldType.IsEnum);
- var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType, hasLayout, packingSize, out bool _);
+ var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType, hasLayout, packingSize, out bool _, out bool _);
instanceNonGCPointerFieldsCount[CalculateLog2(fieldSizeAndAlignment.Size.AsInt)]++;
}
}
@@ -507,7 +520,7 @@ protected ComputedInstanceFieldLayout ComputeAutoFieldLayout(MetadataType type,
TypeDesc fieldType = field.FieldType;
- var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType, hasLayout, packingSize, out bool fieldLayoutAbiStable);
+ var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(fieldType, hasLayout, packingSize, out bool fieldLayoutAbiStable, out bool _);
if (!fieldLayoutAbiStable)
layoutAbiStable = false;
@@ -646,7 +659,7 @@ protected ComputedInstanceFieldLayout ComputeAutoFieldLayout(MetadataType type,
for (int i = 0; i < instanceValueClassFieldsArr.Length; i++)
{
// Align the cumulative field offset to the indeterminate value
- var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(instanceValueClassFieldsArr[i].FieldType, hasLayout, packingSize, out bool fieldLayoutAbiStable);
+ var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(instanceValueClassFieldsArr[i].FieldType, hasLayout, packingSize, out bool fieldLayoutAbiStable, out bool _);
if (!fieldLayoutAbiStable)
layoutAbiStable = false;
@@ -694,7 +707,10 @@ protected ComputedInstanceFieldLayout ComputeAutoFieldLayout(MetadataType type,
classLayoutSize: 0,
byteCount: out instanceByteSizeAndAlignment);
- ComputedInstanceFieldLayout computedLayout = new ComputedInstanceFieldLayout();
+ ComputedInstanceFieldLayout computedLayout = new ComputedInstanceFieldLayout
+ {
+ IsAutoLayoutOrHasAutoLayoutFields = true,
+ };
computedLayout.FieldAlignment = instanceSizeAndAlignment.Alignment;
computedLayout.FieldSize = instanceSizeAndAlignment.Size;
computedLayout.ByteCountUnaligned = instanceByteSizeAndAlignment.Size;
@@ -707,7 +723,7 @@ protected ComputedInstanceFieldLayout ComputeAutoFieldLayout(MetadataType type,
private static void PlaceInstanceField(FieldDesc field, bool hasLayout, int packingSize, FieldAndOffset[] offsets, ref LayoutInt instanceFieldPos, ref int fieldOrdinal, LayoutInt offsetBias)
{
- var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(field.FieldType, hasLayout, packingSize, out bool _);
+ var fieldSizeAndAlignment = ComputeFieldSizeAndAlignment(field.FieldType, hasLayout, packingSize, out bool _, out bool _);
instanceFieldPos = AlignUpInstanceFieldOffset(field.OwningType, instanceFieldPos, fieldSizeAndAlignment.Alignment, field.Context.Target);
offsets[fieldOrdinal] = new FieldAndOffset(field, instanceFieldPos + offsetBias);
@@ -767,10 +783,11 @@ public LayoutInt CalculateFieldBaseOffset(MetadataType type, bool requiresAlign8
return cumulativeInstanceFieldPos;
}
- private static SizeAndAlignment ComputeFieldSizeAndAlignment(TypeDesc fieldType, bool hasLayout, int packingSize, out bool layoutAbiStable)
+ private static SizeAndAlignment ComputeFieldSizeAndAlignment(TypeDesc fieldType, bool hasLayout, int packingSize, out bool layoutAbiStable, out bool fieldTypeHasAutoLayout)
{
SizeAndAlignment result;
layoutAbiStable = true;
+ fieldTypeHasAutoLayout = true;
if (fieldType.IsDefType)
{
@@ -780,6 +797,7 @@ private static SizeAndAlignment ComputeFieldSizeAndAlignment(TypeDesc fieldType,
result.Size = defType.InstanceFieldSize;
result.Alignment = defType.InstanceFieldAlignment;
layoutAbiStable = defType.LayoutAbiStable;
+ fieldTypeHasAutoLayout = defType.IsAutoLayoutOrHasAutoLayoutFields;
}
else
{
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs b/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs
index f062c0daede442..f36f45f00f5cc1 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/TypeSystemHelpers.cs
@@ -287,7 +287,7 @@ public static MethodDesc ResolveInterfaceMethodTarget(this TypeDesc thisType, Me
{
Debug.Assert(interfaceMethodToResolve.OwningType.IsInterface);
- MethodDesc result = null;
+ MethodDesc result;
TypeDesc currentType = thisType;
do
{
@@ -307,7 +307,7 @@ public static MethodDesc ResolveInterfaceMethodTargetWithVariance(this TypeDesc
{
Debug.Assert(interfaceMethodToResolve.OwningType.IsInterface);
- MethodDesc result = null;
+ MethodDesc result;
TypeDesc currentType = thisType;
do
{
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.Algorithm.cs b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.Algorithm.cs
index af5938677a4b4d..b4fc577fb7bb6a 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.Algorithm.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.Algorithm.cs
@@ -51,5 +51,73 @@ private static void FromInstanceLayoutHelper(ref GCPointerMapBuilder builder, De
}
}
}
+
+ ///
+ /// Computes the GC pointer map of the GC static region of the type.
+ ///
+ public static GCPointerMap FromStaticLayout(DefType type)
+ {
+ GCPointerMapBuilder builder = new GCPointerMapBuilder(type.GCStaticFieldSize.AsInt, type.Context.Target.PointerSize);
+
+ foreach (FieldDesc field in type.GetFields())
+ {
+ if (!field.IsStatic || field.HasRva || field.IsLiteral
+ || field.IsThreadStatic || !field.HasGCStaticBase)
+ continue;
+
+ TypeDesc fieldType = field.FieldType;
+ if (fieldType.IsGCPointer)
+ {
+ builder.MarkGCPointer(field.Offset.AsInt);
+ }
+ else
+ {
+ Debug.Assert(fieldType.IsValueType);
+ var fieldDefType = (DefType)fieldType;
+ if (fieldDefType.ContainsGCPointers)
+ {
+ GCPointerMapBuilder innerBuilder =
+ builder.GetInnerBuilder(field.Offset.AsInt, fieldDefType.InstanceByteCount.AsInt);
+ FromInstanceLayoutHelper(ref innerBuilder, fieldDefType);
+ }
+ }
+ }
+
+ Debug.Assert(builder.ToGCMap().Size * type.Context.Target.PointerSize >= type.GCStaticFieldSize.AsInt);
+ return builder.ToGCMap();
+ }
+
+ ///
+ /// Computes the GC pointer map of the thread static region of the type.
+ ///
+ public static GCPointerMap FromThreadStaticLayout(DefType type)
+ {
+ GCPointerMapBuilder builder = new GCPointerMapBuilder(type.ThreadGcStaticFieldSize.AsInt, type.Context.Target.PointerSize);
+
+ foreach (FieldDesc field in type.GetFields())
+ {
+ if (!field.IsStatic || field.HasRva || field.IsLiteral || !field.IsThreadStatic || !field.HasGCStaticBase)
+ continue;
+
+ TypeDesc fieldType = field.FieldType;
+ if (fieldType.IsGCPointer)
+ {
+ builder.MarkGCPointer(field.Offset.AsInt);
+ }
+ else if (fieldType.IsValueType)
+ {
+ var fieldDefType = (DefType)fieldType;
+ if (fieldDefType.ContainsGCPointers)
+ {
+ GCPointerMapBuilder innerBuilder =
+ builder.GetInnerBuilder(field.Offset.AsInt, fieldDefType.InstanceByteCount.AsInt);
+ FromInstanceLayoutHelper(ref innerBuilder, fieldDefType);
+ }
+ }
+ }
+
+ Debug.Assert(builder.ToGCMap().Size * type.Context.Target.PointerSize >= type.ThreadGcStaticFieldSize.AsInt);
+ return builder.ToGCMap();
+ }
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.Aot.cs b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.Aot.cs
deleted file mode 100644
index 4738cde90c6921..00000000000000
--- a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/GCPointerMap.Aot.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using Debug = System.Diagnostics.Debug;
-
-namespace Internal.TypeSystem
-{
- partial struct GCPointerMap
- {
- ///
- /// Computes the GC pointer map of the GC static region of the type.
- ///
- public static GCPointerMap FromStaticLayout(DefType type)
- {
- GCPointerMapBuilder builder = new GCPointerMapBuilder(type.GCStaticFieldSize.AsInt, type.Context.Target.PointerSize);
-
- foreach (FieldDesc field in type.GetFields())
- {
- if (!field.IsStatic || field.HasRva || field.IsLiteral
- || field.IsThreadStatic || !field.HasGCStaticBase)
- continue;
-
- TypeDesc fieldType = field.FieldType;
- if (fieldType.IsGCPointer)
- {
- builder.MarkGCPointer(field.Offset.AsInt);
- }
- else
- {
- Debug.Assert(fieldType.IsValueType);
- var fieldDefType = (DefType)fieldType;
- if (fieldDefType.ContainsGCPointers)
- {
- GCPointerMapBuilder innerBuilder =
- builder.GetInnerBuilder(field.Offset.AsInt, fieldDefType.InstanceByteCount.AsInt);
- FromInstanceLayoutHelper(ref innerBuilder, fieldDefType);
- }
- }
- }
-
- Debug.Assert(builder.ToGCMap().Size * type.Context.Target.PointerSize >= type.GCStaticFieldSize.AsInt);
- return builder.ToGCMap();
- }
-
- ///
- /// Computes the GC pointer map of the thread static region of the type.
- ///
- public static GCPointerMap FromThreadStaticLayout(DefType type)
- {
- GCPointerMapBuilder builder = new GCPointerMapBuilder(type.ThreadGcStaticFieldSize.AsInt, type.Context.Target.PointerSize);
-
- foreach (FieldDesc field in type.GetFields())
- {
- if (!field.IsStatic || field.HasRva || field.IsLiteral || !field.IsThreadStatic || !field.HasGCStaticBase)
- continue;
-
- TypeDesc fieldType = field.FieldType;
- if (fieldType.IsGCPointer)
- {
- builder.MarkGCPointer(field.Offset.AsInt);
- }
- else if (fieldType.IsValueType)
- {
- var fieldDefType = (DefType)fieldType;
- if (fieldDefType.ContainsGCPointers)
- {
- GCPointerMapBuilder innerBuilder =
- builder.GetInnerBuilder(field.Offset.AsInt, fieldDefType.InstanceByteCount.AsInt);
- FromInstanceLayoutHelper(ref innerBuilder, fieldDefType);
- }
- }
- }
-
- Debug.Assert(builder.ToGCMap().Size * type.Context.Target.PointerSize >= type.ThreadGcStaticFieldSize.AsInt);
- return builder.ToGCMap();
- }
- }
-}
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtable.cs b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtable.cs
index eee17ccf0cc482..e915f9518ad043 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtable.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtable.cs
@@ -363,8 +363,7 @@ public bool TryAdd(TValue value)
/// Newly added value, or a value which was already present in the hashtable which is equal to it.
public TValue AddOrGetExisting(TValue value)
{
- bool unused;
- return AddOrGetExistingInner(value, out unused);
+ return AddOrGetExistingInner(value, out _);
}
private TValue AddOrGetExistingInner(TValue value, out bool addedValue)
@@ -584,8 +583,7 @@ public TValue GetOrCreateValue(TKey key)
///
public bool Contains(TKey key)
{
- TValue dummyExistingValue;
- return TryGetValue(key, out dummyExistingValue);
+ return TryGetValue(key, out _);
}
///
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtableOfPointers.cs b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtableOfPointers.cs
index 42b62fc6bb0738..7c03a26c71bc6d 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtableOfPointers.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/Utilities/LockFreeReaderHashtableOfPointers.cs
@@ -326,8 +326,7 @@ public bool TryAdd(TValue value)
/// Newly added value, or a value which was already present in the hashtable which is equal to it.
public TValue AddOrGetExisting(TValue value)
{
- bool unused;
- return AddOrGetExistingInner(value, out unused);
+ return AddOrGetExistingInner(value, out _);
}
private TValue AddOrGetExistingInner(TValue value, out bool addedValue)
@@ -525,8 +524,7 @@ public TValue GetOrCreateValue(TKey key)
///
public bool Contains(TKey key)
{
- TValue dummyExistingValue;
- return TryGetValue(key, out dummyExistingValue);
+ return TryGetValue(key, out _);
}
///
diff --git a/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaAssembly.cs b/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaAssembly.cs
index 0e155fda998f34..5a281d21ba11ad 100644
--- a/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaAssembly.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Ecma/EcmaAssembly.cs
@@ -67,7 +67,7 @@ public override string ToString()
public bool HasAssemblyCustomAttribute(string attributeNamespace, string attributeName)
{
- return _metadataReader.GetCustomAttributeHandle(_assemblyDefinition.GetCustomAttributes(),
+ return !_metadataReader.GetCustomAttributeHandle(_assemblyDefinition.GetCustomAttributes(),
attributeNamespace, attributeName).IsNil;
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/ILDisassembler.cs b/src/coreclr/tools/Common/TypeSystem/IL/ILDisassembler.cs
index 2d1a626cc633d9..f11ed8cf5db8e1 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/ILDisassembler.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/ILDisassembler.cs
@@ -227,8 +227,7 @@ private unsafe double ReadILDouble()
public static void AppendOffset(StringBuilder sb, int offset)
{
- sb.Append("IL_");
- sb.AppendFormat("{0:X4}", offset);
+ sb.Append($"IL_{offset:X4}");
}
private static void PadForInstructionArgument(StringBuilder sb)
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/AssemblyGetExecutingAssemblyMethodThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/AssemblyGetExecutingAssemblyMethodThunk.cs
index ab0e8eee978581..ce1d69716a7b97 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/AssemblyGetExecutingAssemblyMethodThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/AssemblyGetExecutingAssemblyMethodThunk.cs
@@ -44,6 +44,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return $"GetExecutingAssembly_{ExecutingAssembly.GetName().Name}";
+ }
+ }
+
public override TypeDesc OwningType
{
get;
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.Mangling.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.Mangling.cs
index c68f9a10fe2fa6..dd91b65fa90798 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.Mangling.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.Mangling.cs
@@ -20,7 +20,7 @@ string IPrefixMangledSignature.Prefix
{
get
{
- return "Calli";
+ return RuntimeMarshallingEnabled ? "CalliWithRuntimeMarshalling" : "Calli";
}
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.Sorting.cs
index 1c48c00b406078..cd6e620aa86074 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.Sorting.cs
@@ -8,11 +8,16 @@ namespace Internal.IL.Stubs
// Functionality related to deterministic ordering of methods
partial class CalliMarshallingMethodThunk
{
- protected internal override int ClassCode => 1594107963;
+ protected override int ClassCode => 1594107963;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (CalliMarshallingMethodThunk)other;
+ int result = RuntimeMarshallingEnabled.CompareTo(otherMethod.RuntimeMarshallingEnabled);
+ if (result != 0)
+ {
+ return result;
+ }
return comparer.Compare(_targetSignature, otherMethod._targetSignature);
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.cs
index 73b8645e855947..d0d397bafdf388 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/CalliMarshallingMethodThunk.cs
@@ -21,11 +21,13 @@ public partial class CalliMarshallingMethodThunk : ILStubMethod
private MethodSignature _signature;
public CalliMarshallingMethodThunk(MethodSignature targetSignature, TypeDesc owningType,
- InteropStateManager interopStateManager)
+ InteropStateManager interopStateManager,
+ bool runtimeMarshallingEnabled)
{
_targetSignature = targetSignature;
_owningType = owningType;
_interopStateManager = interopStateManager;
+ RuntimeMarshallingEnabled = runtimeMarshallingEnabled;
}
public MethodSignature TargetSignature
@@ -79,6 +81,16 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "CalliMarshallingMethodThunk";
+ }
+ }
+
+ public bool RuntimeMarshallingEnabled { get; }
+
public override PInvokeMetadata GetPInvokeMethodMetadata()
{
// Return PInvokeAttributes.PreserveSig to circumvent marshalling required checks
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.Sorting.cs
index c0a4887211c179..b38cd1fda8e540 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.Sorting.cs
@@ -8,9 +8,9 @@ namespace Internal.IL.Stubs
// Functionality related to deterministic ordering of methods
partial class DelegateMarshallingMethodThunk
{
- protected internal override int ClassCode => 1018037605;
+ protected override int ClassCode => 1018037605;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (DelegateMarshallingMethodThunk)other;
int result = (int)Kind - (int)otherMethod.Kind;
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.cs
index a81809c4193030..5b098630690204 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMarshallingMethodThunk.cs
@@ -27,6 +27,14 @@ public partial class DelegateMarshallingMethodThunk : ILStubMethod
private readonly MethodDesc _invokeMethod;
private MethodSignature _signature; // signature of the native callable marshalling stub
+ public MethodDesc InvokeMethod
+ {
+ get
+ {
+ return _invokeMethod;
+ }
+ }
+
public DelegateMarshallingMethodThunkKind Kind
{
get;
@@ -237,6 +245,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return NamePrefix + "__" + DelegateType.DiagnosticName;
+ }
+ }
+
public override MethodIL EmitIL()
{
return PInvokeILEmitter.EmitIL(this, default(PInvokeILEmitterConfiguration), _interopStateManager);
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.Sorting.cs
index a5aece70b22371..1126e01d4020ba 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.Sorting.cs
@@ -8,7 +8,7 @@ namespace Internal.IL.Stubs
// Functionality related to deterministic ordering of types
partial class DelegateThunk
{
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (DelegateThunk)other;
return comparer.Compare(_delegateInfo.Type, otherMethod._delegateInfo.Type);
@@ -17,39 +17,39 @@ protected internal override int CompareToImpl(MethodDesc other, TypeSystemCompar
partial class DelegateInvokeOpenStaticThunk
{
- protected internal override int ClassCode => 386356101;
+ protected override int ClassCode => 386356101;
}
public sealed partial class DelegateInvokeOpenInstanceThunk
{
- protected internal override int ClassCode => -1787190244;
+ protected override int ClassCode => -1787190244;
}
partial class DelegateInvokeClosedStaticThunk
{
- protected internal override int ClassCode => 28195375;
+ protected override int ClassCode => 28195375;
}
partial class DelegateInvokeMulticastThunk
{
- protected internal override int ClassCode => 639863471;
+ protected override int ClassCode => 639863471;
}
partial class DelegateInvokeInstanceClosedOverGenericMethodThunk
{
- protected internal override int ClassCode => -354480633;
+ protected override int ClassCode => -354480633;
}
partial class DelegateInvokeObjectArrayThunk
{
- protected internal override int ClassCode => 1993292344;
+ protected override int ClassCode => 1993292344;
}
partial class DelegateGetThunkMethodOverride
{
- protected internal override int ClassCode => -321263379;
+ protected override int ClassCode => -321263379;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (DelegateGetThunkMethodOverride)other;
return comparer.Compare(_delegateInfo.Type, otherMethod._delegateInfo.Type);
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.cs
index 5725a062a086e2..5e9ed17fbc478b 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateThunks.cs
@@ -90,6 +90,14 @@ protected FieldDesc FunctionPointerField
return SystemDelegateType.GetKnownField("m_functionPointer");
}
}
+
+ public sealed override string DiagnosticName
+ {
+ get
+ {
+ return Name;
+ }
+ }
}
///
@@ -718,7 +726,8 @@ public override MethodIL EmitIL()
Debug.Assert(_delegateInfo.Thunks[i] == null);
var sig = new DynamicInvokeMethodSignature(_delegateInfo.Signature);
- MethodDesc thunk = Context.GetDynamicInvokeThunk(sig);
+ // TODO: layering violation. Should move delegate thunk stuff to ILCompiler.Compiler.
+ MethodDesc thunk = ((ILCompiler.CompilerTypeSystemContext)Context).GetDynamicInvokeThunk(sig);
if (thunk.HasInstantiation)
{
@@ -779,5 +788,13 @@ public override string Name
return "GetThunk";
}
}
+
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "GetThunk";
+ }
+ }
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.Sorting.cs
index 43da587d086346..29976d1a659c4e 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.Sorting.cs
@@ -11,9 +11,9 @@ namespace Internal.IL.Stubs
// Functionality related to determinstic ordering of types
partial class DynamicInvokeMethodThunk
{
- protected internal override int ClassCode => -1980933220;
+ protected override int ClassCode => -1980933220;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
return CompareTo((DynamicInvokeMethodThunk)other);
}
@@ -51,9 +51,9 @@ private int CompareTo(DynamicInvokeMethodThunk otherMethod)
partial class DynamicInvokeThunkGenericParameter
{
- protected internal override int ClassCode => -234393261;
+ protected override int ClassCode => -234393261;
- protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
{
var otherType = (DynamicInvokeThunkGenericParameter)other;
int result = Index - otherType.Index;
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.cs
index 90ce50f8425ca4..de076f3b8cbff8 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/DynamicInvokeMethodThunk.cs
@@ -308,6 +308,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return Name;
+ }
+ }
+
public override MethodIL EmitIL()
{
ILEmitter emitter = new ILEmitter();
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.Sorting.cs
index d6ae00c139863f..33b07a8e86f109 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.Sorting.cs
@@ -8,9 +8,9 @@ namespace Internal.IL.Stubs
// Functionality related to deterministic ordering of types
partial class EnumGetHashCodeThunk
{
- protected internal override int ClassCode => 261739662;
+ protected override int ClassCode => 261739662;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (EnumGetHashCodeThunk)other;
return comparer.Compare(_owningType, otherMethod._owningType);
@@ -19,9 +19,9 @@ protected internal override int CompareToImpl(MethodDesc other, TypeSystemCompar
partial class EnumEqualsThunk
{
- protected internal override int ClassCode => -1774524780;
+ protected override int ClassCode => -1774524780;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (EnumEqualsThunk)other;
return comparer.Compare(_owningType, otherMethod._owningType);
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.cs
index a44161e6fa354b..dc8fba49876afc 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/EnumThunks.cs
@@ -64,6 +64,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "GetHashCode";
+ }
+ }
+
public override bool IsVirtual
{
get
@@ -147,6 +155,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "Equals";
+ }
+ }
+
public override bool IsVirtual
{
get
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.Sorting.cs
index 7bdbbadd0d00fc..66d5142caa2878 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.Sorting.cs
@@ -8,9 +8,9 @@ namespace Internal.IL.Stubs
// Functionality related to deterministic ordering of types
partial class ForwardDelegateCreationThunk
{
- protected internal override int ClassCode => 1026039617;
+ protected override int ClassCode => 1026039617;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (ForwardDelegateCreationThunk)other;
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.cs
index e93d385a0ffcf6..fd1e907f844031 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ForwardDelegateCreationThunk.cs
@@ -75,6 +75,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "ForwardDelegateCreationStub__" + DelegateType.DiagnosticName;
+ }
+ }
+
///
/// This thunk creates a delegate from a native function pointer
/// by first creating a PInvokeDelegateWrapper from the function pointer
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/MethodBaseGetCurrentMethodThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/MethodBaseGetCurrentMethodThunk.cs
index d75feac0fe9bdc..82a729dc3eb2db 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/MethodBaseGetCurrentMethodThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/MethodBaseGetCurrentMethodThunk.cs
@@ -44,6 +44,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return Method.DiagnosticName;
+ }
+ }
+
public override TypeDesc OwningType
{
get
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeILEmitter.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeILEmitter.cs
index d77bb5994ec0e5..81245ffe82515a 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeILEmitter.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeILEmitter.cs
@@ -12,11 +12,6 @@ namespace Internal.IL.Stubs
{
///
/// Provides method bodies for PInvoke methods
- ///
- /// This by no means intends to provide full PInvoke support. The intended use of this is to
- /// a) prevent calls getting generated to targets that require a full marshaller
- /// (this compiler doesn't provide that), and b) offer a hand in some very simple marshalling
- /// situations (but support for this part might go away as the product matures).
///
public struct PInvokeILEmitter
{
@@ -55,23 +50,27 @@ private static Marshaller[] InitializeMarshallers(MethodDesc targetMethod, Inter
{
MarshalDirection direction = MarshalDirection.Forward;
MethodSignature methodSig;
+ bool runtimeMarshallingEnabled;
switch (targetMethod)
{
case DelegateMarshallingMethodThunk delegateMethod:
methodSig = delegateMethod.DelegateSignature;
direction = delegateMethod.Direction;
+ runtimeMarshallingEnabled = MarshalHelpers.IsRuntimeMarshallingEnabled(delegateMethod.DelegateType.Module);
break;
case CalliMarshallingMethodThunk calliMethod:
methodSig = calliMethod.TargetSignature;
+ runtimeMarshallingEnabled = calliMethod.RuntimeMarshallingEnabled;
break;
default:
methodSig = targetMethod.Signature;
+ runtimeMarshallingEnabled = MarshalHelpers.IsRuntimeMarshallingEnabled(((MetadataType)targetMethod.OwningType).Module);
break;
}
int indexOffset = 0;
if (!methodSig.IsStatic && direction == MarshalDirection.Forward)
{
- // For instance methods(eg. Forward delegate marshalling thunk), first argument is
+ // For instance methods(eg. Forward delegate marshalling thunk), first argument is
// the instance
indexOffset = 1;
}
@@ -88,7 +87,7 @@ private static Marshaller[] InitializeMarshallers(MethodDesc targetMethod, Inter
// if we don't have metadata for the parameter, create a dummy one
parameterMetadata = new ParameterMetadata(i, ParameterMetadataAttributes.None, null);
}
- else
+ else
{
Debug.Assert(i == parameterMetadataArray[parameterIndex].Index);
parameterMetadata = parameterMetadataArray[parameterIndex++];
@@ -104,7 +103,7 @@ private static Marshaller[] InitializeMarshallers(MethodDesc targetMethod, Inter
{
// PreserveSig = false can only show up an regular forward PInvokes
Debug.Assert(direction == MarshalDirection.Forward);
-
+
parameterType = methodSig.Context.GetByRefType(parameterType);
isHRSwappedRetVal = true;
}
@@ -114,20 +113,35 @@ private static Marshaller[] InitializeMarshallers(MethodDesc targetMethod, Inter
parameterType = methodSig[i - 1];
}
- marshallers[i] = Marshaller.CreateMarshaller(parameterType,
- parameterIndex,
- methodSig.GetEmbeddedSignatureData(),
- MarshallerType.Argument,
- parameterMetadata.MarshalAsDescriptor,
- direction,
- marshallers,
- interopStateManager,
- indexOffset + parameterMetadata.Index,
- flags,
- parameterMetadata.In,
- isHRSwappedRetVal ? true : parameterMetadata.Out,
- isHRSwappedRetVal ? false : parameterMetadata.Return
- );
+ if (runtimeMarshallingEnabled)
+ {
+ marshallers[i] = Marshaller.CreateMarshaller(parameterType,
+ parameterIndex,
+ methodSig.GetEmbeddedSignatureData(),
+ MarshallerType.Argument,
+ parameterMetadata.MarshalAsDescriptor,
+ direction,
+ marshallers,
+ interopStateManager,
+ indexOffset + parameterMetadata.Index,
+ flags,
+ parameterMetadata.In,
+ isHRSwappedRetVal ? true : parameterMetadata.Out,
+ isHRSwappedRetVal ? false : parameterMetadata.Return
+ );
+ }
+ else
+ {
+ marshallers[i] = Marshaller.CreateDisabledMarshaller(
+ parameterType,
+ parameterIndex,
+ MarshallerType.Argument,
+ direction,
+ marshallers,
+ indexOffset + parameterMetadata.Index,
+ flags,
+ parameterMetadata.Return);
+ }
}
return marshallers;
@@ -146,10 +160,10 @@ private void EmitDelegateCall(DelegateMarshallingMethodThunk delegateMethod, PIn
if (delegateMethod.Kind == DelegateMarshallingMethodThunkKind.ReverseOpenStatic)
{
//
- // For Open static delegates call
+ // For Open static delegates call
// InteropHelpers.GetCurrentCalleeOpenStaticDelegateFunctionPointer()
// which returns a function pointer. Just call the function pointer and we are done.
- //
+ //
TypeDesc[] parameters = new TypeDesc[_marshallers.Length - 1];
for (int i = 1; i < _marshallers.Length; i++)
{
@@ -193,7 +207,7 @@ private void EmitDelegateCall(DelegateMarshallingMethodThunk delegateMethod, PIn
else if (delegateMethod.Kind == DelegateMarshallingMethodThunkKind
.ForwardNativeFunctionWrapper)
{
- // if the SetLastError flag is set in UnmanagedFunctionPointerAttribute, clear the error code before doing P/Invoke
+ // if the SetLastError flag is set in UnmanagedFunctionPointerAttribute, clear the error code before doing P/Invoke
if (_flags.SetLastError)
{
callsiteSetupCodeStream.Emit(ILOpcode.call, emitter.NewToken(
@@ -225,7 +239,7 @@ private void EmitDelegateCall(DelegateMarshallingMethodThunk delegateMethod, PIn
MethodSignatureFlags unmanagedCallingConvention = _flags.UnmanagedCallingConvention;
if (unmanagedCallingConvention == MethodSignatureFlags.None)
unmanagedCallingConvention = MethodSignatureFlags.UnmanagedCallingConvention;
-
+
MethodSignature nativeSig = new MethodSignature(
MethodSignatureFlags.Static | unmanagedCallingConvention, 0, nativeReturnType, nativeParameterTypes);
@@ -257,9 +271,16 @@ private void EmitPInvokeCall(PInvokeILCodeStreams ilCodeStreams)
TypeDesc nativeReturnType = _flags.PreserveSig ? _marshallers[0].NativeParameterType : context.GetWellKnownType(WellKnownType.Int32);
TypeDesc[] nativeParameterTypes = new TypeDesc[isHRSwappedRetVal ? _marshallers.Length : _marshallers.Length - 1];
- // if the SetLastError flag is set in DllImport, clear the error code before doing P/Invoke
+ bool runtimeMarshallingEnabled = MarshalHelpers.IsRuntimeMarshallingEnabled(((MetadataType)_targetMethod.OwningType).Module);
+
+ // if the SetLastError flag is set in DllImport, clear the error code before doing P/Invoke
if (_flags.SetLastError)
{
+ if (!runtimeMarshallingEnabled)
+ {
+ // When runtime marshalling is disabled, we don't support SetLastError
+ throw new NotSupportedException();
+ }
callsiteSetupCodeStream.Emit(ILOpcode.call, emitter.NewToken(
InteropTypes.GetPInvokeMarshal(context).GetKnownMethod("ClearLastError", null)));
}
@@ -271,6 +292,11 @@ private void EmitPInvokeCall(PInvokeILCodeStreams ilCodeStreams)
if (isHRSwappedRetVal)
{
+ if (!runtimeMarshallingEnabled)
+ {
+ // When runtime marshalling is disabled, we don't support HResult-return-swapping
+ throw new NotSupportedException();
+ }
nativeParameterTypes[_marshallers.Length - 1] = _marshallers[0].NativeParameterType;
}
@@ -364,6 +390,9 @@ private void EmitCalli(PInvokeILCodeStreams ilCodeStreams, CalliMarshallingMetho
private MethodIL EmitIL()
{
+ if (_targetMethod.HasCustomAttribute("System.Runtime.InteropServices", "LCIDConversionAttribute"))
+ throw new NotSupportedException();
+
PInvokeILCodeStreams pInvokeILCodeStreams = new PInvokeILCodeStreams();
ILEmitter emitter = pInvokeILCodeStreams.Emitter;
ILCodeStream marshallingCodestream = pInvokeILCodeStreams.MarshallingCodeStream;
@@ -417,8 +446,8 @@ private MethodIL EmitIL()
return new PInvokeILStubMethodIL((ILStubMethodIL)emitter.Link(_targetMethod), IsStubRequired());
}
- public static MethodIL EmitIL(MethodDesc method,
- PInvokeILEmitterConfiguration pinvokeILEmitterConfiguration,
+ public static MethodIL EmitIL(MethodDesc method,
+ PInvokeILEmitterConfiguration pinvokeILEmitterConfiguration,
InteropStateManager interopStateManager)
{
try
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeLazyFixupField.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeLazyFixupField.Sorting.cs
index edfccf89890e67..d3156fbefb2cf4 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeLazyFixupField.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/PInvokeLazyFixupField.Sorting.cs
@@ -7,9 +7,9 @@ namespace Internal.IL.Stubs
{
partial class PInvokeLazyFixupField
{
- protected internal override int ClassCode => -1784477702;
+ protected override int ClassCode => -1784477702;
- protected internal override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer)
{
return comparer.Compare(_targetMethod, ((PInvokeLazyFixupField)other)._targetMethod);
}
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.Sorting.cs
index f2eee55f961086..0cbb4f7e7c6c38 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.Sorting.cs
@@ -8,9 +8,9 @@ namespace Internal.IL.Stubs
// Functionality related to deterministic ordering of types
partial class StructMarshallingThunk
{
- protected internal override int ClassCode => 340834018;
+ protected override int ClassCode => 340834018;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (StructMarshallingThunk)other;
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.cs
index cf346c06852173..2751290f0c91ef 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/StructMarshallingThunk.cs
@@ -126,6 +126,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return NamePrefix + "__" + ManagedType.DiagnosticName;
+ }
+ }
+
private Marshaller[] InitializeMarshallers()
{
Debug.Assert(_interopStateManager != null);
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/TypeGetTypeMethodThunk.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/TypeGetTypeMethodThunk.cs
index be09098c5dab6a..b1a32586bef3f5 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/TypeGetTypeMethodThunk.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/TypeGetTypeMethodThunk.cs
@@ -41,6 +41,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return $"{_helperMethod.DiagnosticName}_{Signature.Length}_{DefaultAssemblyName}";
+ }
+ }
+
public override TypeDesc OwningType
{
get;
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.Sorting.cs
index 882a4419e2e242..e12b3bc41567f9 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.Sorting.cs
@@ -7,9 +7,9 @@ namespace Internal.IL.Stubs
{
partial class ValueTypeGetFieldHelperMethodOverride
{
- protected internal override int ClassCode => 2036839816;
+ protected override int ClassCode => 2036839816;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (ValueTypeGetFieldHelperMethodOverride)other;
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.cs b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.cs
index a324de7bb222be..a5cfa2db42e5ec 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.cs
+++ b/src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.cs
@@ -149,5 +149,13 @@ public override string Name
return "__GetFieldHelper";
}
}
+
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "__GetFieldHelper";
+ }
+ }
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.Sorting.cs
index 2bcee373962bea..c8655241711389 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.Sorting.cs
@@ -6,9 +6,9 @@ namespace Internal.TypeSystem.Interop
// Functionality related to determinstic ordering of types
partial class InlineArrayType
{
- protected internal override int ClassCode => 226817075;
+ protected override int ClassCode => 226817075;
- protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
{
var otherType = (InlineArrayType)other;
int result = (int)Length - (int)otherType.Length;
@@ -20,9 +20,9 @@ protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer
partial class InlineArrayMethod
{
- protected internal override int ClassCode => -1303220581;
+ protected override int ClassCode => -1303220581;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var otherMethod = (InlineArrayMethod)other;
@@ -30,19 +30,19 @@ protected internal override int CompareToImpl(MethodDesc other, TypeSystemCompar
if (result != 0)
return result;
- return comparer.CompareWithinClass(OwningType, otherMethod.OwningType);
+ return comparer.Compare(OwningType, otherMethod.OwningType);
}
}
partial class InlineArrayField
{
- protected internal override int ClassCode => 1542668652;
+ protected override int ClassCode => 1542668652;
- protected internal override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer)
{
var otherField = (InlineArrayField)other;
- return comparer.CompareWithinClass(OwningType, otherField.OwningType);
+ return comparer.Compare(OwningType, otherField.OwningType);
}
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.cs
index 6462c6ee2c59c7..4cf06e8b6bfb4f 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/InlineArrayType.cs
@@ -35,6 +35,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "_InlineArray__" + ElementType.DiagnosticName + "__" + Length;
+ }
+ }
+
public override string Namespace
{
get
@@ -43,6 +51,14 @@ public override string Namespace
}
}
+ public override string DiagnosticNamespace
+ {
+ get
+ {
+ return Namespace;
+ }
+ }
+
public override Instantiation Instantiation
{
get
@@ -320,6 +336,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return Name;
+ }
+ }
+
public override MethodSignature Signature
{
get
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.Aot.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.Aot.cs
index 8925f9964b093c..b047f29e9ec64f 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.Aot.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.Aot.cs
@@ -126,7 +126,7 @@ public static MethodIL EmitExceptionBody(string message, MethodDesc method)
TypeSystemContext context = method.Context;
MethodSignature ctorSignature = new MethodSignature(0, 0, context.GetWellKnownType(WellKnownType.Void),
new TypeDesc[] { context.GetWellKnownType(WellKnownType.String) });
- MethodDesc exceptionCtor = method.Context.GetWellKnownType(WellKnownType.Exception).GetKnownMethod(".ctor", ctorSignature);
+ MethodDesc exceptionCtor = InteropTypes.GetMarshalDirectiveException(context).GetKnownMethod(".ctor", ctorSignature);
ILCodeStream codeStream = emitter.NewCodeStream();
codeStream.Emit(ILOpcode.ldstr, emitter.NewToken(message));
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs
index a736d065dd8332..b50d0406129ba6 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshalHelpers.cs
@@ -5,6 +5,7 @@
using Internal.IL;
using Debug = System.Diagnostics.Debug;
using Internal.IL.Stubs;
+using Internal.TypeSystem.Ecma;
namespace Internal.TypeSystem.Interop
{
@@ -75,6 +76,7 @@ internal static TypeDesc GetNativeTypeFromMarshallerKind(TypeDesc type,
#if !READYTORUN
case MarshallerKind.Struct:
case MarshallerKind.LayoutClass:
+ Debug.Assert(interopStateManager is not null, "An InteropStateManager is required to look up the native representation of a non-blittable struct or class with layout.");
return interopStateManager.GetStructMarshallingNativeType((MetadataType)type);
#endif
@@ -521,7 +523,7 @@ internal static MarshallerKind GetMarshallerKind(
else
return MarshallerKind.Invalid;
}
- else if (type.IsDelegate)
+ else if (type.IsDelegate || InteropTypes.IsSystemDelegate(context, type) || InteropTypes.IsSystemMulticastDelegate(context, type))
{
if (type.HasInstantiation)
{
@@ -844,6 +846,37 @@ private static MarshallerKind GetArrayElementMarshallerKind(
}
}
+ internal static MarshallerKind GetDisabledMarshallerKind(
+ TypeDesc type)
+ {
+ if (type.Category == TypeFlags.Void)
+ {
+ return MarshallerKind.VoidReturn;
+ }
+ else if (type.IsByRef)
+ {
+ // Managed refs are not supported when runtime marshalling is disabled.
+ return MarshallerKind.Invalid;
+ }
+ else if (type.IsPrimitive)
+ {
+ return MarshallerKind.BlittableValue;
+ }
+ else if (type.IsPointer || type.IsFunctionPointer)
+ {
+ return MarshallerKind.BlittableValue;
+ }
+ else if (type.IsValueType)
+ {
+ var defType = (DefType)type;
+ if (!defType.ContainsGCPointers && !defType.IsAutoLayoutOrHasAutoLayoutFields)
+ {
+ return MarshallerKind.BlittableValue;
+ }
+ }
+ return MarshallerKind.Invalid;
+ }
+
internal static bool ShouldCheckForPendingException(TargetDetails target, PInvokeMetadata metadata)
{
if (!target.IsOSX)
@@ -861,5 +894,10 @@ internal static bool ShouldCheckForPendingException(TargetDetails target, PInvok
return metadata.Module.Equals(ObjectiveCLibrary)
&& metadata.Name.StartsWith(ObjectiveCMsgSend);
}
+
+ public static bool IsRuntimeMarshallingEnabled(ModuleDesc module)
+ {
+ return module.Assembly is not EcmaAssembly assembly || !assembly.HasAssemblyCustomAttribute("System.Runtime.CompilerServices", "DisableRuntimeMarshallingAttribute");
+ }
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs
index 40e316e2834288..7b7e3a24d9813a 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/Marshaller.cs
@@ -11,65 +11,12 @@
namespace Internal.TypeSystem.Interop
{
- enum MarshallerKind
- {
- Unknown,
- BlittableValue,
- Array,
- BlittableArray,
- Bool, // 4 byte bool
- CBool, // 1 byte bool
- VariantBool, // Variant bool
- Enum,
- AnsiChar, // Marshal char (Unicode 16bits) for byte (Ansi 8bits)
- UnicodeChar,
- AnsiCharArray,
- ByValArray,
- ByValAnsiCharArray, // Particular case of ByValArray because the conversion between wide Char and Byte need special treatment.
- AnsiString,
- UnicodeString,
- UTF8String,
- AnsiBSTRString,
- BSTRString,
- ByValAnsiString,
- ByValUnicodeString,
- AnsiStringBuilder,
- UnicodeStringBuilder,
- FunctionPointer,
- SafeHandle,
- CriticalHandle,
- HandleRef,
- VoidReturn,
- Variant,
- Object,
- OleDateTime,
- Decimal,
- OleCurrency,
- Guid,
- Struct,
- BlittableStruct,
- BlittableStructPtr, // Additional indirection on top of blittable struct. Used by MarshalAs(LpStruct)
- LayoutClass,
- LayoutClassPtr,
- AsAnyA,
- AsAnyW,
- ComInterface,
- BlittableValueClassWithCopyCtor,
- Invalid
- }
public enum MarshalDirection
{
Forward, // safe-to-unsafe / managed-to-native
Reverse, // unsafe-to-safe / native-to-managed
}
- public enum MarshallerType
- {
- Argument,
- Element,
- Field
- }
-
// Each type of marshaller knows how to generate the marshalling code for the argument it marshals.
// Marshallers contain method related marshalling information (which is common to all the Marshallers)
// and also argument specific marshalling informaiton
@@ -382,6 +329,44 @@ public static Marshaller CreateMarshaller(TypeDesc parameterType,
return marshaller;
}
+
+ ///
+ /// Create a marshaller
+ ///
+ /// type of the parameter to marshal
+ /// The created Marshaller
+ public static Marshaller CreateDisabledMarshaller(TypeDesc parameterType,
+ int? parameterIndex,
+ MarshallerType marshallerType,
+ MarshalDirection direction,
+ Marshaller[] marshallers,
+ int index,
+ PInvokeFlags flags,
+ bool isReturn)
+ {
+ MarshallerKind marshallerKind = MarshalHelpers.GetDisabledMarshallerKind(parameterType);
+
+ TypeSystemContext context = parameterType.Context;
+ // Create the marshaller based on MarshallerKind
+ Marshaller marshaller = CreateMarshaller(marshallerKind);
+ marshaller.Context = context;
+ marshaller.MarshallerKind = marshallerKind;
+ marshaller.MarshallerType = marshallerType;
+ marshaller.ElementMarshallerKind = MarshallerKind.Unknown;
+ marshaller.ManagedParameterType = parameterType;
+ marshaller.ManagedType = parameterType;
+ marshaller.Return = isReturn;
+ marshaller.IsManagedByRef = false;
+ marshaller.IsNativeByRef = false;
+ marshaller.MarshalDirection = direction;
+ marshaller.MarshalAsDescriptor = null;
+ marshaller.Marshallers = marshallers;
+ marshaller.Index = index;
+ marshaller.PInvokeFlags = flags;
+ marshaller.In = true;
+ marshaller.Out = false;
+ return marshaller;
+ }
#endregion
@@ -1613,7 +1598,7 @@ protected override void EmitCleanupManaged(ILCodeStream codeStream)
class AnsiStringMarshaller : Marshaller
{
#if READYTORUN
- const int MAX_LOCAL_BUFFER_LENGTH = 260 + 1; // MAX_PATH + 1
+ const int MAX_LOCAL_BUFFER_LENGTH = 260 + 1; // MAX_PATH + 1
private ILLocalVariable? _localBuffer = null;
#endif
@@ -1650,7 +1635,7 @@ protected override void TransformManagedToNative(ILCodeStream codeStream)
.GetKnownMethod("ConvertToNative", null);
bool bPassByValueInOnly = In && !Out && !IsManagedByRef;
-
+
if (bPassByValueInOnly)
{
var bufSize = emitter.NewLocal(Context.GetWellKnownType(WellKnownType.Int32));
@@ -1685,7 +1670,7 @@ protected override void TransformManagedToNative(ILCodeStream codeStream)
codeStream.EmitStLoc(bufSize);
// if (MAX_LOCAL_BUFFER_LENGTH < BufSize ) goto NoOptimize
- codeStream.EmitLdc(MAX_LOCAL_BUFFER_LENGTH + 1);
+ codeStream.EmitLdc(MAX_LOCAL_BUFFER_LENGTH + 1);
codeStream.EmitLdLoc(bufSize);
codeStream.Emit(ILOpcode.clt);
codeStream.Emit(ILOpcode.brtrue, noOptimize);
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshallerKind.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshallerKind.cs
new file mode 100644
index 00000000000000..37d09857b694ad
--- /dev/null
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/MarshallerKind.cs
@@ -0,0 +1,59 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+namespace Internal.TypeSystem.Interop
+{
+ enum MarshallerKind
+ {
+ Unknown,
+ BlittableValue,
+ Array,
+ BlittableArray,
+ Bool, // 4 byte bool
+ CBool, // 1 byte bool
+ VariantBool, // Variant bool
+ Enum,
+ AnsiChar, // Marshal char (Unicode 16bits) for byte (Ansi 8bits)
+ UnicodeChar,
+ AnsiCharArray,
+ ByValArray,
+ ByValAnsiCharArray, // Particular case of ByValArray because the conversion between wide Char and Byte need special treatment.
+ AnsiString,
+ UnicodeString,
+ UTF8String,
+ AnsiBSTRString,
+ BSTRString,
+ ByValAnsiString,
+ ByValUnicodeString,
+ AnsiStringBuilder,
+ UnicodeStringBuilder,
+ FunctionPointer,
+ SafeHandle,
+ CriticalHandle,
+ HandleRef,
+ VoidReturn,
+ Variant,
+ Object,
+ OleDateTime,
+ Decimal,
+ OleCurrency,
+ Guid,
+ Struct,
+ BlittableStruct,
+ BlittableStructPtr, // Additional indirection on top of blittable struct. Used by MarshalAs(LpStruct)
+ LayoutClass,
+ LayoutClassPtr,
+ AsAnyA,
+ AsAnyW,
+ ComInterface,
+ BlittableValueClassWithCopyCtor,
+ Invalid
+ }
+
+ public enum MarshallerType
+ {
+ Argument,
+ Element,
+ Field
+ }
+}
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.Sorting.cs
index 0da2d42007d56b..bcd97084e56718 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.Sorting.cs
@@ -6,18 +6,18 @@ namespace Internal.TypeSystem.Interop
// Functionality related to determinstic ordering of types
partial class NativeStructType
{
- protected internal override int ClassCode => -377751537;
+ protected override int ClassCode => -377751537;
- protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
{
return comparer.Compare(ManagedStructType, ((NativeStructType)other).ManagedStructType);
}
partial class NativeStructField
{
- protected internal override int ClassCode => 1580219745;
+ protected override int ClassCode => 1580219745;
- protected internal override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(FieldDesc other, TypeSystemComparer comparer)
{
return comparer.Compare(_managedField, ((NativeStructField)other)._managedField);
}
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.cs
index d20d6fafcc0dc9..bf5e0c6ef3d7ba 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.cs
@@ -28,6 +28,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "__NativeType__" + ManagedStructType.DiagnosticName;
+ }
+ }
+
public override string Namespace
{
get
@@ -36,6 +44,14 @@ public override string Namespace
}
}
+ public override string DiagnosticNamespace
+ {
+ get
+ {
+ return "Internal.CompilerGenerated";
+ }
+ }
+
public override PInvokeStringFormat PInvokeStringFormat
{
get
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.Sorting.cs
index 6b4f6b9ca06206..72948268466607 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.Sorting.cs
@@ -6,9 +6,9 @@ namespace Internal.TypeSystem.Interop
// Functionality related to determinstic ordering of types
partial class PInvokeDelegateWrapper
{
- protected internal override int ClassCode => -262930217;
+ protected override int ClassCode => -262930217;
- protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
{
return comparer.Compare(DelegateType, ((PInvokeDelegateWrapper)other).DelegateType);
}
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.cs
index 78cbe796e397f1..dcc2fbff41c065 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapper.cs
@@ -35,6 +35,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "PInvokeDelegateWrapper__" + DelegateType.DiagnosticName;
+ }
+ }
+
public override string Namespace
{
get
@@ -43,6 +51,14 @@ public override string Namespace
}
}
+ public override string DiagnosticNamespace
+ {
+ get
+ {
+ return "Internal.CompilerGenerated";
+ }
+ }
+
public override bool IsExplicitLayout
{
get
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.Sorting.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.Sorting.cs
index 2509b265ea71e8..5fe9290213b2f6 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.Sorting.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.Sorting.cs
@@ -6,9 +6,9 @@ namespace Internal.TypeSystem.Interop
// Functionality related to deterministic ordering of methods
partial class PInvokeDelegateWrapperConstructor
{
- protected internal override int ClassCode => 1000342011;
+ protected override int ClassCode => 1000342011;
- protected internal override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(MethodDesc other, TypeSystemComparer comparer)
{
var owningType = (PInvokeDelegateWrapper)OwningType;
var otherOwningType = (PInvokeDelegateWrapper)other.OwningType;
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.cs b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.cs
index 6917c71f656e42..2e138f6098c7ff 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/IL/PInvokeDelegateWrapperConstructor.cs
@@ -33,6 +33,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return ".ctor";
+ }
+ }
+
private MethodSignature _signature;
public override MethodSignature Signature
{
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/InteropStateManager.cs b/src/coreclr/tools/Common/TypeSystem/Interop/InteropStateManager.cs
index 202fcce90becef..0d594010328e67 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/InteropStateManager.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/InteropStateManager.cs
@@ -38,7 +38,7 @@ public InteropStateManager(ModuleDesc generatedAssembly)
//
// Delegate Marshalling Stubs
//
-
+
///
/// Generates marshalling stubs for open static delegates
///
@@ -105,9 +105,9 @@ public PInvokeDelegateWrapper GetPInvokeDelegateWrapper(TypeDesc delegateType)
}
//
- // Struct Marshalling
+ // Struct Marshalling
// To support struct marshalling compiler needs to generate a native type which
- // imitates the original struct being passed to managed side with corresponding
+ // imitates the original struct being passed to managed side with corresponding
// fields of marshalled types. Additionally it needs to generate three thunks
// 1. Managed to Native Thunk: For forward marshalling
// 2. Native to Managed Thunk: For reverse marshalling
@@ -186,9 +186,9 @@ public FieldDesc GetPInvokeLazyFixupField(MethodDesc method)
return _pInvokeLazyFixupFieldHashtable.GetOrCreateValue(method);
}
- public MethodDesc GetPInvokeCalliStub(MethodSignature signature)
+ public MethodDesc GetPInvokeCalliStub(MethodSignature signature, ModuleDesc moduleContext)
{
- return _pInvokeCalliHashtable.GetOrCreateValue(signature);
+ return _pInvokeCalliHashtable.GetOrCreateValue(new CalliMarshallingMethodThunkKey(signature, MarshalHelpers.IsRuntimeMarshallingEnabled(moduleContext)));
}
private class NativeStructTypeHashtable : LockFreeReaderHashtable
@@ -355,7 +355,7 @@ protected override bool CompareValueToValue(DelegateMarshallingMethodThunk value
protected override DelegateMarshallingMethodThunk CreateValueFromKey(DelegateMarshallingStubHashtableKey key)
{
- return new DelegateMarshallingMethodThunk(key.DelegateType, _owningType,
+ return new DelegateMarshallingMethodThunk(key.DelegateType, _owningType,
_interopStateManager, key.Kind);
}
@@ -478,34 +478,36 @@ public PInvokeLazyFixupFieldHashtable(DefType owningType)
}
}
- private class PInvokeCalliHashtable : LockFreeReaderHashtable
+ private readonly record struct CalliMarshallingMethodThunkKey(MethodSignature Signature, bool RuntimeMarshallingEnabled);
+
+ private class PInvokeCalliHashtable : LockFreeReaderHashtable
{
private readonly InteropStateManager _interopStateManager;
private readonly TypeDesc _owningType;
- protected override int GetKeyHashCode(MethodSignature key)
+ protected override int GetKeyHashCode(CalliMarshallingMethodThunkKey key)
{
return key.GetHashCode();
}
protected override int GetValueHashCode(CalliMarshallingMethodThunk value)
{
- return value.TargetSignature.GetHashCode();
+ return new CalliMarshallingMethodThunkKey(value.TargetSignature, value.RuntimeMarshallingEnabled).GetHashCode();
}
- protected override bool CompareKeyToValue(MethodSignature key, CalliMarshallingMethodThunk value)
+ protected override bool CompareKeyToValue(CalliMarshallingMethodThunkKey key, CalliMarshallingMethodThunk value)
{
- return key.Equals(value.TargetSignature);
+ return key.Signature.Equals(value.TargetSignature) && key.RuntimeMarshallingEnabled == value.RuntimeMarshallingEnabled;
}
protected override bool CompareValueToValue(CalliMarshallingMethodThunk value1, CalliMarshallingMethodThunk value2)
{
- return value1.TargetSignature.Equals(value2.TargetSignature);
+ return value1.TargetSignature.Equals(value2.TargetSignature) && value1.RuntimeMarshallingEnabled == value2.RuntimeMarshallingEnabled;
}
- protected override CalliMarshallingMethodThunk CreateValueFromKey(MethodSignature key)
+ protected override CalliMarshallingMethodThunk CreateValueFromKey(CalliMarshallingMethodThunkKey key)
{
- return new CalliMarshallingMethodThunk(key, _owningType, _interopStateManager);
+ return new CalliMarshallingMethodThunk(key.Signature, _owningType, _interopStateManager, key.RuntimeMarshallingEnabled);
}
public PInvokeCalliHashtable(InteropStateManager interopStateManager, TypeDesc owningType)
diff --git a/src/coreclr/tools/Common/TypeSystem/Interop/InteropTypes.cs b/src/coreclr/tools/Common/TypeSystem/Interop/InteropTypes.cs
index 4007dc756494ee..ac32fbbe54647b 100644
--- a/src/coreclr/tools/Common/TypeSystem/Interop/InteropTypes.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Interop/InteropTypes.cs
@@ -54,6 +54,11 @@ public static MetadataType GetNativeFunctionPointerWrapper(TypeSystemContext con
return context.SystemModule.GetKnownType("System.Runtime.InteropServices", "NativeFunctionPointerWrapper");
}
+ public static MetadataType GetMarshalDirectiveException(TypeSystemContext context)
+ {
+ return context.SystemModule.GetKnownType("System.Runtime.InteropServices", "MarshalDirectiveException");
+ }
+
public static MetadataType GetVariant(TypeSystemContext context)
{
return context.SystemModule.GetKnownType("System.Runtime.InteropServices", "Variant");
@@ -97,6 +102,16 @@ public static bool IsSystemDecimal(TypeSystemContext context, TypeDesc type)
return IsCoreNamedType(context, type, "System", "Decimal");
}
+ public static bool IsSystemDelegate(TypeSystemContext context, TypeDesc type)
+ {
+ return IsCoreNamedType(context, type, "System", "Delegate");
+ }
+
+ public static bool IsSystemMulticastDelegate(TypeSystemContext context, TypeDesc type)
+ {
+ return IsCoreNamedType(context, type, "System", "MulticastDelegate");
+ }
+
public static bool IsSystemGuid(TypeSystemContext context, TypeDesc type)
{
return IsCoreNamedType(context, type, "System", "Guid");
diff --git a/src/coreclr/tools/GenClrDebugResource/GenClrDebugResource.cpp b/src/coreclr/tools/GenClrDebugResource/GenClrDebugResource.cpp
index bc8c6fd978370a..ded0cee406deb4 100644
--- a/src/coreclr/tools/GenClrDebugResource/GenClrDebugResource.cpp
+++ b/src/coreclr/tools/GenClrDebugResource/GenClrDebugResource.cpp
@@ -28,7 +28,7 @@ struct ClrDebugResource
};
BOOL
-GetBinFileData(__in_z char* binFileName, DWORD* pTimeStamp, DWORD* pSizeOfImage)
+GetBinFileData(_In_z_ char* binFileName, DWORD* pTimeStamp, DWORD* pSizeOfImage)
{
HANDLE binFileHandle;
DWORD peHeaderOffset;
@@ -111,7 +111,7 @@ Usage(void)
}
void __cdecl
-main(int argc, __in_z char** argv)
+main(int argc, _In_z_ char** argv)
{
char* outFile = NULL;
char* dacFile = NULL;
diff --git a/src/coreclr/tools/ILVerification/ILImporter.Verify.cs b/src/coreclr/tools/ILVerification/ILImporter.Verify.cs
index d1b3d10ed5a3fe..258a005ffdd09f 100644
--- a/src/coreclr/tools/ILVerification/ILImporter.Verify.cs
+++ b/src/coreclr/tools/ILVerification/ILImporter.Verify.cs
@@ -2060,7 +2060,7 @@ void ImportLoadField(int token, bool isStatic)
actualThis = StackValue.CreateByRef(actualThis.Type);
var declaredThis = owningType.IsValueType ?
- StackValue.CreateByRef(owningType) : StackValue.CreateObjRef(owningType);
+ StackValue.CreateByRef(owningType, readOnly : true) : StackValue.CreateObjRef(owningType);
CheckIsAssignable(actualThis, declaredThis);
diff --git a/src/coreclr/tools/ILVerification/ILVerification.csproj b/src/coreclr/tools/ILVerification/ILVerification.csproj
index a7d028326cfc9f..a7d00d9f304730 100644
--- a/src/coreclr/tools/ILVerification/ILVerification.csproj
+++ b/src/coreclr/tools/ILVerification/ILVerification.csproj
@@ -8,6 +8,8 @@
falsenetstandard2.0AnyCPU
+ true
+ Open
diff --git a/src/coreclr/tools/ILVerification/TypeVerifier.cs b/src/coreclr/tools/ILVerification/TypeVerifier.cs
index 9c760c8dd733fb..94672533bdd21f 100644
--- a/src/coreclr/tools/ILVerification/TypeVerifier.cs
+++ b/src/coreclr/tools/ILVerification/TypeVerifier.cs
@@ -99,7 +99,11 @@ public void VerifyInterfaces()
continue;
}
- MethodDesc resolvedMethod = type.ResolveInterfaceMethodTarget(method);
+ if (type.ResolveInterfaceMethodTarget(method) is not MethodDesc resolvedMethod)
+ {
+ type.ResolveInterfaceMethodToDefaultImplementationOnType(method, out resolvedMethod);
+ }
+
if (resolvedMethod is null)
{
VerificationError(VerifierError.InterfaceMethodNotImplemented, Format(type), Format(implementedInterface.InterfaceType, _module, implementedInterface.InterfaceImplementation), Format(method));
diff --git a/src/coreclr/tools/InjectResource/InjectResource.cpp b/src/coreclr/tools/InjectResource/InjectResource.cpp
index 61f49f5d3c7301..cf5c3917df9d2c 100644
--- a/src/coreclr/tools/InjectResource/InjectResource.cpp
+++ b/src/coreclr/tools/InjectResource/InjectResource.cpp
@@ -12,8 +12,8 @@ char* g_appName;
#define MAX(x,y) ((x) > (y) ? (x) : (y))
void
-AddBinaryResourceToDll(__in_z char* dllName,
- __in_z const char* resName,
+AddBinaryResourceToDll(_In_z_ char* dllName,
+ _In_z_ const char* resName,
PVOID resData,
ULONG resDataSize)
{
@@ -59,7 +59,7 @@ AddBinaryResourceToDll(__in_z char* dllName,
}
void
-GetBinFileData(__in_z char* binFileName, PVOID* binData, PULONG binDataSize)
+GetBinFileData(_In_z_ char* binFileName, PVOID* binData, PULONG binDataSize)
{
HANDLE binFileHandle;
PVOID data;
@@ -108,7 +108,7 @@ Usage(void)
}
void __cdecl
-main(int argc, __in_z char** argv)
+main(int argc, _In_z_ char** argv)
{
char* binFile = NULL;
char* dllFile = NULL;
diff --git a/src/coreclr/ToolBox/SOS/CMakeLists.txt b/src/coreclr/tools/SOS/CMakeLists.txt
similarity index 100%
rename from src/coreclr/ToolBox/SOS/CMakeLists.txt
rename to src/coreclr/tools/SOS/CMakeLists.txt
diff --git a/src/coreclr/ToolBox/SOS/DIALib/DIALib.il b/src/coreclr/tools/SOS/DIALib/DIALib.il
similarity index 100%
rename from src/coreclr/ToolBox/SOS/DIALib/DIALib.il
rename to src/coreclr/tools/SOS/DIALib/DIALib.il
diff --git a/src/coreclr/ToolBox/SOS/DIALib/DIALib.ilproj b/src/coreclr/tools/SOS/DIALib/DIALib.ilproj
similarity index 100%
rename from src/coreclr/ToolBox/SOS/DIALib/DIALib.ilproj
rename to src/coreclr/tools/SOS/DIALib/DIALib.ilproj
diff --git a/src/coreclr/ToolBox/SOS/DacTableGen/DacTableGen.csproj b/src/coreclr/tools/SOS/DacTableGen/DacTableGen.csproj
similarity index 100%
rename from src/coreclr/ToolBox/SOS/DacTableGen/DacTableGen.csproj
rename to src/coreclr/tools/SOS/DacTableGen/DacTableGen.csproj
diff --git a/src/coreclr/ToolBox/SOS/DacTableGen/MapSymbolProvider.cs b/src/coreclr/tools/SOS/DacTableGen/MapSymbolProvider.cs
similarity index 100%
rename from src/coreclr/ToolBox/SOS/DacTableGen/MapSymbolProvider.cs
rename to src/coreclr/tools/SOS/DacTableGen/MapSymbolProvider.cs
diff --git a/src/coreclr/ToolBox/SOS/DacTableGen/cvconst.cs b/src/coreclr/tools/SOS/DacTableGen/cvconst.cs
similarity index 100%
rename from src/coreclr/ToolBox/SOS/DacTableGen/cvconst.cs
rename to src/coreclr/tools/SOS/DacTableGen/cvconst.cs
diff --git a/src/coreclr/ToolBox/SOS/DacTableGen/diautil.cs b/src/coreclr/tools/SOS/DacTableGen/diautil.cs
similarity index 99%
rename from src/coreclr/ToolBox/SOS/DacTableGen/diautil.cs
rename to src/coreclr/tools/SOS/DacTableGen/diautil.cs
index 8da9217b477bc0..28af4119833668 100644
--- a/src/coreclr/ToolBox/SOS/DacTableGen/diautil.cs
+++ b/src/coreclr/tools/SOS/DacTableGen/diautil.cs
@@ -619,7 +619,7 @@ private String GetTypeString(IDiaSymbol s)
else if (tag == SymTagEnum.SymTagBaseType)
{
BasicType bt = (BasicType) s.baseType;
- str.AppendFormat("(base type={0}, len={1:d})", bt.ToString(), s.length);
+ str.Append($"(base type={bt}, len={s.length:d})");
}
else if (tag == SymTagEnum.SymTagArrayType)
{
@@ -677,7 +677,7 @@ private String GetTypeString(IDiaSymbol s)
try
{
succ = true;
- str.AppendFormat("[{0:d}]", s.length/s.type.length );
+ str.Append($"[{s.length/s.type.length:d}]");
}
catch (Exception)
{
diff --git a/src/coreclr/ToolBox/SOS/DacTableGen/main.cs b/src/coreclr/tools/SOS/DacTableGen/main.cs
similarity index 100%
rename from src/coreclr/ToolBox/SOS/DacTableGen/main.cs
rename to src/coreclr/tools/SOS/DacTableGen/main.cs
diff --git a/src/coreclr/ToolBox/SOS/Directory.Build.props b/src/coreclr/tools/SOS/Directory.Build.props
similarity index 100%
rename from src/coreclr/ToolBox/SOS/Directory.Build.props
rename to src/coreclr/tools/SOS/Directory.Build.props
diff --git a/src/coreclr/ToolBox/SOS/SOS_README.md b/src/coreclr/tools/SOS/SOS_README.md
similarity index 100%
rename from src/coreclr/ToolBox/SOS/SOS_README.md
rename to src/coreclr/tools/SOS/SOS_README.md
diff --git a/src/coreclr/tools/StressLogAnalyzer/StressLogDump.cpp b/src/coreclr/tools/StressLogAnalyzer/StressLogDump.cpp
index a0e8c877be52f2..f7f22d310c1b33 100644
--- a/src/coreclr/tools/StressLogAnalyzer/StressLogDump.cpp
+++ b/src/coreclr/tools/StressLogAnalyzer/StressLogDump.cpp
@@ -39,7 +39,7 @@ void GcHistAddLog(LPCSTR msg, StressMsg* stressMsg);
/*********************************************************************************/
-static const WCHAR* getTime(const FILETIME* time, __out_ecount (buffLen) WCHAR* buff, int buffLen)
+static const WCHAR* getTime(const FILETIME* time, _Out_writes_ (buffLen) WCHAR* buff, int buffLen)
{
SYSTEMTIME systemTime;
static const WCHAR badTime[] = W("BAD TIME");
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilationBuilder.Aot.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilationBuilder.Aot.cs
index 25cd0bc9b85a6b..fb4ad5ce51b7f6 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilationBuilder.Aot.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilationBuilder.Aot.cs
@@ -22,7 +22,6 @@ partial class CompilationBuilder
protected MethodImportationErrorProvider _methodImportationErrorProvider = new MethodImportationErrorProvider();
protected IInliningPolicy _inliningPolicy;
protected bool _methodBodyFolding;
- protected bool _singleThreaded;
protected InstructionSetSupport _instructionSetSupport;
protected SecurityMitigationOptions _mitigationOptions;
@@ -92,12 +91,6 @@ public CompilationBuilder UseMethodBodyFolding(bool enable)
return this;
}
- public CompilationBuilder UseSingleThread(bool enable)
- {
- _singleThreaded = enable;
- return this;
- }
-
public CompilationBuilder UsePreinitializationManager(PreinitializationManager manager)
{
_preinitializationManager = manager;
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.Aot.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.Aot.cs
index 33305d2011c876..66e6044d418a1f 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.Aot.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.Aot.cs
@@ -14,12 +14,21 @@ namespace ILCompiler
{
partial class CompilerTypeSystemContext
{
+ // Chosen rather arbitrarily. For the app that I was looking at, cutoff point of 7 compiled
+ // more than 10 minutes on a release build of the compiler, and I lost patience.
+ // Cutoff point of 5 produced an 1.7 GB object file.
+ // Cutoff point of 4 produced an 830 MB object file.
+ // Cutoff point of 3 produced an 470 MB object file.
+ // We want this to be high enough so that it doesn't cut off too early. But also not too
+ // high because things that are recursive often end up expanding laterally as well
+ // through various other generic code the deep code calls into.
+ public const int DefaultGenericCycleCutoffPoint = 4;
+
public SharedGenericsConfiguration GenericsConfig
{
get;
}
- private readonly DelegateFeature _delegateFeatures;
private readonly MetadataFieldLayoutAlgorithm _metadataFieldLayoutAlgorithm = new CompilerMetadataFieldLayoutAlgorithm();
private readonly RuntimeDeterminedFieldLayoutAlgorithm _runtimeDeterminedFieldLayoutAlgorithm = new RuntimeDeterminedFieldLayoutAlgorithm();
private readonly VectorOfTFieldLayoutAlgorithm _vectorOfTFieldLayoutAlgorithm;
@@ -29,7 +38,7 @@ public SharedGenericsConfiguration GenericsConfig
private ArrayOfTRuntimeInterfacesAlgorithm _arrayOfTRuntimeInterfacesAlgorithm;
private MetadataType _arrayOfTType;
- public CompilerTypeSystemContext(TargetDetails details, SharedGenericsMode genericsMode, DelegateFeature delegateFeatures)
+ public CompilerTypeSystemContext(TargetDetails details, SharedGenericsMode genericsMode, DelegateFeature delegateFeatures, int genericCycleCutoffPoint = DefaultGenericCycleCutoffPoint)
: base(details)
{
_genericsMode = genericsMode;
@@ -37,7 +46,9 @@ public CompilerTypeSystemContext(TargetDetails details, SharedGenericsMode gener
_vectorOfTFieldLayoutAlgorithm = new VectorOfTFieldLayoutAlgorithm(_metadataFieldLayoutAlgorithm);
_vectorFieldLayoutAlgorithm = new VectorFieldLayoutAlgorithm(_metadataFieldLayoutAlgorithm);
- _delegateFeatures = delegateFeatures;
+ _delegateInfoHashtable = new DelegateInfoHashtable(delegateFeatures);
+
+ _genericCycleDetector = new LazyGenericsSupport.GenericCycleDetector(genericCycleCutoffPoint);
GenericsConfig = new SharedGenericsConfiguration();
}
@@ -165,11 +176,6 @@ protected virtual IEnumerable GetAllMethodsForDelegate(TypeDesc type
yield return m;
}
- protected override DelegateInfo CreateDelegateInfo(TypeDesc delegateType)
- {
- return new DelegateInfo(delegateType, _delegateFeatures);
- }
-
internal DefType GetClosestDefType(TypeDesc type)
{
if (type.IsArray)
@@ -187,7 +193,7 @@ internal DefType GetClosestDefType(TypeDesc type)
return (DefType)type;
}
- private readonly LazyGenericsSupport.GenericCycleDetector _genericCycleDetector = new LazyGenericsSupport.GenericCycleDetector();
+ private readonly LazyGenericsSupport.GenericCycleDetector _genericCycleDetector;
public void DetectGenericCycles(TypeSystemEntity owner, TypeSystemEntity referent)
{
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.BoxedTypes.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.BoxedTypes.cs
index 8be62c3d9950db..39a6bf3490beb0 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.BoxedTypes.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.BoxedTypes.cs
@@ -259,7 +259,8 @@ private partial class BoxedValueType : MetadataType, INonEmittableType
public override string Name => "Boxed_" + ValueTypeRepresented.Name;
public override string Namespace => ValueTypeRepresented.Namespace;
-
+ public override string DiagnosticName => "Boxed_" + ValueTypeRepresented.DiagnosticName;
+ public override string DiagnosticNamespace => ValueTypeRepresented.DiagnosticNamespace;
public override Instantiation Instantiation => ValueTypeRepresented.Instantiation;
public override PInvokeStringFormat PInvokeStringFormat => PInvokeStringFormat.AutoClass;
public override bool IsExplicitLayout => false;
@@ -411,6 +412,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return _targetMethod.DiagnosticName + "_Unbox";
+ }
+ }
+
public override MethodIL EmitIL()
{
if (_owningType.ValueTypeRepresented.IsByRefLike)
@@ -487,6 +496,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return _targetMethod.DiagnosticName + "_Unbox";
+ }
+ }
+
public override MethodIL EmitIL()
{
if (_owningType.ValueTypeRepresented.IsByRefLike)
@@ -574,6 +591,7 @@ public ValueTypeInstanceMethodWithHiddenParameter(MethodDesc methodRepresented)
public override TypeDesc OwningType => _methodRepresented.OwningType;
public override string Name => _methodRepresented.Name;
+ public override string DiagnosticName => _methodRepresented.DiagnosticName;
public override MethodSignature Signature
{
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.DelegateInfo.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DelegateInfo.cs
similarity index 67%
rename from src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.DelegateInfo.cs
rename to src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DelegateInfo.cs
index b9a3a3e1fdbbb2..a021e39691d226 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.DelegateInfo.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DelegateInfo.cs
@@ -4,13 +4,19 @@
using System;
using Internal.IL;
+using Internal.TypeSystem;
-namespace Internal.TypeSystem
+namespace ILCompiler
{
- public abstract partial class TypeSystemContext
+ partial class CompilerTypeSystemContext
{
private class DelegateInfoHashtable : LockFreeReaderHashtable
{
+ private readonly DelegateFeature _delegateFeatures;
+
+ public DelegateInfoHashtable(DelegateFeature features)
+ => _delegateFeatures = features;
+
protected override int GetKeyHashCode(TypeDesc key)
{
return key.GetHashCode();
@@ -29,24 +35,15 @@ protected override bool CompareValueToValue(DelegateInfo value1, DelegateInfo va
}
protected override DelegateInfo CreateValueFromKey(TypeDesc key)
{
- return key.Context.CreateDelegateInfo(key);
+ return new DelegateInfo(key, _delegateFeatures);
}
}
- private DelegateInfoHashtable _delegateInfoHashtable = new DelegateInfoHashtable();
+ private readonly DelegateInfoHashtable _delegateInfoHashtable;
public DelegateInfo GetDelegateInfo(TypeDesc delegateType)
{
return _delegateInfoHashtable.GetOrCreateValue(delegateType);
}
-
- ///
- /// Creates a for a given delegate type.
- ///
- protected virtual DelegateInfo CreateDelegateInfo(TypeDesc key)
- {
- // Type system contexts that support creating delegate infos need to override.
- throw new NotSupportedException();
- }
}
}
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.DynamicInvoke.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DynamicInvoke.cs
similarity index 85%
rename from src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.DynamicInvoke.cs
rename to src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DynamicInvoke.cs
index 290f11dd90a508..0ed3d107b3a396 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.DynamicInvoke.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DynamicInvoke.cs
@@ -2,12 +2,13 @@
// The .NET Foundation licenses this file to you under the MIT license.
using Internal.IL.Stubs;
+using Internal.TypeSystem;
using Debug = System.Diagnostics.Debug;
-namespace Internal.TypeSystem
+namespace ILCompiler
{
- partial class TypeSystemContext
+ partial class CompilerTypeSystemContext
{
private class DynamicInvokeThunkHashtable : LockFreeReaderHashtable
{
@@ -17,7 +18,7 @@ private class DynamicInvokeThunkHashtable : LockFreeReaderHashtable value.TargetSignature.GetHashCode();
protected override DynamicInvokeMethodThunk CreateValueFromKey(DynamicInvokeMethodSignature key)
{
- return new DynamicInvokeMethodThunk(key.Context.GeneratedAssembly.GetGlobalModuleType(), key);
+ return new DynamicInvokeMethodThunk(((CompilerTypeSystemContext)key.Context).GeneratedAssembly.GetGlobalModuleType(), key);
}
}
DynamicInvokeThunkHashtable _dynamicInvokeThunks = new DynamicInvokeThunkHashtable();
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.EnumMethods.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.EnumMethods.cs
similarity index 97%
rename from src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.EnumMethods.cs
rename to src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.EnumMethods.cs
index 0be009f53c7bb3..b777e28a2d144e 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.EnumMethods.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.EnumMethods.cs
@@ -3,13 +3,14 @@
using System.Collections.Generic;
+using Internal.TypeSystem;
using Internal.IL.Stubs;
using Debug = System.Diagnostics.Debug;
-namespace Internal.TypeSystem
+namespace ILCompiler
{
- public abstract partial class TypeSystemContext
+ partial class CompilerTypeSystemContext
{
private class EnumInfo
{
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.GeneratedAssembly.Sorting.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.GeneratedAssembly.Sorting.cs
similarity index 64%
rename from src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.GeneratedAssembly.Sorting.cs
rename to src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.GeneratedAssembly.Sorting.cs
index a2490a4cb196e7..41254150763cf9 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.GeneratedAssembly.Sorting.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.GeneratedAssembly.Sorting.cs
@@ -3,16 +3,18 @@
using System;
-namespace Internal.TypeSystem
+using Internal.TypeSystem;
+
+namespace ILCompiler
{
- partial class TypeSystemContext
+ partial class CompilerTypeSystemContext
{
// Functionality related to determinstic ordering of types and members
partial class CompilerGeneratedType : MetadataType
{
- protected internal override int ClassCode => -1036681447;
+ protected override int ClassCode => -1036681447;
- protected internal override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
+ protected override int CompareToImpl(TypeDesc other, TypeSystemComparer comparer)
{
// Should be a singleton
throw new NotSupportedException();
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.GeneratedAssembly.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.GeneratedAssembly.cs
similarity index 94%
rename from src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.GeneratedAssembly.cs
rename to src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.GeneratedAssembly.cs
index a01beba3cea869..280f2d85684a3b 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.GeneratedAssembly.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.GeneratedAssembly.cs
@@ -4,14 +4,16 @@
using System;
using System.Collections.Generic;
+using Internal.TypeSystem;
+
using TypeHashingAlgorithms = Internal.NativeFormat.TypeHashingAlgorithms;
using Interlocked = System.Threading.Interlocked;
using AssemblyName = System.Reflection.AssemblyName;
using Debug = System.Diagnostics.Debug;
-namespace Internal.TypeSystem
+namespace ILCompiler
{
- partial class TypeSystemContext
+ partial class CompilerTypeSystemContext
{
private ModuleDesc _generatedAssembly;
@@ -89,6 +91,14 @@ public override string Name
get;
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return Name;
+ }
+ }
+
public override string Namespace
{
get
@@ -97,6 +107,14 @@ public override string Namespace
}
}
+ public override string DiagnosticNamespace
+ {
+ get
+ {
+ return "Internal.CompilerGenerated";
+ }
+ }
+
public override int GetHashCode()
{
if (_hashcode != 0)
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.IntefaceThunks.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.IntefaceThunks.cs
index ad558ae43bf51b..adc509298c0bbc 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.IntefaceThunks.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.IntefaceThunks.cs
@@ -149,7 +149,7 @@ protected override bool CompareValueToValue(DefaultInterfaceMethodImplementation
}
protected override DefaultInterfaceMethodImplementationInstantiationThunk CreateValueFromKey(DefaultInterfaceMethodImplementationInstantiationThunkHashtableKey key)
{
- TypeDesc owningTypeOfThunks = key.TargetMethod.Context.GeneratedAssembly.GetGlobalModuleType();
+ TypeDesc owningTypeOfThunks = ((CompilerTypeSystemContext)key.TargetMethod.Context).GeneratedAssembly.GetGlobalModuleType();
return new DefaultInterfaceMethodImplementationInstantiationThunk(owningTypeOfThunks, key.TargetMethod, key.InterfaceIndex);
}
}
@@ -194,6 +194,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return _targetMethod.DiagnosticName;
+ }
+ }
+
public MethodDesc BaseMethod => _targetMethod;
public string Prefix => $"__InstantiatingStub_{_interfaceIndex}_";
@@ -274,6 +282,7 @@ public DefaultInterfaceMethodImplementationWithHiddenParameter(MethodDesc method
public override TypeDesc OwningType => _owningType;
public override string Name => _methodRepresented.Name;
+ public override string DiagnosticName => _methodRepresented.DiagnosticName;
public override MethodSignature Signature
{
diff --git a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.ValueTypeMethods.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.ValueTypeMethods.cs
similarity index 97%
rename from src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.ValueTypeMethods.cs
rename to src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.ValueTypeMethods.cs
index f44bf4b11cf8e2..738b43554182c8 100644
--- a/src/coreclr/tools/Common/TypeSystem/IL/TypeSystemContext.ValueTypeMethods.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.ValueTypeMethods.cs
@@ -3,13 +3,14 @@
using System.Collections.Generic;
+using Internal.TypeSystem;
using Internal.IL.Stubs;
using Debug = System.Diagnostics.Debug;
-namespace Internal.TypeSystem
+namespace ILCompiler
{
- public abstract partial class TypeSystemContext
+ partial class CompilerTypeSystemContext
{
private MethodDesc _objectEqualsMethod;
@@ -154,7 +155,7 @@ private bool ComputeCanCompareValueTypeBits(MetadataType type)
// Would be a suprise if this wasn't a valuetype. We checked ContainsGCPointers above.
Debug.Assert(fieldType.IsValueType);
- MethodDesc objectEqualsMethod = fieldType.Context._objectEqualsMethod;
+ MethodDesc objectEqualsMethod = ((CompilerTypeSystemContext)fieldType.Context)._objectEqualsMethod;
// If the field overrides Equals, we can't use the fast helper because we need to call the method.
if (fieldType.FindVirtualFunctionTargetMethodOnObjectType(objectEqualsMethod).OwningType == fieldType)
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMethodBodyScanner.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMethodBodyScanner.cs
index 981983750de052..06d371cd17aea0 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMethodBodyScanner.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/ReflectionMethodBodyScanner.cs
@@ -2199,7 +2199,9 @@ public override bool HandleCall(MethodIL callingMethodBody, MethodDesc calledMet
if (comDangerousMethod)
{
reflectionContext.AnalyzingPattern();
- reflectionContext.RecordUnrecognizedPattern(2050, $"P/invoke method '{calledMethod.GetDisplayName()}' declares a parameter with COM marshalling. Correctness of COM interop cannot be guaranteed after trimming. Interfaces and interface members might be removed.");
+ reflectionContext.RecordUnrecognizedPattern(
+ (int)DiagnosticId.CorrectnessOfCOMCannotBeGuaranteed,
+ new DiagnosticString(DiagnosticId.CorrectnessOfCOMCannotBeGuaranteed).GetMessage(DiagnosticUtilities.GetMethodSignatureDisplayName(calledMethod)));
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DelegateCreationInfo.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DelegateCreationInfo.cs
index 0195f82d6c3692..dc6cd81fcccf5d 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DelegateCreationInfo.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DelegateCreationInfo.cs
@@ -161,7 +161,7 @@ private DelegateCreationInfo(IMethodNode constructor, MethodDesc targetMethod, T
///
public static DelegateCreationInfo Create(TypeDesc delegateType, MethodDesc targetMethod, NodeFactory factory, bool followVirtualDispatch)
{
- TypeSystemContext context = delegateType.Context;
+ CompilerTypeSystemContext context = factory.TypeSystemContext;
DefType systemDelegate = context.GetWellKnownType(WellKnownType.MulticastDelegate).BaseType;
int paramCountTargetMethod = targetMethod.Signature.Length;
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/CallingConventionConverterKey.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/CallingConventionConverterKey.cs
index 7c94539fb6bb42..40b7281dbba01b 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/CallingConventionConverterKey.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/CallingConventionConverterKey.cs
@@ -78,4 +78,156 @@ public static string GetName(this MethodSignature signature)
return nameBuilder.ToString();
}
}
+
+ public class UniqueTypeNameFormatter : TypeNameFormatter
+ {
+ public static UniqueTypeNameFormatter Instance { get; } = new UniqueTypeNameFormatter();
+
+ public override void AppendName(StringBuilder sb, PointerType type)
+ {
+ AppendName(sb, type.ParameterType);
+ sb.Append('*');
+ }
+
+ public override void AppendName(StringBuilder sb, GenericParameterDesc type)
+ {
+ string prefix = type.Kind == GenericParameterKind.Type ? "!" : "!!";
+ sb.Append(prefix);
+ sb.Append(type.Name);
+ }
+
+ public override void AppendName(StringBuilder sb, SignatureTypeVariable type)
+ {
+ sb.Append("!");
+ sb.Append(type.Index.ToStringInvariant());
+ }
+
+ public override void AppendName(StringBuilder sb, SignatureMethodVariable type)
+ {
+ sb.Append("!!");
+ sb.Append(type.Index.ToStringInvariant());
+ }
+
+ public override void AppendName(StringBuilder sb, FunctionPointerType type)
+ {
+ MethodSignature signature = type.Signature;
+
+ AppendName(sb, signature.ReturnType);
+
+ sb.Append(" (");
+ for (int i = 0; i < signature.Length; i++)
+ {
+ if (i > 0)
+ sb.Append(", ");
+ AppendName(sb, signature[i]);
+ }
+
+ // TODO: Append '...' for vararg methods
+
+ sb.Append(')');
+ }
+
+ public override void AppendName(StringBuilder sb, ByRefType type)
+ {
+ AppendName(sb, type.ParameterType);
+ sb.Append(" ByRef");
+ }
+
+ public override void AppendName(StringBuilder sb, ArrayType type)
+ {
+ AppendName(sb, type.ElementType);
+ sb.Append('[');
+
+ if (type.Rank == 1 && type.IsMdArray)
+ sb.Append('*');
+ sb.Append(',', type.Rank - 1);
+
+ sb.Append(']');
+ }
+
+ protected override void AppendNameForInstantiatedType(StringBuilder sb, DefType type)
+ {
+ AppendName(sb, type.GetTypeDefinition());
+ sb.Append('<');
+
+ for (int i = 0; i < type.Instantiation.Length; i++)
+ {
+ if (i > 0)
+ sb.Append(", ");
+ AppendName(sb, type.Instantiation[i]);
+ }
+
+ sb.Append('>');
+ }
+
+ protected override void AppendNameForNamespaceType(StringBuilder sb, DefType type)
+ {
+ string ns = GetTypeNamespace(type);
+ if (ns.Length > 0)
+ {
+ AppendEscapedIdentifier(sb, ns);
+ sb.Append('.');
+ }
+ AppendEscapedIdentifier(sb, GetTypeName(type));
+
+ if (type is MetadataType)
+ {
+ IAssemblyDesc homeAssembly = ((MetadataType)type).Module as IAssemblyDesc;
+ AppendAssemblyName(sb, homeAssembly);
+ }
+ }
+
+ private void AppendAssemblyName(StringBuilder sb, IAssemblyDesc assembly)
+ {
+ if (assembly == null)
+ return;
+
+ sb.Append(',');
+ AppendEscapedIdentifier(sb, assembly.GetName().Name);
+ }
+
+ protected override void AppendNameForNestedType(StringBuilder sb, DefType nestedType, DefType containingType)
+ {
+ AppendName(sb, containingType);
+
+ sb.Append('+');
+
+ string ns = GetTypeNamespace(nestedType);
+ if (ns.Length > 0)
+ {
+ AppendEscapedIdentifier(sb, ns);
+ sb.Append('.');
+ }
+ AppendEscapedIdentifier(sb, GetTypeName(nestedType));
+ }
+
+ private string GetTypeName(DefType type)
+ {
+ return type.Name;
+ }
+
+ private string GetTypeNamespace(DefType type)
+ {
+ return type.Namespace;
+ }
+
+ private static char[] s_escapedChars = new char[] { ',', '=', '"', ']', '[', '*', '&', '+', '\\' };
+ private void AppendEscapedIdentifier(StringBuilder sb, string identifier)
+ {
+ if (identifier.IndexOfAny(s_escapedChars) < 0)
+ {
+ string escapedIdentifier = identifier;
+ foreach (char escapedChar in s_escapedChars)
+ {
+ string escapedCharString = new string(escapedChar, 1);
+ escapedIdentifier = escapedIdentifier.Replace(escapedCharString, "\\" + escapedCharString);
+ }
+ sb.Append(escapedIdentifier);
+ }
+ else
+ {
+ sb.Append(identifier);
+ }
+ }
+ }
}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs
index 9873fb76c78370..2dd04047e594e0 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs
@@ -35,7 +35,7 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
}
int ISymbolDefinitionNode.Offset => 0;
- int ISymbolNode.Offset => Method.Context.Target.FatFunctionPointerOffset;
+ int ISymbolNode.Offset => Method.Context.Target.Architecture == TargetArchitecture.Wasm32 ? 1 << 31 : 2;
public override bool IsShareable => true;
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericCompositionNode.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericCompositionNode.cs
index a4388b4eeb4a96..9857c633784db6 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericCompositionNode.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericCompositionNode.cs
@@ -36,6 +36,7 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
if (_details.Variance != null)
{
+ sb.Append("__Variance__");
for (int i = 0; i < _details.Variance.Length; i++)
{
sb.Append('_');
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/FeatureSettings.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/FeatureSettings.cs
new file mode 100644
index 00000000000000..773c061081e459
--- /dev/null
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/FeatureSettings.cs
@@ -0,0 +1,52 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Collections.Generic;
+using System.Xml.XPath;
+using ILLink.Shared;
+using Internal.TypeSystem;
+
+namespace ILCompiler
+{
+ public static class FeatureSettings
+ {
+ public static bool ShouldProcessElement(XPathNavigator nav, IReadOnlyDictionary featureSwitchValues)
+ {
+ var feature = GetAttribute(nav, "feature");
+ if (string.IsNullOrEmpty(feature))
+ return true;
+
+ var value = GetAttribute(nav, "featurevalue");
+ if (string.IsNullOrEmpty(value))
+ {
+ //context.LogError(null, DiagnosticId.XmlFeatureDoesNotSpecifyFeatureValue, documentLocation, feature);
+ return false;
+ }
+
+ if (!bool.TryParse(value, out bool bValue))
+ {
+ //context.LogError(null, DiagnosticId.XmlUnsupportedNonBooleanValueForFeature, documentLocation, feature);
+ return false;
+ }
+
+ var isDefault = GetAttribute(nav, "featuredefault");
+ bool bIsDefault = false;
+ if (!string.IsNullOrEmpty(isDefault) && (!bool.TryParse(isDefault, out bIsDefault) || !bIsDefault))
+ {
+ //context.LogError(null, DiagnosticId.XmlDocumentLocationHasInvalidFeatureDefault, documentLocation);
+ return false;
+ }
+
+ if (!featureSwitchValues.TryGetValue(feature, out bool featureSetting))
+ return bIsDefault;
+
+ return bValue == featureSetting;
+ }
+
+ public static string GetAttribute(XPathNavigator nav, string attribute)
+ {
+ return nav.GetAttribute(attribute, String.Empty);
+ }
+ }
+}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/FeatureSwitchManager.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/FeatureSwitchManager.cs
index 5f06913b97d37b..20050db2c8cdab 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/FeatureSwitchManager.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/FeatureSwitchManager.cs
@@ -792,7 +792,7 @@ public MethodIL EmitIL(MethodDesc method)
}
}
- private class SubstitutionsReader : ProcessLinkerXmlBase
+ private class SubstitutionsReader : ProcessXmlBase
{
private readonly Dictionary _methodSubstitutions;
private readonly Dictionary _fieldSubstitutions;
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/HardwareIntrinsicHelpers.Aot.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/HardwareIntrinsicHelpers.Aot.cs
index 7c12cf6c8a3da5..188d44c3f65fb8 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/HardwareIntrinsicHelpers.Aot.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/HardwareIntrinsicHelpers.Aot.cs
@@ -95,6 +95,7 @@ private static class XArchIntrinsicConstants
public const int Bmi1 = 0x0400;
public const int Bmi2 = 0x0800;
public const int Lzcnt = 0x1000;
+ public const int AvxVnni = 0x2000;
public static int FromHardwareIntrinsicId(string id)
{
@@ -113,6 +114,7 @@ public static int FromHardwareIntrinsicId(string id)
"Bmi1" => Bmi1,
"Bmi2" => Bmi2,
"Lzcnt" => Lzcnt,
+ "AvxVnni" => AvxVnni,
_ => throw new NotSupportedException(),
};
}
@@ -155,6 +157,8 @@ public static int FromInstructionSetFlags(InstructionSetFlags instructionSets)
InstructionSet.X64_BMI2_X64 => Bmi2,
InstructionSet.X64_LZCNT => Lzcnt,
InstructionSet.X64_LZCNT_X64 => Popcnt,
+ InstructionSet.X64_AVXVNNI => AvxVnni,
+ InstructionSet.X64_AVXVNNI_X64 => AvxVnni,
// SSE and SSE2 are baseline ISAs - they're always available
InstructionSet.X64_SSE => 0,
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs
index e10bbe95f07971..ae9e60343dfb42 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs
@@ -4,18 +4,18 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
-using System.Threading;
+using System.Threading.Tasks;
using ILCompiler.DependencyAnalysis;
using ILCompiler.DependencyAnalysisFramework;
using Internal.IL;
using Internal.IL.Stubs;
+using Internal.JitInterface;
using Internal.TypeSystem;
using Internal.ReadyToRunConstants;
using Debug = System.Diagnostics.Debug;
-using Internal.JitInterface;
namespace ILCompiler
{
@@ -26,8 +26,7 @@ namespace ILCompiler
///
internal sealed class ILScanner : Compilation, IILScanner
{
- private CountdownEvent _compilationCountdown;
- private readonly bool _singleThreaded;
+ private readonly int _parallelism;
internal ILScanner(
DependencyAnalyzerBase dependencyGraph,
@@ -36,11 +35,11 @@ internal ILScanner(
ILProvider ilProvider,
DebugInformationProvider debugInformationProvider,
Logger logger,
- bool singleThreaded)
+ int parallelism)
: base(dependencyGraph, nodeFactory, roots, ilProvider, debugInformationProvider, null, nodeFactory.CompilationModuleGroup, logger)
{
_helperCache = new HelperCache(this);
- _singleThreaded = singleThreaded;
+ _parallelism = parallelism;
}
protected override void CompileInternal(string outputFile, ObjectDumper dumper)
@@ -78,7 +77,7 @@ protected override void ComputeDependencyNodeDependencies(List methodsToCompile)
Logger.Writer.WriteLine($"Scanning {methodsToCompile.Count} methods...");
}
- WaitCallback compileSingleMethodDelegate = m => CompileSingleMethod((ScannedMethodNode)m);
-
- using (_compilationCountdown = new CountdownEvent(methodsToCompile.Count))
- {
- foreach (ScannedMethodNode methodCodeNodeNeedingCode in methodsToCompile)
- {
- ThreadPool.QueueUserWorkItem(compileSingleMethodDelegate, methodCodeNodeNeedingCode);
- }
-
- _compilationCountdown.Wait();
- _compilationCountdown = null;
- }
+ Parallel.ForEach(
+ methodsToCompile,
+ new ParallelOptions { MaxDegreeOfParallelism = _parallelism },
+ CompileSingleMethod);
}
private void CompileSingleThreaded(List methodsToCompile)
@@ -142,11 +133,6 @@ private void CompileSingleMethod(ScannedMethodNode methodCodeNodeNeedingCode)
{
throw new CodeGenerationFailedException(method, ex);
}
- finally
- {
- if (_compilationCountdown != null)
- _compilationCountdown.Signal();
- }
}
ILScanResults IILScanner.Scan()
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScannerBuilder.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScannerBuilder.cs
index 27e7e64b6ce193..cf784d458dde24 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScannerBuilder.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScannerBuilder.cs
@@ -27,7 +27,7 @@ public sealed class ILScannerBuilder
private IEnumerable _compilationRoots = Array.Empty();
private MetadataManager _metadataManager;
private InteropStubManager _interopStubManager = new EmptyInteropStubManager();
- private bool _singleThreaded;
+ private int _parallelism = -1;
internal ILScannerBuilder(CompilerTypeSystemContext context, CompilationModuleGroup compilationGroup, NameMangler mangler, ILProvider ilProvider, PreinitializationManager preinitializationManager)
{
@@ -63,9 +63,9 @@ public ILScannerBuilder UseInteropStubManager(InteropStubManager interopStubMana
return this;
}
- public ILScannerBuilder UseSingleThread(bool enable)
+ public ILScannerBuilder UseParallelism(int parallelism)
{
- _singleThreaded = enable;
+ _parallelism = parallelism;
return this;
}
@@ -74,7 +74,7 @@ public IILScanner ToILScanner()
var nodeFactory = new ILScanNodeFactory(_context, _compilationGroup, _metadataManager, _interopStubManager, _nameMangler, _preinitializationManager);
DependencyAnalyzerBase graph = _dependencyTrackingLevel.CreateDependencyGraph(nodeFactory);
- return new ILScanner(graph, nodeFactory, _compilationRoots, _ilProvider, new NullDebugInformationProvider(), _logger, _singleThreaded);
+ return new ILScanner(graph, nodeFactory, _compilationRoots, _ilProvider, new NullDebugInformationProvider(), _logger, _parallelism);
}
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/LazyGenerics/ModuleCycleInfo.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/LazyGenerics/ModuleCycleInfo.cs
index 47b1ce7e1d05c0..378af488af0208 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/LazyGenerics/ModuleCycleInfo.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/LazyGenerics/ModuleCycleInfo.cs
@@ -34,18 +34,69 @@ public bool FormsCycle(TypeSystemEntity owner)
TypeDesc ownerType = (owner as EcmaMethod)?.OwningType;
return _entitiesInCycles.Contains(owner) || (ownerType != null && _entitiesInCycles.Contains(ownerType));
}
+ }
+
+ private class CycleInfoHashtable : LockFreeReaderHashtable
+ {
+ protected override bool CompareKeyToValue(EcmaModule key, ModuleCycleInfo value) => key == value.Module;
+ protected override bool CompareValueToValue(ModuleCycleInfo value1, ModuleCycleInfo value2) => value1.Module == value2.Module;
+ protected override int GetKeyHashCode(EcmaModule key) => key.GetHashCode();
+ protected override int GetValueHashCode(ModuleCycleInfo value) => value.Module.GetHashCode();
+
+ protected override ModuleCycleInfo CreateValueFromKey(EcmaModule key)
+ {
+ GraphBuilder gb = new GraphBuilder(key);
+ Graph graph = gb.Graph;
+
+ var formalsNeedingLazyGenerics = graph.ComputeVerticesInvolvedInAFlaggedCycle();
+ var entitiesNeedingLazyGenerics = new HashSet();
+
+ foreach (EcmaGenericParameter formal in formalsNeedingLazyGenerics)
+ {
+ var formalDefinition = key.MetadataReader.GetGenericParameter(formal.Handle);
+ if (formal.Kind == GenericParameterKind.Type)
+ {
+ entitiesNeedingLazyGenerics.Add(key.GetType(formalDefinition.Parent));
+ }
+ else
+ {
+ entitiesNeedingLazyGenerics.Add(key.GetMethod(formalDefinition.Parent));
+ }
+ }
+
+ return new ModuleCycleInfo(key, entitiesNeedingLazyGenerics);
+ }
+ }
+
+ internal class GenericCycleDetector
+ {
+ private readonly CycleInfoHashtable _hashtable = new CycleInfoHashtable();
+
+ private readonly struct EntityPair : IEquatable
+ {
+ public readonly TypeSystemEntity Owner;
+ public readonly TypeSystemEntity Referent;
+ public EntityPair(TypeSystemEntity owner, TypeSystemEntity referent)
+ => (Owner, Referent) = (owner, referent);
+ public bool Equals(EntityPair other) => Owner == other.Owner && Referent == other.Referent;
+ public override bool Equals(object obj) => obj is EntityPair p && Equals(p);
+ public override int GetHashCode() => HashCode.Combine(Owner.GetHashCode(), Referent.GetHashCode());
+ }
+
+ // This is a set of entities that had actual problems that caused us to abort compilation
+ // somewhere.
+ // Would prefer this to be a ConcurrentHashSet but there isn't any. ModuleCycleInfo can be looked up
+ // from the key, but since this is a key/value pair, might as well use the value too...
+ private readonly ConcurrentDictionary _actualProblems = new ConcurrentDictionary();
+
+ private readonly int _cutoffPoint;
+
+ public GenericCycleDetector(int cutoffPoint)
+ {
+ _cutoffPoint = cutoffPoint;
+ }
- // Chosen rather arbitrarily. For the app that I was looking at, cutoff point of 7 compiled
- // more than 10 minutes on a release build of the compiler, and I lost patience.
- // Cutoff point of 5 produced an 1.7 GB object file.
- // Cutoff point of 4 produced an 830 MB object file.
- // Cutoff point of 3 produced an 470 MB object file.
- // We want this to be high enough so that it doesn't cut off too early. But also not too
- // high because things that are recursive often end up expanding laterally as well
- // through various other generic code the deep code calls into.
- private const int CutoffPoint = 4;
-
- public bool IsDeepPossiblyCyclicInstantiation(TypeSystemEntity entity)
+ private bool IsDeepPossiblyCyclicInstantiation(TypeSystemEntity entity)
{
if (entity is TypeDesc type)
{
@@ -57,7 +108,7 @@ public bool IsDeepPossiblyCyclicInstantiation(TypeSystemEntity entity)
}
}
- public bool IsDeepPossiblyCyclicInstantiation(TypeDesc type, List seenTypes = null)
+ private bool IsDeepPossiblyCyclicInstantiation(TypeDesc type, List seenTypes = null)
{
switch (type.Category)
{
@@ -80,7 +131,7 @@ public bool IsDeepPossiblyCyclicInstantiation(TypeDesc type, List seen
count++;
}
- if (count > CutoffPoint)
+ if (count > _cutoffPoint)
{
return true;
}
@@ -112,60 +163,6 @@ public bool IsDeepPossiblyCyclicInstantiation(MethodDesc method)
{
return IsDeepPossiblyCyclicInstantiation(method.Instantiation) || IsDeepPossiblyCyclicInstantiation(method.OwningType);
}
- }
-
- private class CycleInfoHashtable : LockFreeReaderHashtable
- {
- protected override bool CompareKeyToValue(EcmaModule key, ModuleCycleInfo value) => key == value.Module;
- protected override bool CompareValueToValue(ModuleCycleInfo value1, ModuleCycleInfo value2) => value1.Module == value2.Module;
- protected override int GetKeyHashCode(EcmaModule key) => key.GetHashCode();
- protected override int GetValueHashCode(ModuleCycleInfo value) => value.Module.GetHashCode();
-
- protected override ModuleCycleInfo CreateValueFromKey(EcmaModule key)
- {
- GraphBuilder gb = new GraphBuilder(key);
- Graph graph = gb.Graph;
-
- var formalsNeedingLazyGenerics = graph.ComputeVerticesInvolvedInAFlaggedCycle();
- var entitiesNeedingLazyGenerics = new HashSet();
-
- foreach (EcmaGenericParameter formal in formalsNeedingLazyGenerics)
- {
- var formalDefinition = key.MetadataReader.GetGenericParameter(formal.Handle);
- if (formal.Kind == GenericParameterKind.Type)
- {
- entitiesNeedingLazyGenerics.Add(key.GetType(formalDefinition.Parent));
- }
- else
- {
- entitiesNeedingLazyGenerics.Add(key.GetMethod(formalDefinition.Parent));
- }
- }
-
- return new ModuleCycleInfo(key, entitiesNeedingLazyGenerics);
- }
- }
-
- internal class GenericCycleDetector
- {
- private readonly CycleInfoHashtable _hashtable = new CycleInfoHashtable();
-
- private readonly struct EntityPair : IEquatable
- {
- public readonly TypeSystemEntity Owner;
- public readonly TypeSystemEntity Referent;
- public EntityPair(TypeSystemEntity owner, TypeSystemEntity referent)
- => (Owner, Referent) = (owner, referent);
- public bool Equals(EntityPair other) => Owner == other.Owner && Referent == other.Referent;
- public override bool Equals(object obj) => obj is EntityPair p && Equals(p);
- public override int GetHashCode() => HashCode.Combine(Owner.GetHashCode(), Referent.GetHashCode());
- }
-
- // This is a set of entities that had actual problems that caused us to abort compilation
- // somewhere.
- // Would prefer this to be a ConcurrentHashSet but there isn't any. ModuleCycleInfo can be looked up
- // from the key, but since this is a key/value pair, might as well use the value too...
- private readonly ConcurrentDictionary _actualProblems = new ConcurrentDictionary();
public void DetectCycle(TypeSystemEntity owner, TypeSystemEntity referent)
{
@@ -196,7 +193,7 @@ public void DetectCycle(TypeSystemEntity owner, TypeSystemEntity referent)
{
// Just the presence of a cycle is not a problem, but once we start getting too deep,
// we need to cut our losses.
- if (cycleInfo.IsDeepPossiblyCyclicInstantiation(referent))
+ if (IsDeepPossiblyCyclicInstantiation(referent))
{
_actualProblems.TryAdd(new EntityPair(owner, referent), cycleInfo);
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ManifestResourceBlockingPolicy.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ManifestResourceBlockingPolicy.cs
index f9df59bfa816fb..3b2b3a2e25384b 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ManifestResourceBlockingPolicy.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ManifestResourceBlockingPolicy.cs
@@ -100,7 +100,7 @@ public AssemblyFeatureInfo(EcmaModule module, IReadOnlyDictionary
}
}
- private class SubstitutionsReader : ProcessLinkerXmlBase
+ private class SubstitutionsReader : ProcessXmlBase
{
private readonly HashSet _substitutions = new HashSet();
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/MultiFileCompilationModuleGroup.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/MultiFileCompilationModuleGroup.cs
index 9f93ae3ea87a13..a7c4b27afd274f 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/MultiFileCompilationModuleGroup.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/MultiFileCompilationModuleGroup.cs
@@ -15,7 +15,7 @@ public abstract class MultiFileCompilationModuleGroup : CompilationModuleGroup
{
private HashSet _compilationModuleSet;
- public MultiFileCompilationModuleGroup(TypeSystemContext context, IEnumerable compilationModuleSet)
+ public MultiFileCompilationModuleGroup(CompilerTypeSystemContext context, IEnumerable compilationModuleSet)
{
_compilationModuleSet = new HashSet(compilationModuleSet);
@@ -94,7 +94,7 @@ public override bool CanHaveReferenceThroughImportTable
///
public class MultiFileSharedCompilationModuleGroup : MultiFileCompilationModuleGroup
{
- public MultiFileSharedCompilationModuleGroup(TypeSystemContext context, IEnumerable compilationModuleSet)
+ public MultiFileSharedCompilationModuleGroup(CompilerTypeSystemContext context, IEnumerable compilationModuleSet)
: base(context, compilationModuleSet)
{
}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ProcessLinkerXmlBase.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ProcessLinkerXmlBase.cs
index c5101bde818fa3..e157381162aa51 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ProcessLinkerXmlBase.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ProcessLinkerXmlBase.cs
@@ -1,316 +1,511 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Collections.Generic;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.IO;
+using System.Linq;
using System.Reflection;
+using System.Reflection.Metadata;
using System.Text;
+using System.Text.RegularExpressions;
using System.Xml;
-
+using System.Xml.Linq;
+using System.Xml.XPath;
+using ILLink.Shared;
using Internal.TypeSystem;
+#nullable enable
+
namespace ILCompiler
{
- ///
- /// Base class for readers of IL Linker XML file format.
- ///
- internal abstract class ProcessLinkerXmlBase
+ [Flags]
+ public enum AllowedAssemblies
{
- private readonly XmlReader _reader;
- private readonly ModuleDesc _owningModule;
+ ContainingAssembly = 0x1,
+ AnyAssembly = 0x2 | ContainingAssembly,
+ AllAssemblies = 0x4 | AnyAssembly
+ }
+
+ public abstract class ProcessLinkerXmlBase
+ {
+ const string FullNameAttributeName = "fullname";
+ const string LinkerElementName = "linker";
+ const string TypeElementName = "type";
+ const string SignatureAttributeName = "signature";
+ const string NameAttributeName = "name";
+ const string FieldElementName = "field";
+ const string MethodElementName = "method";
+ const string EventElementName = "event";
+ const string PropertyElementName = "property";
+ const string AllAssembliesFullName = "*";
+ protected const string XmlNamespace = "";
+
+ protected readonly string _xmlDocumentLocation;
+ readonly XPathNavigator _document;
+ protected readonly ModuleDesc? _owningModule;
private readonly IReadOnlyDictionary _featureSwitchValues;
protected readonly TypeSystemContext _context;
- public ProcessLinkerXmlBase(TypeSystemContext context, XmlReader reader, ModuleDesc owningModule, IReadOnlyDictionary featureSwitchValues)
+ protected ProcessLinkerXmlBase(TypeSystemContext context, UnmanagedMemoryStream documentStream, string xmlDocumentLocation, IReadOnlyDictionary featureSwitchValues)
{
- _reader = reader;
- _owningModule = owningModule;
- _featureSwitchValues = featureSwitchValues;
_context = context;
+ using (documentStream)
+ {
+ _document = XDocument.Load(documentStream, LoadOptions.SetLineInfo).CreateNavigator();
+ }
+ _xmlDocumentLocation = xmlDocumentLocation;
+ _featureSwitchValues = featureSwitchValues;
}
- public void ProcessXml()
+ protected ProcessLinkerXmlBase(TypeSystemContext context, UnmanagedMemoryStream documentStream, ManifestResource resource, ModuleDesc resourceAssembly, string xmlDocumentLocation, IReadOnlyDictionary featureSwitchValues)
+ : this(context, documentStream, xmlDocumentLocation, featureSwitchValues)
{
- if (_reader.IsStartElement() && _reader.Name == "linker")
+ _owningModule = resourceAssembly ?? throw new ArgumentNullException(nameof(resourceAssembly));
+ }
+
+ protected virtual bool ShouldProcessElement(XPathNavigator nav) => FeatureSettings.ShouldProcessElement(nav, _featureSwitchValues);
+
+ protected virtual void ProcessXml(bool ignoreResource)
+ {
+ if (!AllowedAssemblySelector.HasFlag(AllowedAssemblies.AnyAssembly) && _owningModule == null)
+ throw new InvalidOperationException("The containing assembly must be specified for XML which is restricted to modifying that assembly only.");
+
+ try
{
- if (!ShouldProcessElement())
+ XPathNavigator nav = _document.CreateNavigator();
+
+ // Initial structure check - ignore XML document which don't look like linker XML format
+ if (!nav.MoveToChild(LinkerElementName, XmlNamespace))
+ return;
+
+ if (_owningModule != null)
+ {
+ if (ignoreResource)
+ return;
+ }
+
+ if (!ShouldProcessElement(nav))
return;
- _reader.Read();
+ ProcessAssemblies(nav);
- ProcessAssemblies();
+ // For embedded XML, allow not specifying the assembly explicitly in XML.
+ if (_owningModule != null)
+ ProcessAssembly(_owningModule, nav, warnOnUnresolvedTypes: true);
+
+ }
+ catch (Exception ex)
+ {
+ // throw new LinkerFatalErrorException(MessageContainer.CreateErrorMessage(null, DiagnosticId.ErrorProcessingXmlLocation, _xmlDocumentLocation), ex);
+ throw ex;
}
}
- protected string GetAttribute(string attribute)
- {
- return _reader.GetAttribute(attribute);
- }
+ protected virtual AllowedAssemblies AllowedAssemblySelector { get => _owningModule != null ? AllowedAssemblies.ContainingAssembly : AllowedAssemblies.AnyAssembly; }
- protected bool IsEmpty()
+ bool ShouldProcessAllAssemblies(XPathNavigator nav, [NotNullWhen(false)] out AssemblyName? assemblyName)
{
- return _reader.IsEmptyElement;
+ assemblyName = null;
+ if (GetFullName(nav) == AllAssembliesFullName)
+ return true;
+
+ assemblyName = GetAssemblyName(nav);
+ return false;
}
- private void ProcessAssemblies()
+ protected virtual void ProcessAssemblies(XPathNavigator nav)
{
- while (_reader.IsStartElement())
+ foreach (XPathNavigator assemblyNav in nav.SelectChildren("assembly", ""))
{
- if (_reader.Name == "assembly")
+ // Errors for invalid assembly names should show up even if this element will be
+ // skipped due to feature conditions.
+ bool processAllAssemblies = ShouldProcessAllAssemblies(assemblyNav, out AssemblyName? name);
+ if (processAllAssemblies && AllowedAssemblySelector != AllowedAssemblies.AllAssemblies)
{
- string assemblyName = _reader.GetAttribute("fullname");
+ //LogWarning(assemblyNav, DiagnosticId.XmlUnsuportedWildcard);
+ continue;
+ }
- if (assemblyName == "*")
+ ModuleDesc? assemblyToProcess = null;
+ if (!AllowedAssemblySelector.HasFlag(AllowedAssemblies.AnyAssembly))
+ {
+ Debug.Assert(!processAllAssemblies);
+ Debug.Assert(_owningModule != null);
+ if (_owningModule.Assembly.GetName().Name != name!.Name)
{
- // https://github.com/dotnet/runtimelab/issues/1381
- _reader.Skip();
+ //LogWarning(assemblyNav, DiagnosticId.AssemblyWithEmbeddedXmlApplyToAnotherAssembly, _resource.Value.Assembly.Name.Name, name.ToString());
continue;
}
+ assemblyToProcess = _owningModule;
+ }
- // Errors for invalid assembly names should show up even if this element will be
- // skipped due to feature conditions.
- var name = new AssemblyName(assemblyName);
+ if (!ShouldProcessElement(assemblyNav))
+ continue;
- if (!ShouldProcessElement())
- {
- _reader.Skip();
- continue;
- }
-
- ModuleDesc assembly = GetAssembly(name);
+ if (processAllAssemblies)
+ {
+ throw new NotImplementedException();
+ // We could avoid loading all references in this case: https://github.com/dotnet/linker/issues/1708
+ //foreach (ModuleDesc assembly in GetReferencedAssemblies())
+ // ProcessAssembly(assembly, assemblyNav, warnOnUnresolvedTypes: false);
+ }
+ else
+ {
+ Debug.Assert(!processAllAssemblies);
+ ModuleDesc? assembly = assemblyToProcess ?? _context.ResolveAssembly(name!);
if (assembly == null)
{
- //Context.LogWarning($"Could not resolve assembly '{name.Name}'", 2007, _xmlDocumentLocation);
- _reader.Skip();
+ //LogWarning(assemblyNav, DiagnosticId.XmlCouldNotResolveAssembly, name!.Name);
continue;
}
- _reader.Read();
-
- ProcessAssembly(assembly);
- }
- else if (_reader.Name == "type")
- {
- ProcessType(_owningModule);
- }
- else if (_reader.Name == "resource")
- {
- ProcessResource(_owningModule);
- }
- else
- {
- _reader.Skip();
+ ProcessAssembly(assembly, assemblyNav, warnOnUnresolvedTypes: true);
}
}
}
- protected ModuleDesc GetAssembly(AssemblyName name)
- {
- return _context.ResolveAssembly(name);
- }
- private void ProcessAssembly(ModuleDesc assembly)
+ protected abstract void ProcessAssembly(ModuleDesc assembly, XPathNavigator nav, bool warnOnUnresolvedTypes);
+
+ protected virtual void ProcessTypes(ModuleDesc assembly, XPathNavigator nav, bool warnOnUnresolvedTypes)
{
- while (_reader.IsStartElement())
+ foreach (XPathNavigator typeNav in nav.SelectChildren(TypeElementName, XmlNamespace))
{
- if (_reader.Name == "type")
+
+ if (!ShouldProcessElement(typeNav))
+ continue;
+
+ string fullname = GetFullName(typeNav);
+
+ if (fullname.IndexOf("*") != -1)
{
- ProcessType(assembly);
+ if (ProcessTypePattern(fullname, assembly, typeNav))
+ continue;
}
- else if (_reader.Name == "resource")
+
+ // TODO: Process exported types
+
+ // TODO: Semantics differ and xml format is cecil specific, therefore they are discrepancies on things like nested types
+ TypeDesc type = CustomAttributeTypeNameParser.GetTypeByCustomAttributeTypeName(assembly, fullname, throwIfNotFound: false);
+
+ if (type == null)
{
- ProcessResource(assembly);
+ //if (warnOnUnresolvedTypes)
+ // LogWarning(typeNav, DiagnosticId.XmlCouldNotResolveType, fullname);
+ continue;
}
- _reader.Skip();
+ ProcessType(type, typeNav);
}
+ }
+
+ void MatchType(TypeDesc type, Regex regex, XPathNavigator nav)
+ {
+ StringBuilder sb = new StringBuilder();
+ CecilTypeNameFormatter.Instance.AppendName(sb, type);
+ if (regex.Match(sb.ToString()).Success)
+ ProcessType(type, nav);
+ }
- _reader.ReadEndElement();
+ protected virtual bool ProcessTypePattern(string fullname, ModuleDesc assembly, XPathNavigator nav)
+ {
+ Regex regex = new Regex(fullname.Replace(".", @"\.").Replace("*", "(.*)"));
+
+ foreach (TypeDesc type in assembly.GetAllTypes())
+ MatchType(type, regex, nav);
+
+ return true;
}
- private void ProcessType(ModuleDesc assembly)
+ protected abstract void ProcessType(TypeDesc type, XPathNavigator nav);
+
+ protected void ProcessTypeChildren(TypeDesc type, XPathNavigator nav, object? customData = null)
{
- if (ShouldProcessElement())
+ if (nav.HasChildren)
{
- string typeName = _reader.GetAttribute("fullname");
+ ProcessSelectedFields(nav, type);
+ ProcessSelectedMethods(nav, type, customData);
+ // TODO: In order to be compatible with the format we need to be able to recognize properties, events and maybe attributes
+ }
+ }
- if (typeName.Contains('*'))
- throw new NotSupportedException();
+ void ProcessSelectedFields(XPathNavigator nav, TypeDesc type)
+ {
+ foreach (XPathNavigator fieldNav in nav.SelectChildren(FieldElementName, XmlNamespace))
+ {
+ if (!ShouldProcessElement(fieldNav))
+ continue;
+ ProcessField(type, fieldNav);
+ }
+ }
- TypeDesc type = CustomAttributeTypeNameParser.GetTypeByCustomAttributeTypeName(assembly, typeName, throwIfNotFound: false);
- if (type == null)
+ protected virtual void ProcessField(TypeDesc type, XPathNavigator nav)
+ {
+ string signature = GetSignature(nav);
+ if (!String.IsNullOrEmpty(signature))
+ {
+ FieldDesc? field = GetField(type, signature);
+ if (field == null)
{
- //Context.LogWarning ($"Could not resolve type '{fullname}'", 2008, _xmlDocumentLocation);
- _reader.Skip();
+ //LogWarning(nav, DiagnosticId.XmlCouldNotFindFieldOnType, signature, type.GetDisplayName());
return;
}
- _reader.Read();
+ ProcessField(type, field, nav);
+ }
- while (_reader.IsStartElement())
+ string name = GetName(nav);
+ if (!String.IsNullOrEmpty(name))
+ {
+ bool foundMatch = false;
+ foreach (FieldDesc field in type.GetFields())
{
- if (_reader.Name == "method")
- {
- ProcessMethod(type);
- }
- else if (_reader.Name == "field")
+ if (field.Name == name)
{
- ProcessField(type);
- }
- else if (_reader.Name == "attribute")
- {
- ProcessAttribute(type);
+ foundMatch = true;
+ ProcessField(type, field, nav);
}
+ }
+
- _reader.Skip();
+ if (!foundMatch)
+ {
+ // LogWarning(nav, DiagnosticId.XmlCouldNotFindFieldOnType, name, type.GetDisplayName());
}
}
+ }
+
+ protected static FieldDesc? GetField(TypeDesc type, string signature)
+ {
+ StringBuilder sb = new StringBuilder();
+ foreach (FieldDesc field in type.GetFields())
+ {
+ sb.Clear();
+ CecilTypeNameFormatter.Instance.AppendName(sb, field.FieldType);
+ if (signature == sb.ToString() + " " + field.Name)
+ return field;
+ }
+
+ return null;
+ }
+
+ protected virtual void ProcessField(TypeDesc type, FieldDesc field, XPathNavigator nav) { }
- _reader.Skip();
+ void ProcessSelectedMethods(XPathNavigator nav, TypeDesc type, object? customData)
+ {
+ foreach (XPathNavigator methodNav in nav.SelectChildren(MethodElementName, XmlNamespace))
+ {
+ if (!ShouldProcessElement(methodNav))
+ continue;
+ ProcessMethod(type, methodNav, customData);
+ }
}
- private void ProcessMethod(TypeDesc type)
+ protected virtual void ProcessMethod(TypeDesc type, XPathNavigator nav, object? customData)
{
- if (ShouldProcessElement())
+ string signature = GetSignature(nav);
+ if (!String.IsNullOrEmpty(signature))
{
- string signature = _reader.GetAttribute("signature");
- if (!String.IsNullOrEmpty(signature))
+ MethodDesc? method = GetMethod(type, signature);
+ if (method == null)
{
- MethodDesc method = GetMethod(type, signature);
- if (method == null)
- {
- //Context.LogWarning($"Could not find method '{signature}' on type '{type.GetDisplayName()}'", 2009, _xmlDocumentLocation);
- return;
- }
-
- ProcessMethod(method);
+ //LogWarning(nav, DiagnosticId.XmlCouldNotFindMethodOnType, signature, type.GetDisplayName());
+ return;
}
- string methodName = _reader.GetAttribute("name");
- if (!String.IsNullOrEmpty(methodName))
- {
- bool foundMatch = false;
- foreach (MethodDesc method in type.GetMethods())
- {
- if (method.Name == methodName)
- {
- foundMatch = true;
- ProcessMethod(method);
- }
- }
+ ProcessMethod(type, method, nav, customData);
+ }
- if (!foundMatch)
+ string name = GetAttribute(nav, NameAttributeName);
+ if (!String.IsNullOrEmpty(name))
+ {
+ bool foundMatch = false;
+ foreach (MethodDesc method in type.GetAllMethods())
+ {
+ if (name == method.Name)
{
- //Context.LogWarning($"Could not find method '{name}' on type '{type.GetDisplayName()}'", 2009, _xmlDocumentLocation);
+ foundMatch = true;
+ ProcessMethod(type, method, nav, customData);
}
}
+ if (!foundMatch)
+ {
+ // LogWarning(nav, DiagnosticId.XmlCouldNotFindMethodOnType, name, type.GetDisplayName());
+ }
}
}
- protected virtual void ProcessMethod(MethodDesc method)
+ protected virtual MethodDesc? GetMethod(TypeDesc type, string signature) => null;
+
+ protected virtual void ProcessMethod(TypeDesc type, MethodDesc method, XPathNavigator nav, object? customData) { }
+
+#if false
+ void ProcessSelectedEvents(XPathNavigator nav, TypeDefinition type, object? customData)
{
+ foreach (XPathNavigator eventNav in nav.SelectChildren(EventElementName, XmlNamespace))
+ {
+ if (!ShouldProcessElement(eventNav))
+ continue;
+ ProcessEvent(type, eventNav, customData);
+ }
}
- private void ProcessField(TypeDesc type)
+ protected virtual void ProcessEvent(TypeDefinition type, XPathNavigator nav, object? customData)
{
- if (ShouldProcessElement())
+ string signature = GetSignature(nav);
+ if (!String.IsNullOrEmpty(signature))
{
- string fieldName = _reader.GetAttribute("name");
- if (!String.IsNullOrEmpty(fieldName))
+ EventDefinition? @event = GetEvent(type, signature);
+ if (@event == null)
{
- FieldDesc field = type.GetField(fieldName);
+ LogWarning(nav, DiagnosticId.XmlCouldNotFindEventOnType, signature, type.GetDisplayName());
+ return;
+ }
- if (field == null)
- {
- //Context.LogWarning($"Could not find field '{name}' on type '{type.GetDisplayName()}'", 2012, _xmlDocumentLocation);
- }
- else
+ ProcessEvent(type, @event, nav, customData);
+ }
+
+ string name = GetAttribute(nav, NameAttributeName);
+ if (!String.IsNullOrEmpty(name))
+ {
+ bool foundMatch = false;
+ foreach (EventDefinition @event in type.Events)
+ {
+ if (@event.Name == name)
{
- ProcessField(field);
+ foundMatch = true;
+ ProcessEvent(type, @event, nav, customData);
}
}
+
+ if (!foundMatch)
+ {
+ LogWarning(nav, DiagnosticId.XmlCouldNotFindEventOnType, name, type.GetDisplayName());
+ }
}
}
- protected virtual void ProcessField(FieldDesc field)
+ protected static EventDefinition? GetEvent(TypeDefinition type, string signature)
{
- }
+ if (!type.HasEvents)
+ return null;
- protected virtual void ProcessAttribute(TypeDesc type)
- {
- }
+ foreach (EventDefinition @event in type.Events)
+ if (signature == @event.EventType.FullName + " " + @event.Name)
+ return @event;
- protected virtual void ProcessResource(ModuleDesc module)
- {
+ return null;
}
- protected MethodDesc GetMethod(TypeDesc type, string signature)
- {
- foreach (MethodDesc meth in type.GetMethods())
- if (signature == GetMethodSignature(meth, false))
- return meth;
+ protected virtual void ProcessEvent(TypeDefinition type, EventDefinition @event, XPathNavigator nav, object? customData) { }
- return null;
+ void ProcessSelectedProperties(XPathNavigator nav, TypeDefinition type, object? customData)
+ {
+ foreach (XPathNavigator propertyNav in nav.SelectChildren(PropertyElementName, XmlNamespace))
+ {
+ if (!ShouldProcessElement(propertyNav))
+ continue;
+ ProcessProperty(type, propertyNav, customData);
+ }
}
- public static string GetMethodSignature(MethodDesc meth, bool includeGenericParameters)
+ protected virtual void ProcessProperty(TypeDefinition type, XPathNavigator nav, object? customData)
{
- StringBuilder sb = new StringBuilder();
- CecilTypeNameFormatter.Instance.AppendName(sb, meth.Signature.ReturnType);
- sb.Append(' ');
- sb.Append(meth.Name);
- if (includeGenericParameters && meth.HasInstantiation)
+ string signature = GetSignature(nav);
+ if (!String.IsNullOrEmpty(signature))
{
- sb.Append('`');
- sb.Append(meth.Instantiation.Length);
+ PropertyDefinition? property = GetProperty(type, signature);
+ if (property == null)
+ {
+ LogWarning(nav, DiagnosticId.XmlCouldNotFindPropertyOnType, signature, type.GetDisplayName());
+ return;
+ }
+
+ ProcessProperty(type, property, nav, customData, true);
}
- sb.Append('(');
- for (int i = 0; i < meth.Signature.Length; i++)
+ string name = GetAttribute(nav, NameAttributeName);
+ if (!String.IsNullOrEmpty(name))
{
- if (i > 0)
- sb.Append(',');
+ bool foundMatch = false;
+ foreach (PropertyDefinition property in type.Properties)
+ {
+ if (property.Name == name)
+ {
+ foundMatch = true;
+ ProcessProperty(type, property, nav, customData, false);
+ }
+ }
- CecilTypeNameFormatter.Instance.AppendName(sb, meth.Signature[i]);
+ if (!foundMatch)
+ {
+ LogWarning(nav, DiagnosticId.XmlCouldNotFindPropertyOnType, name, type.GetDisplayName());
+ }
}
+ }
+
+ protected static PropertyDefinition? GetProperty(TypeDefinition type, string signature)
+ {
+ if (!type.HasProperties)
+ return null;
+
+ foreach (PropertyDefinition property in type.Properties)
+ if (signature == property.PropertyType.FullName + " " + property.Name)
+ return property;
- sb.Append(')');
- return sb.ToString();
+ return null;
}
- private bool ShouldProcessElement()
+ protected virtual void ProcessProperty(TypeDefinition type, PropertyDefinition property, XPathNavigator nav, object? customData, bool fromSignature) { }
+#endif
+
+ protected virtual AssemblyName GetAssemblyName(XPathNavigator nav)
{
- string feature = _reader.GetAttribute("feature");
- if (string.IsNullOrEmpty(feature))
- return true;
+ return new AssemblyName(GetFullName(nav));
+ }
- string value = _reader.GetAttribute("featurevalue");
- if (string.IsNullOrEmpty(value))
- {
- //context.LogError($"Failed to process '{documentLocation}'. Feature '{feature}' does not specify a 'featurevalue' attribute", 1001);
- return false;
- }
+ protected static string GetFullName(XPathNavigator nav)
+ {
+ return GetAttribute(nav, FullNameAttributeName);
+ }
- if (!bool.TryParse(value, out bool bValue))
- {
- //context.LogError($"Failed to process '{documentLocation}'. Unsupported non-boolean feature definition '{feature}'", 1002);
- return false;
- }
+ protected static string GetName(XPathNavigator nav)
+ {
+ return GetAttribute(nav, NameAttributeName);
+ }
- var isDefault = _reader.GetAttribute("featuredefault");
- bool bIsDefault = false;
- if (!string.IsNullOrEmpty(isDefault) && (!bool.TryParse(isDefault, out bIsDefault) || !bIsDefault))
- {
- //context.LogError($"Failed to process '{documentLocation}'. Unsupported value for featuredefault attribute", 1014);
- return false;
- }
+ protected static string GetSignature(XPathNavigator nav)
+ {
+ return GetAttribute(nav, SignatureAttributeName);
+ }
- if (!_featureSwitchValues.TryGetValue(feature, out bool featureSetting))
- return bIsDefault;
+ protected static string GetAttribute(XPathNavigator nav, string attribute)
+ {
+ return nav.GetAttribute(attribute, XmlNamespace);
+ }
- return bValue == featureSetting;
+#if false
+ protected MessageOrigin GetMessageOriginForPosition(XPathNavigator position)
+ {
+ return (position is IXmlLineInfo lineInfo)
+ ? new MessageOrigin(_xmlDocumentLocation, lineInfo.LineNumber, lineInfo.LinePosition, _resource?.Assembly)
+ : new MessageOrigin(_xmlDocumentLocation, 0, 0, _resource?.Assembly);
+ }
+ protected void LogWarning(string message, int warningCode, XPathNavigator position)
+ {
+ _context.LogWarning(message, warningCode, GetMessageOriginForPosition(position));
+ }
+
+ protected void LogWarning(XPathNavigator position, DiagnosticId id, params string[] args)
+ {
+ _context.LogWarning(GetMessageOriginForPosition(position), id, args);
}
+#endif
class CecilTypeNameFormatter : TypeNameFormatter
{
@@ -399,6 +594,106 @@ protected override void AppendNameForNestedType(StringBuilder sb, DefType nested
sb.Append('/');
sb.Append(nestedType.Name);
}
+
+#if false
+ public bool TryConvertValue(string value, TypeDesc type, out object? result)
+ {
+ switch (type.UnderlyingType.Category)
+ {
+ case TypeFlags.Boolean:
+ if ((bool.TryParse(value, out bool bvalue)))
+ {
+ result = bvalue ? 1 : 0;
+ return true;
+ }
+ else
+ goto case TypeFlags.Int32;
+
+ case TypeFlags.Byte:
+ if (!byte.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out byte byteresult))
+ break;
+
+ result = (int)byteresult;
+ return true;
+
+ case TypeFlags.SByte:
+ if (!sbyte.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out sbyte sbyteresult))
+ break;
+
+ result = (int)sbyteresult;
+ return true;
+
+ case TypeFlags.Int16:
+ if (!short.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out short shortresult))
+ break;
+
+ result = (int)shortresult;
+ return true;
+
+ case TypeFlags.UInt16:
+ if (!ushort.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out ushort ushortresult))
+ break;
+
+ result = (int)ushortresult;
+ return true;
+
+ case TypeFlags.Int32:
+ if (!int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out int iresult))
+ break;
+
+ result = iresult;
+ return true;
+
+ case TypeFlags.UInt32:
+ if (!uint.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out uint uresult))
+ break;
+
+ result = (int)uresult;
+ return true;
+
+ case TypeFlags.Double:
+ if (!double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out double dresult))
+ break;
+
+ result = dresult;
+ return true;
+
+ case TypeFlags.Single:
+ if (!float.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out float fresult))
+ break;
+
+ result = fresult;
+ return true;
+
+ case TypeFlags.Int64:
+ if (!long.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out long lresult))
+ break;
+
+ result = lresult;
+ return true;
+
+ case TypeFlags.UInt64:
+ if (!ulong.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out ulong ulresult))
+ break;
+
+ result = (long)ulresult;
+ return true;
+
+ case TypeFlags.Char:
+ if (!char.TryParse(value, out char chresult))
+ break;
+
+ result = (int)chresult;
+ return true;
+
+ default:
+ throw new NotSupportedException(type.ToString());
+ }
+
+ result = null;
+ return false;
+ }
+#endif
}
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ProcessXmlBase.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ProcessXmlBase.cs
new file mode 100644
index 00000000000000..b00f56a0c2ce47
--- /dev/null
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ProcessXmlBase.cs
@@ -0,0 +1,404 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+using System.Xml;
+
+using Internal.TypeSystem;
+
+namespace ILCompiler
+{
+ ///
+ /// Base class for readers of IL Linker XML file format.
+ ///
+ internal abstract class ProcessXmlBase
+ {
+ private readonly XmlReader _reader;
+ private readonly ModuleDesc _owningModule;
+ private readonly IReadOnlyDictionary _featureSwitchValues;
+ protected readonly TypeSystemContext _context;
+
+ public ProcessXmlBase(TypeSystemContext context, XmlReader reader, ModuleDesc owningModule, IReadOnlyDictionary featureSwitchValues)
+ {
+ _reader = reader;
+ _owningModule = owningModule;
+ _featureSwitchValues = featureSwitchValues;
+ _context = context;
+ }
+
+ public void ProcessXml()
+ {
+ if (_reader.IsStartElement() && _reader.Name == "linker")
+ {
+ if (!ShouldProcessElement())
+ return;
+
+ _reader.Read();
+
+ ProcessAssemblies();
+ }
+ }
+
+ protected string GetAttribute(string attribute)
+ {
+ return _reader.GetAttribute(attribute);
+ }
+
+ protected bool IsEmpty()
+ {
+ return _reader.IsEmptyElement;
+ }
+
+ private void ProcessAssemblies()
+ {
+ while (_reader.IsStartElement())
+ {
+ if (_reader.Name == "assembly")
+ {
+ string assemblyName = _reader.GetAttribute("fullname");
+
+ if (assemblyName == "*")
+ {
+ // https://github.com/dotnet/runtimelab/issues/1381
+ _reader.Skip();
+ continue;
+ }
+
+ // Errors for invalid assembly names should show up even if this element will be
+ // skipped due to feature conditions.
+ var name = new AssemblyName(assemblyName);
+
+ if (!ShouldProcessElement())
+ {
+ _reader.Skip();
+ continue;
+ }
+
+ ModuleDesc assembly = GetAssembly(name);
+
+ if (assembly == null)
+ {
+ //Context.LogWarning($"Could not resolve assembly '{name.Name}'", 2007, _xmlDocumentLocation);
+ _reader.Skip();
+ continue;
+ }
+
+ _reader.Read();
+
+ ProcessAssembly(assembly);
+ }
+ else if (_reader.Name == "type")
+ {
+ ProcessType(_owningModule);
+ }
+ else if (_reader.Name == "resource")
+ {
+ ProcessResource(_owningModule);
+ }
+ else
+ {
+ _reader.Skip();
+ }
+ }
+ }
+
+ protected ModuleDesc GetAssembly(AssemblyName name)
+ {
+ return _context.ResolveAssembly(name);
+ }
+
+ private void ProcessAssembly(ModuleDesc assembly)
+ {
+ while (_reader.IsStartElement())
+ {
+ if (_reader.Name == "type")
+ {
+ ProcessType(assembly);
+ }
+ else if (_reader.Name == "resource")
+ {
+ ProcessResource(assembly);
+ }
+
+ _reader.Skip();
+ }
+
+ _reader.ReadEndElement();
+ }
+
+ private void ProcessType(ModuleDesc assembly)
+ {
+ if (ShouldProcessElement())
+ {
+ string typeName = _reader.GetAttribute("fullname");
+
+ if (typeName.Contains('*'))
+ throw new NotSupportedException();
+
+ TypeDesc type = CustomAttributeTypeNameParser.GetTypeByCustomAttributeTypeName(assembly, typeName, throwIfNotFound: false);
+ if (type == null)
+ {
+ //Context.LogWarning ($"Could not resolve type '{fullname}'", 2008, _xmlDocumentLocation);
+ _reader.Skip();
+ return;
+ }
+
+ _reader.Read();
+
+ while (_reader.IsStartElement())
+ {
+ if (_reader.Name == "method")
+ {
+ ProcessMethod(type);
+ }
+ else if (_reader.Name == "field")
+ {
+ ProcessField(type);
+ }
+ else if (_reader.Name == "attribute")
+ {
+ ProcessAttribute(type);
+ }
+
+ _reader.Skip();
+ }
+ }
+
+ _reader.Skip();
+ }
+
+ private void ProcessMethod(TypeDesc type)
+ {
+ if (ShouldProcessElement())
+ {
+ string signature = _reader.GetAttribute("signature");
+ if (!String.IsNullOrEmpty(signature))
+ {
+ MethodDesc method = GetMethod(type, signature);
+ if (method == null)
+ {
+ //Context.LogWarning($"Could not find method '{signature}' on type '{type.GetDisplayName()}'", 2009, _xmlDocumentLocation);
+ return;
+ }
+
+ ProcessMethod(method);
+ }
+
+ string methodName = _reader.GetAttribute("name");
+ if (!String.IsNullOrEmpty(methodName))
+ {
+ bool foundMatch = false;
+ foreach (MethodDesc method in type.GetMethods())
+ {
+ if (method.Name == methodName)
+ {
+ foundMatch = true;
+ ProcessMethod(method);
+ }
+ }
+
+ if (!foundMatch)
+ {
+ //Context.LogWarning($"Could not find method '{name}' on type '{type.GetDisplayName()}'", 2009, _xmlDocumentLocation);
+ }
+ }
+ }
+ }
+
+ protected virtual void ProcessMethod(MethodDesc method)
+ {
+ }
+
+ private void ProcessField(TypeDesc type)
+ {
+ if (ShouldProcessElement())
+ {
+ string fieldName = _reader.GetAttribute("name");
+ if (!String.IsNullOrEmpty(fieldName))
+ {
+ FieldDesc field = type.GetField(fieldName);
+
+ if (field == null)
+ {
+ //Context.LogWarning($"Could not find field '{name}' on type '{type.GetDisplayName()}'", 2012, _xmlDocumentLocation);
+ }
+ else
+ {
+ ProcessField(field);
+ }
+ }
+ }
+ }
+
+ protected virtual void ProcessField(FieldDesc field)
+ {
+ }
+
+ protected virtual void ProcessAttribute(TypeDesc type)
+ {
+ }
+
+ protected virtual void ProcessResource(ModuleDesc module)
+ {
+ }
+
+ protected MethodDesc GetMethod(TypeDesc type, string signature)
+ {
+ foreach (MethodDesc meth in type.GetMethods())
+ if (signature == GetMethodSignature(meth, false))
+ return meth;
+
+ return null;
+ }
+
+ public static string GetMethodSignature(MethodDesc meth, bool includeGenericParameters)
+ {
+ StringBuilder sb = new StringBuilder();
+ CecilTypeNameFormatter.Instance.AppendName(sb, meth.Signature.ReturnType);
+ sb.Append(' ');
+ sb.Append(meth.Name);
+ if (includeGenericParameters && meth.HasInstantiation)
+ {
+ sb.Append('`');
+ sb.Append(meth.Instantiation.Length);
+ }
+
+ sb.Append('(');
+ for (int i = 0; i < meth.Signature.Length; i++)
+ {
+ if (i > 0)
+ sb.Append(',');
+
+ CecilTypeNameFormatter.Instance.AppendName(sb, meth.Signature[i]);
+ }
+
+ sb.Append(')');
+ return sb.ToString();
+ }
+
+ private bool ShouldProcessElement()
+ {
+ string feature = _reader.GetAttribute("feature");
+ if (string.IsNullOrEmpty(feature))
+ return true;
+
+ string value = _reader.GetAttribute("featurevalue");
+ if (string.IsNullOrEmpty(value))
+ {
+ //context.LogError($"Failed to process '{documentLocation}'. Feature '{feature}' does not specify a 'featurevalue' attribute", 1001);
+ return false;
+ }
+
+ if (!bool.TryParse(value, out bool bValue))
+ {
+ //context.LogError($"Failed to process '{documentLocation}'. Unsupported non-boolean feature definition '{feature}'", 1002);
+ return false;
+ }
+
+ var isDefault = _reader.GetAttribute("featuredefault");
+ bool bIsDefault = false;
+ if (!string.IsNullOrEmpty(isDefault) && (!bool.TryParse(isDefault, out bIsDefault) || !bIsDefault))
+ {
+ //context.LogError($"Failed to process '{documentLocation}'. Unsupported value for featuredefault attribute", 1014);
+ return false;
+ }
+
+ if (!_featureSwitchValues.TryGetValue(feature, out bool featureSetting))
+ return bIsDefault;
+
+ return bValue == featureSetting;
+ }
+
+ class CecilTypeNameFormatter : TypeNameFormatter
+ {
+ public static readonly CecilTypeNameFormatter Instance = new CecilTypeNameFormatter();
+
+ public override void AppendName(StringBuilder sb, ArrayType type)
+ {
+ AppendName(sb, type.ElementType);
+ sb.Append('[');
+ if (type.Rank > 1)
+ sb.Append(new string(',', type.Rank - 1));
+ sb.Append(']');
+ }
+ public override void AppendName(StringBuilder sb, ByRefType type)
+ {
+ AppendName(sb, type.ParameterType);
+ sb.Append('&');
+ }
+
+ public override void AppendName(StringBuilder sb, PointerType type)
+ {
+ AppendName(sb, type.ParameterType);
+ sb.Append('*');
+ }
+
+ public override void AppendName(StringBuilder sb, FunctionPointerType type)
+ {
+ sb.Append(" ");
+ AppendName(sb, type.Signature.ReturnType);
+ sb.Append(" *");
+
+ sb.Append("(");
+
+ for (int i = 0; i < type.Signature.Length; i++)
+ {
+ var parameter = type.Signature[i];
+ if (i > 0)
+ sb.Append(",");
+
+ AppendName(sb, parameter);
+ }
+
+ sb.Append(")");
+ }
+
+ public override void AppendName(StringBuilder sb, GenericParameterDesc type)
+ {
+ sb.Append(type.Name);
+ }
+ public override void AppendName(StringBuilder sb, SignatureMethodVariable type)
+ {
+ }
+ public override void AppendName(StringBuilder sb, SignatureTypeVariable type)
+ {
+ }
+ protected override void AppendNameForInstantiatedType(StringBuilder sb, DefType type)
+ {
+ AppendName(sb, type.GetTypeDefinition());
+
+ sb.Append('<');
+
+ for (int i = 0; i < type.Instantiation.Length; i++)
+ {
+ if (i != 0)
+ sb.Append(',');
+
+ AppendName(sb, type.Instantiation[i]);
+ }
+
+ sb.Append('>');
+ }
+ protected override void AppendNameForNamespaceType(StringBuilder sb, DefType type)
+ {
+ if (!String.IsNullOrEmpty(type.Namespace))
+ {
+ sb.Append(type.Namespace);
+ sb.Append('.');
+ }
+
+ sb.Append(type.Name);
+ }
+
+ protected override void AppendNameForNestedType(StringBuilder sb, DefType nestedType, DefType containingType)
+ {
+ AppendName(sb, containingType);
+ sb.Append('/');
+ sb.Append(nestedType.Name);
+ }
+ }
+ }
+}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/BodySubstitutionParser.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/BodySubstitutionParser.cs
new file mode 100644
index 00000000000000..403eb9207342e5
--- /dev/null
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/BodySubstitutionParser.cs
@@ -0,0 +1,174 @@
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Xml.XPath;
+using ILLink.Shared;
+using Mono.Cecil;
+
+namespace Mono.Linker.Steps
+{
+ public class BodySubstitutionParser : ProcessLinkerXmlBase
+ {
+ SubstitutionInfo? _substitutionInfo;
+
+ public BodySubstitutionParser(LinkContext context, Stream documentStream, string xmlDocumentLocation)
+ : base(context, documentStream, xmlDocumentLocation)
+ {
+ }
+
+ public BodySubstitutionParser(LinkContext context, Stream documentStream, EmbeddedResource resource, AssemblyDefinition resourceAssembly, string xmlDocumentLocation = "")
+ : base(context, documentStream, resource, resourceAssembly, xmlDocumentLocation)
+ {
+ }
+
+ public void Parse(SubstitutionInfo xmlInfo)
+ {
+ _substitutionInfo = xmlInfo;
+ bool stripSubstitutions = _context.IsOptimizationEnabled(CodeOptimizations.RemoveSubstitutions, _resource?.Assembly);
+ ProcessXml(stripSubstitutions, _context.IgnoreSubstitutions);
+ }
+
+ protected override void ProcessAssembly(AssemblyDefinition assembly, XPathNavigator nav, bool warnOnUnresolvedTypes)
+ {
+ ProcessTypes(assembly, nav, warnOnUnresolvedTypes);
+ ProcessResources(assembly, nav);
+ }
+
+ protected override TypeDefinition? ProcessExportedType(ExportedType exported, AssemblyDefinition assembly, XPathNavigator nav) => null;
+
+ protected override bool ProcessTypePattern(string fullname, AssemblyDefinition assembly, XPathNavigator nav) => false;
+
+ protected override void ProcessType(TypeDefinition type, XPathNavigator nav)
+ {
+ Debug.Assert(ShouldProcessElement(nav));
+ ProcessTypeChildren(type, nav);
+ }
+
+ protected override void ProcessMethod(TypeDefinition type, XPathNavigator methodNav, object? _customData)
+ {
+ Debug.Assert(_substitutionInfo != null);
+ string signature = GetSignature(methodNav);
+ if (string.IsNullOrEmpty(signature))
+ return;
+
+ MethodDefinition? method = FindMethod(type, signature);
+ if (method == null)
+ {
+ LogWarning(methodNav, DiagnosticId.XmlCouldNotFindMethodOnType, signature, type.GetDisplayName());
+ return;
+ }
+
+ string action = GetAttribute(methodNav, "body");
+ switch (action)
+ {
+ case "remove":
+ _substitutionInfo.SetMethodAction(method, MethodAction.ConvertToThrow);
+ return;
+ case "stub":
+ string value = GetAttribute(methodNav, "value");
+ if (!string.IsNullOrEmpty(value))
+ {
+ if (!TryConvertValue(value, method.ReturnType, out object? res))
+ {
+ LogWarning(methodNav, DiagnosticId.XmlInvalidValueForStub, method.GetDisplayName());
+ return;
+ }
+
+ _substitutionInfo.SetMethodStubValue(method, res);
+ }
+
+ _substitutionInfo.SetMethodAction(method, MethodAction.ConvertToStub);
+ return;
+ default:
+ LogWarning(methodNav, DiagnosticId.XmlUnkownBodyModification, action, method.GetDisplayName());
+ return;
+ }
+ }
+
+ protected override void ProcessField(TypeDefinition type, XPathNavigator fieldNav)
+ {
+ Debug.Assert(_substitutionInfo != null);
+ string name = GetAttribute(fieldNav, "name");
+ if (string.IsNullOrEmpty(name))
+ return;
+
+ var field = type.Fields.FirstOrDefault(f => f.Name == name);
+ if (field == null)
+ {
+ LogWarning(fieldNav, DiagnosticId.XmlCouldNotFindFieldOnType, name, type.GetDisplayName());
+ return;
+ }
+
+ if (!field.IsStatic || field.IsLiteral)
+ {
+ LogWarning(fieldNav, DiagnosticId.XmlSubstitutedFieldNeedsToBeStatic, field.GetDisplayName());
+ return;
+ }
+
+ string value = GetAttribute(fieldNav, "value");
+ if (string.IsNullOrEmpty(value))
+ {
+ LogWarning(fieldNav, DiagnosticId.XmlMissingSubstitutionValueForField, field.GetDisplayName());
+ return;
+ }
+ if (!TryConvertValue(value, field.FieldType, out object? res))
+ {
+ LogWarning(fieldNav, DiagnosticId.XmlInvalidSubstitutionValueForField, value, field.GetDisplayName());
+ return;
+ }
+
+ _substitutionInfo.SetFieldValue(field, res);
+
+ string init = GetAttribute(fieldNav, "initialize");
+ if (init?.ToLowerInvariant() == "true")
+ {
+ _substitutionInfo.SetFieldInit(field);
+ }
+ }
+
+ void ProcessResources(AssemblyDefinition assembly, XPathNavigator nav)
+ {
+ foreach (XPathNavigator resourceNav in nav.SelectChildren("resource", ""))
+ {
+ if (!ShouldProcessElement(resourceNav))
+ continue;
+
+ string name = GetAttribute(resourceNav, "name");
+ if (String.IsNullOrEmpty(name))
+ {
+ LogWarning(resourceNav, DiagnosticId.XmlMissingNameAttributeInResource);
+ continue;
+ }
+
+ string action = GetAttribute(resourceNav, "action");
+ if (action != "remove")
+ {
+ LogWarning(resourceNav, DiagnosticId.XmlInvalidValueForAttributeActionForResource, action, name);
+ continue;
+ }
+
+ EmbeddedResource? resource = assembly.FindEmbeddedResource(name);
+ if (resource == null)
+ {
+ LogWarning(resourceNav, DiagnosticId.XmlCouldNotFindResourceToRemoveInAssembly, name, assembly.Name.Name);
+ continue;
+ }
+
+ _context.Annotations.AddResourceToRemove(assembly, resource);
+ }
+ }
+
+ static MethodDefinition? FindMethod(TypeDefinition type, string signature)
+ {
+ if (!type.HasMethods)
+ return null;
+
+ foreach (MethodDefinition meth in type.Methods)
+ if (signature == DescriptorMarker.GetMethodSignature(meth, includeGenericParameters: true))
+ return meth;
+
+ return null;
+ }
+ }
+}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/DescriptorMarker.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/DescriptorMarker.cs
new file mode 100644
index 00000000000000..49404575e41f91
--- /dev/null
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/DescriptorMarker.cs
@@ -0,0 +1,292 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Text;
+using System.Xml.XPath;
+using ILLink.Shared;
+
+using Mono.Cecil;
+
+namespace Mono.Linker.Steps
+{
+ public class DescriptorMarker : ProcessLinkerXmlBase
+ {
+ const string NamespaceElementName = "namespace";
+
+ const string _required = "required";
+ const string _preserve = "preserve";
+ const string _accessors = "accessors";
+
+ static readonly string[] _accessorsAll = new string[] { "all" };
+ static readonly char[] _accessorsSep = new char[] { ';' };
+
+ public DescriptorMarker(LinkContext context, Stream documentStream, string xmlDocumentLocation)
+ : base(context, documentStream, xmlDocumentLocation)
+ {
+ }
+
+ public DescriptorMarker(LinkContext context, Stream documentStream, EmbeddedResource resource, AssemblyDefinition resourceAssembly, string xmlDocumentLocation = "")
+ : base(context, documentStream, resource, resourceAssembly, xmlDocumentLocation)
+ {
+ }
+
+ public void Mark()
+ {
+ bool stripDescriptors = _context.IsOptimizationEnabled(CodeOptimizations.RemoveDescriptors, _resource?.Assembly);
+ ProcessXml(stripDescriptors, _context.IgnoreDescriptors);
+ }
+
+ protected override AllowedAssemblies AllowedAssemblySelector { get => AllowedAssemblies.AnyAssembly; }
+
+ protected override void ProcessAssembly(AssemblyDefinition assembly, XPathNavigator nav, bool warnOnUnresolvedTypes)
+ {
+ if (GetTypePreserve(nav) == TypePreserve.All)
+ {
+ foreach (var type in assembly.MainModule.Types)
+ MarkAndPreserveAll(type, nav);
+
+ foreach (var exportedType in assembly.MainModule.ExportedTypes)
+ _context.MarkingHelpers.MarkExportedType(exportedType, assembly.MainModule, new DependencyInfo(DependencyKind.XmlDescriptor, assembly.MainModule), GetMessageOriginForPosition(nav));
+ }
+ else
+ {
+ ProcessTypes(assembly, nav, warnOnUnresolvedTypes);
+ ProcessNamespaces(assembly, nav);
+ }
+ }
+
+ void ProcessNamespaces(AssemblyDefinition assembly, XPathNavigator nav)
+ {
+ foreach (XPathNavigator namespaceNav in nav.SelectChildren(NamespaceElementName, XmlNamespace))
+ {
+ if (!ShouldProcessElement(namespaceNav))
+ continue;
+
+ string fullname = GetFullName(namespaceNav);
+ bool foundMatch = false;
+ foreach (TypeDefinition type in assembly.MainModule.Types)
+ {
+ if (type.Namespace != fullname)
+ continue;
+
+ foundMatch = true;
+ MarkAndPreserveAll(type, nav);
+ }
+
+ if (!foundMatch)
+ {
+ LogWarning(namespaceNav, DiagnosticId.XmlCouldNotFindAnyTypeInNamespace, fullname);
+ }
+ }
+ }
+
+ void MarkAndPreserveAll(TypeDefinition type, XPathNavigator nav)
+ {
+ _context.Annotations.Mark(type, new DependencyInfo(DependencyKind.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition(nav));
+ _context.Annotations.SetPreserve(type, TypePreserve.All);
+
+ if (!type.HasNestedTypes)
+ return;
+
+ foreach (TypeDefinition nested in type.NestedTypes)
+ MarkAndPreserveAll(nested, nav);
+ }
+
+ protected override TypeDefinition? ProcessExportedType(ExportedType exported, AssemblyDefinition assembly, XPathNavigator nav)
+ {
+ _context.MarkingHelpers.MarkExportedType(exported, assembly.MainModule, new DependencyInfo(DependencyKind.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition(nav));
+ return base.ProcessExportedType(exported, assembly, nav);
+ }
+
+ protected override void ProcessType(TypeDefinition type, XPathNavigator nav)
+ {
+ Debug.Assert(ShouldProcessElement(nav));
+
+ TypePreserve preserve = GetTypePreserve(nav);
+ switch (preserve)
+ {
+ case TypePreserve.Fields when !type.HasFields:
+ LogWarning(nav, DiagnosticId.TypeHasNoFieldsToPreserve, type.GetDisplayName());
+ break;
+
+ case TypePreserve.Methods when !type.HasMethods:
+ LogWarning(nav, DiagnosticId.TypeHasNoMethodsToPreserve, type.GetDisplayName());
+ break;
+
+ case TypePreserve.Fields:
+ case TypePreserve.Methods:
+ case TypePreserve.All:
+ _context.Annotations.SetPreserve(type, preserve);
+ break;
+ }
+
+ bool required = IsRequired(nav);
+ ProcessTypeChildren(type, nav, required);
+
+ if (!required)
+ return;
+
+ _context.Annotations.Mark(type, new DependencyInfo(DependencyKind.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition(nav));
+
+ if (type.IsNested)
+ {
+ var currentType = type;
+ while (currentType.IsNested)
+ {
+ var parent = currentType.DeclaringType;
+ _context.Annotations.Mark(parent, new DependencyInfo(DependencyKind.DeclaringType, currentType), GetMessageOriginForPosition(nav));
+ currentType = parent;
+ }
+ }
+ }
+
+ static TypePreserve GetTypePreserve(XPathNavigator nav)
+ {
+ string attribute = GetAttribute(nav, _preserve);
+ if (string.IsNullOrEmpty(attribute))
+ return nav.HasChildren ? TypePreserve.Nothing : TypePreserve.All;
+
+ if (Enum.TryParse(attribute, true, out TypePreserve result))
+ return result;
+ return TypePreserve.Nothing;
+ }
+
+ protected override void ProcessField(TypeDefinition type, FieldDefinition field, XPathNavigator nav)
+ {
+ if (_context.Annotations.IsMarked(field))
+ LogWarning(nav, DiagnosticId.XmlDuplicatePreserveMember, field.FullName);
+
+ _context.Annotations.Mark(field, new DependencyInfo(DependencyKind.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition(nav));
+ }
+
+ protected override void ProcessMethod(TypeDefinition type, MethodDefinition method, XPathNavigator nav, object? customData)
+ {
+ if (_context.Annotations.IsMarked(method))
+ LogWarning(nav, DiagnosticId.XmlDuplicatePreserveMember, method.GetDisplayName());
+
+ _context.Annotations.MarkIndirectlyCalledMethod(method);
+ _context.Annotations.SetAction(method, MethodAction.Parse);
+
+ if (customData is bool required && !required)
+ {
+ _context.Annotations.AddPreservedMethod(type, method);
+ }
+ else
+ {
+ _context.Annotations.Mark(method, new DependencyInfo(DependencyKind.XmlDescriptor, _xmlDocumentLocation), GetMessageOriginForPosition(nav));
+ }
+ }
+
+ void ProcessMethodIfNotNull(TypeDefinition type, MethodDefinition method, XPathNavigator nav, object? customData)
+ {
+ if (method == null)
+ return;
+
+ ProcessMethod(type, method, nav, customData);
+ }
+
+ protected override MethodDefinition? GetMethod(TypeDefinition type, string signature)
+ {
+ if (type.HasMethods)
+ foreach (MethodDefinition meth in type.Methods)
+ if (signature == GetMethodSignature(meth, false))
+ return meth;
+
+ return null;
+ }
+
+ public static string GetMethodSignature(MethodDefinition meth, bool includeGenericParameters)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append(meth.ReturnType.FullName);
+ sb.Append(" ");
+ sb.Append(meth.Name);
+ if (includeGenericParameters && meth.HasGenericParameters)
+ {
+ sb.Append("`");
+ sb.Append(meth.GenericParameters.Count);
+ }
+
+ sb.Append("(");
+ if (meth.HasParameters)
+ {
+ for (int i = 0; i < meth.Parameters.Count; i++)
+ {
+ if (i > 0)
+ sb.Append(",");
+
+ sb.Append(meth.Parameters[i].ParameterType.FullName);
+ }
+ }
+ sb.Append(")");
+ return sb.ToString();
+ }
+
+ protected override void ProcessEvent(TypeDefinition type, EventDefinition @event, XPathNavigator nav, object? customData)
+ {
+ if (_context.Annotations.IsMarked(@event))
+ LogWarning(nav, DiagnosticId.XmlDuplicatePreserveMember, @event.FullName);
+
+ ProcessMethod(type, @event.AddMethod, nav, customData);
+ ProcessMethod(type, @event.RemoveMethod, nav, customData);
+ ProcessMethodIfNotNull(type, @event.InvokeMethod, nav, customData);
+ }
+
+ protected override void ProcessProperty(TypeDefinition type, PropertyDefinition property, XPathNavigator nav, object? customData, bool fromSignature)
+ {
+ string[] accessors = fromSignature ? GetAccessors(nav) : _accessorsAll;
+
+ if (_context.Annotations.IsMarked(property))
+ LogWarning(nav, DiagnosticId.XmlDuplicatePreserveMember, property.FullName);
+
+ if (Array.IndexOf(accessors, "all") >= 0)
+ {
+ ProcessMethodIfNotNull(type, property.GetMethod, nav, customData);
+ ProcessMethodIfNotNull(type, property.SetMethod, nav, customData);
+ return;
+ }
+
+ if (property.GetMethod != null && Array.IndexOf(accessors, "get") >= 0)
+ ProcessMethod(type, property.GetMethod, nav, customData);
+ else if (property.GetMethod == null)
+ LogWarning(nav, DiagnosticId.XmlCouldNotFindGetAccesorOfPropertyOnType, property.Name, type.FullName);
+
+ if (property.SetMethod != null && Array.IndexOf(accessors, "set") >= 0)
+ ProcessMethod(type, property.SetMethod, nav, customData);
+ else if (property.SetMethod == null)
+ LogWarning(nav, DiagnosticId.XmlCouldNotFindSetAccesorOfPropertyOnType, property.Name, type.FullName);
+ }
+
+ static bool IsRequired(XPathNavigator nav)
+ {
+ string attribute = GetAttribute(nav, _required);
+ if (attribute == null || attribute.Length == 0)
+ return true;
+
+ return bool.TryParse(attribute, out bool result) && result;
+ }
+
+ protected static string[] GetAccessors(XPathNavigator nav)
+ {
+ string accessorsValue = GetAttribute(nav, _accessors);
+
+ if (accessorsValue != null)
+ {
+ string[] accessors = accessorsValue.Split(
+ _accessorsSep, StringSplitOptions.RemoveEmptyEntries);
+
+ if (accessors.Length > 0)
+ {
+ for (int i = 0; i < accessors.Length; ++i)
+ accessors[i] = accessors[i].ToLower();
+
+ return accessors;
+ }
+ }
+ return _accessorsAll;
+ }
+ }
+}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/FeatureSettings.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/FeatureSettings.cs
new file mode 100644
index 00000000000000..5e893760226848
--- /dev/null
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/FeatureSettings.cs
@@ -0,0 +1,50 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Xml.XPath;
+using ILLink.Shared;
+
+namespace Mono.Linker
+{
+ public static class FeatureSettings
+ {
+ public static bool ShouldProcessElement(XPathNavigator nav, LinkContext context, string documentLocation)
+ {
+ var feature = GetAttribute(nav, "feature");
+ if (string.IsNullOrEmpty(feature))
+ return true;
+
+ var value = GetAttribute(nav, "featurevalue");
+ if (string.IsNullOrEmpty(value))
+ {
+ context.LogError(null, DiagnosticId.XmlFeatureDoesNotSpecifyFeatureValue, documentLocation, feature);
+ return false;
+ }
+
+ if (!bool.TryParse(value, out bool bValue))
+ {
+ context.LogError(null, DiagnosticId.XmlUnsupportedNonBooleanValueForFeature, documentLocation, feature);
+ return false;
+ }
+
+ var isDefault = GetAttribute(nav, "featuredefault");
+ bool bIsDefault = false;
+ if (!string.IsNullOrEmpty(isDefault) && (!bool.TryParse(isDefault, out bIsDefault) || !bIsDefault))
+ {
+ context.LogError(null, DiagnosticId.XmlDocumentLocationHasInvalidFeatureDefault, documentLocation);
+ return false;
+ }
+
+ if (!context.FeatureSettings.TryGetValue(feature, out bool featureSetting))
+ return bIsDefault;
+
+ return bValue == featureSetting;
+ }
+
+ public static string GetAttribute(XPathNavigator nav, string attribute)
+ {
+ return nav.GetAttribute(attribute, String.Empty);
+ }
+ }
+}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/LinkAttributesParser.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/LinkAttributesParser.cs
new file mode 100644
index 00000000000000..0acfdda2dccbe5
--- /dev/null
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/LinkAttributesParser.cs
@@ -0,0 +1,578 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Xml.XPath;
+using ILLink.Shared;
+using Mono.Cecil;
+
+namespace Mono.Linker.Steps
+{
+ public class LinkAttributesParser : ProcessLinkerXmlBase
+ {
+ AttributeInfo? _attributeInfo;
+
+ public LinkAttributesParser(LinkContext context, Stream documentStream, string xmlDocumentLocation)
+ : base(context, documentStream, xmlDocumentLocation)
+ {
+ }
+
+ public LinkAttributesParser(LinkContext context, Stream documentStream, EmbeddedResource resource, AssemblyDefinition resourceAssembly, string xmlDocumentLocation = "")
+ : base(context, documentStream, resource, resourceAssembly, xmlDocumentLocation)
+ {
+ }
+
+ public void Parse(AttributeInfo xmlInfo)
+ {
+ _attributeInfo = xmlInfo;
+ bool stripLinkAttributes = _context.IsOptimizationEnabled(CodeOptimizations.RemoveLinkAttributes, _resource?.Assembly);
+ ProcessXml(stripLinkAttributes, _context.IgnoreLinkAttributes);
+ }
+
+ CustomAttribute[]? ProcessAttributes(XPathNavigator nav, ICustomAttributeProvider provider)
+ {
+ var builder = new ArrayBuilder();
+ foreach (XPathNavigator argumentNav in nav.SelectChildren("attribute", string.Empty))
+ {
+ if (!ShouldProcessElement(argumentNav))
+ continue;
+
+ TypeDefinition? attributeType;
+ string internalAttribute = GetAttribute(argumentNav, "internal");
+ if (!string.IsNullOrEmpty(internalAttribute))
+ {
+ attributeType = GenerateRemoveAttributeInstancesAttribute();
+ if (attributeType == null)
+ continue;
+
+ // TODO: Replace with IsAttributeType check once we have it
+ if (provider is not TypeDefinition)
+ {
+ LogWarning(argumentNav, DiagnosticId.XmlRemoveAttributeInstancesCanOnlyBeUsedOnType, attributeType.Name);
+ continue;
+ }
+ }
+ else
+ {
+ string attributeFullName = GetFullName(argumentNav);
+ if (string.IsNullOrEmpty(attributeFullName))
+ {
+ LogWarning(argumentNav, DiagnosticId.XmlElementDoesNotContainRequiredAttributeFullname);
+ continue;
+ }
+
+ if (!GetAttributeType(argumentNav, attributeFullName, out attributeType))
+ continue;
+ }
+
+ CustomAttribute? customAttribute = CreateCustomAttribute(argumentNav, attributeType);
+ if (customAttribute != null)
+ {
+ _context.LogMessage($"Assigning external custom attribute '{FormatCustomAttribute(customAttribute)}' instance to '{provider}'.");
+ builder.Add(customAttribute);
+ }
+ }
+
+ return builder.ToArray();
+
+ static string FormatCustomAttribute(CustomAttribute ca)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append(ca.Constructor.GetDisplayName());
+ sb.Append(" { args: ");
+ for (int i = 0; i < ca.ConstructorArguments.Count; ++i)
+ {
+ if (i > 0)
+ sb.Append(", ");
+
+ var caa = ca.ConstructorArguments[i];
+ sb.Append($"{caa.Type.GetDisplayName()} {caa.Value}");
+ }
+ sb.Append(" }");
+
+ return sb.ToString();
+ }
+ }
+
+ TypeDefinition? GenerateRemoveAttributeInstancesAttribute()
+ {
+ if (_context.MarkedKnownMembers.RemoveAttributeInstancesAttributeDefinition != null)
+ return _context.MarkedKnownMembers.RemoveAttributeInstancesAttributeDefinition;
+
+ var voidType = BCL.FindPredefinedType("System", "Void", _context);
+ if (voidType == null)
+ return null;
+
+ var attributeType = BCL.FindPredefinedType("System", "Attribute", _context);
+ if (attributeType == null)
+ return null;
+
+ var objectType = BCL.FindPredefinedType("System", "Object", _context);
+ if (objectType == null)
+ return null;
+
+ //
+ // Generates metadata information for internal type
+ //
+ // public sealed class RemoveAttributeInstancesAttribute : Attribute
+ // {
+ // public RemoveAttributeInstancesAttribute () {}
+ // public RemoveAttributeInstancesAttribute (object value1) {}
+ // }
+ //
+ var td = new TypeDefinition("", "RemoveAttributeInstancesAttribute", TypeAttributes.Public);
+ td.BaseType = attributeType;
+
+ const MethodAttributes ctorAttributes = MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName | MethodAttributes.Final;
+ var ctor = new MethodDefinition(".ctor", ctorAttributes, voidType);
+ td.Methods.Add(ctor);
+
+ ctor = new MethodDefinition(".ctor", ctorAttributes, voidType);
+ ctor.Parameters.Add(new ParameterDefinition(objectType));
+ td.Methods.Add(ctor);
+
+ return _context.MarkedKnownMembers.RemoveAttributeInstancesAttributeDefinition = td;
+ }
+
+ CustomAttribute? CreateCustomAttribute(XPathNavigator nav, TypeDefinition attributeType)
+ {
+ CustomAttributeArgument[] arguments = ReadCustomAttributeArguments(nav, attributeType);
+
+ MethodDefinition? constructor = FindBestMatchingConstructor(attributeType, arguments);
+ if (constructor == null)
+ {
+ LogWarning(nav, DiagnosticId.XmlCouldNotFindMatchingConstructorForCustomAttribute, attributeType.GetDisplayName());
+ return null;
+ }
+
+ CustomAttribute customAttribute = new CustomAttribute(constructor);
+ foreach (var argument in arguments)
+ customAttribute.ConstructorArguments.Add(argument);
+
+ ReadCustomAttributeProperties(nav, attributeType, customAttribute);
+
+ return customAttribute;
+ }
+
+ MethodDefinition? FindBestMatchingConstructor(TypeDefinition attributeType, CustomAttributeArgument[] args)
+ {
+ var methods = attributeType.Methods;
+ for (int i = 0; i < attributeType.Methods.Count; ++i)
+ {
+ var m = methods[i];
+ if (!m.IsInstanceConstructor())
+ continue;
+
+ var p = m.Parameters;
+ if (args.Length != p.Count)
+ continue;
+
+ bool match = true;
+ for (int ii = 0; match && ii != args.Length; ++ii)
+ {
+ //
+ // No candidates betterness, only exact matches are supported
+ //
+ var parameterType = _context.TryResolve(p[ii].ParameterType);
+ if (parameterType == null || parameterType != _context.TryResolve(args[ii].Type))
+ match = false;
+ }
+
+ if (match)
+ return m;
+ }
+
+ return null;
+ }
+
+ void ReadCustomAttributeProperties(XPathNavigator nav, TypeDefinition attributeType, CustomAttribute customAttribute)
+ {
+ foreach (XPathNavigator propertyNav in nav.SelectChildren("property", string.Empty))
+ {
+ string propertyName = GetName(propertyNav);
+ if (string.IsNullOrEmpty(propertyName))
+ {
+ LogWarning(propertyNav, DiagnosticId.XmlPropertyDoesNotContainAttributeName);
+ continue;
+ }
+
+ PropertyDefinition? property = attributeType.Properties.Where(prop => prop.Name == propertyName).FirstOrDefault();
+ if (property == null)
+ {
+ LogWarning(propertyNav, DiagnosticId.XmlCouldNotFindProperty, propertyName);
+ continue;
+ }
+
+ var caa = ReadCustomAttributeArgument(propertyNav, property);
+ if (caa is null)
+ continue;
+
+ customAttribute.Properties.Add(new CustomAttributeNamedArgument(property.Name, caa.Value));
+ }
+ }
+
+ CustomAttributeArgument[] ReadCustomAttributeArguments(XPathNavigator nav, TypeDefinition attributeType)
+ {
+ var args = new ArrayBuilder();
+
+ foreach (XPathNavigator argumentNav in nav.SelectChildren("argument", string.Empty))
+ {
+ CustomAttributeArgument? caa = ReadCustomAttributeArgument(argumentNav, attributeType);
+ if (caa is not null)
+ args.Add(caa.Value);
+ }
+
+ return args.ToArray() ?? Array.Empty();
+ }
+
+ CustomAttributeArgument? ReadCustomAttributeArgument(XPathNavigator nav, IMemberDefinition memberWithAttribute)
+ {
+ TypeReference? typeref = ResolveArgumentType(nav, memberWithAttribute);
+ if (typeref is null)
+ return null;
+
+ string svalue = nav.Value;
+
+ //
+ // Builds CustomAttributeArgument in the same way as it would be
+ // represented in the metadata if encoded there. This simplifies
+ // any custom attributes handling in linker by using same attributes
+ // value extraction or mathing logic.
+ //
+ switch (typeref.MetadataType)
+ {
+ case MetadataType.Object:
+ var argumentIterator = nav.SelectChildren("argument", string.Empty);
+ if (argumentIterator?.MoveNext() != true)
+ {
+ _context.LogError(null, DiagnosticId.CustomAttributeArgumentForTypeRequiresNestedNode, "System.Object", "argument");
+ return null;
+ }
+
+ var typedef = _context.TryResolve(typeref);
+ if (typedef == null)
+ return null;
+
+ var boxedValue = ReadCustomAttributeArgument(argumentIterator.Current!, typedef);
+ if (boxedValue is null)
+ return null;
+
+ return new CustomAttributeArgument(typeref, boxedValue);
+
+ case MetadataType.Char:
+ case MetadataType.Byte:
+ case MetadataType.SByte:
+ case MetadataType.Int16:
+ case MetadataType.UInt16:
+ case MetadataType.Int32:
+ case MetadataType.UInt32:
+ case MetadataType.UInt64:
+ case MetadataType.Int64:
+ case MetadataType.String:
+ return new CustomAttributeArgument(typeref, ConvertStringValue(svalue, typeref));
+
+ case MetadataType.ValueType:
+ var enumType = _context.Resolve(typeref);
+ if (enumType?.IsEnum != true)
+ goto default;
+
+ var enumField = enumType.Fields.Where(f => f.IsStatic && f.Name == svalue).FirstOrDefault();
+ object evalue = enumField?.Constant ?? svalue;
+
+ typeref = enumType.GetEnumUnderlyingType();
+ return new CustomAttributeArgument(enumType, ConvertStringValue(evalue, typeref));
+
+ case MetadataType.Class:
+ if (!typeref.IsTypeOf("System", "Type"))
+ goto default;
+
+ if (!_context.TypeNameResolver.TryResolveTypeName(svalue, memberWithAttribute, out TypeReference? type, out _))
+ {
+ _context.LogError(GetMessageOriginForPosition(nav), DiagnosticId.CouldNotResolveCustomAttributeTypeValue, svalue);
+ return null;
+ }
+
+ return new CustomAttributeArgument(typeref, type);
+ default:
+ // No support for null and arrays, consider adding - dotnet/linker/issues/1957
+ _context.LogError(GetMessageOriginForPosition(nav), DiagnosticId.UnexpectedAttributeArgumentType, typeref.GetDisplayName());
+ return null;
+ }
+
+ TypeReference? ResolveArgumentType(XPathNavigator nav, IMemberDefinition memberWithAttribute)
+ {
+ string typeName = GetAttribute(nav, "type");
+ if (string.IsNullOrEmpty(typeName))
+ typeName = "System.String";
+
+ if (!_context.TypeNameResolver.TryResolveTypeName(typeName, memberWithAttribute, out TypeReference? typeref, out _))
+ {
+ _context.LogError(GetMessageOriginForPosition(nav), DiagnosticId.TypeUsedWithAttributeValueCouldNotBeFound, typeName, nav.Value);
+ return null;
+ }
+
+ return typeref;
+ }
+ }
+
+ object? ConvertStringValue(object value, TypeReference targetType)
+ {
+ TypeCode typeCode;
+ switch (targetType.MetadataType)
+ {
+ case MetadataType.String:
+ typeCode = TypeCode.String;
+ break;
+ case MetadataType.Char:
+ typeCode = TypeCode.Char;
+ break;
+ case MetadataType.Byte:
+ typeCode = TypeCode.Byte;
+ break;
+ case MetadataType.SByte:
+ typeCode = TypeCode.SByte;
+ break;
+ case MetadataType.Int16:
+ typeCode = TypeCode.Int16;
+ break;
+ case MetadataType.UInt16:
+ typeCode = TypeCode.UInt16;
+ break;
+ case MetadataType.Int32:
+ typeCode = TypeCode.Int32;
+ break;
+ case MetadataType.UInt32:
+ typeCode = TypeCode.UInt32;
+ break;
+ case MetadataType.UInt64:
+ typeCode = TypeCode.UInt64;
+ break;
+ case MetadataType.Int64:
+ typeCode = TypeCode.Int64;
+ break;
+ case MetadataType.Boolean:
+ typeCode = TypeCode.Boolean;
+ break;
+ case MetadataType.Single:
+ typeCode = TypeCode.Single;
+ break;
+ case MetadataType.Double:
+ typeCode = TypeCode.Double;
+ break;
+ default:
+ throw new NotSupportedException(targetType.ToString());
+ }
+
+ try
+ {
+ return Convert.ChangeType(value, typeCode);
+ }
+ catch
+ {
+ _context.LogError(null, DiagnosticId.CannotConverValueToType, value.ToString() ?? "", targetType.GetDisplayName());
+ return null;
+ }
+ }
+
+ bool GetAttributeType(XPathNavigator nav, string attributeFullName, [NotNullWhen(true)] out TypeDefinition? attributeType)
+ {
+ string assemblyName = GetAttribute(nav, "assembly");
+ if (string.IsNullOrEmpty(assemblyName))
+ {
+ attributeType = _context.GetType(attributeFullName);
+ }
+ else
+ {
+ AssemblyDefinition? assembly;
+ try
+ {
+ assembly = _context.TryResolve(AssemblyNameReference.Parse(assemblyName));
+ if (assembly == null)
+ {
+ LogWarning(nav, DiagnosticId.XmlCouldNotResolveAssemblyForAttribute, assemblyName, attributeFullName);
+
+ attributeType = default;
+ return false;
+ }
+ }
+ catch (Exception)
+ {
+ LogWarning(nav, DiagnosticId.XmlCouldNotResolveAssemblyForAttribute, assemblyName, attributeFullName);
+ attributeType = default;
+ return false;
+ }
+
+ attributeType = _context.TryResolve(assembly, attributeFullName);
+ }
+
+ if (attributeType == null)
+ {
+ LogWarning(nav, DiagnosticId.XmlAttributeTypeCouldNotBeFound, attributeFullName);
+ return false;
+ }
+
+ return true;
+ }
+
+ protected override AllowedAssemblies AllowedAssemblySelector
+ {
+ get
+ {
+ if (_resource?.Assembly == null)
+ return AllowedAssemblies.AllAssemblies;
+
+ // Corelib XML may contain assembly wildcard to support compiler-injected attribute types
+ if (_resource?.Assembly.Name.Name == PlatformAssemblies.CoreLib)
+ return AllowedAssemblies.AllAssemblies;
+
+ return AllowedAssemblies.ContainingAssembly;
+ }
+ }
+
+ protected override void ProcessAssembly(AssemblyDefinition assembly, XPathNavigator nav, bool warnOnUnresolvedTypes)
+ {
+ PopulateAttributeInfo(assembly, nav);
+ ProcessTypes(assembly, nav, warnOnUnresolvedTypes);
+ }
+
+ protected override void ProcessType(TypeDefinition type, XPathNavigator nav)
+ {
+ Debug.Assert(ShouldProcessElement(nav));
+
+ PopulateAttributeInfo(type, nav);
+ ProcessTypeChildren(type, nav);
+
+ if (!type.HasNestedTypes)
+ return;
+
+ foreach (XPathNavigator nestedTypeNav in nav.SelectChildren("type", string.Empty))
+ {
+ foreach (TypeDefinition nested in type.NestedTypes)
+ {
+ if (nested.Name == GetAttribute(nestedTypeNav, "name") && ShouldProcessElement(nestedTypeNav))
+ ProcessType(nested, nestedTypeNav);
+ }
+ }
+ }
+
+ protected override void ProcessField(TypeDefinition type, FieldDefinition field, XPathNavigator nav)
+ {
+ PopulateAttributeInfo(field, nav);
+ }
+
+ protected override void ProcessMethod(TypeDefinition type, MethodDefinition method, XPathNavigator nav, object? customData)
+ {
+ PopulateAttributeInfo(method, nav);
+ ProcessReturnParameters(method, nav);
+ ProcessParameters(method, nav);
+ }
+
+ void ProcessParameters(MethodDefinition method, XPathNavigator nav)
+ {
+ Debug.Assert(_attributeInfo != null);
+ foreach (XPathNavigator parameterNav in nav.SelectChildren("parameter", string.Empty))
+ {
+ var attributes = ProcessAttributes(parameterNav, method);
+ if (attributes != null)
+ {
+ string paramName = GetAttribute(parameterNav, "name");
+ foreach (ParameterDefinition parameter in method.Parameters)
+ {
+ if (paramName == parameter.Name)
+ {
+ if (parameter.HasCustomAttributes || _attributeInfo.CustomAttributes.ContainsKey(parameter))
+ LogWarning(parameterNav, DiagnosticId.XmlMoreThanOneValyForParameterOfMethod, paramName, method.GetDisplayName());
+ _attributeInfo.AddCustomAttributes(parameter, attributes);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ void ProcessReturnParameters(MethodDefinition method, XPathNavigator nav)
+ {
+ bool firstAppearance = true;
+ foreach (XPathNavigator returnNav in nav.SelectChildren("return", string.Empty))
+ {
+ if (firstAppearance)
+ {
+ firstAppearance = false;
+ PopulateAttributeInfo(method.MethodReturnType, returnNav);
+ }
+ else
+ {
+ LogWarning(returnNav, DiagnosticId.XmlMoreThanOneReturnElementForMethod, method.GetDisplayName());
+ }
+ }
+ }
+
+ protected override MethodDefinition? GetMethod(TypeDefinition type, string signature)
+ {
+ if (type.HasMethods)
+ foreach (MethodDefinition method in type.Methods)
+ if (signature.Replace(" ", "") == GetMethodSignature(method) || signature.Replace(" ", "") == GetMethodSignature(method, true))
+ return method;
+
+ return null;
+ }
+
+ static string GetMethodSignature(MethodDefinition method, bool includeReturnType = false)
+ {
+ StringBuilder sb = new StringBuilder();
+ if (includeReturnType)
+ {
+ sb.Append(method.ReturnType.FullName);
+ }
+ sb.Append(method.Name);
+ if (method.HasGenericParameters)
+ {
+ sb.Append("<");
+ for (int i = 0; i < method.GenericParameters.Count; i++)
+ {
+ if (i > 0)
+ sb.Append(",");
+
+ sb.Append(method.GenericParameters[i].Name);
+ }
+ sb.Append(">");
+ }
+ sb.Append("(");
+ if (method.HasParameters)
+ {
+ for (int i = 0; i < method.Parameters.Count; i++)
+ {
+ if (i > 0)
+ sb.Append(",");
+
+ sb.Append(method.Parameters[i].ParameterType.FullName);
+ }
+ }
+ sb.Append(")");
+ return sb.ToString();
+ }
+
+ protected override void ProcessProperty(TypeDefinition type, PropertyDefinition property, XPathNavigator nav, object? customData, bool fromSignature)
+ {
+ PopulateAttributeInfo(property, nav);
+ }
+
+ protected override void ProcessEvent(TypeDefinition type, EventDefinition @event, XPathNavigator nav, object? customData)
+ {
+ PopulateAttributeInfo(@event, nav);
+ }
+
+ void PopulateAttributeInfo(ICustomAttributeProvider provider, XPathNavigator nav)
+ {
+ Debug.Assert(_attributeInfo != null);
+ var attributes = ProcessAttributes(nav, provider);
+ if (attributes != null)
+ _attributeInfo.AddCustomAttributes(provider, attributes);
+ }
+ }
+}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/ProcessLinkerXmlBase.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/ProcessLinkerXmlBase.cs
new file mode 100644
index 00000000000000..842c56639fdd0e
--- /dev/null
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/ProcessLinkerXmlBase.cs
@@ -0,0 +1,662 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text.RegularExpressions;
+using System.Xml;
+using System.Xml.Linq;
+using System.Xml.XPath;
+using ILLink.Shared;
+using Mono.Cecil;
+
+namespace Mono.Linker.Steps
+{
+ [Flags]
+ public enum AllowedAssemblies
+ {
+ ContainingAssembly = 0x1,
+ AnyAssembly = 0x2 | ContainingAssembly,
+ AllAssemblies = 0x4 | AnyAssembly
+ }
+
+ public abstract class ProcessLinkerXmlBase
+ {
+ const string FullNameAttributeName = "fullname";
+ const string LinkerElementName = "linker";
+ const string TypeElementName = "type";
+ const string SignatureAttributeName = "signature";
+ const string NameAttributeName = "name";
+ const string FieldElementName = "field";
+ const string MethodElementName = "method";
+ const string EventElementName = "event";
+ const string PropertyElementName = "property";
+ const string AllAssembliesFullName = "*";
+ protected const string XmlNamespace = "";
+
+ protected readonly string _xmlDocumentLocation;
+ readonly XPathNavigator _document;
+ protected readonly (EmbeddedResource Resource, AssemblyDefinition Assembly)? _resource;
+ protected readonly LinkContext _context;
+
+ protected ProcessLinkerXmlBase(LinkContext context, Stream documentStream, string xmlDocumentLocation)
+ {
+ _context = context;
+ using (documentStream)
+ {
+ _document = XDocument.Load(documentStream, LoadOptions.SetLineInfo).CreateNavigator();
+ }
+ _xmlDocumentLocation = xmlDocumentLocation;
+ }
+
+ protected ProcessLinkerXmlBase(LinkContext context, Stream documentStream, EmbeddedResource resource, AssemblyDefinition resourceAssembly, string xmlDocumentLocation)
+ : this(context, documentStream, xmlDocumentLocation)
+ {
+ _resource = (
+ resource ?? throw new ArgumentNullException(nameof(resource)),
+ resourceAssembly ?? throw new ArgumentNullException(nameof(resourceAssembly))
+ );
+ }
+
+ protected virtual bool ShouldProcessElement(XPathNavigator nav) => FeatureSettings.ShouldProcessElement(nav, _context, _xmlDocumentLocation);
+
+ protected virtual void ProcessXml(bool stripResource, bool ignoreResource)
+ {
+ if (!AllowedAssemblySelector.HasFlag(AllowedAssemblies.AnyAssembly) && _resource == null)
+ throw new InvalidOperationException("The containing assembly must be specified for XML which is restricted to modifying that assembly only.");
+
+ try
+ {
+ XPathNavigator nav = _document.CreateNavigator();
+
+ // Initial structure check - ignore XML document which don't look like linker XML format
+ if (!nav.MoveToChild(LinkerElementName, XmlNamespace))
+ return;
+
+ if (_resource != null)
+ {
+ if (stripResource)
+ _context.Annotations.AddResourceToRemove(_resource.Value.Assembly, _resource.Value.Resource);
+ if (ignoreResource)
+ return;
+ }
+
+ if (!ShouldProcessElement(nav))
+ return;
+
+ ProcessAssemblies(nav);
+
+ // For embedded XML, allow not specifying the assembly explicitly in XML.
+ if (_resource != null)
+ ProcessAssembly(_resource.Value.Assembly, nav, warnOnUnresolvedTypes: true);
+
+ }
+ catch (Exception ex) when (!(ex is LinkerFatalErrorException))
+ {
+ throw new LinkerFatalErrorException(MessageContainer.CreateErrorMessage(null, DiagnosticId.ErrorProcessingXmlLocation, _xmlDocumentLocation), ex);
+ }
+ }
+
+ protected virtual AllowedAssemblies AllowedAssemblySelector { get => _resource != null ? AllowedAssemblies.ContainingAssembly : AllowedAssemblies.AnyAssembly; }
+
+ bool ShouldProcessAllAssemblies(XPathNavigator nav, [NotNullWhen(false)] out AssemblyNameReference? assemblyName)
+ {
+ assemblyName = null;
+ if (GetFullName(nav) == AllAssembliesFullName)
+ return true;
+
+ assemblyName = GetAssemblyName(nav);
+ return false;
+ }
+
+ protected virtual void ProcessAssemblies(XPathNavigator nav)
+ {
+ foreach (XPathNavigator assemblyNav in nav.SelectChildren("assembly", ""))
+ {
+ // Errors for invalid assembly names should show up even if this element will be
+ // skipped due to feature conditions.
+ bool processAllAssemblies = ShouldProcessAllAssemblies(assemblyNav, out AssemblyNameReference? name);
+ if (processAllAssemblies && AllowedAssemblySelector != AllowedAssemblies.AllAssemblies)
+ {
+ LogWarning(assemblyNav, DiagnosticId.XmlUnsuportedWildcard);
+ continue;
+ }
+
+ AssemblyDefinition? assemblyToProcess = null;
+ if (!AllowedAssemblySelector.HasFlag(AllowedAssemblies.AnyAssembly))
+ {
+ Debug.Assert(!processAllAssemblies);
+ Debug.Assert(_resource != null);
+ if (_resource.Value.Assembly.Name.Name != name!.Name)
+ {
+ LogWarning(assemblyNav, DiagnosticId.AssemblyWithEmbeddedXmlApplyToAnotherAssembly, _resource.Value.Assembly.Name.Name, name.ToString());
+ continue;
+ }
+ assemblyToProcess = _resource.Value.Assembly;
+ }
+
+ if (!ShouldProcessElement(assemblyNav))
+ continue;
+
+ if (processAllAssemblies)
+ {
+ // We could avoid loading all references in this case: https://github.com/dotnet/linker/issues/1708
+ foreach (AssemblyDefinition assembly in _context.GetReferencedAssemblies())
+ ProcessAssembly(assembly, assemblyNav, warnOnUnresolvedTypes: false);
+ }
+ else
+ {
+ Debug.Assert(!processAllAssemblies);
+ AssemblyDefinition? assembly = assemblyToProcess ?? _context.TryResolve(name!);
+
+ if (assembly == null)
+ {
+ LogWarning(assemblyNav, DiagnosticId.XmlCouldNotResolveAssembly, name!.Name);
+ continue;
+ }
+
+ ProcessAssembly(assembly, assemblyNav, warnOnUnresolvedTypes: true);
+ }
+ }
+ }
+
+ protected abstract void ProcessAssembly(AssemblyDefinition assembly, XPathNavigator nav, bool warnOnUnresolvedTypes);
+
+ protected virtual void ProcessTypes(AssemblyDefinition assembly, XPathNavigator nav, bool warnOnUnresolvedTypes)
+ {
+ foreach (XPathNavigator typeNav in nav.SelectChildren(TypeElementName, XmlNamespace))
+ {
+
+ if (!ShouldProcessElement(typeNav))
+ continue;
+
+ string fullname = GetFullName(typeNav);
+
+ if (fullname.IndexOf("*") != -1)
+ {
+ if (ProcessTypePattern(fullname, assembly, typeNav))
+ continue;
+ }
+
+ TypeDefinition type = assembly.MainModule.GetType(fullname);
+
+ if (type == null && assembly.MainModule.HasExportedTypes)
+ {
+ foreach (var exported in assembly.MainModule.ExportedTypes)
+ {
+ if (fullname == exported.FullName)
+ {
+ var resolvedExternal = ProcessExportedType(exported, assembly, typeNav);
+ if (resolvedExternal != null)
+ {
+ type = resolvedExternal;
+ break;
+ }
+ }
+ }
+ }
+
+ if (type == null)
+ {
+ if (warnOnUnresolvedTypes)
+ LogWarning(typeNav, DiagnosticId.XmlCouldNotResolveType, fullname);
+ continue;
+ }
+
+ ProcessType(type, typeNav);
+ }
+ }
+
+ protected virtual TypeDefinition? ProcessExportedType(ExportedType exported, AssemblyDefinition assembly, XPathNavigator nav) => exported.Resolve();
+
+ void MatchType(TypeDefinition type, Regex regex, XPathNavigator nav)
+ {
+ if (regex.Match(type.FullName).Success)
+ ProcessType(type, nav);
+
+ if (!type.HasNestedTypes)
+ return;
+
+ foreach (var nt in type.NestedTypes)
+ MatchType(nt, regex, nav);
+ }
+
+ protected virtual bool ProcessTypePattern(string fullname, AssemblyDefinition assembly, XPathNavigator nav)
+ {
+ Regex regex = new Regex(fullname.Replace(".", @"\.").Replace("*", "(.*)"));
+
+ foreach (TypeDefinition type in assembly.MainModule.Types)
+ {
+ MatchType(type, regex, nav);
+ }
+
+ if (assembly.MainModule.HasExportedTypes)
+ {
+ foreach (var exported in assembly.MainModule.ExportedTypes)
+ {
+ if (regex.Match(exported.FullName).Success)
+ {
+ var type = ProcessExportedType(exported, assembly, nav);
+ if (type != null)
+ {
+ ProcessType(type, nav);
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ protected abstract void ProcessType(TypeDefinition type, XPathNavigator nav);
+
+ protected void ProcessTypeChildren(TypeDefinition type, XPathNavigator nav, object? customData = null)
+ {
+ if (nav.HasChildren)
+ {
+ ProcessSelectedFields(nav, type);
+ ProcessSelectedMethods(nav, type, customData);
+ ProcessSelectedEvents(nav, type, customData);
+ ProcessSelectedProperties(nav, type, customData);
+ }
+ }
+
+ void ProcessSelectedFields(XPathNavigator nav, TypeDefinition type)
+ {
+ foreach (XPathNavigator fieldNav in nav.SelectChildren(FieldElementName, XmlNamespace))
+ {
+ if (!ShouldProcessElement(fieldNav))
+ continue;
+ ProcessField(type, fieldNav);
+ }
+ }
+
+ protected virtual void ProcessField(TypeDefinition type, XPathNavigator nav)
+ {
+ string signature = GetSignature(nav);
+ if (!String.IsNullOrEmpty(signature))
+ {
+ FieldDefinition? field = GetField(type, signature);
+ if (field == null)
+ {
+ LogWarning(nav, DiagnosticId.XmlCouldNotFindFieldOnType, signature, type.GetDisplayName());
+ return;
+ }
+
+ ProcessField(type, field, nav);
+ }
+
+ string name = GetName(nav);
+ if (!String.IsNullOrEmpty(name))
+ {
+ bool foundMatch = false;
+ if (type.HasFields)
+ {
+ foreach (FieldDefinition field in type.Fields)
+ {
+ if (field.Name == name)
+ {
+ foundMatch = true;
+ ProcessField(type, field, nav);
+ }
+ }
+ }
+
+ if (!foundMatch)
+ {
+ LogWarning(nav, DiagnosticId.XmlCouldNotFindFieldOnType, name, type.GetDisplayName());
+ }
+ }
+ }
+
+ protected static FieldDefinition? GetField(TypeDefinition type, string signature)
+ {
+ if (!type.HasFields)
+ return null;
+
+ foreach (FieldDefinition field in type.Fields)
+ if (signature == field.FieldType.FullName + " " + field.Name)
+ return field;
+
+ return null;
+ }
+
+ protected virtual void ProcessField(TypeDefinition type, FieldDefinition field, XPathNavigator nav) { }
+
+ void ProcessSelectedMethods(XPathNavigator nav, TypeDefinition type, object? customData)
+ {
+ foreach (XPathNavigator methodNav in nav.SelectChildren(MethodElementName, XmlNamespace))
+ {
+ if (!ShouldProcessElement(methodNav))
+ continue;
+ ProcessMethod(type, methodNav, customData);
+ }
+ }
+
+ protected virtual void ProcessMethod(TypeDefinition type, XPathNavigator nav, object? customData)
+ {
+ string signature = GetSignature(nav);
+ if (!String.IsNullOrEmpty(signature))
+ {
+ MethodDefinition? method = GetMethod(type, signature);
+ if (method == null)
+ {
+ LogWarning(nav, DiagnosticId.XmlCouldNotFindMethodOnType, signature, type.GetDisplayName());
+ return;
+ }
+
+ ProcessMethod(type, method, nav, customData);
+ }
+
+ string name = GetAttribute(nav, NameAttributeName);
+ if (!String.IsNullOrEmpty(name))
+ {
+ bool foundMatch = false;
+ if (type.HasMethods)
+ {
+ foreach (MethodDefinition method in type.Methods)
+ {
+ if (name == method.Name)
+ {
+ foundMatch = true;
+ ProcessMethod(type, method, nav, customData);
+ }
+ }
+ }
+
+ if (!foundMatch)
+ {
+ LogWarning(nav, DiagnosticId.XmlCouldNotFindMethodOnType, name, type.GetDisplayName());
+ }
+ }
+ }
+
+ protected virtual MethodDefinition? GetMethod(TypeDefinition type, string signature) => null;
+
+ protected virtual void ProcessMethod(TypeDefinition type, MethodDefinition method, XPathNavigator nav, object? customData) { }
+
+ void ProcessSelectedEvents(XPathNavigator nav, TypeDefinition type, object? customData)
+ {
+ foreach (XPathNavigator eventNav in nav.SelectChildren(EventElementName, XmlNamespace))
+ {
+ if (!ShouldProcessElement(eventNav))
+ continue;
+ ProcessEvent(type, eventNav, customData);
+ }
+ }
+
+ protected virtual void ProcessEvent(TypeDefinition type, XPathNavigator nav, object? customData)
+ {
+ string signature = GetSignature(nav);
+ if (!String.IsNullOrEmpty(signature))
+ {
+ EventDefinition? @event = GetEvent(type, signature);
+ if (@event == null)
+ {
+ LogWarning(nav, DiagnosticId.XmlCouldNotFindEventOnType, signature, type.GetDisplayName());
+ return;
+ }
+
+ ProcessEvent(type, @event, nav, customData);
+ }
+
+ string name = GetAttribute(nav, NameAttributeName);
+ if (!String.IsNullOrEmpty(name))
+ {
+ bool foundMatch = false;
+ foreach (EventDefinition @event in type.Events)
+ {
+ if (@event.Name == name)
+ {
+ foundMatch = true;
+ ProcessEvent(type, @event, nav, customData);
+ }
+ }
+
+ if (!foundMatch)
+ {
+ LogWarning(nav, DiagnosticId.XmlCouldNotFindEventOnType, name, type.GetDisplayName());
+ }
+ }
+ }
+
+ protected static EventDefinition? GetEvent(TypeDefinition type, string signature)
+ {
+ if (!type.HasEvents)
+ return null;
+
+ foreach (EventDefinition @event in type.Events)
+ if (signature == @event.EventType.FullName + " " + @event.Name)
+ return @event;
+
+ return null;
+ }
+
+ protected virtual void ProcessEvent(TypeDefinition type, EventDefinition @event, XPathNavigator nav, object? customData) { }
+
+ void ProcessSelectedProperties(XPathNavigator nav, TypeDefinition type, object? customData)
+ {
+ foreach (XPathNavigator propertyNav in nav.SelectChildren(PropertyElementName, XmlNamespace))
+ {
+ if (!ShouldProcessElement(propertyNav))
+ continue;
+ ProcessProperty(type, propertyNav, customData);
+ }
+ }
+
+ protected virtual void ProcessProperty(TypeDefinition type, XPathNavigator nav, object? customData)
+ {
+ string signature = GetSignature(nav);
+ if (!String.IsNullOrEmpty(signature))
+ {
+ PropertyDefinition? property = GetProperty(type, signature);
+ if (property == null)
+ {
+ LogWarning(nav, DiagnosticId.XmlCouldNotFindPropertyOnType, signature, type.GetDisplayName());
+ return;
+ }
+
+ ProcessProperty(type, property, nav, customData, true);
+ }
+
+ string name = GetAttribute(nav, NameAttributeName);
+ if (!String.IsNullOrEmpty(name))
+ {
+ bool foundMatch = false;
+ foreach (PropertyDefinition property in type.Properties)
+ {
+ if (property.Name == name)
+ {
+ foundMatch = true;
+ ProcessProperty(type, property, nav, customData, false);
+ }
+ }
+
+ if (!foundMatch)
+ {
+ LogWarning(nav, DiagnosticId.XmlCouldNotFindPropertyOnType, name, type.GetDisplayName());
+ }
+ }
+ }
+
+ protected static PropertyDefinition? GetProperty(TypeDefinition type, string signature)
+ {
+ if (!type.HasProperties)
+ return null;
+
+ foreach (PropertyDefinition property in type.Properties)
+ if (signature == property.PropertyType.FullName + " " + property.Name)
+ return property;
+
+ return null;
+ }
+
+ protected virtual void ProcessProperty(TypeDefinition type, PropertyDefinition property, XPathNavigator nav, object? customData, bool fromSignature) { }
+
+ protected virtual AssemblyNameReference GetAssemblyName(XPathNavigator nav)
+ {
+ return AssemblyNameReference.Parse(GetFullName(nav));
+ }
+
+ protected static string GetFullName(XPathNavigator nav)
+ {
+ return GetAttribute(nav, FullNameAttributeName);
+ }
+
+ protected static string GetName(XPathNavigator nav)
+ {
+ return GetAttribute(nav, NameAttributeName);
+ }
+
+ protected static string GetSignature(XPathNavigator nav)
+ {
+ return GetAttribute(nav, SignatureAttributeName);
+ }
+
+ protected static string GetAttribute(XPathNavigator nav, string attribute)
+ {
+ return nav.GetAttribute(attribute, XmlNamespace);
+ }
+
+ protected MessageOrigin GetMessageOriginForPosition(XPathNavigator position)
+ {
+ return (position is IXmlLineInfo lineInfo)
+ ? new MessageOrigin(_xmlDocumentLocation, lineInfo.LineNumber, lineInfo.LinePosition, _resource?.Assembly)
+ : new MessageOrigin(_xmlDocumentLocation, 0, 0, _resource?.Assembly);
+ }
+ protected void LogWarning(string message, int warningCode, XPathNavigator position)
+ {
+ _context.LogWarning(message, warningCode, GetMessageOriginForPosition(position));
+ }
+
+ protected void LogWarning(XPathNavigator position, DiagnosticId id, params string[] args)
+ {
+ _context.LogWarning(GetMessageOriginForPosition(position), id, args);
+ }
+
+ public override string ToString() => GetType().Name + ": " + _xmlDocumentLocation;
+
+ public bool TryConvertValue(string value, TypeReference target, out object? result)
+ {
+ switch (target.MetadataType)
+ {
+ case MetadataType.Boolean:
+ if (bool.TryParse(value, out bool bvalue))
+ {
+ result = bvalue ? 1 : 0;
+ return true;
+ }
+
+ goto case MetadataType.Int32;
+
+ case MetadataType.Byte:
+ if (!byte.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out byte byteresult))
+ break;
+
+ result = (int)byteresult;
+ return true;
+
+ case MetadataType.SByte:
+ if (!sbyte.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out sbyte sbyteresult))
+ break;
+
+ result = (int)sbyteresult;
+ return true;
+
+ case MetadataType.Int16:
+ if (!short.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out short shortresult))
+ break;
+
+ result = (int)shortresult;
+ return true;
+
+ case MetadataType.UInt16:
+ if (!ushort.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out ushort ushortresult))
+ break;
+
+ result = (int)ushortresult;
+ return true;
+
+ case MetadataType.Int32:
+ if (!int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out int iresult))
+ break;
+
+ result = iresult;
+ return true;
+
+ case MetadataType.UInt32:
+ if (!uint.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out uint uresult))
+ break;
+
+ result = (int)uresult;
+ return true;
+
+ case MetadataType.Double:
+ if (!double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out double dresult))
+ break;
+
+ result = dresult;
+ return true;
+
+ case MetadataType.Single:
+ if (!float.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out float fresult))
+ break;
+
+ result = fresult;
+ return true;
+
+ case MetadataType.Int64:
+ if (!long.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out long lresult))
+ break;
+
+ result = lresult;
+ return true;
+
+ case MetadataType.UInt64:
+ if (!ulong.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out ulong ulresult))
+ break;
+
+ result = (long)ulresult;
+ return true;
+
+ case MetadataType.Char:
+ if (!char.TryParse(value, out char chresult))
+ break;
+
+ result = (int)chresult;
+ return true;
+
+ case MetadataType.String:
+ if (value is string || value == null)
+ {
+ result = value;
+ return true;
+ }
+
+ break;
+
+ case MetadataType.ValueType:
+ if (value is string &&
+ _context.TryResolve(target) is TypeDefinition typeDefinition &&
+ typeDefinition.IsEnum)
+ {
+ var enumField = typeDefinition.Fields.Where(f => f.IsStatic && f.Name == value).FirstOrDefault();
+ if (enumField != null)
+ {
+ result = Convert.ToInt32(enumField.Constant);
+ return true;
+ }
+ }
+
+ break;
+ }
+
+ result = null;
+ return false;
+ }
+ }
+}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/README.md b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/README.md
new file mode 100644
index 00000000000000..a75e53a1f949af
--- /dev/null
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ReferenceSource/README.md
@@ -0,0 +1 @@
+Sources taken from https://github.com/dotnet/linker/tree/c4abaf33f967a8fa42eb20fc386b774ad74ef319/src/linker/Linker.Steps.
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedInteropStubManager.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedInteropStubManager.cs
index 9aa675ca738fc0..e1c1362e109c02 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedInteropStubManager.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedInteropStubManager.cs
@@ -5,7 +5,9 @@
using Internal.TypeSystem;
using Internal.TypeSystem.Interop;
+using ILCompiler.Dataflow;
using ILCompiler.DependencyAnalysis;
+using ILLink.Shared;
using Debug = System.Diagnostics.Debug;
using DependencyList = ILCompiler.DependencyAnalysisFramework.DependencyNodeCore.DependencyList;
@@ -18,23 +20,26 @@ namespace ILCompiler
///
public class UsageBasedInteropStubManager : CompilerGeneratedInteropStubManager
{
- public UsageBasedInteropStubManager(InteropStateManager interopStateManager, PInvokeILEmitterConfiguration pInvokeILEmitterConfiguration)
+ private Logger _logger;
+
+ public UsageBasedInteropStubManager(InteropStateManager interopStateManager, PInvokeILEmitterConfiguration pInvokeILEmitterConfiguration, Logger logger)
: base(interopStateManager, pInvokeILEmitterConfiguration)
{
+ _logger = logger;
}
public override void AddDependeciesDueToPInvoke(ref DependencyList dependencies, NodeFactory factory, MethodDesc method)
{
- if (method.IsPInvoke)
+ if (method.IsPInvoke && method.OwningType is MetadataType type && MarshalHelpers.IsRuntimeMarshallingEnabled(type.Module))
{
dependencies = dependencies ?? new DependencyList();
MethodSignature methodSig = method.Signature;
- AddParameterMarshallingDependencies(ref dependencies, factory, methodSig.ReturnType);
+ AddParameterMarshallingDependencies(ref dependencies, factory, method, methodSig.ReturnType);
for (int i = 0; i < methodSig.Length; i++)
{
- AddParameterMarshallingDependencies(ref dependencies, factory, methodSig[i]);
+ AddParameterMarshallingDependencies(ref dependencies, factory, method, methodSig[i]);
}
}
@@ -45,13 +50,37 @@ public override void AddDependeciesDueToPInvoke(ref DependencyList dependencies,
}
}
- private static void AddParameterMarshallingDependencies(ref DependencyList dependencies, NodeFactory factory, TypeDesc type)
+ private void AddParameterMarshallingDependencies(ref DependencyList dependencies, NodeFactory factory, MethodDesc method, TypeDesc type)
{
if (type.IsDelegate)
{
dependencies.Add(factory.DelegateMarshallingData((DefType)type), "Delegate marshaling");
}
+ TypeSystemContext context = type.Context;
+ if ((type.IsWellKnownType(WellKnownType.MulticastDelegate)
+ || type == context.GetWellKnownType(WellKnownType.MulticastDelegate).BaseType))
+ {
+ // If we hit this p/invoke as part of delegate marshalling (i.e. this is a delegate
+ // that has another delegate in the signature), blame the delegate type, not the marshalling thunk.
+ // This should ideally warn from the use site (e.g. where GetDelegateForFunctionPointer
+ // is called) but it's currently hard to get a warning from those spots and this guarantees
+ // we won't miss a spot (e.g. a p/invoke that has a delegate and that delegate contains
+ // a System.Delegate parameter).
+ MethodDesc reportedMethod = method;
+ if (reportedMethod is Internal.IL.Stubs.DelegateMarshallingMethodThunk delegateThunkMethod)
+ {
+ reportedMethod = delegateThunkMethod.InvokeMethod;
+ }
+
+ var message = new DiagnosticString(DiagnosticId.CorrectnessOfAbstractDelegatesCannotBeGuaranteed).GetMessage(DiagnosticUtilities.GetMethodSignatureDisplayName(method));
+ _logger.LogWarning(
+ message,
+ (int)DiagnosticId.CorrectnessOfAbstractDelegatesCannotBeGuaranteed,
+ reportedMethod,
+ MessageSubCategory.AotAnalysis);
+ }
+
// struct may contain delegate fields, hence we need to add dependencies for it
if (type.IsByRef)
type = ((ParameterizedType)type).ParameterType;
@@ -63,7 +92,7 @@ private static void AddParameterMarshallingDependencies(ref DependencyList depen
if (field.IsStatic)
continue;
- AddParameterMarshallingDependencies(ref dependencies, factory, field.FieldType);
+ AddParameterMarshallingDependencies(ref dependencies, factory, method, field.FieldType);
}
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs
index bd649904129bf8..439d4e014e6db3 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/UsageBasedMetadataManager.cs
@@ -973,7 +973,7 @@ public AssemblyFeatureInfo(EcmaModule module, IReadOnlyDictionary
}
}
- private class LinkAttributesReader : ProcessLinkerXmlBase
+ private class LinkAttributesReader : ProcessXmlBase
{
private readonly HashSet _removedAttributes;
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/PInvokeILProvider.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/PInvokeILProvider.cs
index 830fb11d1ef21a..93fb4cc376c07e 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/PInvokeILProvider.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/PInvokeILProvider.cs
@@ -30,9 +30,9 @@ public override MethodIL GetMethodIL(MethodDesc method)
return PInvokeILEmitter.EmitIL(method, _pInvokeILEmitterConfiguration, _interopStateManager);
}
- public MethodDesc GetCalliStub(MethodSignature signature)
+ public MethodDesc GetCalliStub(MethodSignature signature, ModuleDesc moduleContext)
{
- return _interopStateManager.GetPInvokeCalliStub(signature);
+ return _interopStateManager.GetPInvokeCalliStub(signature, moduleContext);
}
public string GetDirectCallExternName(MethodDesc method)
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/AppContextInitializerMethod.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/AppContextInitializerMethod.cs
index d4b53340b55301..ed40a5f6fcc75c 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/AppContextInitializerMethod.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/AppContextInitializerMethod.cs
@@ -54,6 +54,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "SetAppContextSwitches";
+ }
+ }
+
public override MethodIL EmitIL()
{
ILEmitter emitter = new ILEmitter();
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/NativeLibraryStartupMethod.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/NativeLibraryStartupMethod.cs
index 7138804bb23138..4240af2427d154 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/NativeLibraryStartupMethod.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/NativeLibraryStartupMethod.cs
@@ -48,6 +48,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "NativeLibraryStartup";
+ }
+ }
+
public override MethodIL EmitIL()
{
ILEmitter emitter = new ILEmitter();
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/StartupCodeMainMethod.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/StartupCodeMainMethod.cs
index b18b9435491343..2c91f888c4dc05 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/StartupCodeMainMethod.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/IL/Stubs/StartupCode/StartupCodeMainMethod.cs
@@ -53,6 +53,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "StartupCodeMain";
+ }
+ }
+
public override MethodIL EmitIL()
{
ILEmitter emitter = new ILEmitter();
@@ -229,6 +237,14 @@ public override string Name
}
}
+ public override string DiagnosticName
+ {
+ get
+ {
+ return "MainMethodWrapper";
+ }
+ }
+
public override MethodSignature Signature
{
get
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj b/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj
index 3273d2cc58f567..d2df0a825ca402 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/ILCompiler.Compiler.csproj
@@ -23,6 +23,147 @@
+
+ IL\DelegateInfo.cs
+
+
+ IL\Stubs\DelegateThunks.Sorting.cs
+
+
+ IL\Stubs\DynamicInvokeMethodThunk.cs
+
+
+ IL\Stubs\DynamicInvokeMethodThunk.Sorting.cs
+
+
+ IL\Stubs\EnumThunks.cs
+
+
+ IL\Stubs\EnumThunks.Sorting.cs
+
+
+ IL\Stubs\PInvokeLazyFixupField.cs
+
+
+ IL\Stubs\PInvokeLazyFixupField.Sorting.cs
+
+
+ IL\Stubs\StructMarshallingThunk.Sorting.cs
+
+
+ IL\Stubs\ValueTypeGetFieldHelperMethodOverride.cs
+
+
+ IL\Stubs\ValueTypeGetFieldHelperMethodOverride.Sorting.cs
+
+
+ TypeSystem\Interop\IL\InlineArrayType.Sorting.cs
+
+
+ Interop\IL\MarshalHelpers.cs
+
+
+ Interop\IL\MarshalHelpers.Aot.cs
+
+
+ Interop\IL\MarshalUtils.cs
+
+
+ Interop\IL\Marshaller.cs
+
+
+ Interop\IL\Marshaller.Aot.cs
+
+
+ Interop\IL\MarshallerKind.cs
+
+
+ TypeSystem\Interop\IL\NativeStructType.Sorting.cs
+
+
+ Interop\IL\PInvokeILEmitterConfiguration.cs
+
+
+ IL\Stubs\PInvokeILEmitter.cs
+
+
+ IL\Stubs\PInvokeILCodeStreams.cs
+
+
+ IL\Stubs\DebuggerSteppingHelpers.cs
+
+
+ IL\Stubs\CalliMarshallingMethodThunk.cs
+
+
+ IL\Stubs\CalliMarshallingMethodThunk.Mangling.cs
+
+
+ IL\Stubs\CalliMarshallingMethodThunk.Sorting.cs
+
+
+ IL\Stubs\DelegateMarshallingMethodThunk.cs
+
+
+ IL\Stubs\DelegateMarshallingMethodThunk.Mangling.cs
+
+
+ IL\Stubs\DelegateMarshallingMethodThunk.Sorting.cs
+
+
+ IL\Stubs\ForwardDelegateCreationThunk.cs
+
+
+ IL\Stubs\ForwardDelegateCreationThunk.Mangling.cs
+
+
+ IL\Stubs\ForwardDelegateCreationThunk.Sorting.cs
+
+
+ IL\Stubs\DelegateThunks.cs
+
+
+ IL\Stubs\StructMarshallingThunk.cs
+
+
+ IL\Stubs\StructMarshallingThunk.Mangling.cs
+
+
+ TypeSystem\Interop\IL\NativeStructType.cs
+
+
+ TypeSystem\Interop\IL\NativeStructType.Mangling.cs
+
+
+ TypeSystem\Interop\IL\PInvokeDelegateWrapper.cs
+
+
+ TypeSystem\Interop\IL\PInvokeDelegateWrapper.Mangling.cs
+
+
+ TypeSystem\Interop\IL\PInvokeDelegateWrapper.Sorting.cs
+
+
+ TypeSystem\Interop\IL\PInvokeDelegateWrapperConstructor.cs
+
+
+ TypeSystem\Interop\IL\PInvokeDelegateWrapperConstructor.Sorting.cs
+
+
+ TypeSystem\Interop\IL\InlineArrayType.cs
+
+
+ TypeSystem\Interop\InteropTypes.cs
+
+
+ TypeSystem\Interop\InteropStateManager.cs
+
+
+ TypeSystem\CodeGen\INonEmittableType.cs
+
+
+ TypeSystem\CodeGen\NativeStructType.CodeGen.cs
+
Compiler\Logging\CompilerGeneratedState.cs
@@ -179,6 +320,12 @@
+
+
+
+
+
+
@@ -226,6 +373,7 @@
+
@@ -380,6 +528,7 @@
+
diff --git a/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/EventSourceLogStrategy.cs b/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/EventSourceLogStrategy.cs
index 4595d0ab07e53d..e7615ad545fbfa 100644
--- a/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/EventSourceLogStrategy.cs
+++ b/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/EventSourceLogStrategy.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
using System;
+using System.Diagnostics.CodeAnalysis;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -28,10 +29,16 @@ public class Keywords
// with the name of the event (method name) as well as the names and types of all the parameters.
[Event(1, Keywords = Keywords.Graph, Level = EventLevel.Informational)]
public void Graph(int id, string name) { WriteEvent(1, id, name); }
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = "Parameters to this method are primitive and are trimmer safe")]
[Event(2, Keywords = Keywords.Graph, Level = EventLevel.Informational)]
public void Node(int id, int index, string name) { WriteEvent(2, id, index, name); }
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = "Parameters to this method are primitive and are trimmer safe")]
[Event(3, Keywords = Keywords.Graph, Level = EventLevel.Informational)]
public void Edge(int id, int dependentIndex, int dependencyIndex, string reason) { WriteEvent(3, id, dependentIndex, dependencyIndex, reason); }
+ [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern",
+ Justification = "Parameters to this method are primitive and are trimmer safe")]
[Event(4, Keywords = Keywords.Graph, Level = EventLevel.Informational)]
public void ConditionalEdge(int id, int dependentIndex1, int dependentIndex2, int dependencyIndex, string reason) { WriteEvent(4, id, dependentIndex1, dependentIndex2, dependencyIndex, reason); }
diff --git a/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/ILCompiler.DependencyAnalysisFramework.csproj b/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/ILCompiler.DependencyAnalysisFramework.csproj
index c98ffb07608364..17f44699ea3cb6 100644
--- a/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/ILCompiler.DependencyAnalysisFramework.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/ILCompiler.DependencyAnalysisFramework.csproj
@@ -3,7 +3,7 @@
LibraryILCompiler.DependencyAnalysisFrameworkILCompiler.DependencyAnalysisFramework
- netstandard2.0
+ net5.0falsex64;x86AnyCPU
diff --git a/src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompiler.Diagnostics.csproj b/src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompiler.Diagnostics.csproj
index 8fe3bd1982d475..97c97bb7de720d 100644
--- a/src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompiler.Diagnostics.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.Diagnostics/ILCompiler.Diagnostics.csproj
@@ -18,7 +18,7 @@
-
+
diff --git a/src/coreclr/tools/aot/ILCompiler.MetadataTransform/ILCompiler.MetadataTransform.csproj b/src/coreclr/tools/aot/ILCompiler.MetadataTransform/ILCompiler.MetadataTransform.csproj
index ca6174b66dab13..83ab3456fb5e31 100644
--- a/src/coreclr/tools/aot/ILCompiler.MetadataTransform/ILCompiler.MetadataTransform.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.MetadataTransform/ILCompiler.MetadataTransform.csproj
@@ -2,7 +2,7 @@
LibraryILCompiler.MetadataTransform
- netstandard2.0
+ net5.0true$(DefineConstants);NATIVEFORMAT_PUBLICWRITER;NETFX_45false
diff --git a/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeMetadataWriter.cs b/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeMetadataWriter.cs
index 01bef848d2b36b..c31437d0dd2c45 100644
--- a/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeMetadataWriter.cs
+++ b/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeMetadataWriter.cs
@@ -965,18 +965,14 @@ public override string ToString()
public static class EnumHelpers
{
- public static string FlagsToString(this T value) where T : IConvertible
+ public static string FlagsToString(this T value) where T : struct, Enum, IConvertible
{
- if (!(value is Enum))
- throw new ArgumentException();
-
- var eType = value.GetType();
- var flags = ((T[])Enum.GetValues(eType)).Where(
+ var flags = Enum.GetValues().Where(
eVal => (((IConvertible)eVal).ToInt32(null) != 0) && ((((IConvertible)value).ToInt32(null) & ((IConvertible)eVal).ToInt32(null)) == ((IConvertible)eVal).ToInt32(null)));
if (flags.Count() == 0)
return "";
else
- return "[" + String.Join(" | ", flags.Select(eVal => Enum.GetName(eType, eVal))) + "] ";
+ return "[" + String.Join(" | ", flags.Select(eVal => Enum.GetName(eVal))) + "] ";
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ArgIterator.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ArgIterator.cs
index b9671aa4850223..28d10f23a28f06 100644
--- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ArgIterator.cs
+++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/ArgIterator.cs
@@ -1606,9 +1606,8 @@ private void ForceSigWalk()
int byteArgSize = GetArgSize();
- // Composites greater than 16bytes are passed by reference
- TypeHandle dummy;
- if (GetArgType(out dummy) == CorElementType.ELEMENT_TYPE_VALUETYPE && GetArgSize() > _transitionBlock.EnregisteredParamTypeMaxSize)
+ // On ARM64 some composites are implicitly passed by reference.
+ if (IsArgPassedByRef())
{
byteArgSize = _transitionBlock.PointerSize;
}
diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs
index 34aced76b44b01..8f468f78b39771 100644
--- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs
+++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilationBuilder.cs
@@ -33,7 +33,6 @@ public sealed class ReadyToRunCodegenCompilationBuilder : CompilationBuilder
private string _perfMapPath;
private int _perfMapFormatVersion;
private bool _generateProfileFile;
- private int _parallelism;
Func _printReproInstructions;
private InstructionSetSupport _instructionSetSupport;
private ProfileDataManager _profileData;
@@ -170,12 +169,6 @@ public ReadyToRunCodegenCompilationBuilder UseProfileFile(bool generateProfileFi
return this;
}
- public ReadyToRunCodegenCompilationBuilder UseParallelism(int parallelism)
- {
- _parallelism = parallelism;
- return this;
- }
-
public ReadyToRunCodegenCompilationBuilder UsePrintReproInstructions(Func printReproInstructions)
{
_printReproInstructions = printReproInstructions;
diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunHashCode.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunHashCode.cs
index e506bb8b3b6ef8..9380a829b8f3c9 100644
--- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunHashCode.cs
+++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunHashCode.cs
@@ -34,10 +34,10 @@ public static int NameHashCode(string name)
byte[] src = Encoding.UTF8.GetBytes(name);
for (int i = 0; i < src.Length; i += 2)
{
- hash1 = unchecked(hash1 + RotateLeft(hash1, 5)) ^ src[i];
+ hash1 = unchecked(hash1 + RotateLeft(hash1, 5)) ^ (int)unchecked((sbyte)src[i]);
if (i + 1 < src.Length)
{
- hash2 = unchecked(hash2 + RotateLeft(hash2, 5)) ^ src[i + 1];
+ hash2 = unchecked(hash2 + RotateLeft(hash2, 5)) ^ (int)unchecked((sbyte)src[i + 1]);
}
else
{
diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/IL/Stubs/PInvokeILEmitter.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/IL/Stubs/PInvokeILEmitter.cs
index a8e42ec37b9bc0..6fc1687d7a7f99 100644
--- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/IL/Stubs/PInvokeILEmitter.cs
+++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/IL/Stubs/PInvokeILEmitter.cs
@@ -46,6 +46,13 @@ private void EmitPInvokeCall(PInvokeILCodeStreams ilCodeStreams)
// if the SetLastError flag is set in DllImport, clear the error code before doing P/Invoke
if (_importMetadata.Flags.SetLastError)
{
+ if (!MarshalHelpers.IsRuntimeMarshallingEnabled(((MetadataType)_targetMethod.OwningType).Module))
+ {
+ // When runtime marshalling is disabled, we don't support generating the stub IL
+ // in Ready-to-Run so we can correctly throw an exception at runtime when the user tries to
+ // use SetLastError=true when marshalling is disabled.
+ throw new NotSupportedException();
+ }
callsiteSetupCodeStream.Emit(ILOpcode.call, emitter.NewToken(
stubHelpersType.GetKnownMethod("ClearLastError", null)));
}
diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj
index 40f19bfefc78a5..5154db358a8b8e 100644
--- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ILCompiler.ReadyToRun.csproj
@@ -20,7 +20,7 @@
-
+
@@ -44,6 +44,7 @@
+
diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Interop/IL/Marshaller.ReadyToRun.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Interop/IL/Marshaller.ReadyToRun.cs
index 927148cf006e26..ddb1d24c1b5357 100644
--- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Interop/IL/Marshaller.ReadyToRun.cs
+++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Interop/IL/Marshaller.ReadyToRun.cs
@@ -43,7 +43,8 @@ protected static Marshaller CreateMarshaller(MarshallerKind kind)
private static Marshaller[] GetMarshallers(
MethodSignature methodSig,
PInvokeFlags flags,
- ParameterMetadata[] parameterMetadataArray)
+ ParameterMetadata[] parameterMetadataArray,
+ bool runtimeMarshallingEnabled)
{
Marshaller[] marshallers = new Marshaller[methodSig.Length + 1];
@@ -64,39 +65,55 @@ private static Marshaller[] GetMarshallers(
}
TypeDesc parameterType = (i == 0) ? methodSig.ReturnType : methodSig[i - 1]; //first item is the return type
- marshallers[i] = CreateMarshaller(parameterType,
- parameterIndex,
- methodSig.GetEmbeddedSignatureData(),
- MarshallerType.Argument,
- parameterMetadata.MarshalAsDescriptor,
- MarshalDirection.Forward,
- marshallers,
- parameterMetadata.Index,
- flags,
- parameterMetadata.In,
- parameterMetadata.Out,
- parameterMetadata.Return);
+ if (runtimeMarshallingEnabled)
+ {
+ marshallers[i] = CreateMarshaller(parameterType,
+ parameterIndex,
+ methodSig.GetEmbeddedSignatureData(),
+ MarshallerType.Argument,
+ parameterMetadata.MarshalAsDescriptor,
+ MarshalDirection.Forward,
+ marshallers,
+ parameterMetadata.Index,
+ flags,
+ parameterMetadata.In,
+ parameterMetadata.Out,
+ parameterMetadata.Return);
+ }
+ else
+ {
+ marshallers[i] = CreateDisabledMarshaller(
+ parameterType,
+ parameterIndex,
+ MarshallerType.Argument,
+ MarshalDirection.Forward,
+ marshallers,
+ parameterMetadata.Index,
+ flags,
+ parameterMetadata.Return);
+ }
}
return marshallers;
}
-
public static Marshaller[] GetMarshallersForMethod(MethodDesc targetMethod)
{
Debug.Assert(targetMethod.IsPInvoke);
return GetMarshallers(
targetMethod.Signature,
targetMethod.GetPInvokeMethodMetadata().Flags,
- targetMethod.GetParameterMetadata());
+ targetMethod.GetParameterMetadata(),
+ MarshalHelpers.IsRuntimeMarshallingEnabled(((MetadataType)targetMethod.OwningType).Module));
}
- public static Marshaller[] GetMarshallersForSignature(MethodSignature methodSig, ParameterMetadata[] paramMetadata)
+ public static Marshaller[] GetMarshallersForSignature(MethodSignature methodSig, ParameterMetadata[] paramMetadata, ModuleDesc moduleContext)
{
return GetMarshallers(
methodSig,
new PInvokeFlags(PInvokeAttributes.None),
- paramMetadata);
+ paramMetadata,
+ MarshalHelpers.IsRuntimeMarshallingEnabled(moduleContext));
}
public static bool IsMarshallingRequired(MethodDesc targetMethod)
@@ -128,9 +145,9 @@ public static bool IsMarshallingRequired(MethodDesc targetMethod)
return false;
}
- public static bool IsMarshallingRequired(MethodSignature methodSig, ParameterMetadata[] paramMetadata)
+ public static bool IsMarshallingRequired(MethodSignature methodSig, ParameterMetadata[] paramMetadata, ModuleDesc moduleContext)
{
- Marshaller[] marshallers = GetMarshallersForSignature(methodSig, paramMetadata);
+ Marshaller[] marshallers = GetMarshallersForSignature(methodSig, paramMetadata, moduleContext);
for (int i = 0; i < marshallers.Length; i++)
{
if (marshallers[i].IsMarshallingRequired())
diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs
index f8282ab82cd27c..c2dcc6b397016c 100644
--- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs
+++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs
@@ -1811,7 +1811,7 @@ private void ceeInfoGetCallInfo(
pResult->wrapperDelegateInvoke = false;
- Get_CORINFO_SIG_INFO(methodToCall, &pResult->sig, useInstantiatingStub);
+ Get_CORINFO_SIG_INFO(methodToCall, &pResult->sig, scope: null, useInstantiatingStub);
}
private uint getMethodAttribs(CORINFO_METHOD_STRUCT_* ftn)
@@ -2579,7 +2579,7 @@ private bool pInvokeMarshalingRequired(CORINFO_METHOD_STRUCT_* handle, CORINFO_S
else
{
var sig = HandleToObject(callSiteSig->methodSignature);
- return Marshaller.IsMarshallingRequired(sig, Array.Empty());
+ return Marshaller.IsMarshallingRequired(sig, Array.Empty(), ((MetadataType)HandleToObject(callSiteSig->scope).OwningMethod.OwningType).Module);
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ILCompiler.Reflection.ReadyToRun.csproj b/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ILCompiler.Reflection.ReadyToRun.csproj
index 86644068f3c172..b57b5be6d076bb 100644
--- a/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ILCompiler.Reflection.ReadyToRun.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.Reflection.ReadyToRun/ILCompiler.Reflection.ReadyToRun.csproj
@@ -31,6 +31,6 @@
-
+
diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs
index e794bdd1a94790..0d8b11c51f82e2 100644
--- a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs
+++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilation.cs
@@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
+using System.Threading.Tasks;
using ILCompiler.DependencyAnalysis;
using ILCompiler.DependencyAnalysisFramework;
@@ -21,10 +22,10 @@ public sealed class RyuJitCompilation : Compilation
private readonly ConditionalWeakTable _corinfos = new ConditionalWeakTable();
internal readonly RyuJitCompilationOptions _compilationOptions;
private readonly ExternSymbolMappedField _hardwareIntrinsicFlags;
- private CountdownEvent _compilationCountdown;
private readonly Dictionary _instructionSetMap;
private readonly ProfileDataManager _profileDataManager;
private readonly MethodImportationErrorProvider _methodImportationErrorProvider;
+ private readonly int _parallelism;
public InstructionSetSupport InstructionSetSupport { get; }
@@ -40,7 +41,8 @@ internal RyuJitCompilation(
InstructionSetSupport instructionSetSupport,
ProfileDataManager profileDataManager,
MethodImportationErrorProvider errorProvider,
- RyuJitCompilationOptions options)
+ RyuJitCompilationOptions options,
+ int parallelism)
: base(dependencyGraph, nodeFactory, roots, ilProvider, debugInformationProvider, devirtualizationManager, inliningPolicy, logger)
{
_compilationOptions = options;
@@ -59,6 +61,8 @@ internal RyuJitCompilation(
_profileDataManager = profileDataManager;
_methodImportationErrorProvider = errorProvider;
+
+ _parallelism = parallelism;
}
public ProfileDataManager ProfileData => _profileDataManager;
@@ -125,7 +129,7 @@ protected override void ComputeDependencyNodeDependencies(List methodsToCompile)
Logger.Writer.WriteLine($"Compiling {methodsToCompile.Count} methods...");
}
- WaitCallback compileSingleMethodDelegate = m =>
- {
- CorInfoImpl corInfo = _corinfos.GetValue(Thread.CurrentThread, thread => new CorInfoImpl(this));
- CompileSingleMethod(corInfo, (MethodCodeNode)m);
- };
-
- using (_compilationCountdown = new CountdownEvent(methodsToCompile.Count))
- {
-
- foreach (MethodCodeNode methodCodeNodeNeedingCode in methodsToCompile)
- {
- ThreadPool.QueueUserWorkItem(compileSingleMethodDelegate, methodCodeNodeNeedingCode);
- }
-
- _compilationCountdown.Wait();
- _compilationCountdown = null;
- }
+ Parallel.ForEach(
+ methodsToCompile,
+ new ParallelOptions { MaxDegreeOfParallelism = _parallelism },
+ CompileSingleMethod);
}
@@ -176,52 +167,50 @@ private void CompileSingleThreaded(List methodsToCompile)
}
}
+ private void CompileSingleMethod(MethodCodeNode methodCodeNodeNeedingCode)
+ {
+ CorInfoImpl corInfo = _corinfos.GetValue(Thread.CurrentThread, thread => new CorInfoImpl(this));
+ CompileSingleMethod(corInfo, methodCodeNodeNeedingCode);
+ }
+
private void CompileSingleMethod(CorInfoImpl corInfo, MethodCodeNode methodCodeNodeNeedingCode)
{
- try
- {
- MethodDesc method = methodCodeNodeNeedingCode.Method;
+ MethodDesc method = methodCodeNodeNeedingCode.Method;
- TypeSystemException exception = _methodImportationErrorProvider.GetCompilationError(method);
+ TypeSystemException exception = _methodImportationErrorProvider.GetCompilationError(method);
- // If we previously failed to import the method, do not try to import it again and go
- // directly to the error path.
- if (exception == null)
+ // If we previously failed to import the method, do not try to import it again and go
+ // directly to the error path.
+ if (exception == null)
+ {
+ try
{
- try
- {
- corInfo.CompileMethod(methodCodeNodeNeedingCode);
- }
- catch (TypeSystemException ex)
- {
- exception = ex;
- }
+ corInfo.CompileMethod(methodCodeNodeNeedingCode);
}
-
- if (exception != null)
+ catch (TypeSystemException ex)
{
- // TODO: fail compilation if a switch was passed
-
- // Try to compile the method again, but with a throwing method body this time.
- MethodIL throwingIL = TypeSystemThrowingILEmitter.EmitIL(method, exception);
- corInfo.CompileMethod(methodCodeNodeNeedingCode, throwingIL);
-
- if (exception is TypeSystemException.InvalidProgramException
- && method.OwningType is MetadataType mdOwningType
- && mdOwningType.HasCustomAttribute("System.Runtime.InteropServices", "ClassInterfaceAttribute"))
- {
- Logger.LogWarning("COM interop is not supported with full ahead of time compilation", 3052, method, MessageSubCategory.AotAnalysis);
- }
- else
- {
- Logger.LogWarning($"Method will always throw because: {exception.Message}", 1005, method, MessageSubCategory.AotAnalysis);
- }
+ exception = ex;
}
}
- finally
+
+ if (exception != null)
{
- if (_compilationCountdown != null)
- _compilationCountdown.Signal();
+ // TODO: fail compilation if a switch was passed
+
+ // Try to compile the method again, but with a throwing method body this time.
+ MethodIL throwingIL = TypeSystemThrowingILEmitter.EmitIL(method, exception);
+ corInfo.CompileMethod(methodCodeNodeNeedingCode, throwingIL);
+
+ if (exception is TypeSystemException.InvalidProgramException
+ && method.OwningType is MetadataType mdOwningType
+ && mdOwningType.HasCustomAttribute("System.Runtime.InteropServices", "ClassInterfaceAttribute"))
+ {
+ Logger.LogWarning("COM interop is not supported with full ahead of time compilation", 3052, method, MessageSubCategory.AotAnalysis);
+ }
+ else
+ {
+ Logger.LogWarning($"Method will always throw because: {exception.Message}", 1005, method, MessageSubCategory.AotAnalysis);
+ }
}
}
@@ -252,7 +241,6 @@ public override MethodIL GetMethodIL(MethodDesc method)
public enum RyuJitCompilationOptions
{
MethodBodyFolding = 0x1,
- SingleThreadedCompilation = 0x2,
- ControlFlowGuardAnnotations = 0x4,
+ ControlFlowGuardAnnotations = 0x2,
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs
index 162f1a39e86bbc..8b753c71039942 100644
--- a/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs
+++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/RyuJitCompilationBuilder.cs
@@ -107,9 +107,6 @@ public override ICompilation ToCompilation()
if (_methodBodyFolding)
options |= RyuJitCompilationOptions.MethodBodyFolding;
- if (_singleThreaded)
- options |= RyuJitCompilationOptions.SingleThreadedCompilation;
-
if ((_mitigationOptions & SecurityMitigationOptions.ControlFlowGuardAnnotations) != 0)
options |= RyuJitCompilationOptions.ControlFlowGuardAnnotations;
@@ -117,7 +114,7 @@ public override ICompilation ToCompilation()
JitConfigProvider.Initialize(_context.Target, jitFlagBuilder.ToArray(), _ryujitOptions);
DependencyAnalyzerBase graph = CreateDependencyGraph(factory, new ObjectNode.ObjectNodeComparer(new CompilerComparer()));
- return new RyuJitCompilation(graph, factory, _compilationRoots, _ilProvider, _debugInformationProvider, _logger, _devirtualizationManager, _inliningPolicy ?? _compilationGroup, _instructionSetSupport, _profileDataManager, _methodImportationErrorProvider, options);
+ return new RyuJitCompilation(graph, factory, _compilationRoots, _ilProvider, _debugInformationProvider, _logger, _devirtualizationManager, _inliningPolicy ?? _compilationGroup, _instructionSetSupport, _profileDataManager, _methodImportationErrorProvider, options, _parallelism);
}
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/ILCompiler.RyuJit.csproj b/src/coreclr/tools/aot/ILCompiler.RyuJit/ILCompiler.RyuJit.csproj
index efff02a77708c0..cecc90d6da81b0 100644
--- a/src/coreclr/tools/aot/ILCompiler.RyuJit/ILCompiler.RyuJit.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/ILCompiler.RyuJit.csproj
@@ -3,7 +3,7 @@
LibraryILCompilerILCompiler.RyuJit
- net5.0
+ net6.0truefalsex64;x86
diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs
index 5966efead0066f..1b1fbdf550777d 100644
--- a/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs
+++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs
@@ -1027,7 +1027,7 @@ private CorInfoHelpFunc getNewHelper(ref CORINFO_RESOLVED_TOKEN pResolvedToken,
TypeDesc type = HandleToObject(pResolvedToken.hClass);
Debug.Assert(!type.IsString && !type.IsArray && !type.IsCanonicalDefinitionType(CanonicalFormKind.Any));
-
+
pHasSideEffects = type.HasFinalizer;
if (type.RequiresAlign8())
@@ -1520,7 +1520,7 @@ private void getCallInfo(ref CORINFO_RESOLVED_TOKEN pResolvedToken, CORINFO_RESO
targetIsFatFunctionPointer |= (flags & CORINFO_CALLINFO_FLAGS.CORINFO_CALLINFO_CALLVIRT) != 0 && !(pResult->kind == CORINFO_CALL_KIND.CORINFO_CALL);
- Get_CORINFO_SIG_INFO(targetMethod, &pResult->sig, targetIsFatFunctionPointer);
+ Get_CORINFO_SIG_INFO(targetMethod, &pResult->sig, scope: null, targetIsFatFunctionPointer);
if (useFatCallTransform)
{
pResult->sig.flags |= CorInfoSigInfoFlags.CORINFO_SIGFLAG_FAT_CALL;
@@ -1531,7 +1531,7 @@ private void getCallInfo(ref CORINFO_RESOLVED_TOKEN pResolvedToken, CORINFO_RESO
if (pResult->hMethod != pResolvedToken.hMethod)
{
pResult->verMethodFlags = getMethodAttribsInternal(targetMethod);
- Get_CORINFO_SIG_INFO(targetMethod, &pResult->verSig);
+ Get_CORINFO_SIG_INFO(targetMethod, &pResult->verSig, scope: null);
}
else
{
@@ -1791,7 +1791,9 @@ private bool pInvokeMarshalingRequired(CORINFO_METHOD_STRUCT_* handle, CORINFO_S
#if DEBUG
MethodSignature methodSignature = (MethodSignature)HandleToObject((IntPtr)callSiteSig->pSig);
- MethodDesc stub = _compilation.PInvokeILProvider.GetCalliStub(methodSignature);
+ MethodDesc stub = _compilation.PInvokeILProvider.GetCalliStub(
+ methodSignature,
+ ((MetadataType)HandleToObject(callSiteSig->scope).OwningMethod.OwningType).Module);
Debug.Assert(!IsPInvokeStubRequired(stub));
#endif
@@ -1825,7 +1827,9 @@ private bool convertPInvokeCalliToCall(ref CORINFO_RESOLVED_TOKEN pResolvedToken
if ((signature.Flags & MethodSignatureFlags.UnmanagedCallingConventionMask) == 0)
return false;
- MethodDesc stub = _compilation.PInvokeILProvider.GetCalliStub(signature);
+ MethodDesc stub = _compilation.PInvokeILProvider.GetCalliStub(
+ signature,
+ ((MetadataType)methodIL.OwningMethod.OwningType).Module);
if (!mustConvert && !IsPInvokeStubRequired(stub))
return false;
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun/ILCompiler.TypeSystem.ReadyToRun.csproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun/ILCompiler.TypeSystem.ReadyToRun.csproj
deleted file mode 100644
index 86b9c06a6cf0d2..00000000000000
--- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun/ILCompiler.TypeSystem.ReadyToRun.csproj
+++ /dev/null
@@ -1,647 +0,0 @@
-
-
- Library
- Internal.TypeSystem
- ILCompiler.TypeSystem.ReadyToRun
- true
- netstandard2.0
- false
- x64;x86
- AnyCPU
- false
- true
- $(DefineConstants);DISABLE_UNMANAGED_PDB_SYMBOLS
-
-
- false
- Debug;Release;Checked
-
-
-
-
- Internal.TypeSystem.Strings.resources
-
-
-
-
-
- $(SystemReflectionMetadataVersion)
-
-
- 1.3.0
-
-
-
-
- TypeSystem\Common\ArrayMethod.Diagnostic.cs
-
-
- TypeSystem\Canon\ArrayType.Canon.cs
-
-
- TypeSystem\Canon\ByRefType.Canon.cs
-
-
- TypeSystem\Canon\CanonTypes.cs
-
-
- TypeSystem\Canon\CanonTypes.Diagnostic.cs
-
-
- TypeSystem\Canon\CanonTypes.Interop.cs
-
-
- TypeSystem\Canon\CanonTypes.Sorting.cs
-
-
- TypeSystem\Canon\FunctionPointerType.Canon.cs
-
-
- TypeSystem\Canon\GenericParameterDesc.Canon.cs
-
-
- TypeSystem\Canon\StandardCanonicalizationAlgorithm.cs
-
-
- TypeSystem\Canon\DefType.Canon.cs
-
-
- TypeSystem\Canon\InstantiatedMethod.Canon.cs
-
-
- TypeSystem\Canon\InstantiatedType.Canon.cs
-
-
- TypeSystem\Canon\MetadataType.Canon.cs
-
-
- TypeSystem\Canon\MethodDelegator.Canon.cs
-
-
- TypeSystem\Canon\MethodDesc.Canon.cs
-
-
- TypeSystem\Canon\MethodForInstantiatedType.Canon.cs
-
-
- TypeSystem\Canon\ParameterizedType.Canon.cs
-
-
- TypeSystem\Canon\PointerType.Canon.cs
-
-
- TypeSystem\Canon\SignatureVariable.Canon.cs
-
-
- TypeSystem\Canon\TypeDesc.Canon.cs
-
-
- TypeSystem\Canon\TypeSystemContext.Canon.cs
-
-
- TypeSystem\CodeGen\FieldDesc.CodeGen.cs
-
-
- TypeSystem\CodeGen\MethodDelegator.CodeGen.cs
-
-
- TypeSystem\CodeGen\MethodDesc.CodeGen.cs
-
-
- TypeSystem\CodeGen\TargetDetails.CodeGen.cs
-
-
- TypeSystem\CodeGen\TypeDesc.CodeGen.cs
-
-
- Utilities\AlignmentHelper.cs
-
-
- Utilities\ArrayOfTRuntimeInterfacesAlgorithm.cs
-
-
- TypeSystem\Common\CastingHelper.cs
-
-
- TypeSystem\Common\ConstructedTypeRewritingHelpers.cs
-
-
- TypeSystem\Common\ExplicitLayoutValidator.cs
-
-
- TypeSystem\Common\FunctionPointerType.cs
-
-
- TypeSystem\Common\IAssemblyDesc.cs
-
-
- TypeSystem\Common\IModuleResolver.cs
-
-
- TypeSystem\Common\Instantiation.cs
-
-
- TypeSystem\Common\ModuleDesc.cs
-
-
- TypeSystem\Common\NotFoundBehavior.cs
-
-
- TypeSystem\Common\ResolutionFailure.cs
-
-
- TypeSystem\Common\TypeSystemEntity.cs
-
-
- TypeSystem\Common\TypeSystemException.cs
-
-
- TypeSystem\Common\TypeSystemException.Resources.cs
-
-
- TypeSystem\Common\ThrowHelper.cs
-
-
- TypeSystem\Common\ThrowHelper.Common.cs
-
-
- TypeSystem\Common\UniversalCanonLayoutAlgorithm.cs
-
-
- Utilities\CustomAttributeTypeNameFormatter.cs
-
-
- Utilities\CustomAttributeTypeNameParser.cs
-
-
- Utilities\GCPointerMap.Algorithm.cs
-
-
- Utilities\GCPointerMap.cs
-
-
- Utilities\DebugNameFormatter.cs
-
-
- Utilities\LockFreeReaderHashtable.cs
-
-
- TypeSystem\Common\ArrayType.cs
-
-
- TypeSystem\Common\BaseTypeRuntimeInterfacesAlgorithm.cs
-
-
- TypeSystem\Common\ByRefType.cs
-
-
- TypeSystem\Common\GenericParameterDesc.cs
-
-
- TypeSystem\Common\GenericParameterDesc.Diagnostic.cs
-
-
- TypeSystem\Common\ExceptionStringID.cs
-
-
- TypeSystem\Common\FieldForInstantiatedType.cs
-
-
- TypeSystem\Common\FieldDesc.cs
-
-
- TypeSystem\Common\FieldDesc.ToString.cs
-
-
- TypeSystem\Common\FieldDesc.FieldLayout.cs
-
-
- TypeSystem\Common\FieldLayoutAlgorithm.cs
-
-
- TypeSystem\Common\InstantiatedMethod.cs
-
-
- TypeSystem\Common\InstantiatedMethod.Diagnostic.cs
-
-
- TypeSystem\Common\InstantiatedType.cs
-
-
- TypeSystem\Common\InstantiatedType.Diagnostic.cs
-
-
- TypeSystem\Common\InstantiatedType.Interfaces.cs
-
-
- TypeSystem\Common\InstantiatedType.MethodImpls.cs
-
-
- TypeSystem\Common\LayoutInt.cs
-
-
- TypeSystem\Common\LinqPoison.cs
-
-
- TypeSystem\Common\MetadataType.cs
-
-
- TypeSystem\Common\DefType.Diagnostic.cs
-
-
- TypeSystem\Common\MetadataType.Interfaces.cs
-
-
- TypeSystem\Common\MetadataType.MethodImpls.cs
-
-
- TypeSystem\Common\MetadataFieldLayoutAlgorithm.cs
-
-
- TypeSystem\Common\MetadataRuntimeInterfacesAlgorithm.cs
-
-
- TypeSystem\Common\MetadataTypeSystemContext.cs
-
-
- TypeSystem\Common\MethodForInstantiatedType.cs
-
-
- TypeSystem\Common\MethodForInstantiatedType.Diagnostic.cs
-
-
- TypeSystem\Common\ParameterizedType.cs
-
-
- TypeSystem\Common\PointerType.cs
-
-
- TypeSystem\Common\PropertySignature.cs
-
-
- TypeSystem\Common\SignatureVariable.cs
-
-
- TypeSystem\Common\TargetArchitecture.cs
-
-
- TypeSystem\Common\TargetDetails.cs
-
-
- TypeSystem\Common\TargetDetails.ToString.cs
-
-
- TypeSystem\Common\ThreadSafeFlags.cs
-
-
- TypeSystem\Common\TypeFlags.cs
-
-
- TypeSystem\Common\TypeHashingAlgorithms.cs
-
-
- TypeSystem\Common\TypeSystemConstraintsHelpers.cs
-
-
- TypeSystem\Common\TypeSystemContext.cs
-
-
- TypeSystem\Common\TypeSystemHelpers.cs
-
-
- Utilities\ExceptionTypeNameFormatter.cs
-
-
- Utilities\ExceptionTypeNameFormatter.Metadata.cs
-
-
- Utilities\TypeNameFormatter.cs
-
-
- TypeSystem\Common\WellKnownType.cs
-
-
- TypeSystem\Common\VirtualMethodAlgorithm.cs
-
-
- TypeSystem\Common\MethodDelegator.cs
-
-
- TypeSystem\Common\MethodDelegator.Diagnostic.cs
-
-
- TypeSystem\Common\MethodDesc.cs
-
-
- TypeSystem\Common\MethodDesc.Diagnostic.cs
-
-
- TypeSystem\Common\MethodDesc.ToString.cs
-
-
- TypeSystem\Common\StandardVirtualMethodAlgorithm.cs
-
-
- TypeSystem\Common\TypeDesc.cs
-
-
- TypeSystem\Common\TypeDesc.ToString.cs
-
-
- TypeSystem\Common\TypeDesc.Interfaces.cs
-
-
- TypeSystem\Common\DefType.cs
-
-
- TypeSystem\Common\DefType.FieldLayout.cs
-
-
- TypeSystem\Common\RuntimeInterfacesAlgorithm.cs
-
-
- Ecma\CustomAttributeTypeProvider.cs
-
-
- Ecma\EcmaAssembly.cs
-
-
- Ecma\EcmaAssembly.Symbols.cs
-
-
- Ecma\EcmaField.Sorting.cs
-
-
- Ecma\EcmaField.CodeGen.cs
-
-
- Ecma\EcmaField.Serialization.cs
-
-
- Ecma\EcmaGenericParameter.Sorting.cs
-
-
- Ecma\EcmaMethod.Sorting.cs
-
-
- Ecma\EcmaModule.Sorting.cs
-
-
- Ecma\EcmaType.Serialization.cs
-
-
- Ecma\EcmaType.Sorting.cs
-
-
- Ecma\PrimitiveTypeProvider.cs
-
-
- Ecma\EcmaModule.Symbols.cs
-
-
- Ecma\SymbolReader\PdbSymbolReader.cs
-
-
- Ecma\SymbolReader\PortablePdbSymbolReader.cs
-
-
- Ecma\SymbolReader\UnmanagedPdbSymbolReader.cs
-
-
- Ecma\EcmaField.cs
-
-
- Ecma\EcmaGenericParameter.cs
-
-
- Ecma\EcmaGenericParameter.Diagnostic.cs
-
-
- Ecma\EcmaMethod.cs
-
-
- Ecma\EcmaMethod.cs
-
-
- Ecma\EcmaModule.cs
-
-
- Ecma\EcmaSignatureParser.cs
-
-
- Ecma\EcmaType.cs
-
-
- Ecma\EcmaType.Diagnostic.cs
-
-
- Ecma\EcmaType.MethodImpls.cs
-
-
- Ecma\EcmaType.Interfaces.cs
-
-
- Ecma\MetadataExtensions.cs
-
-
- Ecma\IMetadataStringDecoderProvider.cs
-
-
- Ecma\CachingMetadataStringDecoder.cs
-
-
- IL\EcmaMethodIL.cs
-
-
- IL\EcmaMethodIL.Symbols.cs
-
-
- IL\MethodIL.cs
-
-
- IL\MethodIL.Symbols.cs
-
-
- IL\MethodILDebugView.cs
-
-
- IL\ILDisassembler.cs
-
-
- IL\InstantiatedMethodIL.cs
-
-
- IL\ILStackHelper.cs
-
-
- IL\ILOpcode.cs
-
-
- IL\ILOpcodeHelper.cs
-
-
- IL\Stubs\ILEmitter.cs
-
-
- IL\Stubs\PInvokeTargetNativeMethod.cs
-
-
- IL\Stubs\PInvokeTargetNativeMethod.Diagnostic.cs
-
-
- IL\Stubs\PInvokeTargetNativeMethod.Mangling.cs
-
-
- IL\Stubs\PInvokeTargetNativeMethod.Sorting.cs
-
-
- TypeSystem\CodeGen\FieldDesc.Serialization.cs
-
-
- TypeSystem\CodeGen\TypeDesc.Serialization.cs
-
-
- TypeSystem\Sorting\FieldDesc.Sorting.cs
-
-
- TypeSystem\Sorting\FieldForInstantiatedType.Sorting.cs
-
-
- TypeSystem\Sorting\InstantiatedMethod.Sorting.cs
-
-
- TypeSystem\Sorting\MethodDesc.Sorting.cs
-
-
- TypeSystem\Sorting\MethodForInstantiatedType.Sorting.cs
-
-
- TypeSystem\Interop\FieldDesc.Interop.cs
-
-
- TypeSystem\Interop\InstantiatedType.Interop.cs
-
-
- TypeSystem\Interop\MetadataType.Interop.cs
-
-
- TypeSystem\Interop\MethodDelegator.Interop.cs
-
-
- TypeSystem\Interop\MethodDesc.Interop.cs
-
-
- TypeSystem\Interop\MarshalAsDescriptor.cs
-
-
- TypeSystem\Mangling\IPrefixMangledMethod.cs
-
-
- TypeSystem\Mangling\IPrefixMangledType.cs
-
-
- TypeSystem\Mangling\IPrefixMangledSignature.cs
-
-
- Utilities\ArrayBuilder.cs
-
-
- TypeSystem\Common\LocalVariableDefinition.cs
-
-
- TypeSystem\RuntimeDetermined\ArrayType.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\ByRefType.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\FieldDesc.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\FunctionPointerType.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\MethodDesc.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\PointerType.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\MethodForRuntimeDeterminedType.cs
-
-
- TypeSystem\RuntimeDetermined\MethodForRuntimeDeterminedType.cs
-
-
- TypeSystem\RuntimeDetermined\MethodForRuntimeDeterminedType.Sorting.cs
-
-
- TypeSystem\RuntimeDetermined\RuntimeDeterminedCanonicalizationAlgorithm.cs
-
-
- TypeSystem\RuntimeDetermined\RuntimeDeterminedFieldLayoutAlgorithm.cs
-
-
- TypeSystem\RuntimeDetermined\DefType.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\GenericParameterDesc.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\ParameterizedType.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\RuntimeDeterminedType.cs
-
-
- TypeSystem\RuntimeDetermined\RuntimeDeterminedType.Diagnostic.cs
-
-
- TypeSystem\RuntimeDetermined\RuntimeDeterminedType.Sorting.cs
-
-
- TypeSystem\RuntimeDetermined\RuntimeDeterminedTypeUtilities.cs
-
-
- TypeSystem\RuntimeDetermined\SignatureVariable.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\TypeDesc.RuntimeDetermined.cs
-
-
- TypeSystem\RuntimeDetermined\TypeSystemContext.RuntimeDetermined.cs
-
-
- Common\System\FormattingHelpers.cs
-
-
- TypeSystem\Sorting\ArrayType.Sorting.cs
-
-
- TypeSystem\Sorting\ByRefType.Sorting.cs
-
-
- TypeSystem\Sorting\FunctionPointerType.Sorting.cs
-
-
- TypeSystem\Sorting\InstantiatedType.Sorting.cs
-
-
- TypeSystem\Sorting\MethodSignature.Sorting.cs
-
-
- TypeSystem\Sorting\PointerType.Sorting.cs
-
-
- TypeSystem\Sorting\SignatureVariable.Sorting.cs
-
-
- TypeSystem\Sorting\TypeDesc.Sorting.cs
-
-
- TypeSystem\Sorting\TypeSystemComparer.cs
-
-
-
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ArchitectureSpecificFieldLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ArchitectureSpecificFieldLayoutTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ArchitectureSpecificFieldLayoutTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ArchitectureSpecificFieldLayoutTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CanonicalizationTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CanonicalizationTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CanonicalizationTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CanonicalizationTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CastingTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CastingTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CastingTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CastingTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ConstraintsValidationTest.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ConstraintsValidationTest.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ConstraintsValidationTest.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ConstraintsValidationTest.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Canonicalization.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Canonicalization.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Canonicalization.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Canonicalization.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Casting.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Casting.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Casting.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Casting.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/CoreTestAssembly.csproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/CoreTestAssembly.csproj
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/CoreTestAssembly.csproj
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/CoreTestAssembly.csproj
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/GCPointerMap.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/GCPointerMap.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/GCPointerMap.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/GCPointerMap.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/GenericConstraints.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/GenericConstraints.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/GenericConstraints.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/GenericConstraints.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/GenericTypes.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/GenericTypes.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/GenericTypes.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/GenericTypes.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Hashcode.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Hashcode.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Hashcode.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Hashcode.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/InstanceFieldLayout.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/InstanceFieldLayout.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/InstanceFieldLayout.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/InstanceFieldLayout.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/InterfaceArrangements.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/InterfaceArrangements.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/InterfaceArrangements.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/InterfaceArrangements.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Marshalling.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Marshalling.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Marshalling.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Marshalling.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Platform.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Platform.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/Platform.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Platform.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/StaticFieldLayout.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/StaticFieldLayout.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/StaticFieldLayout.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/StaticFieldLayout.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/SyntheticVirtualOverride.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/SyntheticVirtualOverride.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/SyntheticVirtualOverride.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/SyntheticVirtualOverride.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/TypeNameParsing.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/TypeNameParsing.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/TypeNameParsing.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/TypeNameParsing.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/ValueTypeShapeCharacteristics.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/ValueTypeShapeCharacteristics.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/ValueTypeShapeCharacteristics.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/ValueTypeShapeCharacteristics.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/VirtualFunctionOverride.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/VirtualFunctionOverride.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/CoreTestAssembly/VirtualFunctionOverride.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/VirtualFunctionOverride.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/DefType.FieldLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/DefType.FieldLayoutTests.cs
similarity index 98%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/DefType.FieldLayoutTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/DefType.FieldLayoutTests.cs
index c82f6c21a85be8..f41f4a7ea63068 100644
--- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/DefType.FieldLayoutTests.cs
+++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/DefType.FieldLayoutTests.cs
@@ -2,7 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
using Internal.TypeSystem;
-using Internal.TypeSystem.Interop;
using Xunit;
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ExceptionStringTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ExceptionStringTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ExceptionStringTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ExceptionStringTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/GCPointerMapTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/GCPointerMapTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/GCPointerMapTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/GCPointerMapTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/GenericTypeAndMethodTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/GenericTypeAndMethodTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/GenericTypeAndMethodTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/GenericTypeAndMethodTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/HashcodeTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/HashcodeTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/HashcodeTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/HashcodeTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILCompiler.TypeSystem.ReadyToRun.Tests.csproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILCompiler.TypeSystem.Tests.csproj
similarity index 78%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILCompiler.TypeSystem.ReadyToRun.Tests.csproj
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILCompiler.TypeSystem.Tests.csproj
index 558daa29f76b70..767680f651aacd 100644
--- a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILCompiler.TypeSystem.ReadyToRun.Tests.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILCompiler.TypeSystem.Tests.csproj
@@ -1,6 +1,6 @@
- ILCompiler.TypeSystem.ReadyToRun.Tests
+ ILCompiler.TypeSystem.Tests$(NetCoreAppToolCurrent)Debug;Release;Checked
@@ -14,6 +14,9 @@
AnyCPU;x64AnyCPUtrue
+
+
+ READYTORUN;$(DefineConstants)
@@ -23,8 +26,7 @@
-
-
+ false
@@ -40,6 +42,11 @@
+
+
+
+
+
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILDisassemblerTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILDisassemblerTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILDisassemblerTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILDisassemblerTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/ILDisassembler.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/ILDisassembler.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/ILDisassembler.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/ILDisassembler.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/ILTestAssembly.ilproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/ILTestAssembly.ilproj
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/ILTestAssembly.ilproj
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/ILTestAssembly.ilproj
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/InstanceFieldLayout.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/InstanceFieldLayout.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/InstanceFieldLayout.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/InstanceFieldLayout.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/MDArrayFunctionResolution.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/MDArrayFunctionResolution.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/MDArrayFunctionResolution.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/MDArrayFunctionResolution.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/Main.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/Main.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/Main.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/Main.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/MethodImplOverride1.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/MethodImplOverride1.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/MethodImplOverride1.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/MethodImplOverride1.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/Signature.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/Signature.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/Signature.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/Signature.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/StaticFieldLayout.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/StaticFieldLayout.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/StaticFieldLayout.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/StaticFieldLayout.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/VirtualFunctionOverride.il b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/VirtualFunctionOverride.il
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ILTestAssembly/VirtualFunctionOverride.il
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ILTestAssembly/VirtualFunctionOverride.il
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/InstanceFieldLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/InstanceFieldLayoutTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/InstanceFieldLayoutTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/InstanceFieldLayoutTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/InterfacesTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/InterfacesTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/InterfacesTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/InterfacesTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/MarshalUtilsTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/MarshalUtilsTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/MarshalUtilsTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/MarshalUtilsTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/RuntimeDeterminedTypesTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/RuntimeDeterminedTypesTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/RuntimeDeterminedTypesTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/RuntimeDeterminedTypesTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/SignatureTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SignatureTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/SignatureTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SignatureTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/StaticFieldLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/StaticFieldLayoutTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/StaticFieldLayoutTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/StaticFieldLayoutTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/SyntheticVirtualOverrideTests.DiagnosticName.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SyntheticVirtualOverrideTests.DiagnosticName.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/SyntheticVirtualOverrideTests.DiagnosticName.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SyntheticVirtualOverrideTests.DiagnosticName.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/SyntheticVirtualOverrideTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SyntheticVirtualOverrideTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/SyntheticVirtualOverrideTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SyntheticVirtualOverrideTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/TestMetadataFieldLayoutAlgorithm.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TestMetadataFieldLayoutAlgorithm.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/TestMetadataFieldLayoutAlgorithm.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TestMetadataFieldLayoutAlgorithm.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/TestTypeSystemContext.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TestTypeSystemContext.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/TestTypeSystemContext.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TestTypeSystemContext.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/TypeNameParsingTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TypeNameParsingTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/TypeNameParsingTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/TypeNameParsingTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/UniversalGenericFieldLayoutTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/UniversalGenericFieldLayoutTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/UniversalGenericFieldLayoutTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/UniversalGenericFieldLayoutTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ValueTypeShapeCharacteristicsTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ValueTypeShapeCharacteristicsTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/ValueTypeShapeCharacteristicsTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/ValueTypeShapeCharacteristicsTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/VirtualFunctionOverrideTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/VirtualFunctionOverrideTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/VirtualFunctionOverrideTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/VirtualFunctionOverrideTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/WellKnownTypeTests.cs b/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/WellKnownTypeTests.cs
similarity index 100%
rename from src/coreclr/tools/aot/ILCompiler.TypeSystem.ReadyToRun.Tests/WellKnownTypeTests.cs
rename to src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/WellKnownTypeTests.cs
diff --git a/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj b/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj
index 4aa53fd19c5e11..bf9a6275d972b7 100644
--- a/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj
+++ b/src/coreclr/tools/aot/ILCompiler.TypeSystem/ILCompiler.TypeSystem.csproj
@@ -9,6 +9,8 @@
x64;x86AnyCPUfalse
+ true
+ $(DefineConstants);DISABLE_UNMANAGED_PDB_SYMBOLS
- win-$(TargetArchitecture)
- linux-$(TargetArchitecture)
- osx-$(TargetArchitecture)
+ $(ToolsRID)
diff --git a/src/coreclr/tools/aot/ILCompiler/Program.cs b/src/coreclr/tools/aot/ILCompiler/Program.cs
index 007c3787df15f5..e973c05b08c2c6 100644
--- a/src/coreclr/tools/aot/ILCompiler/Program.cs
+++ b/src/coreclr/tools/aot/ILCompiler/Program.cs
@@ -57,9 +57,10 @@ internal class Program
private bool _reflectedOnly;
private bool _scanReflection;
private bool _methodBodyFolding;
- private bool _singleThreaded;
+ private int _parallelism = Environment.ProcessorCount;
private string _instructionSet;
private string _guard;
+ private int _maxGenericCycle = CompilerTypeSystemContext.DefaultGenericCycleCutoffPoint;
private string _singleMethodTypeName;
private string _singleMethodName;
@@ -205,7 +206,7 @@ private ArgumentSyntax ParseCommandLine(string[] args)
syntax.DefineOptionList("appcontextswitch", ref _appContextSwitches, "System.AppContext switches to set (format: 'Key=Value')");
syntax.DefineOptionList("feature", ref _featureSwitches, "Feature switches to apply (format: 'Namespace.Name=[true|false]'");
syntax.DefineOptionList("runtimeopt", ref _runtimeOptions, "Runtime options to set");
- syntax.DefineOption("singlethreaded", ref _singleThreaded, "Run compilation on a single thread");
+ syntax.DefineOption("parallelism", ref _parallelism, "Maximum number of threads to use during compilation");
syntax.DefineOption("instructionset", ref _instructionSet, "Instruction set to allow or disallow");
syntax.DefineOption("guard", ref _guard, "Enable mitigations. Options: 'cf': CFG (Control Flow Guard, Windows only)");
syntax.DefineOption("preinitstatics", ref _preinitStatics, "Interpret static constructors at compile time if possible (implied by -O)");
@@ -216,7 +217,7 @@ private ArgumentSyntax ParseCommandLine(string[] args)
syntax.DefineOptionList("nosinglewarnassembly", ref _singleWarnDisabledAssemblies, "Expand AOT/trimming warnings for given assembly");
syntax.DefineOptionList("directpinvoke", ref _directPInvokes, "PInvoke to call directly");
syntax.DefineOptionList("directpinvokelist", ref _directPInvokeLists, "File with list of PInvokes to call directly");
-
+ syntax.DefineOption("maxgenericcycle", ref _maxGenericCycle, "Max depth of generic cycle");
syntax.DefineOptionList("root", ref _rootedAssemblies, "Fully generate given assembly");
syntax.DefineOptionList("conditionalroot", ref _conditionallyRootedAssemblies, "Fully generate given assembly if it's used");
syntax.DefineOptionList("trim", ref _trimmedAssemblies, "Trim the specified assembly");
@@ -270,7 +271,7 @@ private ArgumentSyntax ParseCommandLine(string[] args)
return argSyntax;
}
- private IReadOnlyCollection CreateInitializerList(TypeSystemContext context)
+ private IReadOnlyCollection CreateInitializerList(CompilerTypeSystemContext context)
{
List assembliesWithInitalizers = new List();
@@ -278,7 +279,7 @@ private IReadOnlyCollection CreateInitializerList(TypeSystemContext
// any user code runs.
foreach (string initAssemblyName in _initAssemblies)
{
- ModuleDesc assembly = context.ResolveAssembly(new AssemblyName(initAssemblyName));
+ ModuleDesc assembly = context.ResolveAssembly(new AssemblyName(initAssemblyName), throwIfNotFound: true);
assembliesWithInitalizers.Add(assembly);
}
@@ -419,13 +420,14 @@ private int Run(string[] args)
optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("popcnt");
optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("lzcnt");
- // If AVX was enabled, we can opportunistically enable FMA/BMI
+ // If AVX was enabled, we can opportunistically enable FMA/BMI/VNNI
Debug.Assert(InstructionSet.X64_AVX == InstructionSet.X86_AVX);
if (supportedInstructionSet.HasInstructionSet(InstructionSet.X64_AVX))
{
optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("fma");
optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("bmi");
optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("bmi2");
+ optimisticInstructionSetSupportBuilder.AddSupportedInstructionSet("avxvnni");
}
}
else if (_targetArchitecture == TargetArchitecture.ARM64)
@@ -460,7 +462,7 @@ private int Run(string[] args)
var targetAbi = TargetAbi.CoreRT;
var targetDetails = new TargetDetails(_targetArchitecture, _targetOS, targetAbi, simdVectorLength);
CompilerTypeSystemContext typeSystemContext =
- new CompilerTypeSystemContext(targetDetails, genericsMode, supportsReflection ? DelegateFeature.All : 0);
+ new CompilerTypeSystemContext(targetDetails, genericsMode, supportsReflection ? DelegateFeature.All : 0, _maxGenericCycle);
//
// TODO: To support our pre-compiled test tree, allow input files that aren't managed assemblies since
@@ -703,7 +705,7 @@ static string ILLinkify(string rootedAssembly)
_trimmedAssemblies);
InteropStateManager interopStateManager = new InteropStateManager(typeSystemContext.GeneratedAssembly);
- InteropStubManager interopStubManager = new UsageBasedInteropStubManager(interopStateManager, pinvokePolicy);
+ InteropStubManager interopStubManager = new UsageBasedInteropStubManager(interopStateManager, pinvokePolicy, logger);
// Unless explicitly opted in at the command line, we enable scanner for retail builds by default.
// We also don't do this for multifile because scanner doesn't simulate inlining (this would be
@@ -730,7 +732,7 @@ static string ILLinkify(string rootedAssembly)
ILScannerBuilder scannerBuilder = builder.GetILScannerBuilder()
.UseCompilationRoots(compilationRoots)
.UseMetadataManager(metadataManager)
- .UseSingleThread(enable: _singleThreaded)
+ .UseParallelism(_parallelism)
.UseInteropStubManager(interopStubManager);
if (_scanDgmlLogFileName != null)
@@ -759,7 +761,7 @@ static string ILLinkify(string rootedAssembly)
.UseInstructionSetSupport(instructionSetSupport)
.UseBackendOptions(_codegenOptions)
.UseMethodBodyFolding(enable: _methodBodyFolding)
- .UseSingleThread(enable: _singleThreaded)
+ .UseParallelism(_parallelism)
.UseMetadataManager(metadataManager)
.UseInteropStubManager(interopStubManager)
.UseLogger(logger)
diff --git a/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj b/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj
index 0194a7f6e43201..c0df3bfd2c6ee3 100644
--- a/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj
+++ b/src/coreclr/tools/aot/ILCompiler/repro/repro.csproj
@@ -9,6 +9,7 @@
linux-x64;win-x64;osx-x64Debug;Release;Checkedtrue
+ falseP/invoke method '{0}' declares a parameter with COM marshalling. Correctness of COM interop cannot be guaranteed after trimming. Interfaces and interface members might be removed.
+
+ P/invoke method '{0}' declares a parameter with an abstract delegate. Correctness of interop for abstract delegates cannot be guaranteed after native compilation: the marshalling code for the delegate might not be available. Use a non-abstract delegate type or ensure any delegate instance passed as parameter is marked with `UnmanagedFunctionPointerAttribute`.
+
diff --git a/src/coreclr/tools/aot/crossgen2.sln b/src/coreclr/tools/aot/crossgen2.sln
index 4727feaef44e4f..ee4d3a0973f014 100644
--- a/src/coreclr/tools/aot/crossgen2.sln
+++ b/src/coreclr/tools/aot/crossgen2.sln
@@ -8,14 +8,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.DependencyAnalys
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.ReadyToRun", "ILCompiler.ReadyToRun\ILCompiler.ReadyToRun.csproj", "{83A832DE-BF4A-44C4-B361-90F5F88B979B}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.TypeSystem.ReadyToRun", "ILCompiler.TypeSystem.ReadyToRun\ILCompiler.TypeSystem.ReadyToRun.csproj", "{751583CD-E880-49E1-B3E2-8B1990114CAC}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.TypeSystem.ReadyToRun.Tests", "ILCompiler.TypeSystem.ReadyToRun.Tests\ILCompiler.TypeSystem.ReadyToRun.Tests.csproj", "{1043373D-8C14-4224-9E2B-75F0DE645E7E}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.Diagnostics", "ILCompiler.Diagnostics\ILCompiler.Diagnostics.csproj", "{3EACD929-4725-4173-A845-734936BBDF87}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.Reflection.ReadyToRun", "ILCompiler.Reflection.ReadyToRun\ILCompiler.Reflection.ReadyToRun.csproj", "{0BB34BA1-1B3A-445C-9C04-0D710D1983F0}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.TypeSystem", "ILCompiler.TypeSystem\ILCompiler.TypeSystem.csproj", "{C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.TypeSystem.Tests", "ILCompiler.TypeSystem.Tests\ILCompiler.TypeSystem.Tests.csproj", "{9E65EC58-B500-4C4A-B57D-BF242129A3C6}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Checked|Any CPU = Checked|Any CPU
@@ -74,39 +74,6 @@ Global
{83A832DE-BF4A-44C4-B361-90F5F88B979B}.Release|x64.Build.0 = Release|x64
{83A832DE-BF4A-44C4-B361-90F5F88B979B}.Release|x86.ActiveCfg = Release|x86
{83A832DE-BF4A-44C4-B361-90F5F88B979B}.Release|x86.Build.0 = Release|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Checked|Any CPU.ActiveCfg = Checked|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Checked|x64.ActiveCfg = Checked|x64
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Checked|x64.Build.0 = Checked|x64
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Checked|x86.ActiveCfg = Checked|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Checked|x86.Build.0 = Checked|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Debug|Any CPU.ActiveCfg = Debug|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Debug|x64.ActiveCfg = Debug|x64
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Debug|x64.Build.0 = Debug|x64
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Debug|x86.ActiveCfg = Debug|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Debug|x86.Build.0 = Debug|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Release|Any CPU.ActiveCfg = Release|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Release|x64.ActiveCfg = Release|x64
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Release|x64.Build.0 = Release|x64
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Release|x86.ActiveCfg = Release|x86
- {751583CD-E880-49E1-B3E2-8B1990114CAC}.Release|x86.Build.0 = Release|x86
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Checked|Any CPU.ActiveCfg = Checked|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Checked|Any CPU.Build.0 = Checked|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Checked|x64.ActiveCfg = Checked|x64
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Checked|x64.Build.0 = Checked|x64
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Checked|x86.ActiveCfg = Checked|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Checked|x86.Build.0 = Checked|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Debug|x64.ActiveCfg = Debug|x64
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Debug|x64.Build.0 = Debug|x64
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Debug|x86.ActiveCfg = Debug|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Debug|x86.Build.0 = Debug|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Release|Any CPU.Build.0 = Release|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Release|x64.ActiveCfg = Release|x64
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Release|x64.Build.0 = Release|x64
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Release|x86.ActiveCfg = Release|Any CPU
- {1043373D-8C14-4224-9E2B-75F0DE645E7E}.Release|x86.Build.0 = Release|Any CPU
{3EACD929-4725-4173-A845-734936BBDF87}.Checked|Any CPU.ActiveCfg = Debug|x86
{3EACD929-4725-4173-A845-734936BBDF87}.Checked|x64.ActiveCfg = Debug|x64
{3EACD929-4725-4173-A845-734936BBDF87}.Checked|x64.Build.0 = Debug|x64
@@ -142,6 +109,42 @@ Global
{0BB34BA1-1B3A-445C-9C04-0D710D1983F0}.Release|x64.Build.0 = Release|x64
{0BB34BA1-1B3A-445C-9C04-0D710D1983F0}.Release|x86.ActiveCfg = Release|Any CPU
{0BB34BA1-1B3A-445C-9C04-0D710D1983F0}.Release|x86.Build.0 = Release|Any CPU
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Checked|Any CPU.ActiveCfg = Checked|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Checked|Any CPU.Build.0 = Checked|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Checked|x64.ActiveCfg = Checked|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Checked|x64.Build.0 = Checked|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Checked|x86.ActiveCfg = Checked|x86
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Checked|x86.Build.0 = Checked|x86
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Debug|Any CPU.ActiveCfg = Debug|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Debug|Any CPU.Build.0 = Debug|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Debug|x64.ActiveCfg = Debug|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Debug|x64.Build.0 = Debug|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Debug|x86.ActiveCfg = Debug|x86
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Debug|x86.Build.0 = Debug|x86
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Release|Any CPU.ActiveCfg = Release|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Release|Any CPU.Build.0 = Release|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Release|x64.ActiveCfg = Release|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Release|x64.Build.0 = Release|x64
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Release|x86.ActiveCfg = Release|x86
+ {C07EE795-01F1-49F5-A4EE-F8235A1F3F7A}.Release|x86.Build.0 = Release|x86
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Checked|Any CPU.ActiveCfg = Checked|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Checked|Any CPU.Build.0 = Checked|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Checked|x64.ActiveCfg = Checked|x64
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Checked|x64.Build.0 = Checked|x64
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Checked|x86.ActiveCfg = Checked|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Checked|x86.Build.0 = Checked|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Debug|x64.ActiveCfg = Debug|x64
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Debug|x64.Build.0 = Debug|x64
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Debug|x86.Build.0 = Debug|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Release|x64.ActiveCfg = Release|x64
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Release|x64.Build.0 = Release|x64
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Release|x86.ActiveCfg = Release|Any CPU
+ {9E65EC58-B500-4C4A-B57D-BF242129A3C6}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/coreclr/tools/aot/crossgen2/Program.cs b/src/coreclr/tools/aot/crossgen2/Program.cs
index d4c693805f5e20..ff538c05fd64c4 100644
--- a/src/coreclr/tools/aot/crossgen2/Program.cs
+++ b/src/coreclr/tools/aot/crossgen2/Program.cs
@@ -736,7 +736,6 @@ private void RunSingleCompilation(Dictionary inFilePaths, Instru
.UsePdbFile(_commandLineOptions.Pdb, _commandLineOptions.PdbPath)
.UsePerfMapFile(_commandLineOptions.PerfMap, _commandLineOptions.PerfMapPath, _commandLineOptions.PerfMapFormatVersion)
.UseProfileFile(jsonProfile != null)
- .UseParallelism(_commandLineOptions.Parallelism)
.UseProfileData(profileDataManager)
.FileLayoutAlgorithms(_methodLayout, _fileLayout)
.UseCompositeImageSettings(compositeImageSettings)
@@ -748,6 +747,7 @@ private void RunSingleCompilation(Dictionary inFilePaths, Instru
.UseILProvider(ilProvider)
.UseBackendOptions(_commandLineOptions.CodegenOptions)
.UseLogger(logger)
+ .UseParallelism(_commandLineOptions.Parallelism)
.UseDependencyTracking(trackingLevel)
.UseCompilationRoots(compilationRoots)
.UseOptimizationMode(optimizationMode);
diff --git a/src/coreclr/tools/aot/crossgen2/crossgen2.props b/src/coreclr/tools/aot/crossgen2/crossgen2.props
index e69b66ceecb3e2..2d6e9dff4072d9 100644
--- a/src/coreclr/tools/aot/crossgen2/crossgen2.props
+++ b/src/coreclr/tools/aot/crossgen2/crossgen2.props
@@ -29,7 +29,7 @@
-
+
diff --git a/src/coreclr/tools/aot/ilc.sln b/src/coreclr/tools/aot/ilc.sln
index be90b9bc202d73..b1c7181908a26d 100644
--- a/src/coreclr/tools/aot/ilc.sln
+++ b/src/coreclr/tools/aot/ilc.sln
@@ -20,6 +20,8 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ILLink.Shared", "ILLink.Sha
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.Compiler.Tests", "ILCompiler.Compiler.Tests\ILCompiler.Compiler.Tests.csproj", "{24CBA9C6-EDBA-47D6-A0B5-04417BDE5FE3}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.TypeSystem.Tests", "ILCompiler.TypeSystem.Tests\ILCompiler.TypeSystem.Tests.csproj", "{740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}"
+EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
ILLink.Shared\ILLink.Shared.projitems*{ff598e93-8e9e-4091-9f50-61a7572663ae}*SharedItemsImports = 13
@@ -160,6 +162,24 @@ Global
{24CBA9C6-EDBA-47D6-A0B5-04417BDE5FE3}.Release|x64.Build.0 = Release|x64
{24CBA9C6-EDBA-47D6-A0B5-04417BDE5FE3}.Release|x86.ActiveCfg = Release|x86
{24CBA9C6-EDBA-47D6-A0B5-04417BDE5FE3}.Release|x86.Build.0 = Release|x86
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Checked|Any CPU.ActiveCfg = Checked|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Checked|Any CPU.Build.0 = Checked|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Checked|x64.ActiveCfg = Checked|x64
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Checked|x64.Build.0 = Checked|x64
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Checked|x86.ActiveCfg = Checked|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Checked|x86.Build.0 = Checked|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Debug|x64.ActiveCfg = Debug|x64
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Debug|x64.Build.0 = Debug|x64
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Debug|x86.Build.0 = Debug|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Release|x64.ActiveCfg = Release|x64
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Release|x64.Build.0 = Release|x64
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Release|x86.ActiveCfg = Release|Any CPU
+ {740CDFF4-B8EC-4A37-951B-C9FE9980EF2A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/coreclr/tools/aot/jitinterface/jitinterface.h b/src/coreclr/tools/aot/jitinterface/jitinterface.h
index f0158199fea1a3..14286588063b23 100644
--- a/src/coreclr/tools/aot/jitinterface/jitinterface.h
+++ b/src/coreclr/tools/aot/jitinterface/jitinterface.h
@@ -159,7 +159,6 @@ struct JitInterfaceCallbacks
InfoAccessType (* constructStringLiteral)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_MODULE_HANDLE module, unsigned int metaTok, void** ppValue);
InfoAccessType (* emptyStringLiteral)(void * thisHandle, CorInfoExceptionClass** ppException, void** ppValue);
uint32_t (* getFieldThreadLocalStoreID)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_FIELD_HANDLE field, void** ppIndirection);
- void (* setOverride)(void * thisHandle, CorInfoExceptionClass** ppException, ICorDynamicInfo* pOverride, CORINFO_METHOD_HANDLE currentMethod);
void (* addActiveDependency)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo);
CORINFO_METHOD_HANDLE (* GetDelegateCtor)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE methHnd, CORINFO_CLASS_HANDLE clsHnd, CORINFO_METHOD_HANDLE targetMethodHnd, DelegateCtorArgs* pCtorData);
void (* MethodCompileComplete)(void * thisHandle, CorInfoExceptionClass** ppException, CORINFO_METHOD_HANDLE methHnd);
@@ -1617,15 +1616,6 @@ class JitInterfaceWrapper : public ICorJitInfo
return temp;
}
- virtual void setOverride(
- ICorDynamicInfo* pOverride,
- CORINFO_METHOD_HANDLE currentMethod)
-{
- CorInfoExceptionClass* pException = nullptr;
- _callbacks->setOverride(_thisHandle, &pException, pOverride, currentMethod);
- if (pException != nullptr) throw pException;
-}
-
virtual void addActiveDependency(
CORINFO_MODULE_HANDLE moduleFrom,
CORINFO_MODULE_HANDLE moduleTo)
diff --git a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj
index c957bcd1b8a9e5..5e27eb6011b4cd 100644
--- a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj
+++ b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.csproj
@@ -56,7 +56,7 @@
-
+
diff --git a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.sln b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.sln
index 3d5a6f3b1ad1d7..45bc67bf401400 100644
--- a/src/coreclr/tools/dotnet-pgo/dotnet-pgo.sln
+++ b/src/coreclr/tools/dotnet-pgo/dotnet-pgo.sln
@@ -1,13 +1,13 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.30114.105
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-pgo", "dotnet-pgo.csproj", "{7DA4CC22-F01D-4505-845F-57C06E5C3F9F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.Reflection.ReadyToRun", "..\aot\ILCompiler.Reflection.ReadyToRun\ILCompiler.Reflection.ReadyToRun.csproj", "{ED3FE303-74EB-43D1-BEA1-14484A14B22E}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.TypeSystem.ReadyToRun", "..\aot\ILCompiler.TypeSystem.ReadyToRun\ILCompiler.TypeSystem.ReadyToRun.csproj", "{D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ILCompiler.TypeSystem", "..\aot\ILCompiler.TypeSystem\ILCompiler.TypeSystem.csproj", "{8A811180-D605-469B-9693-EC3915B3E0DC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -58,21 +58,24 @@ Global
{ED3FE303-74EB-43D1-BEA1-14484A14B22E}.Release|x64.Build.0 = Release|x64
{ED3FE303-74EB-43D1-BEA1-14484A14B22E}.Release|x86.ActiveCfg = Release|Any CPU
{ED3FE303-74EB-43D1-BEA1-14484A14B22E}.Release|x86.Build.0 = Release|Any CPU
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Checked|Any CPU.ActiveCfg = Checked|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Checked|x64.ActiveCfg = Checked|x64
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Checked|x64.Build.0 = Checked|x64
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Checked|x86.ActiveCfg = Checked|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Checked|x86.Build.0 = Checked|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Debug|Any CPU.ActiveCfg = Debug|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Debug|x64.ActiveCfg = Debug|x64
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Debug|x64.Build.0 = Debug|x64
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Debug|x86.ActiveCfg = Debug|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Debug|x86.Build.0 = Debug|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Release|Any CPU.ActiveCfg = Release|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Release|x64.ActiveCfg = Release|x64
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Release|x64.Build.0 = Release|x64
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Release|x86.ActiveCfg = Release|x86
- {D6BA6C4F-F7DF-4414-94BE-8E124CDDDEE6}.Release|x86.Build.0 = Release|x86
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Checked|Any CPU.ActiveCfg = Checked|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Checked|Any CPU.Build.0 = Checked|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Checked|x64.ActiveCfg = Checked|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Checked|x64.Build.0 = Checked|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Checked|x86.ActiveCfg = Checked|x86
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Checked|x86.Build.0 = Checked|x86
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Debug|Any CPU.ActiveCfg = Debug|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Debug|Any CPU.Build.0 = Debug|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Debug|x64.ActiveCfg = Debug|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Debug|x64.Build.0 = Debug|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Debug|x86.ActiveCfg = Debug|x86
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Debug|x86.Build.0 = Debug|x86
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Release|Any CPU.ActiveCfg = Release|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Release|Any CPU.Build.0 = Release|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Release|x64.ActiveCfg = Release|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Release|x64.Build.0 = Release|x64
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Release|x86.ActiveCfg = Release|x86
+ {8A811180-D605-469B-9693-EC3915B3E0DC}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/coreclr/tools/metainfo/mdinfo.cpp b/src/coreclr/tools/metainfo/mdinfo.cpp
index 24c782b4076d9e..8351b8de24bf1b 100644
--- a/src/coreclr/tools/metainfo/mdinfo.cpp
+++ b/src/coreclr/tools/metainfo/mdinfo.cpp
@@ -204,7 +204,7 @@ void MDInfo::InitSigBuffer()
// helper to append a string into the signature buffer. If size of signature buffer is not big enough,
// we will grow it.
-HRESULT MDInfo::AddToSigBuffer(__in_z __in const char *string)
+HRESULT MDInfo::AddToSigBuffer(_In_z_ const char *string)
{
HRESULT hr;
size_t LL = strlen((LPSTR)m_sigBuf.Ptr()) + strlen(string) + 1;
@@ -368,7 +368,7 @@ void MDInfo::DisplayMD()
WriteLine("===========================================================");
} // MDVEHandlerClass()
-int MDInfo::WriteLine(__in_z __in const char *str)
+int MDInfo::WriteLine(_In_z_ const char *str)
{
ULONG32 count = (ULONG32) strlen(str);
@@ -377,7 +377,7 @@ int MDInfo::WriteLine(__in_z __in const char *str)
return count;
} // int MDInfo::WriteLine()
-int MDInfo::Write(__in_z __in const char *str)
+int MDInfo::Write(_In_z_ const char *str)
{
ULONG32 count = (ULONG32) strlen(str);
@@ -385,7 +385,7 @@ int MDInfo::Write(__in_z __in const char *str)
return count;
} // int MDInfo::Write()
-int MDInfo::VWriteLine(__in_z __in const char *str, ...)
+int MDInfo::VWriteLine(_In_z_ const char *str, ...)
{
va_list marker;
int count;
@@ -397,7 +397,7 @@ int MDInfo::VWriteLine(__in_z __in const char *str, ...)
return count;
} // int MDInfo::VWriteLine()
-int MDInfo::VWrite(__in_z __in const char *str, ...)
+int MDInfo::VWrite(_In_z_ const char *str, ...)
{
va_list marker;
int count;
@@ -408,7 +408,7 @@ int MDInfo::VWrite(__in_z __in const char *str, ...)
return count;
} // int MDInfo::VWrite()
-int MDInfo::VWriteMarker(__in_z __in const char *str, va_list marker)
+int MDInfo::VWriteMarker(_In_z_ const char *str, va_list marker)
{
HRESULT hr;
int count = -1;
@@ -561,7 +561,7 @@ const char *MDInfo::TokenTypeName(mdToken inToken)
// Prints out name of the given memberref
//
-LPCWSTR MDInfo::MemberRefName(mdMemberRef inMemRef, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen)
+LPCWSTR MDInfo::MemberRefName(mdMemberRef inMemRef, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen)
{
HRESULT hr;
@@ -829,7 +829,7 @@ void MDInfo::DisplaySignatureInfo(mdSignature inSignature)
// member in wide characters
//
-LPCWSTR MDInfo::MemberName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen)
+LPCWSTR MDInfo::MemberName(mdToken inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen)
{
HRESULT hr;
@@ -1312,7 +1312,7 @@ void MDInfo::DisplayGenericParamInfo(mdGenericParam tkParam, const char *prefix)
DisplayCustomAttributes(tkParam, newprefix);
}
-LPCWSTR MDInfo::TokenName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen)
+LPCWSTR MDInfo::TokenName(mdToken inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen)
{
LPCUTF8 pName; // Token name in UTF8.
@@ -1329,7 +1329,7 @@ LPCWSTR MDInfo::TokenName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, U
// prints out name of typeref or typedef
//
-LPCWSTR MDInfo::TypeDeforRefName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen)
+LPCWSTR MDInfo::TypeDeforRefName(mdToken inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen)
{
if (RidFromToken(inToken))
{
@@ -1346,7 +1346,7 @@ LPCWSTR MDInfo::TypeDeforRefName(mdToken inToken, __out_ecount(bufLen) LPWSTR bu
return W("");
} // LPCWSTR MDInfo::TypeDeforRefName()
-LPCWSTR MDInfo::MemberDeforRefName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen)
+LPCWSTR MDInfo::MemberDeforRefName(mdToken inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen)
{
if (RidFromToken(inToken))
{
@@ -1365,7 +1365,7 @@ LPCWSTR MDInfo::MemberDeforRefName(mdToken inToken, __out_ecount(bufLen) LPWSTR
//
//
-LPCWSTR MDInfo::TypeDefName(mdTypeDef inTypeDef, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen)
+LPCWSTR MDInfo::TypeDefName(mdTypeDef inTypeDef, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen)
{
HRESULT hr;
@@ -1439,7 +1439,7 @@ void MDInfo::DisplayTypeDefProps(mdTypeDef inTypeDef)
// Prints out the name of the given TypeRef
//
-LPCWSTR MDInfo::TypeRefName(mdTypeRef tr, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen)
+LPCWSTR MDInfo::TypeRefName(mdTypeRef tr, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen)
{
HRESULT hr;
@@ -1543,7 +1543,7 @@ void MDInfo::DisplayMethodSpecInfo(mdMethodSpec ms, const char *preFix)
// associated with the class.
//
-char *MDInfo::ClassFlags(DWORD flags, __out_ecount(STRING_BUFFER_LEN) char *sFlags)
+char *MDInfo::ClassFlags(DWORD flags, _Out_writes_(STRING_BUFFER_LEN) char *sFlags)
{
sFlags[0] = 0;
ISFLAG(Td, NotPublic);
@@ -2169,7 +2169,7 @@ void MDInfo::DisplayPermissionInfo(mdPermission inPermission, const char *preFix
// simply prints out the given GUID in standard form
-LPWSTR MDInfo::GUIDAsString(GUID inGuid, __out_ecount(bufLen) LPWSTR guidString, ULONG bufLen)
+LPWSTR MDInfo::GUIDAsString(GUID inGuid, _Out_writes_(bufLen) LPWSTR guidString, ULONG bufLen)
{
StringFromGUID2(inGuid, guidString, bufLen);
return guidString;
diff --git a/src/coreclr/tools/metainfo/mdinfo.h b/src/coreclr/tools/metainfo/mdinfo.h
index 04002fdb267ffb..ff60b31ae3c492 100644
--- a/src/coreclr/tools/metainfo/mdinfo.h
+++ b/src/coreclr/tools/metainfo/mdinfo.h
@@ -67,20 +67,20 @@ class MDInfo {
void DisplaySignatures(void);
void DisplaySignatureInfo(mdSignature inSignature);
- LPCWSTR TokenName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR TokenName(mdToken inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR TypeDeforRefName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR TypeDefName(mdTypeDef inTypeDef, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR TypeRefName(mdTypeRef tr, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR TypeDeforRefName(mdToken inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR TypeDefName(mdTypeDef inTypeDef, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR TypeRefName(mdTypeRef tr, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR MemberDeforRefName(mdToken inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR MemberRefName(mdToken inMemRef, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR MemberName(mdToken inMember, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR MemberDeforRefName(mdToken inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR MemberRefName(mdToken inMemRef, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR MemberName(mdToken inMember, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR MethodName(mdMethodDef inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
- LPCWSTR FieldName(mdFieldDef inToken, __out_ecount(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR MethodName(mdMethodDef inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
+ LPCWSTR FieldName(mdFieldDef inToken, _Out_writes_(bufLen) LPWSTR buffer, ULONG bufLen);
- char *ClassFlags(DWORD flags, __out_ecount(STRING_BUFFER_LEN) char *sFlags);
+ char *ClassFlags(DWORD flags, _Out_writes_(STRING_BUFFER_LEN) char *sFlags);
void DisplayTypeRefs(void);
void DisplayTypeRefInfo(mdTypeRef tr);
@@ -96,7 +96,7 @@ class MDInfo {
void DisplayInterfaceImpls(mdTypeDef inTypeDef);
void DisplayInterfaceImplInfo(mdInterfaceImpl inImpl);
- LPWSTR GUIDAsString(GUID inGuid, __out_ecount(bufLen) LPWSTR guidString, ULONG bufLen);
+ LPWSTR GUIDAsString(GUID inGuid, _Out_writes_(bufLen) LPWSTR guidString, ULONG bufLen);
const char *TokenTypeName(mdToken inToken);
@@ -170,15 +170,15 @@ class MDInfo {
int DumpHex(const char *szPrefix, const void *pvData, ULONG cbData, int bText=true, ULONG nLine=16);
- int Write(__in_z __in const char *str);
- int WriteLine(__in_z __in const char *str);
+ int Write(_In_z_ const char *str);
+ int WriteLine(_In_z_ const char *str);
- int VWrite(__in_z __in const char *str, ...);
- int VWriteLine(__in_z __in const char *str, ...);
- int VWriteMarker(__in_z __in const char *str, va_list marker);
+ int VWrite(_In_z_ const char *str, ...);
+ int VWriteLine(_In_z_ const char *str, ...);
+ int VWriteMarker(_In_z_ const char *str, va_list marker);
void InitSigBuffer();
- HRESULT AddToSigBuffer(__in_z __in const char *string);
+ HRESULT AddToSigBuffer(_In_z_ const char *string);
IMetaDataImport2 *m_pRegImport;
IMetaDataImport2 *m_pImport;
diff --git a/src/coreclr/tools/metainfo/mdobj.cpp b/src/coreclr/tools/metainfo/mdobj.cpp
index c8851a85228fd7..5bb4689410bb04 100644
--- a/src/coreclr/tools/metainfo/mdobj.cpp
+++ b/src/coreclr/tools/metainfo/mdobj.cpp
@@ -57,7 +57,7 @@ static HRESULT FindObjMetaData(PVOID pImage, PVOID *ppMetaData, long *pcbMetaDat
// This function returns the address to the MapView of file and file size.
-void GetMapViewOfFile(__in WCHAR *szFile, PBYTE *ppbMap, DWORD *pdwFileSize)
+void GetMapViewOfFile(_In_ WCHAR *szFile, PBYTE *ppbMap, DWORD *pdwFileSize)
{
HANDLE hMapFile;
DWORD dwHighSize;
@@ -161,7 +161,7 @@ char *GetNameOfObj(PBYTE pbLongNames, PIMAGE_ARCHIVE_MEMBER_HEADER pMemHdr, char
//
// Opens the .LIB file, and displays the metadata in the specified object files.
-void DisplayArchive(__in_z __in WCHAR* szFile, ULONG DumpFilter, __in_z __in_opt WCHAR* szObjName, strPassBackFn pDisplayString)
+void DisplayArchive(_In_z_ WCHAR* szFile, ULONG DumpFilter, _In_opt_z_ WCHAR* szObjName, strPassBackFn pDisplayString)
{
PBYTE pbMapAddress;
PBYTE pbStartAddress;
@@ -249,7 +249,7 @@ void DisplayArchive(__in_z __in WCHAR* szFile, ULONG DumpFilter, __in_z __in_opt
// Opens the meta data content of a .EXE, .CLB, .CLASS, .TLB, .DLL or .LIB file, and
// calls RawDisplay()
-void DisplayFile(__in_z __in WCHAR* szFile, BOOL isFile, ULONG DumpFilter, __in_z __in_opt WCHAR* szObjName, strPassBackFn pDisplayString)
+void DisplayFile(_In_z_ WCHAR* szFile, BOOL isFile, ULONG DumpFilter, _In_opt_z_ WCHAR* szObjName, strPassBackFn pDisplayString)
{
// Open the emit scope
diff --git a/src/coreclr/tools/r2rdump/CoreDisTools.cs b/src/coreclr/tools/r2rdump/CoreDisTools.cs
index 75029e04a163c9..8c917662014141 100644
--- a/src/coreclr/tools/r2rdump/CoreDisTools.cs
+++ b/src/coreclr/tools/r2rdump/CoreDisTools.cs
@@ -396,17 +396,17 @@ private void ProbeX64Quirks(RuntimeFunction rtf, int imageOffset, int rtfOffset,
{
if (targetName != null)
{
- translated.AppendFormat("[{0}]", targetName);
+ translated.Append($"[{targetName}]");
}
else
{
- translated.AppendFormat("[0x{0:x4}]", target);
+ translated.Append($"[0x{target:x4}]");
}
translated.Append(instruction, rightBracketPlusOne, instruction.Length - rightBracketPlusOne);
}
else
{
- translated.AppendFormat("[0x{0:x4}]", target);
+ translated.Append($"[0x{target:x4}]");
translated.Append(instruction, rightBracketPlusOne, instruction.Length - rightBracketPlusOne);
if (targetName != null)
{
@@ -449,17 +449,17 @@ private void ProbeX86Quirks(RuntimeFunction rtf, int imageOffset, int rtfOffset,
{
if (targetName != null)
{
- translated.AppendFormat("[{0}]", targetName);
+ translated.Append($"[{targetName}]");
}
else
{
- translated.AppendFormat("[0x{0:x4}]", target);
+ translated.Append($"[0x{target:x4}]");
}
translated.Append(instruction, rightBracketPlusOne, instruction.Length - rightBracketPlusOne);
}
else
{
- translated.AppendFormat("[0x{0:x4}]", target);
+ translated.Append($"[0x{target:x4}]");
translated.Append(instruction, rightBracketPlusOne, instruction.Length - rightBracketPlusOne);
if (targetName != null)
{
@@ -818,7 +818,7 @@ private void ProbeArm64Quirks(RuntimeFunction rtf, int imageOffset, int rtfOffse
}
else
{
- translated.AppendFormat("#0x{0:x4}", targetPage);
+ translated.Append($"#0x{targetPage:x4}");
}
instruction = translated.ToString();
@@ -843,7 +843,7 @@ private void ProbeArm64Quirks(RuntimeFunction rtf, int imageOffset, int rtfOffse
}
else
{
- translated.AppendFormat("#0x{0:x}", target & 0xfff);
+ translated.Append($"#0x{target & 0xfff:x}");
if (targetName != null)
{
AppendComment(translated, "import{" + targetName + "}");
diff --git a/src/coreclr/tools/r2rdump/R2RDiff.cs b/src/coreclr/tools/r2rdump/R2RDiff.cs
index 91962d3ee929af..9bea8d860f202d 100644
--- a/src/coreclr/tools/r2rdump/R2RDiff.cs
+++ b/src/coreclr/tools/r2rdump/R2RDiff.cs
@@ -281,7 +281,7 @@ private void ShowDiff(Dictionary leftObjects, Dictionary leftObjects, Dictionary leftObjects, Dictionarycr->AddCall("GetErrorMessage");
return original_ICorJitInfo->GetErrorMessage(buffer, bufferLength);
@@ -1367,7 +1367,7 @@ unsigned interceptor_ICJI::getMethodHash(CORINFO_METHOD_HANDLE ftn /* IN */
// this function is for debugging only.
size_t interceptor_ICJI::findNameOfToken(CORINFO_MODULE_HANDLE module, /* IN */
mdToken metaTOK, /* IN */
- __out_ecount(FQNameCapacity) char* szFQName, /* OUT */
+ _Out_writes_(FQNameCapacity) char* szFQName, /* OUT */
size_t FQNameCapacity /* IN */
)
{
@@ -1716,13 +1716,6 @@ uint32_t interceptor_ICJI::getFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field
return temp;
}
-// Sets another object to intercept calls to "self" and current method being compiled
-void interceptor_ICJI::setOverride(ICorDynamicInfo* pOverride, CORINFO_METHOD_HANDLE currentMethod)
-{
- mc->cr->AddCall("setOverride");
- original_ICorJitInfo->setOverride(pOverride, currentMethod);
-}
-
// Adds an active dependency from the context method's module to the given module
// This is internal callback for the EE. JIT should not call it directly.
void interceptor_ICJI::addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo)
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.h b/src/coreclr/tools/superpmi/superpmi-shim-collector/icorjitinfo.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.h
rename to src/coreclr/tools/superpmi/superpmi-shim-collector/icorjitinfo.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/jithost.cpp b/src/coreclr/tools/superpmi/superpmi-shim-collector/jithost.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-collector/jithost.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-collector/jithost.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/jithost.h b/src/coreclr/tools/superpmi/superpmi-shim-collector/jithost.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-collector/jithost.h
rename to src/coreclr/tools/superpmi/superpmi-shim-collector/jithost.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp b/src/coreclr/tools/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-collector/superpmi-shim-collector.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.def b/src/coreclr/tools/superpmi/superpmi-shim-collector/superpmi-shim-collector.def
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.def
rename to src/coreclr/tools/superpmi/superpmi-shim-collector/superpmi-shim-collector.def
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.h b/src/coreclr/tools/superpmi/superpmi-shim-collector/superpmi-shim-collector.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-collector/superpmi-shim-collector.h
rename to src/coreclr/tools/superpmi/superpmi-shim-collector/superpmi-shim-collector.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt b/src/coreclr/tools/superpmi/superpmi-shim-counter/CMakeLists.txt
similarity index 96%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/CMakeLists.txt
index 602a6751b02da9..403841d95c8edb 100644
--- a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt
+++ b/src/coreclr/tools/superpmi/superpmi-shim-counter/CMakeLists.txt
@@ -63,4 +63,4 @@ else()
)
endif(CLR_CMAKE_HOST_UNIX)
-install_clr(TARGETS superpmi-shim-counter DESTINATIONS .)
+install_clr(TARGETS superpmi-shim-counter DESTINATIONS . COMPONENT spmi)
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.cpp b/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitcompiler.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitcompiler.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.h b/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitcompiler.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitcompiler.h
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitcompiler.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp b/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo.cpp
similarity index 99%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo.cpp
index 88e0e03e42d989..657575cce71fe3 100644
--- a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
+++ b/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo.cpp
@@ -1184,14 +1184,6 @@ uint32_t interceptor_ICJI::getFieldThreadLocalStoreID(
return original_ICorJitInfo->getFieldThreadLocalStoreID(field, ppIndirection);
}
-void interceptor_ICJI::setOverride(
- ICorDynamicInfo* pOverride,
- CORINFO_METHOD_HANDLE currentMethod)
-{
- mcs->AddCall("setOverride");
- original_ICorJitInfo->setOverride(pOverride, currentMethod);
-}
-
void interceptor_ICJI::addActiveDependency(
CORINFO_MODULE_HANDLE moduleFrom,
CORINFO_MODULE_HANDLE moduleTo)
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.h b/src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.h
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/icorjitinfo.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/jithost.cpp b/src/coreclr/tools/superpmi/superpmi-shim-counter/jithost.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/jithost.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/jithost.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/jithost.h b/src/coreclr/tools/superpmi/superpmi-shim-counter/jithost.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/jithost.h
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/jithost.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp b/src/coreclr/tools/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/methodcallsummarizer.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.h b/src/coreclr/tools/superpmi/superpmi-shim-counter/methodcallsummarizer.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/methodcallsummarizer.h
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/methodcallsummarizer.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp b/src/coreclr/tools/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/superpmi-shim-counter.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.def b/src/coreclr/tools/superpmi/superpmi-shim-counter/superpmi-shim-counter.def
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.def
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/superpmi-shim-counter.def
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.h b/src/coreclr/tools/superpmi/superpmi-shim-counter/superpmi-shim-counter.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-counter/superpmi-shim-counter.h
rename to src/coreclr/tools/superpmi/superpmi-shim-counter/superpmi-shim-counter.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt b/src/coreclr/tools/superpmi/superpmi-shim-simple/CMakeLists.txt
similarity index 96%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/CMakeLists.txt
index b6f4d52ea4cab0..e1c168ef9d9dd9 100644
--- a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt
+++ b/src/coreclr/tools/superpmi/superpmi-shim-simple/CMakeLists.txt
@@ -62,4 +62,4 @@ else()
)
endif(CLR_CMAKE_HOST_UNIX)
-install_clr(TARGETS superpmi-shim-simple DESTINATIONS .)
+install_clr(TARGETS superpmi-shim-simple DESTINATIONS . COMPONENT spmi)
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.cpp b/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitcompiler.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitcompiler.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.h b/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitcompiler.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitcompiler.h
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitcompiler.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp b/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo.cpp
similarity index 99%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo.cpp
index 16926858871788..294750ccde5c1a 100644
--- a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
+++ b/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo.cpp
@@ -1036,13 +1036,6 @@ uint32_t interceptor_ICJI::getFieldThreadLocalStoreID(
return original_ICorJitInfo->getFieldThreadLocalStoreID(field, ppIndirection);
}
-void interceptor_ICJI::setOverride(
- ICorDynamicInfo* pOverride,
- CORINFO_METHOD_HANDLE currentMethod)
-{
- original_ICorJitInfo->setOverride(pOverride, currentMethod);
-}
-
void interceptor_ICJI::addActiveDependency(
CORINFO_MODULE_HANDLE moduleFrom,
CORINFO_MODULE_HANDLE moduleTo)
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.h b/src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.h
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/icorjitinfo.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/jithost.cpp b/src/coreclr/tools/superpmi/superpmi-shim-simple/jithost.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/jithost.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/jithost.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/jithost.h b/src/coreclr/tools/superpmi/superpmi-shim-simple/jithost.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/jithost.h
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/jithost.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp b/src/coreclr/tools/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/superpmi-shim-simple.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.def b/src/coreclr/tools/superpmi/superpmi-shim-simple/superpmi-shim-simple.def
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.def
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/superpmi-shim-simple.def
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.h b/src/coreclr/tools/superpmi/superpmi-shim-simple/superpmi-shim-simple.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi-shim-simple/superpmi-shim-simple.h
rename to src/coreclr/tools/superpmi/superpmi-shim-simple/superpmi-shim-simple.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/CMakeLists.txt b/src/coreclr/tools/superpmi/superpmi/CMakeLists.txt
similarity index 96%
rename from src/coreclr/ToolBox/superpmi/superpmi/CMakeLists.txt
rename to src/coreclr/tools/superpmi/superpmi/CMakeLists.txt
index 4827c195dc2997..63237450898e3b 100644
--- a/src/coreclr/ToolBox/superpmi/superpmi/CMakeLists.txt
+++ b/src/coreclr/tools/superpmi/superpmi/CMakeLists.txt
@@ -64,4 +64,4 @@ else()
)
endif(CLR_CMAKE_HOST_UNIX)
-install_clr(TARGETS superpmi DESTINATIONS .)
+install_clr(TARGETS superpmi DESTINATIONS . COMPONENT spmi)
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/commandline.cpp b/src/coreclr/tools/superpmi/superpmi/commandline.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/commandline.cpp
rename to src/coreclr/tools/superpmi/superpmi/commandline.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/commandline.h b/src/coreclr/tools/superpmi/superpmi/commandline.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/commandline.h
rename to src/coreclr/tools/superpmi/superpmi/commandline.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/cycletimer.cpp b/src/coreclr/tools/superpmi/superpmi/cycletimer.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/cycletimer.cpp
rename to src/coreclr/tools/superpmi/superpmi/cycletimer.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/cycletimer.h b/src/coreclr/tools/superpmi/superpmi/cycletimer.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/cycletimer.h
rename to src/coreclr/tools/superpmi/superpmi/cycletimer.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp b/src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp
similarity index 99%
rename from src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp
rename to src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp
index 3ff21d07fb59f0..16c66a6a398476 100644
--- a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp
+++ b/src/coreclr/tools/superpmi/superpmi/icorjitinfo.cpp
@@ -426,7 +426,7 @@ CORINFO_CLASS_HANDLE MyICJI::getTypeInstantiationArgument(CORINFO_CLASS_HANDLE c
// If fFullInst=TRUE (regardless of fNamespace and fAssembly), include namespace and assembly for any type parameters
// If fAssembly=TRUE, suffix with a comma and the full assembly qualification
// return size of representation
-int MyICJI::appendClassName(__deref_inout_ecount(*pnBufLen) char16_t** ppBuf,
+int MyICJI::appendClassName(_Outptr_result_buffer_(*pnBufLen) char16_t** ppBuf,
int* pnBufLen,
CORINFO_CLASS_HANDLE cls,
bool fNamespace,
@@ -1099,7 +1099,7 @@ HRESULT MyICJI::GetErrorHRESULT(struct _EXCEPTION_POINTERS* pExceptionPointers)
// Fetches the message of the current exception
// Returns the size of the message (including terminating null). This can be
// greater than bufferLength if the buffer is insufficient.
-uint32_t MyICJI::GetErrorMessage(__inout_ecount(bufferLength) char16_t* buffer, uint32_t bufferLength)
+uint32_t MyICJI::GetErrorMessage(_Inout_updates_(bufferLength) char16_t* buffer, uint32_t bufferLength)
{
jitInstance->mc->cr->AddCall("GetErrorMessage");
LogError("Hit unimplemented GetErrorMessage");
@@ -1214,7 +1214,7 @@ unsigned MyICJI::getMethodHash(CORINFO_METHOD_HANDLE ftn /* IN */
// this function is for debugging only.
size_t MyICJI::findNameOfToken(CORINFO_MODULE_HANDLE module, /* IN */
mdToken metaTOK, /* IN */
- __out_ecount(FQNameCapacity) char* szFQName, /* OUT */
+ _Out_writes_(FQNameCapacity) char* szFQName, /* OUT */
size_t FQNameCapacity /* IN */
)
{
@@ -1490,14 +1490,6 @@ uint32_t MyICJI::getFieldThreadLocalStoreID(CORINFO_FIELD_HANDLE field, void** p
return jitInstance->mc->repGetFieldThreadLocalStoreID(field, ppIndirection);
}
-// Sets another object to intercept calls to "self" and current method being compiled
-void MyICJI::setOverride(ICorDynamicInfo* pOverride, CORINFO_METHOD_HANDLE currentMethod)
-{
- jitInstance->mc->cr->AddCall("setOverride");
- LogError("Hit unimplemented setOverride");
- DebugBreakorAV(115);
-}
-
// Adds an active dependency from the context method's module to the given module
// This is internal callback for the EE. JIT should not call it directly.
void MyICJI::addActiveDependency(CORINFO_MODULE_HANDLE moduleFrom, CORINFO_MODULE_HANDLE moduleTo)
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.h b/src/coreclr/tools/superpmi/superpmi/icorjitinfo.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.h
rename to src/coreclr/tools/superpmi/superpmi/icorjitinfo.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/jitdebugger.cpp b/src/coreclr/tools/superpmi/superpmi/jitdebugger.cpp
similarity index 98%
rename from src/coreclr/ToolBox/superpmi/superpmi/jitdebugger.cpp
rename to src/coreclr/tools/superpmi/superpmi/jitdebugger.cpp
index 169d0a268483b7..242771fe796c85 100644
--- a/src/coreclr/ToolBox/superpmi/superpmi/jitdebugger.cpp
+++ b/src/coreclr/tools/superpmi/superpmi/jitdebugger.cpp
@@ -134,7 +134,7 @@ BOOL GetRegistryLongValue(HKEY hKeyParent, LPCWSTR szKey, LPCWSTR szName, long*
// Note:
//
//----------------------------------------------------------------------------
-HRESULT GetCurrentModuleFileName(__out_ecount(*pcchBuffer) LPWSTR pBuffer, __inout DWORD* pcchBuffer)
+HRESULT GetCurrentModuleFileName(_Out_writes_(*pcchBuffer) LPWSTR pBuffer, __inout DWORD* pcchBuffer)
{
LIMITED_METHOD_CONTRACT;
@@ -252,7 +252,7 @@ void GetDebuggerSettingInfo(LPWSTR wszDebuggerString, DWORD cchDebuggerString, B
// * wszDebuggerString can be NULL. When wszDebuggerString is NULL, pcchDebuggerString should
// * point to a DWORD of zero. pcchDebuggerString cannot be NULL, and the DWORD pointed by
// * pcchDebuggerString will store the used or required string buffer size in characters.
-HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString, *pcchDebuggerString)
+HRESULT GetDebuggerSettingInfoWorker(_Out_writes_to_opt_(*pcchDebuggerString, *pcchDebuggerString)
LPWSTR wszDebuggerString,
DWORD* pcchDebuggerString,
BOOL* pfAuto)
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/jitdebugger.h b/src/coreclr/tools/superpmi/superpmi/jitdebugger.h
similarity index 87%
rename from src/coreclr/ToolBox/superpmi/superpmi/jitdebugger.h
rename to src/coreclr/tools/superpmi/superpmi/jitdebugger.h
index f941151b2e5493..a7f1eec42765de 100644
--- a/src/coreclr/ToolBox/superpmi/superpmi/jitdebugger.h
+++ b/src/coreclr/tools/superpmi/superpmi/jitdebugger.h
@@ -14,14 +14,14 @@ BOOL GetRegistryLongValue(HKEY hKeyParent, // Parent key.
long* pValue, // Put value here, if found.
BOOL fReadNonVirtualizedKey); // Whether to read 64-bit hive on WOW64
-HRESULT GetCurrentModuleFileName(__out_ecount(*pcchBuffer) LPWSTR pBuffer, __inout DWORD* pcchBuffer);
+HRESULT GetCurrentModuleFileName(_Out_writes_(*pcchBuffer) LPWSTR pBuffer, __inout DWORD* pcchBuffer);
#ifndef _WIN64
BOOL RunningInWow64();
#endif
BOOL IsCurrentModuleFileNameInAutoExclusionList();
-HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString, *pcchDebuggerString)
+HRESULT GetDebuggerSettingInfoWorker(_Out_writes_to_opt_(*pcchDebuggerString, *pcchDebuggerString)
LPWSTR wszDebuggerString,
DWORD* pcchDebuggerString,
BOOL* pfAuto);
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/jithost.cpp b/src/coreclr/tools/superpmi/superpmi/jithost.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/jithost.cpp
rename to src/coreclr/tools/superpmi/superpmi/jithost.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/jithost.h b/src/coreclr/tools/superpmi/superpmi/jithost.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/jithost.h
rename to src/coreclr/tools/superpmi/superpmi/jithost.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/jitinstance.cpp b/src/coreclr/tools/superpmi/superpmi/jitinstance.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/jitinstance.cpp
rename to src/coreclr/tools/superpmi/superpmi/jitinstance.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/jitinstance.h b/src/coreclr/tools/superpmi/superpmi/jitinstance.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/jitinstance.h
rename to src/coreclr/tools/superpmi/superpmi/jitinstance.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/methodstatsemitter.cpp b/src/coreclr/tools/superpmi/superpmi/methodstatsemitter.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/methodstatsemitter.cpp
rename to src/coreclr/tools/superpmi/superpmi/methodstatsemitter.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/methodstatsemitter.h b/src/coreclr/tools/superpmi/superpmi/methodstatsemitter.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/methodstatsemitter.h
rename to src/coreclr/tools/superpmi/superpmi/methodstatsemitter.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/metricssummary.cpp b/src/coreclr/tools/superpmi/superpmi/metricssummary.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/metricssummary.cpp
rename to src/coreclr/tools/superpmi/superpmi/metricssummary.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/metricssummary.h b/src/coreclr/tools/superpmi/superpmi/metricssummary.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/metricssummary.h
rename to src/coreclr/tools/superpmi/superpmi/metricssummary.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/neardiffer.cpp b/src/coreclr/tools/superpmi/superpmi/neardiffer.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/neardiffer.cpp
rename to src/coreclr/tools/superpmi/superpmi/neardiffer.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/neardiffer.h b/src/coreclr/tools/superpmi/superpmi/neardiffer.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/neardiffer.h
rename to src/coreclr/tools/superpmi/superpmi/neardiffer.h
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp b/src/coreclr/tools/superpmi/superpmi/parallelsuperpmi.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp
rename to src/coreclr/tools/superpmi/superpmi/parallelsuperpmi.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/superpmi.cpp b/src/coreclr/tools/superpmi/superpmi/superpmi.cpp
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/superpmi.cpp
rename to src/coreclr/tools/superpmi/superpmi/superpmi.cpp
diff --git a/src/coreclr/ToolBox/superpmi/superpmi/superpmi.h b/src/coreclr/tools/superpmi/superpmi/superpmi.h
similarity index 100%
rename from src/coreclr/ToolBox/superpmi/superpmi/superpmi.h
rename to src/coreclr/tools/superpmi/superpmi/superpmi.h
diff --git a/src/coreclr/tools/util/consoleargs.cpp b/src/coreclr/tools/util/consoleargs.cpp
index 510d86c966a788..6fba56ad69c2d8 100644
--- a/src/coreclr/tools/util/consoleargs.cpp
+++ b/src/coreclr/tools/util/consoleargs.cpp
@@ -335,7 +335,7 @@ void ConsoleArgs::CleanUpArgs()
}
}
-bool ConsoleArgs::GetFullFileName(LPCWSTR szSource, __out_ecount(cchFilenameBuffer) LPWSTR filenameBuffer, DWORD cchFilenameBuffer, bool fOutputFilename)
+bool ConsoleArgs::GetFullFileName(LPCWSTR szSource, _Out_writes_(cchFilenameBuffer) LPWSTR filenameBuffer, DWORD cchFilenameBuffer, bool fOutputFilename)
{
#ifdef TARGET_UNIX
WCHAR tempBuffer[MAX_LONGPATH];
@@ -365,7 +365,7 @@ bool ConsoleArgs::GetFullFileName(LPCWSTR szSource, __out_ecount(cchFilenameBuff
// Clear previous error message if any and set the new one by copying into m_lastErrorMessage.
// We are responsible for freeing the memory destruction.
//
-void ConsoleArgs::SetErrorMessage(__in LPCWSTR pwzMessage)
+void ConsoleArgs::SetErrorMessage(_In_ LPCWSTR pwzMessage)
{
if (m_lastErrorMessage != nullptr)
{
@@ -680,7 +680,7 @@ void ConsoleArgs::TextToArgs(LPCWSTR szText, WStrList ** listReplace)
// We expand any response files that may be contained in the args and return a new
// set of args, pargc2 and pppargv2 that contain the full flat command line.
//
-bool ConsoleArgs::ExpandResponseFiles(__in int argc, __deref_in_ecount(argc) const LPCWSTR * argv, int * pargc2, __deref_out_ecount(*pargc2) LPWSTR ** pppargv2)
+bool ConsoleArgs::ExpandResponseFiles(_In_ int argc, _In_reads_(argc) const LPCWSTR * argv, int * pargc2, _Outptr_result_buffer_(*pargc2) LPWSTR ** pppargv2)
{
*pargc2 = 0;
*pppargv2 = NULL;
@@ -751,7 +751,7 @@ bool ConsoleArgs::ExpandResponseFiles(__in int argc, __deref_in_ecount(argc) con
// Read file to end, converting to unicode
// ppwzTextBuffer is allocated. Caller is responsible for freeing
//
-bool ConsoleArgs::ReadTextFile(LPCWSTR pwzFilename, __deref_out LPWSTR *ppwzTextBuffer)
+bool ConsoleArgs::ReadTextFile(LPCWSTR pwzFilename, _Outptr_ LPWSTR *ppwzTextBuffer)
{
bool success = false;
char *bufA = nullptr;
diff --git a/src/coreclr/tools/util/consoleargs.h b/src/coreclr/tools/util/consoleargs.h
index 10cc1e40b3612f..f82291d61e9d31 100644
--- a/src/coreclr/tools/util/consoleargs.h
+++ b/src/coreclr/tools/util/consoleargs.h
@@ -19,7 +19,7 @@ class ConsoleArgs
{
public:
// Place the fully-qualified filename in the given output buffer
- bool GetFullFileName(LPCWSTR szSource, __out_ecount(cbFilenameBuffer) LPWSTR filenameBuffer, DWORD cbFilenameBuffer, bool fOutputFilename);
+ bool GetFullFileName(LPCWSTR szSource, _Out_writes_(cbFilenameBuffer) LPWSTR filenameBuffer, DWORD cbFilenameBuffer, bool fOutputFilename);
ConsoleArgs() :
m_rgArgs(NULL),
@@ -35,7 +35,7 @@ class ConsoleArgs
};
// returns false if there are errors
- bool ExpandResponseFiles(__in int argc, __deref_in_ecount(argc) const LPCWSTR * argv, int * pargc2, __deref_out_ecount(*pargc2) LPWSTR ** pppargv2);
+ bool ExpandResponseFiles(_In_ int argc, _In_reads_(argc) const LPCWSTR * argv, int * pargc2, _Outptr_result_buffer_(*pargc2) LPWSTR ** pppargv2);
// Frees all memory used by the arg list and the argv/argc array
void CleanUpArgs();
@@ -53,12 +53,12 @@ class ConsoleArgs
}
private:
- void SetErrorMessage(__in LPCWSTR pwzMessage);
+ void SetErrorMessage(_In_ LPCWSTR pwzMessage);
b_tree * MakeLeaf( LPCWSTR szText);
void CleanupTree( b_tree * root);
HRESULT TreeAdd( b_tree ** root, LPCWSTR szAdd);
void TextToArgs( LPCWSTR szText, WStrList ** listReplace);
- bool ReadTextFile(LPCWSTR pwzFilename, __deref_out LPWSTR *ppwzTextBuffer);
+ bool ReadTextFile(LPCWSTR pwzFilename, _Outptr_ LPWSTR *ppwzTextBuffer);
void ProcessResponseArgs();
LPWSTR * m_rgArgs;
diff --git a/src/coreclr/unwinder/amd64/dbs_stack_x64.cpp b/src/coreclr/unwinder/amd64/dbs_stack_x64.cpp
index e6714209b9392b..71b53610035a7f 100644
--- a/src/coreclr/unwinder/amd64/dbs_stack_x64.cpp
+++ b/src/coreclr/unwinder/amd64/dbs_stack_x64.cpp
@@ -63,10 +63,10 @@ DbsX64StackUnwinder::s_UnwindOpSlotTable[] =
HRESULT
DbsX64StackUnwinder::UnwindPrologue(
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __in ULONG64 FrameBase,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _In_ ULONG64 FrameBase,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PAMD64_CONTEXT ContextRecord
)
@@ -520,11 +520,11 @@ Routine Description:
HRESULT
DbsX64StackUnwinder::VirtualUnwind(
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PAMD64_CONTEXT ContextRecord,
- __out PULONG64 EstablisherFrame
+ _Out_ PULONG64 EstablisherFrame
)
/*++
@@ -1033,9 +1033,9 @@ Routine Description:
ULONG64
DbsX64StackUnwinder::LookupPrimaryUnwindInfo(
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in ULONG64 ImageBase,
- __out _PIMAGE_RUNTIME_FUNCTION_ENTRY PrimaryEntry
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase,
+ _Out_ _PIMAGE_RUNTIME_FUNCTION_ENTRY PrimaryEntry
)
/*++
@@ -1114,10 +1114,10 @@ Return Value:
_PIMAGE_RUNTIME_FUNCTION_ENTRY
DbsX64StackUnwinder::SameFunction(
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __out _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionReturnBuffer
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _Out_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionReturnBuffer
)
/*++
@@ -1213,7 +1213,7 @@ Return Value:
(((_DbhFrame)->Reserved[2]) & ~DBHX64_IS_RESTART_FLAG) | \
((_IsRestart) ? DBHX64_IS_RESTART_FLAG : 0))
-DbsX64StackUnwinder::DbsX64StackUnwinder(__in_opt DbsStackServices* Services)
+DbsX64StackUnwinder::DbsX64StackUnwinder(_In_opt_ DbsStackServices* Services)
: DbsStackUnwinder(Services, "x64", IMAGE_FILE_MACHINE_AMD64,
sizeof(m_Context),
sizeof(_IMAGE_RUNTIME_FUNCTION_ENTRY),
@@ -1265,7 +1265,7 @@ DbsX64StackUnwinder::Unwind(void)
DWORD
DbsX64StackUnwinder::
-GetFullUnwindInfoSize(__in PVOID InfoHeader)
+GetFullUnwindInfoSize(_In_ PVOID InfoHeader)
{
PAMD64_UNWIND_INFO UnwindInfo = (PAMD64_UNWIND_INFO)InfoHeader;
@@ -1289,9 +1289,9 @@ GetFullUnwindInfoSize(__in PVOID InfoHeader)
HRESULT
DbsX64StackUnwinder::DbhStart(__inout LPSTACKFRAME64 StackFrame,
- __in DWORD DbhVersion,
- __in_bcount(DbhStorageBytes) PVOID DbhStorage,
- __in DWORD DbhStorageBytes,
+ _In_ DWORD DbhVersion,
+ _In_reads_bytes_(DbhStorageBytes) PVOID DbhStorage,
+ _In_ DWORD DbhStorageBytes,
__inout PVOID Context)
{
HRESULT Status;
@@ -1343,9 +1343,9 @@ DbsX64StackUnwinder::DbhStart(__inout LPSTACKFRAME64 StackFrame,
HRESULT
DbsX64StackUnwinder::
DbhContinue(__inout LPSTACKFRAME64 StackFrame,
- __in DWORD DbhVersion,
- __in_bcount(DbhStorageBytes) PVOID DbhStorage,
- __in DWORD DbhStorageBytes,
+ _In_ DWORD DbhVersion,
+ _In_reads_bytes_(DbhStorageBytes) PVOID DbhStorage,
+ _In_ DWORD DbhStorageBytes,
__inout PVOID Context)
{
HRESULT Status;
@@ -1385,7 +1385,7 @@ DbsX64StackUnwinder::DbhUpdatePreUnwind(__inout LPSTACKFRAME64 StackFrame)
HRESULT
DbsX64StackUnwinder::DbhUpdatePostUnwind(__inout LPSTACKFRAME64 StackFrame,
- __in HRESULT UnwindStatus)
+ _In_ HRESULT UnwindStatus)
{
HRESULT Status;
diff --git a/src/coreclr/unwinder/amd64/unwinder_amd64.cpp b/src/coreclr/unwinder/amd64/unwinder_amd64.cpp
index ef1c5e0b5b54bb..fc3c746d875260 100644
--- a/src/coreclr/unwinder/amd64/unwinder_amd64.cpp
+++ b/src/coreclr/unwinder/amd64/unwinder_amd64.cpp
@@ -321,13 +321,13 @@ UNWIND_INFO * OOPStackUnwinderAMD64::GetUnwindInfo(TADDR taUnwindInfo)
// returned.
//
PEXCEPTION_ROUTINE RtlVirtualUnwind_Unsafe(
- __in ULONG HandlerType,
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __in PT_RUNTIME_FUNCTION FunctionEntry,
- __in OUT PCONTEXT ContextRecord,
- __out PVOID *HandlerData,
- __out PULONG64 EstablisherFrame,
+ _In_ ULONG HandlerType,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _In_ PT_RUNTIME_FUNCTION FunctionEntry,
+ _In_ OUT PCONTEXT ContextRecord,
+ _Out_ PVOID *HandlerData,
+ _Out_ PULONG64 EstablisherFrame,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers
)
{
@@ -395,10 +395,10 @@ PEXCEPTION_ROUTINE RtlVirtualUnwind_Unsafe(
HRESULT
OOPStackUnwinderAMD64::UnwindEpilogue(
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __in ULONG EpilogueOffset,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _In_ ULONG EpilogueOffset,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers
)
@@ -634,13 +634,13 @@ HRESULT.
HRESULT
OOPStackUnwinderAMD64::UnwindPrologue(
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __in ULONG64 FrameBase,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _In_ ULONG64 FrameBase,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers,
- __deref_out _PIMAGE_RUNTIME_FUNCTION_ENTRY *FinalFunctionEntry
+ _Outptr_ _PIMAGE_RUNTIME_FUNCTION_ENTRY *FinalFunctionEntry
)
/*++
@@ -1012,15 +1012,15 @@ Return Value:
HRESULT
OOPStackUnwinderAMD64::VirtualUnwind(
- __in DWORD HandlerType,
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD HandlerType,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
- __out PVOID *HandlerData,
- __out PULONG64 EstablisherFrame,
+ _Out_ PVOID *HandlerData,
+ _Out_ PULONG64 EstablisherFrame,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine
)
/*++
@@ -1663,8 +1663,8 @@ Routine Description:
_PIMAGE_RUNTIME_FUNCTION_ENTRY
OOPStackUnwinderAMD64::LookupPrimaryFunctionEntry(
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in ULONG64 ImageBase
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase
)
@@ -1732,9 +1732,9 @@ Return Value:
_PIMAGE_RUNTIME_FUNCTION_ENTRY
OOPStackUnwinderAMD64::SameFunction(
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in ULONG64 ImageBase,
- __in ULONG64 ControlPc
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc
)
/*++
@@ -1812,7 +1812,7 @@ Return Value:
}
}
-ULONG OOPStackUnwinderAMD64::UnwindOpSlots(__in UNWIND_CODE UnwindCode)
+ULONG OOPStackUnwinderAMD64::UnwindOpSlots(_In_ UNWIND_CODE UnwindCode)
/*++
Routine Description:
diff --git a/src/coreclr/unwinder/amd64/unwinder_amd64.h b/src/coreclr/unwinder/amd64/unwinder_amd64.h
index 48e67f6702187c..c7a7683813ac09 100644
--- a/src/coreclr/unwinder/amd64/unwinder_amd64.h
+++ b/src/coreclr/unwinder/amd64/unwinder_amd64.h
@@ -24,43 +24,43 @@ class OOPStackUnwinderAMD64 : public OOPStackUnwinder
// Everything below comes from dbghelp.dll.
//
- static HRESULT VirtualUnwind(__in DWORD HandlerType,
- __in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ static HRESULT VirtualUnwind(_In_ DWORD HandlerType,
+ _In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
- __out PVOID *HandlerData,
- __out PDWORD64 EstablisherFrame,
+ _Out_ PVOID *HandlerData,
+ _Out_ PDWORD64 EstablisherFrame,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine);
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine);
protected:
- static ULONG UnwindOpSlots(__in UNWIND_CODE UnwindCode);
+ static ULONG UnwindOpSlots(_In_ UNWIND_CODE UnwindCode);
- static HRESULT UnwindEpilogue(__in ULONG64 ImageBase,
- __in ULONG64 ControlPc,
- __in ULONG EpilogueOffset,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ static HRESULT UnwindEpilogue(_In_ ULONG64 ImageBase,
+ _In_ ULONG64 ControlPc,
+ _In_ ULONG EpilogueOffset,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers);
- static HRESULT UnwindPrologue(__in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __in DWORD64 FrameBase,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ static HRESULT UnwindPrologue(_In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _In_ DWORD64 FrameBase,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers,
- __deref_out _PIMAGE_RUNTIME_FUNCTION_ENTRY *FinalFunctionEntry);
+ _Outptr_ _PIMAGE_RUNTIME_FUNCTION_ENTRY *FinalFunctionEntry);
static _PIMAGE_RUNTIME_FUNCTION_ENTRY LookupPrimaryFunctionEntry
- (__in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in DWORD64 ImageBase);
+ (_In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD64 ImageBase);
static _PIMAGE_RUNTIME_FUNCTION_ENTRY SameFunction
- (__in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in DWORD64 ImageBase,
- __in DWORD64 ControlPc);
+ (_In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc);
static UNWIND_INFO * GetUnwindInfo(TADDR taUnwindInfo);
};
diff --git a/src/coreclr/unwinder/arm/unwinder_arm.cpp b/src/coreclr/unwinder/arm/unwinder_arm.cpp
index 5c8de353422680..2ad5d3de94a7a7 100644
--- a/src/coreclr/unwinder/arm/unwinder_arm.cpp
+++ b/src/coreclr/unwinder/arm/unwinder_arm.cpp
@@ -258,8 +258,8 @@ static const ULONG RegisterMaskLookup[1 << 6] =
NTSTATUS
RtlpUnwindCustom(
__inout PT_CONTEXT ContextRecord,
- __in BYTE Opcode,
- __in PARM_UNWIND_PARAMS UnwindParams
+ _In_ BYTE Opcode,
+ _In_ PARM_UNWIND_PARAMS UnwindParams
)
/*++
@@ -385,9 +385,9 @@ Return Value:
NTSTATUS
RtlpPopVfpRegisterRange(
__inout PT_CONTEXT ContextRecord,
- __in ULONG RegStart,
- __in ULONG RegStop,
- __in PARM_UNWIND_PARAMS UnwindParams
+ _In_ ULONG RegStart,
+ _In_ ULONG RegStop,
+ _In_ PARM_UNWIND_PARAMS UnwindParams
)
/*++
@@ -445,9 +445,9 @@ Return Value:
FORCEINLINE
WORD
RtlpRangeToMask(
- __in ULONG Start,
- __in ULONG Stop,
- __in ULONG Lr
+ _In_ ULONG Start,
+ _In_ ULONG Stop,
+ _In_ ULONG Lr
)
/*++
@@ -485,8 +485,8 @@ Return Value:
NTSTATUS
RtlpPopRegisterMask(
__inout PT_CONTEXT ContextRecord,
- __in WORD RegMask,
- __in PARM_UNWIND_PARAMS UnwindParams
+ _In_ WORD RegMask,
+ _In_ PARM_UNWIND_PARAMS UnwindParams
)
/*++
@@ -556,8 +556,8 @@ Return Value:
FORCEINLINE
BOOLEAN
RtlpCheckCondition(
- __in PT_CONTEXT ContextRecord,
- __in ULONG Condition
+ _In_ PT_CONTEXT ContextRecord,
+ _In_ ULONG Condition
)
/*++
@@ -585,10 +585,10 @@ Return Value:
ULONG
RtlpComputeScopeSize(
- __in ULONG UnwindCodePtr,
- __in ULONG UnwindCodesEndPtr,
- __in BOOLEAN IsEpilog,
- __in PVOID UnwindParams
+ _In_ ULONG UnwindCodePtr,
+ _In_ ULONG UnwindCodesEndPtr,
+ _In_ BOOLEAN IsEpilog,
+ _In_ PVOID UnwindParams
)
/*++
@@ -647,13 +647,13 @@ Return Value:
HRESULT
RtlpUnwindFunctionCompact(
- __in ULONG ControlPcRva,
- __in PT_RUNTIME_FUNCTION FunctionEntry,
+ _In_ ULONG ControlPcRva,
+ _In_ PT_RUNTIME_FUNCTION FunctionEntry,
__inout PT_CONTEXT ContextRecord,
- __out PULONG EstablisherFrame,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine,
- __out PVOID *HandlerData,
- __in PARM_UNWIND_PARAMS UnwindParams
+ _Out_ PULONG EstablisherFrame,
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine,
+ _Out_ PVOID *HandlerData,
+ _In_ PARM_UNWIND_PARAMS UnwindParams
)
{
ULONG CBit;
@@ -916,14 +916,14 @@ RtlpUnwindFunctionCompact(
HRESULT
RtlpUnwindFunctionFull(
- __in ULONG ControlPcRva,
- __in ULONG ImageBase,
- __in PT_RUNTIME_FUNCTION FunctionEntry,
+ _In_ ULONG ControlPcRva,
+ _In_ ULONG ImageBase,
+ _In_ PT_RUNTIME_FUNCTION FunctionEntry,
__inout PT_CONTEXT ContextRecord,
- __out PULONG EstablisherFrame,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine,
- __out PVOID *HandlerData,
- __in PARM_UNWIND_PARAMS UnwindParams
+ _Out_ PULONG EstablisherFrame,
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine,
+ _Out_ PVOID *HandlerData,
+ _In_ PARM_UNWIND_PARAMS UnwindParams
)
/*++
@@ -1499,13 +1499,13 @@ BOOL DacUnwindStackFrame(T_CONTEXT *pContext, T_KNONVOLATILE_CONTEXT_POINTERS* p
#if defined(HOST_UNIX)
PEXCEPTION_ROUTINE RtlVirtualUnwind(
- __in ULONG HandlerType,
- __in ULONG ImageBase,
- __in ULONG ControlPc,
- __in PT_RUNTIME_FUNCTION FunctionEntry,
- __in OUT PCONTEXT ContextRecord,
- __out PVOID *HandlerData,
- __out PULONG EstablisherFrame,
+ _In_ ULONG HandlerType,
+ _In_ ULONG ImageBase,
+ _In_ ULONG ControlPc,
+ _In_ PT_RUNTIME_FUNCTION FunctionEntry,
+ _In_ OUT PCONTEXT ContextRecord,
+ _Out_ PVOID *HandlerData,
+ _Out_ PULONG EstablisherFrame,
__inout_opt PT_KNONVOLATILE_CONTEXT_POINTERS ContextPointers
)
{
diff --git a/src/coreclr/unwinder/arm/unwinder_arm.h b/src/coreclr/unwinder/arm/unwinder_arm.h
index 1a8e52fa9a3df3..cb73307448c019 100644
--- a/src/coreclr/unwinder/arm/unwinder_arm.h
+++ b/src/coreclr/unwinder/arm/unwinder_arm.h
@@ -25,28 +25,28 @@ class OOPStackUnwinderArm : public OOPStackUnwinder
//
protected:
- HRESULT UnwindPrologue(__in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __in DWORD64 FrameBase,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ HRESULT UnwindPrologue(_In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _In_ DWORD64 FrameBase,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PT_CONTEXT ContextRecord);
- HRESULT VirtualUnwind(__in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ HRESULT VirtualUnwind(_In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PT_CONTEXT ContextRecord,
- __out PDWORD64 EstablisherFrame);
+ _Out_ PDWORD64 EstablisherFrame);
DWORD64 LookupPrimaryUnwindInfo
- (__in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in DWORD64 ImageBase,
- __out _PIMAGE_RUNTIME_FUNCTION_ENTRY PrimaryEntry);
+ (_In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD64 ImageBase,
+ _Out_ _PIMAGE_RUNTIME_FUNCTION_ENTRY PrimaryEntry);
_PIMAGE_RUNTIME_FUNCTION_ENTRY SameFunction
- (__in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __out _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionReturnBuffer);
+ (_In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _Out_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionReturnBuffer);
};
#endif // __unwinder_arm__
diff --git a/src/coreclr/unwinder/arm64/unwinder_arm64.cpp b/src/coreclr/unwinder/arm64/unwinder_arm64.cpp
index 5740c3cfcab80c..d812e7be3f17bf 100644
--- a/src/coreclr/unwinder/arm64/unwinder_arm64.cpp
+++ b/src/coreclr/unwinder/arm64/unwinder_arm64.cpp
@@ -167,8 +167,8 @@ static const BYTE UnwindCodeSizeTable[256] =
NTSTATUS
RtlpUnwindCustom(
__inout PT_CONTEXT ContextRecord,
- __in BYTE Opcode,
- __in PARM64_UNWIND_PARAMS UnwindParams
+ _In_ BYTE Opcode,
+ _In_ PARM64_UNWIND_PARAMS UnwindParams
)
/*++
@@ -374,10 +374,10 @@ Return Value:
ULONG
RtlpComputeScopeSize(
- __in ULONG_PTR UnwindCodePtr,
- __in ULONG_PTR UnwindCodesEndPtr,
- __in BOOLEAN IsEpilog,
- __in PARM64_UNWIND_PARAMS UnwindParams
+ _In_ ULONG_PTR UnwindCodePtr,
+ _In_ ULONG_PTR UnwindCodesEndPtr,
+ _In_ BOOLEAN IsEpilog,
+ _In_ PARM64_UNWIND_PARAMS UnwindParams
)
/*++
@@ -441,10 +441,10 @@ Return Value:
NTSTATUS
RtlpUnwindRestoreRegisterRange(
__inout PT_CONTEXT ContextRecord,
- __in LONG SpOffset,
- __in ULONG FirstRegister,
- __in ULONG RegisterCount,
- __in PARM64_UNWIND_PARAMS UnwindParams
+ _In_ LONG SpOffset,
+ _In_ ULONG FirstRegister,
+ _In_ ULONG RegisterCount,
+ _In_ PARM64_UNWIND_PARAMS UnwindParams
)
/*++
@@ -517,10 +517,10 @@ Return Value:
NTSTATUS
RtlpUnwindRestoreFpRegisterRange(
__inout PT_CONTEXT ContextRecord,
- __in LONG SpOffset,
- __in ULONG FirstRegister,
- __in ULONG RegisterCount,
- __in PARM64_UNWIND_PARAMS UnwindParams
+ _In_ LONG SpOffset,
+ _In_ ULONG FirstRegister,
+ _In_ ULONG RegisterCount,
+ _In_ PARM64_UNWIND_PARAMS UnwindParams
)
/*++
@@ -588,14 +588,14 @@ Return Value:
NTSTATUS
RtlpUnwindFunctionFull(
- __in DWORD64 ControlPcRva,
- __in ULONG_PTR ImageBase,
- __in PT_RUNTIME_FUNCTION FunctionEntry,
+ _In_ DWORD64 ControlPcRva,
+ _In_ ULONG_PTR ImageBase,
+ _In_ PT_RUNTIME_FUNCTION FunctionEntry,
__inout T_CONTEXT *ContextRecord,
- __out PDWORD64 EstablisherFrame,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine,
- __out PVOID *HandlerData,
- __in PARM64_UNWIND_PARAMS UnwindParams
+ _Out_ PDWORD64 EstablisherFrame,
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine,
+ _Out_ PVOID *HandlerData,
+ _In_ PARM64_UNWIND_PARAMS UnwindParams
)
/*++
@@ -1223,13 +1223,13 @@ Return Value:
NTSTATUS
RtlpUnwindFunctionCompact(
- __in DWORD64 ControlPcRva,
- __in PT_RUNTIME_FUNCTION FunctionEntry,
+ _In_ DWORD64 ControlPcRva,
+ _In_ PT_RUNTIME_FUNCTION FunctionEntry,
__inout T_CONTEXT *ContextRecord,
- __out PDWORD64 EstablisherFrame,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine,
- __out PVOID *HandlerData,
- __in PARM64_UNWIND_PARAMS UnwindParams
+ _Out_ PDWORD64 EstablisherFrame,
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine,
+ _Out_ PVOID *HandlerData,
+ _In_ PARM64_UNWIND_PARAMS UnwindParams
)
/*++
diff --git a/src/coreclr/unwinder/arm64/unwinder_arm64.h b/src/coreclr/unwinder/arm64/unwinder_arm64.h
index f0767d2c315b31..701a3e4f1eb18e 100644
--- a/src/coreclr/unwinder/arm64/unwinder_arm64.h
+++ b/src/coreclr/unwinder/arm64/unwinder_arm64.h
@@ -25,28 +25,28 @@ class OOPStackUnwinderArm64 : public OOPStackUnwinder
//
protected:
- HRESULT UnwindPrologue(__in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __in DWORD64 FrameBase,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ HRESULT UnwindPrologue(_In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _In_ DWORD64 FrameBase,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PT_CONTEXT ContextRecord);
- HRESULT VirtualUnwind(__in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ HRESULT VirtualUnwind(_In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PT_CONTEXT ContextRecord,
- __out PDWORD64 EstablisherFrame);
+ _Out_ PDWORD64 EstablisherFrame);
DWORD64 LookupPrimaryUnwindInfo
- (__in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in DWORD64 ImageBase,
- __out _PIMAGE_RUNTIME_FUNCTION_ENTRY PrimaryEntry);
+ (_In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD64 ImageBase,
+ _Out_ _PIMAGE_RUNTIME_FUNCTION_ENTRY PrimaryEntry);
_PIMAGE_RUNTIME_FUNCTION_ENTRY SameFunction
- (__in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
- __in DWORD64 ImageBase,
- __in DWORD64 ControlPc,
- __out _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionReturnBuffer);
+ (_In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD64 ImageBase,
+ _In_ DWORD64 ControlPc,
+ _Out_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionReturnBuffer);
};
#endif // __unwinder_arm64__
diff --git a/src/coreclr/unwinder/i386/unwinder_i386.cpp b/src/coreclr/unwinder/i386/unwinder_i386.cpp
index 958d0afcf45e20..e1294c8afbd1ea 100644
--- a/src/coreclr/unwinder/i386/unwinder_i386.cpp
+++ b/src/coreclr/unwinder/i386/unwinder_i386.cpp
@@ -98,15 +98,15 @@ Routine Description:
--*/
HRESULT
OOPStackUnwinderX86::VirtualUnwind(
- __in DWORD HandlerType,
- __in DWORD ImageBase,
- __in DWORD ControlPc,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ _In_ DWORD HandlerType,
+ _In_ DWORD ImageBase,
+ _In_ DWORD ControlPc,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
- __out PVOID *HandlerData,
- __out PDWORD EstablisherFrame,
+ _Out_ PVOID *HandlerData,
+ _Out_ PDWORD EstablisherFrame,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine
)
{
if (HandlerRoutine != NULL)
@@ -190,13 +190,13 @@ NTSYSAPI
PEXCEPTION_ROUTINE
NTAPI
RtlVirtualUnwind (
- __in DWORD HandlerType,
- __in DWORD ImageBase,
- __in DWORD ControlPc,
- __in PRUNTIME_FUNCTION FunctionEntry,
+ _In_ DWORD HandlerType,
+ _In_ DWORD ImageBase,
+ _In_ DWORD ControlPc,
+ _In_ PRUNTIME_FUNCTION FunctionEntry,
__inout PT_CONTEXT ContextRecord,
- __out PVOID *HandlerData,
- __out PDWORD EstablisherFrame,
+ _Out_ PVOID *HandlerData,
+ _Out_ PDWORD EstablisherFrame,
__inout_opt PT_KNONVOLATILE_CONTEXT_POINTERS ContextPointers
)
{
diff --git a/src/coreclr/unwinder/i386/unwinder_i386.h b/src/coreclr/unwinder/i386/unwinder_i386.h
index 6a6c3896ee6af4..904ec80dea9813 100644
--- a/src/coreclr/unwinder/i386/unwinder_i386.h
+++ b/src/coreclr/unwinder/i386/unwinder_i386.h
@@ -19,15 +19,15 @@ class OOPStackUnwinderX86 : public OOPStackUnwinder
public:
static BOOL Unwind(T_CONTEXT* pContextRecord, T_KNONVOLATILE_CONTEXT_POINTERS* pContextPointers);
- static HRESULT VirtualUnwind(__in DWORD HandlerType,
- __in DWORD ImageBase,
- __in DWORD ControlPc,
- __in _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
+ static HRESULT VirtualUnwind(_In_ DWORD HandlerType,
+ _In_ DWORD ImageBase,
+ _In_ DWORD ControlPc,
+ _In_ _PIMAGE_RUNTIME_FUNCTION_ENTRY FunctionEntry,
__inout PCONTEXT ContextRecord,
- __out PVOID *HandlerData,
- __out PDWORD EstablisherFrame,
+ _Out_ PVOID *HandlerData,
+ _Out_ PDWORD EstablisherFrame,
__inout_opt PKNONVOLATILE_CONTEXT_POINTERS ContextPointers,
- __deref_opt_out_opt PEXCEPTION_ROUTINE *HandlerRoutine);
+ _Outptr_opt_result_maybenull_ PEXCEPTION_ROUTINE *HandlerRoutine);
};
#endif // FEATURE_EH_FUNCLETS
diff --git a/src/coreclr/unwinder/unwinder.cpp b/src/coreclr/unwinder/unwinder.cpp
index 98245fef445c09..08829fa4cd513b 100644
--- a/src/coreclr/unwinder/unwinder.cpp
+++ b/src/coreclr/unwinder/unwinder.cpp
@@ -25,7 +25,7 @@ EXTERN_C void GetRuntimeStackWalkInfo(IN ULONG64 ControlPc,
//
HRESULT OOPStackUnwinder::GetModuleBase( DWORD64 address,
- __out PDWORD64 pdwBase)
+ _Out_ PDWORD64 pdwBase)
{
GetRuntimeStackWalkInfo(address, reinterpret_cast(pdwBase), NULL);
return ((*pdwBase == NULL) ? E_FAIL : S_OK);
@@ -47,7 +47,7 @@ HRESULT OOPStackUnwinder::GetModuleBase( DWORD64 address,
//
HRESULT OOPStackUnwinder::GetFunctionEntry( DWORD64 address,
- __out_ecount(cbBuffer) PVOID pBuffer,
+ _Out_writes_(cbBuffer) PVOID pBuffer,
DWORD cbBuffer)
{
if (cbBuffer < sizeof(T_RUNTIME_FUNCTION))
diff --git a/src/coreclr/unwinder/unwinder.h b/src/coreclr/unwinder/unwinder.h
index 0c4838f1ed5ccb..241dc8a7ddfb30 100644
--- a/src/coreclr/unwinder/unwinder.h
+++ b/src/coreclr/unwinder/unwinder.h
@@ -29,11 +29,11 @@ class OOPStackUnwinder
// Given a control PC, return the base of the module it is in. For jitted managed code, this is the
// start of the code heap.
static HRESULT GetModuleBase( DWORD64 address,
- __out PDWORD64 pdwBase);
+ _Out_ PDWORD64 pdwBase);
// Given a control PC, return the function entry of the functoin it is in.
static HRESULT GetFunctionEntry( DWORD64 address,
- __out_ecount(cbBuffer) PVOID pBuffer,
+ _Out_writes_(cbBuffer) PVOID pBuffer,
DWORD cbBuffer);
};
diff --git a/src/coreclr/utilcode/ccomprc.cpp b/src/coreclr/utilcode/ccomprc.cpp
index 21d13a5e5d791a..761d966763f6ca 100644
--- a/src/coreclr/utilcode/ccomprc.cpp
+++ b/src/coreclr/utilcode/ccomprc.cpp
@@ -461,7 +461,7 @@ HRESULT CCompRC::GetLibrary(LocaleID langId, HRESOURCEDLL* phInst)
// We load the localized libraries and cache the handle for future use.
// Mutliple threads may call this, so the cache structure is thread safe.
//*****************************************************************************
-HRESULT CCompRC::LoadString(ResourceCategory eCategory, UINT iResourceID, __out_ecount(iMax) LPWSTR szBuffer, int iMax, int *pcwchUsed)
+HRESULT CCompRC::LoadString(ResourceCategory eCategory, UINT iResourceID, _Out_writes_(iMax) LPWSTR szBuffer, int iMax, int *pcwchUsed)
{
WRAPPER_NO_CONTRACT;
LocaleIDValue langIdValue;
@@ -487,7 +487,7 @@ HRESULT CCompRC::LoadString(ResourceCategory eCategory, UINT iResourceID, __out_
return LoadString(eCategory, langId, iResourceID, szBuffer, iMax, pcwchUsed);
}
-HRESULT CCompRC::LoadString(ResourceCategory eCategory, LocaleID langId, UINT iResourceID, __out_ecount(iMax) LPWSTR szBuffer, int iMax, int *pcwchUsed)
+HRESULT CCompRC::LoadString(ResourceCategory eCategory, LocaleID langId, UINT iResourceID, _Out_writes_(iMax) LPWSTR szBuffer, int iMax, int *pcwchUsed)
{
#ifdef DBI_COMPONENT_MONO
return E_NOTIMPL;
diff --git a/src/coreclr/utilcode/clrconfig.cpp b/src/coreclr/utilcode/clrconfig.cpp
index d4f6ec2adabafb..caad3b594a6eaf 100644
--- a/src/coreclr/utilcode/clrconfig.cpp
+++ b/src/coreclr/utilcode/clrconfig.cpp
@@ -228,7 +228,7 @@ namespace
HRESULT GetConfigDWORD(
LPCWSTR name,
DWORD defValue,
- __out DWORD *result,
+ _Out_ DWORD *result,
LookupOptions options)
{
CONTRACTL
@@ -312,7 +312,7 @@ namespace
// Return Value:
// HRESULT indicating success or failure.
//
- HRESULT TrimWhiteSpace(LPCWSTR wszOrig, __deref_out_z LPWSTR * pwszTrimmed)
+ HRESULT TrimWhiteSpace(LPCWSTR wszOrig, _Outptr_result_z_ LPWSTR * pwszTrimmed)
{
CONTRACTL
{
@@ -537,7 +537,7 @@ LPWSTR CLRConfig::GetConfigValue(const ConfigStringInfo & info)
// not found.
//
// static
-HRESULT CLRConfig::GetConfigValue(const ConfigStringInfo & info, __deref_out_z LPWSTR * outVal)
+HRESULT CLRConfig::GetConfigValue(const ConfigStringInfo & info, _Outptr_result_z_ LPWSTR * outVal)
{
CONTRACT(HRESULT) {
NOTHROW;
@@ -609,7 +609,7 @@ BOOL CLRConfig::IsConfigOptionSpecified(LPCWSTR name)
// Deallocation function for code:CLRConfig::FreeConfigString
//
// static
-void CLRConfig::FreeConfigString(__in_z LPWSTR str)
+void CLRConfig::FreeConfigString(_In_z_ LPWSTR str)
{
LIMITED_METHOD_CONTRACT;
diff --git a/src/coreclr/utilcode/clrhost_nodependencies.cpp b/src/coreclr/utilcode/clrhost_nodependencies.cpp
index 48747e031101ba..7d2fceb3005e1a 100644
--- a/src/coreclr/utilcode/clrhost_nodependencies.cpp
+++ b/src/coreclr/utilcode/clrhost_nodependencies.cpp
@@ -44,8 +44,8 @@ void DisableThrowCheck()
#define CLRThrowsExceptionWorker() RealCLRThrowsExceptionWorker(__FUNCTION__, __FILE__, __LINE__)
-static void RealCLRThrowsExceptionWorker(__in_z const char *szFunction,
- __in_z const char *szFile,
+static void RealCLRThrowsExceptionWorker(_In_z_ const char *szFunction,
+ _In_z_ const char *szFile,
int lineNum)
{
WRAPPER_NO_CONTRACT;
diff --git a/src/coreclr/utilcode/fstring.cpp b/src/coreclr/utilcode/fstring.cpp
index 0f4360e9ffe0b9..9bcd12d1fffc6c 100644
--- a/src/coreclr/utilcode/fstring.cpp
+++ b/src/coreclr/utilcode/fstring.cpp
@@ -23,7 +23,7 @@ namespace FString
#define MAX_LENGTH 0x1fffff00
-HRESULT Unicode_Utf8_Length(__in_z LPCWSTR pString, __out bool * pAllAscii, __out DWORD * pLength)
+HRESULT Unicode_Utf8_Length(_In_z_ LPCWSTR pString, _Out_ bool * pAllAscii, _Out_ DWORD * pLength)
{
CONTRACTL
{
@@ -86,7 +86,7 @@ HRESULT Unicode_Utf8_Length(__in_z LPCWSTR pString, __out bool * pAllAscii, __ou
// UNICODE to UTF8
-HRESULT Unicode_Utf8(__in_z LPCWSTR pString, bool allAscii, __out_z LPSTR pBuffer, DWORD length)
+HRESULT Unicode_Utf8(_In_z_ LPCWSTR pString, bool allAscii, _Out_writes_bytes_(length) LPSTR pBuffer, DWORD length)
{
CONTRACTL
{
@@ -143,7 +143,7 @@ HRESULT Unicode_Utf8(__in_z LPCWSTR pString, bool allAscii, __out_z LPSTR pBuffe
}
-HRESULT Utf8_Unicode_Length(__in_z LPCSTR pString, __out bool * pAllAscii, __out DWORD * pLength)
+HRESULT Utf8_Unicode_Length(_In_z_ LPCSTR pString, _Out_ bool * pAllAscii, _Out_ DWORD * pLength)
{
CONTRACTL
{
@@ -207,7 +207,7 @@ HRESULT Utf8_Unicode_Length(__in_z LPCSTR pString, __out bool * pAllAscii, __out
// UTF8 to Unicode
-HRESULT Utf8_Unicode(__in_z LPCSTR pString, bool allAscii, __out_z LPWSTR pBuffer, DWORD length)
+HRESULT Utf8_Unicode(_In_z_ LPCSTR pString, bool allAscii, _Out_writes_bytes_(length) LPWSTR pBuffer, DWORD length)
{
CONTRACTL
{
@@ -264,7 +264,7 @@ HRESULT Utf8_Unicode(__in_z LPCSTR pString, bool allAscii, __out_z LPWSTR pBuffe
}
-HRESULT ConvertUnicode_Utf8(__in_z LPCWSTR pString, __out_z LPSTR * pBuffer)
+HRESULT ConvertUnicode_Utf8(_In_z_ LPCWSTR pString, _Outptr_result_z_ LPSTR * pBuffer)
{
bool allAscii;
DWORD length;
@@ -289,7 +289,7 @@ HRESULT ConvertUnicode_Utf8(__in_z LPCWSTR pString, __out_z LPSTR * pBuffer)
}
-HRESULT ConvertUtf8_Unicode(__in_z LPCSTR pString, __out_z LPWSTR * pBuffer)
+HRESULT ConvertUtf8_Unicode(_In_z_ LPCSTR pString, _Outptr_result_z_ LPWSTR * pBuffer)
{
bool allAscii;
DWORD length;
diff --git a/src/coreclr/utilcode/loaderheap.cpp b/src/coreclr/utilcode/loaderheap.cpp
index bc377c683ba52d..51e39de70ecf92 100644
--- a/src/coreclr/utilcode/loaderheap.cpp
+++ b/src/coreclr/utilcode/loaderheap.cpp
@@ -502,9 +502,9 @@ class LoaderHeapSniffer
static VOID RecordEvent(UnlockedLoaderHeap *pHeap,
AllocationType allocationType,
- __in const char *szFile,
+ _In_ const char *szFile,
int lineNum,
- __in const char *szAllocFile,
+ _In_ const char *szAllocFile,
int allocLineNum,
void *pMem,
size_t dwRequestedSize,
@@ -1248,7 +1248,7 @@ BOOL UnlockedLoaderHeap::GetMoreCommittedPages(size_t dwMinSize)
}
void *UnlockedLoaderHeap::UnlockedAllocMem(size_t dwSize
- COMMA_INDEBUG(__in const char *szFile)
+ COMMA_INDEBUG(_In_ const char *szFile)
COMMA_INDEBUG(int lineNum))
{
CONTRACT(void*)
@@ -1300,7 +1300,7 @@ static DWORD ShouldInjectFault()
#endif
void *UnlockedLoaderHeap::UnlockedAllocMem_NoThrow(size_t dwSize
- COMMA_INDEBUG(__in const char *szFile)
+ COMMA_INDEBUG(_In_ const char *szFile)
COMMA_INDEBUG(int lineNum))
{
CONTRACT(void*)
@@ -1404,9 +1404,9 @@ void *UnlockedLoaderHeap::UnlockedAllocMem_NoThrow(size_t dwSize
void UnlockedLoaderHeap::UnlockedBackoutMem(void *pMem,
size_t dwRequestedSize
- COMMA_INDEBUG(__in const char *szFile)
+ COMMA_INDEBUG(_In_ const char *szFile)
COMMA_INDEBUG(int lineNum)
- COMMA_INDEBUG(__in const char *szAllocFile)
+ COMMA_INDEBUG(_In_ const char *szAllocFile)
COMMA_INDEBUG(int allocLineNum))
{
CONTRACTL
@@ -1576,7 +1576,7 @@ void UnlockedLoaderHeap::UnlockedBackoutMem(void *pMem,
void *UnlockedLoaderHeap::UnlockedAllocAlignedMem_NoThrow(size_t dwRequestedSize,
size_t alignment,
size_t *pdwExtra
- COMMA_INDEBUG(__in const char *szFile)
+ COMMA_INDEBUG(_In_ const char *szFile)
COMMA_INDEBUG(int lineNum))
{
CONTRACT(void*)
@@ -1713,7 +1713,7 @@ void *UnlockedLoaderHeap::UnlockedAllocAlignedMem_NoThrow(size_t dwRequestedSiz
void *UnlockedLoaderHeap::UnlockedAllocAlignedMem(size_t dwRequestedSize,
size_t dwAlignment,
size_t *pdwExtra
- COMMA_INDEBUG(__in const char *szFile)
+ COMMA_INDEBUG(_In_ const char *szFile)
COMMA_INDEBUG(int lineNum))
{
CONTRACTL
@@ -1908,9 +1908,9 @@ void UnlockedLoaderHeap::UnlockedPrintEvents()
/*static*/ VOID LoaderHeapSniffer::RecordEvent(UnlockedLoaderHeap *pHeap,
AllocationType allocationType,
- __in const char *szFile,
+ _In_ const char *szFile,
int lineNum,
- __in const char *szAllocFile,
+ _In_ const char *szAllocFile,
int allocLineNum,
void *pMem,
size_t dwRequestedSize,
diff --git a/src/coreclr/utilcode/log.cpp b/src/coreclr/utilcode/log.cpp
index b4a73f2cb6bafc..b889c7d341ce3a 100644
--- a/src/coreclr/utilcode/log.cpp
+++ b/src/coreclr/utilcode/log.cpp
@@ -76,7 +76,7 @@ VOID InitLogging()
if (CLRConfig::GetConfigValue(CLRConfig::INTERNAL_LogWithPid))
{
WCHAR szPid[20];
- swprintf_s(szPid, COUNTOF(szPid), W(".%d"), GetCurrentProcessId());
+ swprintf_s(szPid, ARRAY_SIZE(szPid), W(".%d"), GetCurrentProcessId());
wcscat_s(szLogFileName.Ptr(), szLogFileName.Size(), szPid);
}
@@ -323,7 +323,7 @@ VOID LogSpewAlwaysValist(const char *fmt, va_list args)
static bool needsPrefix = true;
if (needsPrefix)
- buflen = sprintf_s(pBuffer, COUNTOF(rgchBuffer), "TID %04x: ", GetCurrentThreadId());
+ buflen = sprintf_s(pBuffer, ARRAY_SIZE(rgchBuffer), "TID %04x: ", GetCurrentThreadId());
needsPrefix = (fmt[strlen(fmt)-1] == '\n');
diff --git a/src/coreclr/utilcode/makepath.cpp b/src/coreclr/utilcode/makepath.cpp
index 4bf8787242a1b2..161e859455327d 100644
--- a/src/coreclr/utilcode/makepath.cpp
+++ b/src/coreclr/utilcode/makepath.cpp
@@ -39,11 +39,11 @@
*******************************************************************************/
void MakePath (
- __out CQuickWSTR &szPath,
- __in LPCWSTR drive,
- __in LPCWSTR dir,
- __in LPCWSTR fname,
- __in LPCWSTR ext
+ _Out_ CQuickWSTR &szPath,
+ _In_ LPCWSTR drive,
+ _In_ LPCWSTR dir,
+ _In_ LPCWSTR fname,
+ _In_ LPCWSTR ext
)
{
CONTRACTL
diff --git a/src/coreclr/utilcode/namespaceutil.cpp b/src/coreclr/utilcode/namespaceutil.cpp
index 3731d0399fcdf1..5b6d3d9f95bee8 100644
--- a/src/coreclr/utilcode/namespaceutil.cpp
+++ b/src/coreclr/utilcode/namespaceutil.cpp
@@ -196,9 +196,9 @@ void ns::SplitInline(
//*****************************************************************************
int ns::SplitPath( // true ok, false trunction.
const WCHAR *szPath, // Path to split.
- __out_ecount(cchNameSpace) WCHAR *szNameSpace, // Output for namespace value.
+ _Out_writes_(cchNameSpace) WCHAR *szNameSpace, // Output for namespace value.
int cchNameSpace, // Max chars for output.
- __out_ecount(cchName) WCHAR *szName, // Output for name.
+ _Out_writes_(cchName) WCHAR *szName, // Output for name.
int cchName) // Max chars for output.
{
STATIC_CONTRACT_NOTHROW;
@@ -243,9 +243,9 @@ int ns::SplitPath( // true ok, false trunction.
int ns::SplitPath( // true ok, false trunction.
LPCUTF8 szPath, // Path to split.
- __out_ecount_opt (cchNameSpace) LPUTF8 szNameSpace, // Output for namespace value.
+ _Out_writes_opt_ (cchNameSpace) LPUTF8 szNameSpace, // Output for namespace value.
int cchNameSpace, // Max chars for output.
- __out_ecount_opt (cchName) LPUTF8 szName, // Output for name.
+ _Out_writes_opt_ (cchName) LPUTF8 szName, // Output for name.
int cchName) // Max chars for output.
{
STATIC_CONTRACT_NOTHROW;
@@ -293,7 +293,7 @@ int ns::SplitPath( // true ok, false trunction.
// correct separator.
//*****************************************************************************
int ns::MakePath( // true ok, false truncation.
- __out_ecount(cchChars) WCHAR *szOut, // output path for name.
+ _Out_writes_(cchChars) WCHAR *szOut, // output path for name.
int cchChars, // max chars for output path.
const WCHAR *szNameSpace, // Namespace.
const WCHAR *szName) // Name.
@@ -335,7 +335,7 @@ int ns::MakePath( // true ok, false truncation.
} // int ns::MakePath()
int ns::MakePath( // true ok, false truncation.
- __out_ecount(cchChars) LPUTF8 szOut, // output path for name.
+ _Out_writes_(cchChars) LPUTF8 szOut, // output path for name.
int cchChars, // max chars for output path.
LPCUTF8 szNameSpace, // Namespace.
LPCUTF8 szName) // Name.
@@ -378,7 +378,7 @@ int ns::MakePath( // true ok, false truncation.
} // int ns::MakePath()
int ns::MakePath( // true ok, false truncation.
- __out_ecount(cchChars) WCHAR *szOut, // output path for name.
+ _Out_writes_(cchChars) WCHAR *szOut, // output path for name.
int cchChars, // max chars for output path.
LPCUTF8 szNamespace, // Namespace.
LPCUTF8 szName) // Name.
@@ -513,7 +513,7 @@ void ns::MakePath( // throws on out of memory
}
bool ns::MakeAssemblyQualifiedName( // true ok, false truncation
- __out_ecount(dwBuffer) WCHAR* pBuffer, // Buffer to receive the results
+ _Out_writes_(dwBuffer) WCHAR* pBuffer, // Buffer to receive the results
int dwBuffer, // Number of characters total in buffer
const WCHAR *szTypeName, // Namespace for name.
int dwTypeName, // Number of characters (not including null)
@@ -621,7 +621,7 @@ int ns::MakeNestedTypeName( // true ok, false out of memory
} // int ns::MakeNestedTypeName()
int ns::MakeNestedTypeName( // true ok, false truncation.
- __out_ecount (cchChars) LPUTF8 szOut, // output path for name.
+ _Out_writes_ (cchChars) LPUTF8 szOut, // output path for name.
int cchChars, // max chars for output path.
LPCUTF8 szEnclosingName, // Full name for enclosing type
LPCUTF8 szNestedName) // Full name for nested type
diff --git a/src/coreclr/utilcode/posterror.cpp b/src/coreclr/utilcode/posterror.cpp
index 13cc9960990334..a39367477e0523 100644
--- a/src/coreclr/utilcode/posterror.cpp
+++ b/src/coreclr/utilcode/posterror.cpp
@@ -54,7 +54,7 @@ void SetResourceCultureCallbacks(
//*****************************************************************************
STDAPI UtilLoadStringRC(
UINT iResourceID,
- __out_ecount(iMax) LPWSTR szBuffer,
+ _Out_writes_(iMax) LPWSTR szBuffer,
int iMax,
int bQuiet
)
@@ -63,7 +63,7 @@ STDAPI UtilLoadStringRC(
return UtilLoadResourceString(bQuiet? CCompRC::Optional : CCompRC::Required,iResourceID, szBuffer, iMax);
}
-HRESULT UtilLoadResourceString(CCompRC::ResourceCategory eCategory, UINT iResourceID, __out_ecount (iMax) LPWSTR szBuffer, int iMax)
+HRESULT UtilLoadResourceString(CCompRC::ResourceCategory eCategory, UINT iResourceID, _Out_writes_ (iMax) LPWSTR szBuffer, int iMax)
{
CONTRACTL
{
@@ -98,7 +98,7 @@ HRESULT UtilLoadResourceString(CCompRC::ResourceCategory eCategory, UINT iResour
// Format a Runtime Error message.
//*****************************************************************************
HRESULT __cdecl FormatRuntimeErrorVa(
- __inout_ecount(cchMsg) WCHAR *rcMsg, // Buffer into which to format.
+ _Inout_updates_(cchMsg) WCHAR *rcMsg, // Buffer into which to format.
ULONG cchMsg, // Size of buffer, characters.
HRESULT hrRpt, // The HR to report.
va_list marker) // Optional args.
@@ -158,7 +158,7 @@ HRESULT __cdecl FormatRuntimeErrorVa(
// Format a Runtime Error message, varargs.
//*****************************************************************************
HRESULT __cdecl FormatRuntimeError(
- __out_ecount(cchMsg) WCHAR *rcMsg, // Buffer into which to format.
+ _Out_writes_(cchMsg) WCHAR *rcMsg, // Buffer into which to format.
ULONG cchMsg, // Size of buffer, characters.
HRESULT hrRpt, // The HR to report.
...) // Optional args.
diff --git a/src/coreclr/utilcode/splitpath.cpp b/src/coreclr/utilcode/splitpath.cpp
index b087e6cd3d1259..f5100ef72d3271 100644
--- a/src/coreclr/utilcode/splitpath.cpp
+++ b/src/coreclr/utilcode/splitpath.cpp
@@ -75,11 +75,11 @@ void SplitPath(
// A much more sensible version that just points to each section of the string.
//*******************************************************************************
void SplitPathInterior(
- __in LPCWSTR wszPath,
- __out_opt LPCWSTR *pwszDrive, __out_opt size_t *pcchDrive,
- __out_opt LPCWSTR *pwszDir, __out_opt size_t *pcchDir,
- __out_opt LPCWSTR *pwszFileName, __out_opt size_t *pcchFileName,
- __out_opt LPCWSTR *pwszExt, __out_opt size_t *pcchExt)
+ _In_ LPCWSTR wszPath,
+ _Out_opt_ LPCWSTR *pwszDrive, _Out_opt_ size_t *pcchDrive,
+ _Out_opt_ LPCWSTR *pwszDir, _Out_opt_ size_t *pcchDir,
+ _Out_opt_ LPCWSTR *pwszFileName, _Out_opt_ size_t *pcchFileName,
+ _Out_opt_ LPCWSTR *pwszExt, _Out_opt_ size_t *pcchExt)
{
LIMITED_METHOD_CONTRACT;
@@ -228,7 +228,7 @@ void SplitPathInterior(
*
*******************************************************************************/
-void SplitPath(__in SString const &path,
+void SplitPath(_In_ SString const &path,
__inout_opt SString *drive,
__inout_opt SString *dir,
__inout_opt SString *fname,
diff --git a/src/coreclr/utilcode/sstring.cpp b/src/coreclr/utilcode/sstring.cpp
index a0017a5a003fb4..6b5f7af901ac11 100644
--- a/src/coreclr/utilcode/sstring.cpp
+++ b/src/coreclr/utilcode/sstring.cpp
@@ -2708,7 +2708,7 @@ const WCHAR * SString::DacGetRawUnicode() const
// false if unsuccessful.
//
bool SString::DacGetUnicode(COUNT_T cBufChars,
- __out_z __inout_ecount(cBufChars) WCHAR * pBuffer,
+ _Inout_updates_z_(cBufChars) WCHAR * pBuffer,
COUNT_T * pcNeedChars) const
{
SUPPORTS_DAC;
diff --git a/src/coreclr/utilcode/stacktrace.cpp b/src/coreclr/utilcode/stacktrace.cpp
index dfa07a6d36b479..67126bcdc57d95 100644
--- a/src/coreclr/utilcode/stacktrace.cpp
+++ b/src/coreclr/utilcode/stacktrace.cpp
@@ -905,7 +905,7 @@ CONTEXT * pContext // @parm Context to start the stack trace at; null for curre
void GetStringFromAddr
(
DWORD_PTR dwAddr,
-__out_ecount(cchMaxAssertStackLevelStringLen) LPSTR szString // Place to put string.
+_Out_writes_(cchMaxAssertStackLevelStringLen) LPSTR szString // Place to put string.
// Buffer must hold at least cchMaxAssertStackLevelStringLen.
)
{
@@ -956,7 +956,7 @@ void MagicDeinit(void)
* support this, so we need it for CoreCLR 4, if we require Win2K support
****************************************************************************/
extern "C" __declspec(naked) void __stdcall
-ClrCaptureContext(__out PCONTEXT ctx)
+ClrCaptureContext(_Out_ PCONTEXT ctx)
{
__asm {
push ebx;
diff --git a/src/coreclr/utilcode/stgpoolreadonly.cpp b/src/coreclr/utilcode/stgpoolreadonly.cpp
index 439e9ca42d266a..3c9008bcf470a1 100644
--- a/src/coreclr/utilcode/stgpoolreadonly.cpp
+++ b/src/coreclr/utilcode/stgpoolreadonly.cpp
@@ -89,7 +89,7 @@ void StgPoolReadOnly::Uninit()
//*****************************************************************************
HRESULT StgPoolReadOnly::GetStringW( // Return code.
ULONG iOffset, // Offset of string in pool.
- __out_ecount(cchBuffer) LPWSTR szOut, // Output buffer for string.
+ _Out_writes_(cchBuffer) LPWSTR szOut, // Output buffer for string.
int cchBuffer) // Size of output buffer.
{
STATIC_CONTRACT_NOTHROW;
diff --git a/src/coreclr/utilcode/util.cpp b/src/coreclr/utilcode/util.cpp
index 5d1cdbca61fca6..44b5250547689c 100644
--- a/src/coreclr/utilcode/util.cpp
+++ b/src/coreclr/utilcode/util.cpp
@@ -19,6 +19,7 @@
#include "corinfo.h"
#include "volatile.h"
#include "mdfileformat.h"
+#include
#ifndef DACCESS_COMPILE
UINT32 g_nClrInstanceId = 0;
@@ -827,7 +828,7 @@ DWORD LCM(DWORD u, DWORD v)
CONTRACTL_END;
#if !defined(FEATURE_REDHAWK) && (defined(TARGET_AMD64) || defined(TARGET_ARM64))
- BOOL enableGCCPUGroups = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_GCCpuGroup) != 0;
+ BOOL enableGCCPUGroups = Configuration::GetKnobBooleanValue(W("System.GC.CpuGroup"), CLRConfig::EXTERNAL_GCCpuGroup);
if (!enableGCCPUGroups)
return;
@@ -1338,7 +1339,7 @@ void ConfigString::init(const CLRConfig::ConfigStringInfo & info)
// MyAssembly;mscorlib;System
// MyAssembly;mscorlib System
-AssemblyNamesList::AssemblyNamesList(__in LPWSTR list)
+AssemblyNamesList::AssemblyNamesList(_In_ LPWSTR list)
{
CONTRACTL {
THROWS;
@@ -1430,7 +1431,7 @@ bool AssemblyNamesList::IsInList(LPCUTF8 assemblyName)
// "MyClass:foo2 MyClass:*" will match under _DEBUG
//
-void MethodNamesListBase::Insert(__in_z LPWSTR str)
+void MethodNamesListBase::Insert(_In_z_ LPWSTR str)
{
CONTRACTL {
THROWS;
@@ -3083,7 +3084,7 @@ namespace Reg
}
}
- HRESULT ReadStringValue(HKEY hKey, LPCWSTR wszSubKey, LPCWSTR wszName, __deref_out __deref_out_z LPWSTR* pwszValue)
+ HRESULT ReadStringValue(HKEY hKey, LPCWSTR wszSubKey, LPCWSTR wszName, _Outptr_ _Outptr_result_z_ LPWSTR* pwszValue)
{
CONTRACTL {
NOTHROW;
diff --git a/src/coreclr/utilcode/util_nodependencies.cpp b/src/coreclr/utilcode/util_nodependencies.cpp
index 9dae13a57d3118..650751af0d7e4f 100644
--- a/src/coreclr/utilcode/util_nodependencies.cpp
+++ b/src/coreclr/utilcode/util_nodependencies.cpp
@@ -341,7 +341,7 @@ void GetDebuggerSettingInfo(SString &ssDebuggerString, BOOL *pfAuto)
// * wszDebuggerString can be NULL. When wszDebuggerString is NULL, pcchDebuggerString should
// * point to a DWORD of zero. pcchDebuggerString cannot be NULL, and the DWORD pointed by
// * pcchDebuggerString will store the used or required string buffer size in characters.
-HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString, *pcchDebuggerString) LPWSTR wszDebuggerString, DWORD * pcchDebuggerString, BOOL * pfAuto)
+HRESULT GetDebuggerSettingInfoWorker(_Out_writes_to_opt_(*pcchDebuggerString, *pcchDebuggerString) LPWSTR wszDebuggerString, DWORD * pcchDebuggerString, BOOL * pfAuto)
{
CONTRACTL
{
@@ -478,7 +478,7 @@ HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString,
//*****************************************************************************
HRESULT GetStr(
DWORD hHexNum,
- __out_ecount((cbHexNum * 2)) LPWSTR szHexNum,
+ _Out_writes_((cbHexNum * 2)) LPWSTR szHexNum,
DWORD cbHexNum)
{
CONTRACTL
@@ -512,7 +512,7 @@ HRESULT GetStr(
int
GuidToLPWSTR(
GUID Guid, // The GUID to convert.
- __out_ecount(cchGuid) LPWSTR szGuid, // String into which the GUID is stored
+ _Out_writes_(cchGuid) LPWSTR szGuid, // String into which the GUID is stored
DWORD cchGuid) // Count in wchars
{
CONTRACTL
@@ -579,7 +579,7 @@ GuidToLPWSTR(
//*****************************************************************************
HRESULT GetHex(
DWORD * phHexNum,
- __in_ecount((cbHexNum * 2)) LPCWSTR szHexNum,
+ _In_reads_((cbHexNum * 2)) LPCWSTR szHexNum,
DWORD cbHexNum)
{
CONTRACTL
@@ -624,7 +624,7 @@ HRESULT GetHex(
BOOL
LPWSTRToGuid(
GUID * Guid, // [OUT] The GUID to fill in
- __in_ecount(cchGuid) LPCWSTR szGuid, // [IN] String to parse
+ _In_reads_(cchGuid) LPCWSTR szGuid, // [IN] String to parse
DWORD cchGuid) // [IN] Count in wchars in string
{
CONTRACTL
@@ -742,7 +742,7 @@ void ConfigDWORD::init(const CLRConfig::ConfigDWORDInfo & info)
// terminator); [out] Points to length in chars of trimmed substring (not
// counting null terminator)
//
-void TrimWhiteSpace(__deref_inout_ecount(*pcch) LPCWSTR *pwsz, __inout LPDWORD pcch)
+void TrimWhiteSpace(_Outptr_result_buffer_(*pcch) LPCWSTR *pwsz, __inout LPDWORD pcch)
{
LIMITED_METHOD_DAC_CONTRACT;
diff --git a/src/coreclr/vm/CMakeLists.txt b/src/coreclr/vm/CMakeLists.txt
index bbc411c324cde4..2f34d2c0ceaa17 100644
--- a/src/coreclr/vm/CMakeLists.txt
+++ b/src/coreclr/vm/CMakeLists.txt
@@ -617,7 +617,6 @@ if(CLR_CMAKE_TARGET_WIN32)
dispatchinfo.cpp
dispparammarshaler.cpp
mngstdinterfaces.cpp
- notifyexternals.cpp
olecontexthelpers.cpp
runtimecallablewrapper.cpp
stdinterfaces.cpp
@@ -634,7 +633,6 @@ if(CLR_CMAKE_TARGET_WIN32)
dispatchinfo.h
dispparammarshaler.h
mngstdinterfaces.h
- notifyexternals.h
olecontexthelpers.h
runtimecallablewrapper.h
stdinterfaces.h
diff --git a/src/coreclr/vm/amd64/cgencpu.h b/src/coreclr/vm/amd64/cgencpu.h
index 29b9dddfb7de44..33589c27bae392 100644
--- a/src/coreclr/vm/amd64/cgencpu.h
+++ b/src/coreclr/vm/amd64/cgencpu.h
@@ -415,8 +415,6 @@ extern "C" void setFPReturn(int fpSize, INT64 retVal);
extern "C" void getFPReturn(int fpSize, INT64 *retval);
-struct ComToManagedExRecord; // defined in cgencpu.cpp
-
#include
struct DECLSPEC_ALIGN(8) UMEntryThunkCode
{
diff --git a/src/coreclr/vm/arm64/asmhelpers.S b/src/coreclr/vm/arm64/asmhelpers.S
index 7d8b3c7dd88b23..e7725cd16e63b6 100644
--- a/src/coreclr/vm/arm64/asmhelpers.S
+++ b/src/coreclr/vm/arm64/asmhelpers.S
@@ -551,152 +551,6 @@ LOCAL_LABEL(LNullThis):
LEAF_END SinglecastDelegateInvokeStub, _TEXT
-#ifdef FEATURE_COMINTEROP
-
-#define ComCallPreStub_FrameSize (SIZEOF__GSCookie + SIZEOF__ComMethodFrame)
-#define ComCallPreStub_FirstStackAdjust (8 + SIZEOF__ArgumentRegisters + 2 * 8) // x8, reg args , fp & lr already pushed
-#define ComCallPreStub_StackAlloc0 (ComCallPreStub_FrameSize - ComCallPreStub_FirstStackAdjust)
-#define ComCallPreStub_StackAlloc1 (ComCallPreStub_StackAlloc0 + SIZEOF__FloatArgumentRegisters + 8)// 8 for ErrorReturn
-#define ComCallPreStub_StackAlloc (ComCallPreStub_StackAlloc1 + (ComCallPreStub_StackAlloc1 & 8))
-
-#define ComCallPreStub_FrameOffset (ComCallPreStub_StackAlloc - (SIZEOF__ComMethodFrame - ComCallPreStub_FirstStackAdjust))
-#define ComCallPreStub_ErrorReturnOffset0 SIZEOF__FloatArgumentRegisters
-
-#define ComCallPreStub_FirstStackAdjust (ComCallPreStub_ErrorReturnOffset0 + (ComCallPreStub_ErrorReturnOffset0 & 8))
-
-// ------------------------------------------------------------------
-// COM to CLR stub called the first time a particular method is invoked.//
-//
-// On entry:
-// x12 : ComCallMethodDesc* provided by prepad thunk
-// plus user arguments in registers and on the stack
-//
-// On exit:
-// tail calls to real method
-//
-NESTED_ENTRY ComCallPreStub, _TEXT, NoHandler
-
- // Save arguments and return address
- PROLOG_SAVE_REG_PAIR fp, lr, -ComCallPreStub_FirstStackAdjust!
- PROLOG_STACK_ALLOC ComCallPreStub_StackAlloc
-
- SAVE_ARGUMENT_REGISTERS sp, (16+ComCallPreStub_StackAlloc)
-
- SAVE_FLOAT_ARGUMENT_REGISTERS sp, 0
-
- str x12, [sp, #(ComCallPreStub_FrameOffset + UnmanagedToManagedFrame__m_pvDatum)]
- add x0, sp, #(ComCallPreStub_FrameOffset)
- add x1, sp, #(ComCallPreStub_ErrorReturnOffset)
- bl C_FUNC(ComPreStubWorker)
-
- cbz x0, LOCAL_LABEL(ComCallPreStub_ErrorExit)
-
- mov x12, x0
-
- // pop the stack and restore original register state
- RESTORE_FLOAT_ARGUMENT_REGISTERS sp, 0
- RESTORE_ARGUMENT_REGISTERS sp, (16+ComCallPreStub_StackAlloc)
-
- EPILOG_STACK_FREE ComCallPreStub_StackAlloc
- EPILOG_RESTORE_REG_PAIR fp, lr, ComCallPreStub_FirstStackAdjust!
-
- // and tailcall to the actual method
- EPILOG_BRANCH_REG x12
-
-ComCallPreStub_ErrorExit
- ldr x0, [sp, #(ComCallPreStub_ErrorReturnOffset)] // ErrorReturn
-
- // pop the stack
- EPILOG_STACK_FREE ComCallPreStub_StackAlloc
- EPILOG_RESTORE_REG_PAIR fp, lr, ComCallPreStub_FirstStackAdjust!
-
- EPILOG_RETURN
-
-NESTED_END ComCallPreStub, _TEXT
-
-// ------------------------------------------------------------------
-// COM to CLR stub which sets up a ComMethodFrame and calls COMToCLRWorker.
-//
-// On entry:
-// x12 : ComCallMethodDesc* provided by prepad thunk
-// plus user arguments in registers and on the stack
-//
-// On exit:
-// Result in x0/d0 as per the real method being called
-//
- NESTED_ENTRY GenericComCallStub, _TEXT, NoHandler
-
- // Save arguments and return address
- PROLOG_SAVE_REG_PAIR fp, lr, -GenericComCallStub_FirstStackAdjust!
- PROLOG_STACK_ALLOC GenericComCallStub_StackAlloc
-
- SAVE_ARGUMENT_REGISTERS sp, (16+GenericComCallStub_StackAlloc)
- SAVE_FLOAT_ARGUMENT_REGISTERS sp, 0
-
- str x12, [sp, #(GenericComCallStub_FrameOffset + UnmanagedToManagedFrame__m_pvDatum)]
- add x1, sp, #GenericComCallStub_FrameOffset
- bl C_FUNC(COMToCLRWorker)
-
- // pop the stack
- EPILOG_STACK_FREE GenericComCallStub_StackAlloc
- EPILOG_RESTORE_REG_PAIR fp, lr, GenericComCallStub_FirstStackAdjust!
-
- EPILOG_RETURN
-
- NESTED_END GenericComCallStub, _TEXT
-
-// ------------------------------------------------------------------
-// COM to CLR stub called from COMToCLRWorker that actually dispatches to the real managed method.
-//
-// On entry:
-// x0 : dwStackSlots, count of argument stack slots to copy
-// x1 : pFrame, ComMethodFrame pushed by GenericComCallStub above
-// x2 : pTarget, address of code to call
-// x3 : pSecretArg, hidden argument passed to target above in x12
-// x4 : pDangerousThis, managed 'this' reference
-//
-// On exit:
-// Result in x0/d0 as per the real method being called
-//
- NESTED_ENTRY COMToCLRDispatchHelper, _TEXT,CallDescrWorkerUnwindFrameChainHandler
-
- PROLOG_SAVE_REG_PAIR fp, lr, -16!
-
- cbz x0, LOCAL_LABEL(COMToCLRDispatchHelper_RegSetup)
-
- add x9, x1, #SIZEOF__ComMethodFrame
- add x9, x9, x0, LSL #3
-COMToCLRDispatchHelper_StackLoop
- ldr x8, [x9, #-8]!
- str x8, [sp, #-8]!
- sub x0, x0, #1
- cbnz x0, LOCAL_LABEL(COMToCLRDispatchHelper_StackLoop)
-
-COMToCLRDispatchHelper_RegSetup
-
- RESTORE_FLOAT_ARGUMENT_REGISTERS x1, -1 * GenericComCallStub_FrameOffset
-
- mov lr, x2
- mov x12, x3
-
- mov x0, x4
-
- ldp x2, x3, [x1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters + 16)]
- ldp x4, x5, [x1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters + 32)]
- ldp x6, x7, [x1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters + 48)]
- ldr x8, [x1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters - 8)]
-
- ldr x1, [x1, #(SIZEOF__ComMethodFrame - SIZEOF__ArgumentRegisters + 8)]
-
- blr lr
-
- EPILOG_STACK_RESTORE
- EPILOG_RESTORE_REG_PAIR fp, lr, 16!
- EPILOG_RETURN
-
- NESTED_END COMToCLRDispatchHelper, _TEXT
-
-#endif // FEATURE_COMINTEROP
//
// x12 = UMEntryThunk*
//
@@ -1039,39 +893,6 @@ DynamicHelper DynamicHelperFrameFlags_ObjectArg, _Obj
DynamicHelper DynamicHelperFrameFlags_ObjectArg | DynamicHelperFrameFlags_ObjectArg2, _ObjObj
#endif
-#ifdef FEATURE_COMINTEROP
-
-// Function used by COM interop to get floating point return value (since it's not in the same
-// register(s) as non-floating point values).
-//
-// On entry//
-// x0 : size of the FP result (4 or 8 bytes)
-// x1 : pointer to 64-bit buffer to receive result
-//
-// On exit:
-// buffer pointed to by x1 on entry contains the float or double argument as appropriate
-//
-LEAF_ENTRY getFPReturn, _TEXT
- str d0, [x1]
-LEAF_END getFPReturn, _TEXT
-
-// ------------------------------------------------------------------
-// Function used by COM interop to set floating point return value (since it's not in the same
-// register(s) as non-floating point values).
-//
-// On entry:
-// x0 : size of the FP result (4 or 8 bytes)
-// x1 : 32-bit or 64-bit FP result
-//
-// On exit:
-// s0 : float result if x0 == 4
-// d0 : double result if x0 == 8
-//
-LEAF_ENTRY setFPReturn, _TEXT
- fmov d0, x1
-LEAF_END setFPReturn, _TEXT
-#endif
-
//
// JIT Static access helpers when coreclr host specifies single appdomain flag
//
diff --git a/src/coreclr/vm/array.cpp b/src/coreclr/vm/array.cpp
index a8494c45d8ed6b..1088bacb6275b4 100644
--- a/src/coreclr/vm/array.cpp
+++ b/src/coreclr/vm/array.cpp
@@ -981,7 +981,7 @@ Stub *GenerateArrayOpStub(ArrayMethodDesc* pMD)
static const ILStubTypes stubTypes[3] = { ILSTUB_ARRAYOP_GET, ILSTUB_ARRAYOP_SET, ILSTUB_ARRAYOP_ADDRESS };
- _ASSERTE(pMD->GetArrayFuncIndex() <= COUNTOF(stubTypes));
+ _ASSERTE(pMD->GetArrayFuncIndex() <= ARRAY_SIZE(stubTypes));
NDirectStubFlags arrayOpStubFlag = (NDirectStubFlags)stubTypes[pMD->GetArrayFuncIndex()];
MethodDesc * pStubMD = ILStubCache::CreateAndLinkNewILStubMethodDesc(pMD->GetLoaderAllocator(),
diff --git a/src/coreclr/vm/callingconvention.h b/src/coreclr/vm/callingconvention.h
index 00cc47e9661d0c..1fe96fde98922f 100644
--- a/src/coreclr/vm/callingconvention.h
+++ b/src/coreclr/vm/callingconvention.h
@@ -694,9 +694,8 @@ class ArgIteratorTemplate : public ARGITERATOR_BASE
unsigned byteArgSize = GetArgSize();
- // Question: why do not arm and x86 have similar checks?
- // Composites greater than 16 bytes are passed by reference
- if ((GetArgType() == ELEMENT_TYPE_VALUETYPE) && (byteArgSize > ENREGISTERED_PARAMTYPE_MAXSIZE))
+ // On ARM64 some composites are implicitly passed by reference.
+ if (IsArgPassedByRef())
{
byteArgSize = TARGET_POINTER_SIZE;
}
diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp
index e41efa704c72fd..87876cded4d57f 100644
--- a/src/coreclr/vm/ceeload.cpp
+++ b/src/coreclr/vm/ceeload.cpp
@@ -1775,6 +1775,42 @@ BOOL Module::IsRuntimeWrapExceptions()
return !!(m_dwPersistedFlags & WRAP_EXCEPTIONS);
}
+BOOL Module::IsRuntimeMarshallingEnabled()
+{
+ CONTRACTL
+ {
+ THROWS;
+ if (IsRuntimeMarshallingEnabledCached()) GC_NOTRIGGER; else GC_TRIGGERS;
+ MODE_ANY;
+ }
+ CONTRACTL_END
+
+ if (IsRuntimeMarshallingEnabledCached())
+ {
+ return !!(m_dwPersistedFlags & RUNTIME_MARSHALLING_ENABLED);
+ }
+
+ HRESULT hr;
+
+ IMDInternalImport *mdImport = GetAssembly()->GetManifestImport();
+
+ mdToken token;
+ if (SUCCEEDED(hr = mdImport->GetAssemblyFromScope(&token)))
+ {
+ const BYTE *pVal;
+ ULONG cbVal;
+
+ hr = mdImport->GetCustomAttributeByName(token,
+ g_DisableRuntimeMarshallingAttribute,
+ (const void**)&pVal, &cbVal);
+ }
+
+ FastInterlockOr(&m_dwPersistedFlags, RUNTIME_MARSHALLING_ENABLED_IS_CACHED |
+ (hr == S_OK ? 0 : RUNTIME_MARSHALLING_ENABLED));
+
+ return hr != S_OK;
+}
+
BOOL Module::IsPreV4Assembly()
{
CONTRACTL
@@ -3857,7 +3893,7 @@ MethodDesc *Module::FindMethod(mdToken pMethod)
#ifdef _DEBUG
CONTRACT_VIOLATION(ThrowsViolation);
char szMethodName [MAX_CLASSNAME_LENGTH];
- CEEInfo::findNameOfToken(this, pMethod, szMethodName, COUNTOF (szMethodName));
+ CEEInfo::findNameOfToken(this, pMethod, szMethodName, ARRAY_SIZE(szMethodName));
// This used to be IJW, but changed to LW_INTEROP to reclaim a bit in our log facilities
LOG((LF_INTEROP, LL_INFO10, "Failed to find Method: %s for Vtable Fixup\n", szMethodName));
#endif // _DEBUG
@@ -5765,7 +5801,7 @@ ExternalMethodBlobEntry::ExternalMethodBlobEntry(mdToken _nestedClass,
return static_cast(pEntry);
}
-static bool GetBasename(LPCWSTR _src, __out_ecount(dstlen) __out_z LPWSTR _dst, int dstlen)
+static bool GetBasename(LPCWSTR _src, _Out_writes_z_(dstlen) LPWSTR _dst, int dstlen)
{
LIMITED_METHOD_CONTRACT;
LPCWSTR src = _src;
diff --git a/src/coreclr/vm/ceeload.h b/src/coreclr/vm/ceeload.h
index e7dd5629a2c84b..2b9198b811732f 100644
--- a/src/coreclr/vm/ceeload.h
+++ b/src/coreclr/vm/ceeload.h
@@ -834,6 +834,11 @@ class Module
// Low level system assembly. Used by preferred zap module computation.
LOW_LEVEL_SYSTEM_ASSEMBLY_BY_NAME = 0x00004000,
+
+ //If setting has been cached
+ RUNTIME_MARSHALLING_ENABLED_IS_CACHED = 0x00008000,
+ //If runtime marshalling is enabled for this assembly
+ RUNTIME_MARSHALLING_ENABLED = 0x00010000,
};
Volatile m_dwTransientFlags;
@@ -1985,18 +1990,6 @@ class Module
return dac_cast(m_ModuleID);
}
- SIZE_T * GetAddrModuleID()
- {
- LIMITED_METHOD_CONTRACT;
- return (SIZE_T*) &m_ModuleID;
- }
-
- static SIZE_T GetOffsetOfModuleID()
- {
- LIMITED_METHOD_CONTRACT;
- return offsetof(Module, m_ModuleID);
- }
-
PTR_DomainLocalModule GetDomainLocalModule();
// LoaderHeap for storing IJW thunks
@@ -2071,6 +2064,18 @@ class Module
//-----------------------------------------------------------------------------------------
BOOL IsRuntimeWrapExceptions();
+ //-----------------------------------------------------------------------------------------
+ // If true, the built-in runtime-generated marshalling subsystem will be used for
+ // P/Invokes, function pointer invocations, and delegates defined in this module
+ //-----------------------------------------------------------------------------------------
+ BOOL IsRuntimeMarshallingEnabled();
+
+ BOOL IsRuntimeMarshallingEnabledCached()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_dwPersistedFlags & RUNTIME_MARSHALLING_ENABLED_IS_CACHED);
+ }
+
BOOL HasDefaultDllImportSearchPathsAttribute();
BOOL IsDefaultDllImportSearchPathsAttributeCached()
diff --git a/src/coreclr/vm/ceemain.cpp b/src/coreclr/vm/ceemain.cpp
index 593b8ff3a83d60..93ea7df27ed8c8 100644
--- a/src/coreclr/vm/ceemain.cpp
+++ b/src/coreclr/vm/ceemain.cpp
@@ -185,7 +185,6 @@
#ifdef FEATURE_COMINTEROP
#include "runtimecallablewrapper.h"
-#include "notifyexternals.h"
#include "mngstdinterfaces.h"
#include "interoplibinterface.h"
#endif // FEATURE_COMINTEROP
@@ -221,7 +220,7 @@
#include "genanalysis.h"
-static int GetThreadUICultureId(__out LocaleIDValue* pLocale); // TODO: This shouldn't use the LCID. We should rely on name instead
+static int GetThreadUICultureId(_Out_ LocaleIDValue* pLocale); // TODO: This shouldn't use the LCID. We should rely on name instead
static HRESULT GetThreadUICultureNames(__inout StringArrayList* pCultureNames);
@@ -2136,7 +2135,7 @@ INT32 GetLatchedExitCode (void)
// Impl for UtilLoadStringRC Callback: In VM, we let the thread decide culture
// Return an int uniquely describing which language this thread is using for ui.
// ---------------------------------------------------------------------------
-static int GetThreadUICultureId(__out LocaleIDValue* pLocale)
+static int GetThreadUICultureId(_Out_ LocaleIDValue* pLocale)
{
CONTRACTL{
NOTHROW;
diff --git a/src/coreclr/vm/class.h b/src/coreclr/vm/class.h
index 0ccacd36a9f914..9aa6c6994e726e 100644
--- a/src/coreclr/vm/class.h
+++ b/src/coreclr/vm/class.h
@@ -363,19 +363,21 @@ class EEClassLayoutInfo
private:
enum {
// TRUE if the GC layout of the class is bit-for-bit identical
- // to its unmanaged counterpart (i.e. no internal reference fields,
- // no ansi-unicode char conversions required, etc.) Used to
- // optimize marshaling.
- e_BLITTABLE = 0x01,
- // Post V1.0 addition: Is this type also sequential in managed memory?
- e_MANAGED_SEQUENTIAL = 0x02,
+ // to its unmanaged counterpart with the runtime marshalling system
+ // (i.e. no internal reference fields, no ansi-unicode char conversions required, etc.)
+ // Used to optimize marshaling.
+ e_BLITTABLE = 0x01,
+ // Is this type also sequential in managed memory?
+ e_MANAGED_SEQUENTIAL = 0x02,
// When a sequential/explicit type has no fields, it is conceptually
// zero-sized, but actually is 1 byte in length. This holds onto this
// fact and allows us to revert the 1 byte of padding when another
// explicit type inherits from this type.
- e_ZERO_SIZED = 0x04,
+ e_ZERO_SIZED = 0x04,
// The size of the struct is explicitly specified in the meta-data.
- e_HAS_EXPLICIT_SIZE = 0x08
+ e_HAS_EXPLICIT_SIZE = 0x08,
+ // The type recursively has a field that is LayoutKind.Auto and not an enum.
+ e_HAS_AUTO_LAYOUT_FIELD_IN_LAYOUT = 0x10
};
BYTE m_bFlags;
@@ -419,6 +421,12 @@ class EEClassLayoutInfo
return (m_bFlags & e_HAS_EXPLICIT_SIZE) == e_HAS_EXPLICIT_SIZE;
}
+ BOOL HasAutoLayoutField() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_bFlags & e_HAS_AUTO_LAYOUT_FIELD_IN_LAYOUT) == e_HAS_AUTO_LAYOUT_FIELD_IN_LAYOUT;
+ }
+
BYTE GetPackingSize() const
{
LIMITED_METHOD_CONTRACT;
@@ -453,6 +461,13 @@ class EEClassLayoutInfo
m_bFlags = hasExplicitSize ? (m_bFlags | e_HAS_EXPLICIT_SIZE)
: (m_bFlags & ~e_HAS_EXPLICIT_SIZE);
}
+
+ void SetHasAutoLayoutField(BOOL hasAutoLayoutField)
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_bFlags = hasAutoLayoutField ? (m_bFlags | e_HAS_AUTO_LAYOUT_FIELD_IN_LAYOUT)
+ : (m_bFlags & ~e_HAS_AUTO_LAYOUT_FIELD_IN_LAYOUT);
+ }
};
//
@@ -1395,6 +1410,8 @@ class EEClass // DO NOT CREATE A NEW EEClass USING NEW!
BOOL HasExplicitSize();
+ BOOL IsAutoLayoutOrHasAutoLayoutField();
+
static void GetBestFitMapping(MethodTable * pMT, BOOL *pfBestFitMapping, BOOL *pfThrowOnUnmappableChar);
/*
@@ -2082,6 +2099,13 @@ inline BOOL EEClass::HasExplicitSize()
return HasLayout() && GetLayoutInfo()->HasExplicitSize();
}
+inline BOOL EEClass::IsAutoLayoutOrHasAutoLayoutField()
+{
+ LIMITED_METHOD_CONTRACT;
+ // If this type is not auto
+ return !HasLayout() || GetLayoutInfo()->HasAutoLayoutField();
+}
+
//==========================================================================
// These routines manage the prestub (a bootstrapping stub that all
// FunctionDesc's are initialized with.)
diff --git a/src/coreclr/vm/classhash.cpp b/src/coreclr/vm/classhash.cpp
index 1974e7c3a26db1..28c636f7c9aadd 100644
--- a/src/coreclr/vm/classhash.cpp
+++ b/src/coreclr/vm/classhash.cpp
@@ -348,7 +348,7 @@ EEClassHashEntry_t *EEClassHashTable::InsertValue(LPCUTF8 pszNamespace, LPCUTF8
class ConstructKeyCallbackValidate : public EEClassHashTable::ConstructKeyCallback
{
public:
- virtual void UseKeys(__in_ecount(2) LPUTF8 *Key)
+ virtual void UseKeys(_In_reads_(2) LPUTF8 *Key)
{
LIMITED_METHOD_CONTRACT;
STATIC_CONTRACT_DEBUG_ONLY;
@@ -693,7 +693,7 @@ EEClassHashEntry_t * EEClassHashTable::GetValue(const NameHandle* pName, PTR_VOI
class ConstructKeyCallbackCompare : public EEClassHashTable::ConstructKeyCallback
{
public:
- virtual void UseKeys(__in_ecount(2) LPUTF8 *pKey1)
+ virtual void UseKeys(_In_reads_(2) LPUTF8 *pKey1)
{
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;
@@ -757,7 +757,7 @@ BOOL EEClassHashTable::CompareKeys(PTR_EEClassHashEntry pEntry, LPCUTF8 * pKey2)
class ConstructKeyCallbackCaseInsensitive : public EEClassHashTable::ConstructKeyCallback
{
public:
- virtual void UseKeys(__in_ecount(2) LPUTF8 *key)
+ virtual void UseKeys(_In_reads_(2) LPUTF8 *key)
{
WRAPPER_NO_CONTRACT;
diff --git a/src/coreclr/vm/classhash.h b/src/coreclr/vm/classhash.h
index 4d8da2e7c22c61..4fd943165b4787 100644
--- a/src/coreclr/vm/classhash.h
+++ b/src/coreclr/vm/classhash.h
@@ -86,7 +86,7 @@ class EEClassHashTable : public DacEnumerableHashTablem_alignment = TARGET_POINTER_SIZE;
- pManagedPlacementInfo->m_size = TARGET_POINTER_SIZE;
+ RawFieldPlacementInfo placementInfo;
+ // Initialize offset to a dummy value as we set it to the correct value later.
+ placementInfo.m_offset = (UINT32)-1;
+ placementInfo.m_size = TARGET_POINTER_SIZE;
+ placementInfo.m_alignment = TARGET_POINTER_SIZE;
// This type may qualify for ManagedSequential. Collect managed size and alignment info.
if (CorTypeInfo::IsPrimitiveType(corElemType))
{
// Safe cast - no primitive type is larger than 4gb!
- pManagedPlacementInfo->m_size = ((UINT32)CorTypeInfo::Size(corElemType));
+ placementInfo.m_size = ((UINT32)CorTypeInfo::Size(corElemType));
#if defined(TARGET_X86) && defined(UNIX_X86_ABI)
switch (corElemType)
{
@@ -251,67 +246,87 @@ namespace
case ELEMENT_TYPE_U8:
case ELEMENT_TYPE_R8:
{
- pManagedPlacementInfo->m_alignment = 4;
+ placementInfo.m_alignment = 4;
break;
}
default:
{
- pManagedPlacementInfo->m_alignment = pManagedPlacementInfo->m_size;
+ placementInfo.m_alignment = placementInfo.m_size;
break;
}
}
#else // TARGET_X86 && UNIX_X86_ABI
- pManagedPlacementInfo->m_alignment = pManagedPlacementInfo->m_size;
+ placementInfo.m_alignment = placementInfo.m_size;
#endif
- return FALSE;
}
else if (corElemType == ELEMENT_TYPE_PTR || corElemType == ELEMENT_TYPE_FNPTR)
{
- pManagedPlacementInfo->m_size = TARGET_POINTER_SIZE;
- pManagedPlacementInfo->m_alignment = TARGET_POINTER_SIZE;
-
- return FALSE;
+ placementInfo.m_size = TARGET_POINTER_SIZE;
+ placementInfo.m_alignment = TARGET_POINTER_SIZE;
}
else if (corElemType == ELEMENT_TYPE_VALUETYPE)
{
- TypeHandle pNestedType = fsig.GetLastTypeHandleThrowing(ClassLoader::LoadTypes,
- CLASS_LOAD_APPROXPARENTS,
- TRUE);
+ _ASSERTE(!pNestedType.IsNull());
- pManagedPlacementInfo->m_size = (pNestedType.GetMethodTable()->GetNumInstanceFieldBytes());
+ placementInfo.m_size = (pNestedType.GetMethodTable()->GetNumInstanceFieldBytes());
#if !defined(TARGET_64BIT) && (DATA_ALIGNMENT > 4)
- if (pManagedPlacementInfo->m_size >= DATA_ALIGNMENT)
+ if (placementInfo.m_size >= DATA_ALIGNMENT)
{
- pManagedPlacementInfo->m_alignment = DATA_ALIGNMENT;
+ placementInfo.m_alignment = DATA_ALIGNMENT;
}
else
#elif defined(FEATURE_64BIT_ALIGNMENT)
if (pNestedType.RequiresAlign8())
{
- pManagedPlacementInfo->m_alignment = 8;
+ placementInfo.m_alignment = 8;
}
else
#endif // FEATURE_64BIT_ALIGNMENT
if (pNestedType.GetMethodTable()->ContainsPointers())
{
// this field type has GC pointers in it, which need to be pointer-size aligned
- // so do this if it has not been done already
- pManagedPlacementInfo->m_alignment = TARGET_POINTER_SIZE;
+ placementInfo.m_alignment = TARGET_POINTER_SIZE;
}
else
{
- pManagedPlacementInfo->m_alignment = pNestedType.GetMethodTable()->GetFieldAlignmentRequirement();
+ placementInfo.m_alignment = pNestedType.GetMethodTable()->GetFieldAlignmentRequirement();
}
- // Types that have GC Pointer fields (objects or byrefs) are disqualified from ManagedSequential layout.
- return pNestedType.GetMethodTable()->ContainsPointers() != FALSE;
}
// No other type permitted for ManagedSequential.
+ return placementInfo;
+ }
+
+ BOOL TypeHasGCPointers(CorElementType corElemType, TypeHandle pNestedType)
+ {
+ if (CorTypeInfo::IsPrimitiveType(corElemType) || corElemType == ELEMENT_TYPE_PTR || corElemType == ELEMENT_TYPE_FNPTR)
+ {
+ return FALSE;
+ }
+ if (corElemType == ELEMENT_TYPE_VALUETYPE)
+ {
+ _ASSERTE(!pNestedType.IsNull());
+ return pNestedType.GetMethodTable()->ContainsPointers() != FALSE;
+ }
return TRUE;
}
+ BOOL TypeHasAutoLayoutField(CorElementType corElemType, TypeHandle pNestedType)
+ {
+ if (CorTypeInfo::IsPrimitiveType(corElemType) || corElemType == ELEMENT_TYPE_PTR || corElemType == ELEMENT_TYPE_FNPTR)
+ {
+ return FALSE;
+ }
+ if (corElemType == ELEMENT_TYPE_VALUETYPE)
+ {
+ _ASSERTE(!pNestedType.IsNull());
+ return pNestedType.IsEnum() || pNestedType.GetMethodTable()->IsAutoLayoutOrHasAutoLayoutField();
+ }
+ return FALSE;
+ }
+
#ifdef UNIX_AMD64_ABI
void SystemVAmd64CheckForPassNativeStructInRegister(MethodTable* pMT, EEClassNativeLayoutInfo* pNativeLayoutInfo)
{
@@ -437,6 +452,7 @@ namespace
ParseNativeTypeFlags nativeTypeFlags,
const SigTypeContext* pTypeContext,
BOOL* fDisqualifyFromManagedSequential,
+ BOOL* fHasAutoLayoutField,
LayoutRawFieldInfo* pFieldInfoArrayOut,
BOOL* pIsBlittableOut,
ULONG* cInstanceFields
@@ -505,7 +521,16 @@ namespace
#endif
MetaSig fsig(pCOMSignature, cbCOMSignature, pModule, pTypeContext, MetaSig::sigField);
CorElementType corElemType = fsig.NextArgNormalized();
- *fDisqualifyFromManagedSequential |= CheckIfDisqualifiedFromManagedSequential(corElemType, fsig, &pFieldInfoArrayOut->m_placement);
+ TypeHandle typeHandleMaybe;
+ if (corElemType == ELEMENT_TYPE_VALUETYPE) // Only look up the next element in the signature if it is a value type to avoid causing recursive type loads in valid scenarios.
+ {
+ typeHandleMaybe = fsig.GetLastTypeHandleThrowing(ClassLoader::LoadTypes,
+ CLASS_LOAD_APPROXPARENTS,
+ TRUE);
+ }
+ pFieldInfoArrayOut->m_placement = GetFieldPlacementInfo(corElemType, typeHandleMaybe);
+ *fDisqualifyFromManagedSequential |= TypeHasGCPointers(corElemType, typeHandleMaybe);
+ *fHasAutoLayoutField |= TypeHasAutoLayoutField(corElemType, typeHandleMaybe);
if (!IsFieldBlittable(pModule, fd, fsig.GetArgProps(), pTypeContext, nativeTypeFlags))
*pIsBlittableOut = FALSE;
@@ -598,6 +623,7 @@ VOID EEClassLayoutInfo::CollectLayoutFieldMetadataThrowing(
// Running tote - if anything in this type disqualifies it from being ManagedSequential, somebody will set this to TRUE by the the time
// function exits.
BOOL fDisqualifyFromManagedSequential;
+ BOOL hasAutoLayoutField = FALSE;
// Check if this type might be ManagedSequential. Only valuetypes marked Sequential can be
// ManagedSequential. Other issues checked below might also disqualify the type.
@@ -612,6 +638,11 @@ VOID EEClassLayoutInfo::CollectLayoutFieldMetadataThrowing(
fDisqualifyFromManagedSequential = TRUE;
}
+ if (pParentMT && !pParentMT->IsValueTypeClass() && pParentMT->IsAutoLayoutOrHasAutoLayoutField())
+ {
+ hasAutoLayoutField = TRUE;
+ }
+
BOOL fHasNonTrivialParent = pParentMT &&
!pParentMT->IsObjectClass() &&
@@ -659,6 +690,7 @@ VOID EEClassLayoutInfo::CollectLayoutFieldMetadataThrowing(
nativeTypeFlags,
pTypeContext,
&fDisqualifyFromManagedSequential,
+ &hasAutoLayoutField,
pInfoArrayOut,
&isBlittable,
&cInstanceFields
@@ -671,6 +703,8 @@ VOID EEClassLayoutInfo::CollectLayoutFieldMetadataThrowing(
isBlittable = isBlittable && (fHasNonTrivialParent ? pParentMT->IsBlittable() : TRUE);
pEEClassLayoutInfoOut->SetIsBlittable(isBlittable);
+ pEEClassLayoutInfoOut->SetHasAutoLayoutField(hasAutoLayoutField);
+
S_UINT32 cbSortArraySize = S_UINT32(cTotalFields) * S_UINT32(sizeof(LayoutRawFieldInfo*));
if (cbSortArraySize.IsOverflow())
{
diff --git a/src/coreclr/vm/classnames.h b/src/coreclr/vm/classnames.h
index 94e9b1025c7a4b..7d71ce2c7d891c 100644
--- a/src/coreclr/vm/classnames.h
+++ b/src/coreclr/vm/classnames.h
@@ -113,4 +113,6 @@
#define g_CriticalFinalizerObjectName "CriticalFinalizerObject"
+#define g_DisableRuntimeMarshallingAttribute "System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute"
+
#endif //!__CLASSNAMES_H__
diff --git a/src/coreclr/vm/clrex.cpp b/src/coreclr/vm/clrex.cpp
index a1fe3e4c8985d4..f1b231ff54950c 100644
--- a/src/coreclr/vm/clrex.cpp
+++ b/src/coreclr/vm/clrex.cpp
@@ -815,7 +815,7 @@ void CLRException::HandlerState::CleanupTry()
Exception::HandlerState::CleanupTry();
}
-void CLRException::HandlerState::SetupCatch(INDEBUG_COMMA(__in_z const char * szFile) int lineNum)
+void CLRException::HandlerState::SetupCatch(INDEBUG_COMMA(_In_z_ const char * szFile) int lineNum)
{
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_NOTRIGGER;
diff --git a/src/coreclr/vm/clrex.h b/src/coreclr/vm/clrex.h
index cf7d458f90ff35..fe3797279af6de 100644
--- a/src/coreclr/vm/clrex.h
+++ b/src/coreclr/vm/clrex.h
@@ -178,7 +178,7 @@ class CLRException : public Exception
HandlerState(Thread * pThread, NonNullThread dummy);
void CleanupTry();
- void SetupCatch(INDEBUG_COMMA(__in_z const char * szFile) int lineNum);
+ void SetupCatch(INDEBUG_COMMA(_In_z_ const char * szFile) int lineNum);
#ifdef LOGGING // Use parent implementation that inlines into nothing in retail build
void SucceedCatch();
#endif
diff --git a/src/coreclr/vm/clrtocomcall.cpp b/src/coreclr/vm/clrtocomcall.cpp
index a7f91f7e13d39e..3a7847089b682f 100644
--- a/src/coreclr/vm/clrtocomcall.cpp
+++ b/src/coreclr/vm/clrtocomcall.cpp
@@ -617,7 +617,7 @@ UINT32 CLRToCOMLateBoundWorker(
if (hr == S_OK)
{
WCHAR strTmp[ARRAY_SIZE(DISPID_NAME_FORMAT_STRING W("4294967295"))];
- _snwprintf_s(strTmp, COUNTOF(strTmp), _TRUNCATE, DISPID_NAME_FORMAT_STRING, dispId);
+ _snwprintf_s(strTmp, ARRAY_SIZE(strTmp), _TRUNCATE, DISPID_NAME_FORMAT_STRING, dispId);
gc.MemberName = StringObject::NewString(strTmp);
}
else
diff --git a/src/coreclr/vm/clsload.cpp b/src/coreclr/vm/clsload.cpp
index 0578cc20b54698..a2b0129e2dd71f 100644
--- a/src/coreclr/vm/clsload.cpp
+++ b/src/coreclr/vm/clsload.cpp
@@ -1753,7 +1753,7 @@ HRESULT ClassLoader::FindTypeDefByExportedType(IMDInternalImport *pCTImport, mdE
#ifndef DACCESS_COMPILE
-VOID ClassLoader::CreateCanonicallyCasedKey(LPCUTF8 pszNameSpace, LPCUTF8 pszName, __out LPUTF8 *ppszOutNameSpace, __out LPUTF8 *ppszOutName)
+VOID ClassLoader::CreateCanonicallyCasedKey(LPCUTF8 pszNameSpace, LPCUTF8 pszName, _Out_ LPUTF8 *ppszOutNameSpace, _Out_ LPUTF8 *ppszOutName)
{
CONTRACTL
{
diff --git a/src/coreclr/vm/clsload.hpp b/src/coreclr/vm/clsload.hpp
index 53afd0b38f4cf5..820e69d8cd9cf7 100644
--- a/src/coreclr/vm/clsload.hpp
+++ b/src/coreclr/vm/clsload.hpp
@@ -874,7 +874,7 @@ class ClassLoader
//Creates a key with both the namespace and name converted to lowercase and
//made into a proper namespace-path.
VOID CreateCanonicallyCasedKey(LPCUTF8 pszNameSpace, LPCUTF8 pszName,
- __out LPUTF8 *ppszOutNameSpace, __out LPUTF8 *ppszOutName);
+ _Out_ LPUTF8 *ppszOutNameSpace, _Out_ LPUTF8 *ppszOutName);
static HRESULT FindTypeDefByExportedType(IMDInternalImport *pCTImport,
mdExportedType mdCurrent,
diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp
index 56805d6a3534f3..fe68c6a0f0d175 100644
--- a/src/coreclr/vm/codeman.cpp
+++ b/src/coreclr/vm/codeman.cpp
@@ -1257,7 +1257,7 @@ void EEJitManager::SetCpuInfo()
#endif // TARGET_X86
#if defined(TARGET_X86) || defined(TARGET_AMD64)
- CPUCompileFlags.Set(InstructionSet_X86Base);
+ CPUCompileFlags.Set(InstructionSet_X86Base);
// NOTE: The below checks are based on the information reported by
// Intel® 64 and IA-32 Architectures Software Developer’s Manual. Volume 2
@@ -1469,6 +1469,7 @@ void EEJitManager::SetCpuInfo()
// FP and SIMD support are enabled by default
CPUCompileFlags.Set(InstructionSet_ArmBase);
CPUCompileFlags.Set(InstructionSet_AdvSimd);
+
// PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE (30)
if (IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE))
{
@@ -1492,6 +1493,152 @@ void EEJitManager::SetCpuInfo()
}
#endif // TARGET_ARM64
+ // Now that we've queried the actual hardware support, we need to adjust what is actually supported based
+ // on some externally available config switches that exist so users can test code for downlevel hardware.
+
+#if defined(TARGET_AMD64) || defined(TARGET_X86)
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableHWIntrinsic))
+ {
+ CPUCompileFlags.Clear(InstructionSet_X86Base);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableAES))
+ {
+ CPUCompileFlags.Clear(InstructionSet_AES);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableAVX))
+ {
+ CPUCompileFlags.Clear(InstructionSet_AVX);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableAVX2))
+ {
+ CPUCompileFlags.Clear(InstructionSet_AVX2);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableAVXVNNI))
+ {
+ CPUCompileFlags.Clear(InstructionSet_AVXVNNI);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableBMI1))
+ {
+ CPUCompileFlags.Clear(InstructionSet_BMI1);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableBMI2))
+ {
+ CPUCompileFlags.Clear(InstructionSet_BMI2);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableFMA))
+ {
+ CPUCompileFlags.Clear(InstructionSet_FMA);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableLZCNT))
+ {
+ CPUCompileFlags.Clear(InstructionSet_LZCNT);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnablePCLMULQDQ))
+ {
+ CPUCompileFlags.Clear(InstructionSet_PCLMULQDQ);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnablePOPCNT))
+ {
+ CPUCompileFlags.Clear(InstructionSet_POPCNT);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableSSE))
+ {
+ CPUCompileFlags.Clear(InstructionSet_SSE);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableSSE2))
+ {
+ CPUCompileFlags.Clear(InstructionSet_SSE2);
+ }
+
+ // We need to additionally check that EXTERNAL_EnableSSE3_4 is set, as that
+ // is a prexisting config flag that controls the SSE3+ ISAs
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableSSE3) || !CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableSSE3_4))
+ {
+ CPUCompileFlags.Clear(InstructionSet_SSE3);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableSSE41))
+ {
+ CPUCompileFlags.Clear(InstructionSet_SSE41);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableSSE42))
+ {
+ CPUCompileFlags.Clear(InstructionSet_SSE42);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableSSSE3))
+ {
+ CPUCompileFlags.Clear(InstructionSet_SSSE3);
+ }
+#elif defined(TARGET_ARM64)
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableHWIntrinsic))
+ {
+ CPUCompileFlags.Clear(InstructionSet_ArmBase);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableArm64AdvSimd))
+ {
+ CPUCompileFlags.Clear(InstructionSet_AdvSimd);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableArm64Aes))
+ {
+ CPUCompileFlags.Clear(InstructionSet_Aes);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableArm64Atomics))
+ {
+ CPUCompileFlags.Clear(InstructionSet_Atomics);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableArm64Crc32))
+ {
+ CPUCompileFlags.Clear(InstructionSet_Crc32);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableArm64Dczva))
+ {
+ CPUCompileFlags.Clear(InstructionSet_Dczva);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableArm64Dp))
+ {
+ CPUCompileFlags.Clear(InstructionSet_Dp);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableArm64Rdm))
+ {
+ CPUCompileFlags.Clear(InstructionSet_Rdm);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableArm64Sha1))
+ {
+ CPUCompileFlags.Clear(InstructionSet_Sha1);
+ }
+
+ if (!CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableArm64Sha256))
+ {
+ CPUCompileFlags.Clear(InstructionSet_Sha256);
+ }
+#endif
+
+ // These calls are very important as it ensures the flags are consistent with any
+ // removals specified above. This includes removing corresponding 64-bit ISAs
+ // and any other implications such as SSE2 depending on SSE or AdvSimd on ArmBase
+
CPUCompileFlags.Set64BitInstructionSetVariants();
CPUCompileFlags.EnsureValidInstructionSetSupport();
@@ -1889,7 +2036,7 @@ CodeFragmentHeap::~CodeFragmentHeap()
TaggedMemAllocPtr CodeFragmentHeap::RealAllocAlignedMem(size_t dwRequestedSize
,unsigned dwAlignment
#ifdef _DEBUG
- ,__in __in_z const char *szFile
+ ,_In_ _In_z_ const char *szFile
,int lineNum
#endif
)
@@ -1963,9 +2110,9 @@ TaggedMemAllocPtr CodeFragmentHeap::RealAllocAlignedMem(size_t dwRequestedSize
void CodeFragmentHeap::RealBackoutMem(void *pMem
, size_t dwSize
#ifdef _DEBUG
- , __in __in_z const char *szFile
+ , _In_ _In_z_ const char *szFile
, int lineNum
- , __in __in_z const char *szAllocFile
+ , _In_ _In_z_ const char *szAllocFile
, int allocLineNum
#endif
)
diff --git a/src/coreclr/vm/codeman.h b/src/coreclr/vm/codeman.h
index 032ee960f63198..e2afd8ce645406 100644
--- a/src/coreclr/vm/codeman.h
+++ b/src/coreclr/vm/codeman.h
@@ -686,7 +686,7 @@ class CodeFragmentHeap : public ILoaderHeapBackout
TaggedMemAllocPtr RealAllocAlignedMem(size_t dwRequestedSize
,unsigned dwAlignment
#ifdef _DEBUG
- ,__in __in_z const char *szFile
+ ,_In_ _In_z_ const char *szFile
,int lineNum
#endif
);
@@ -694,9 +694,9 @@ class CodeFragmentHeap : public ILoaderHeapBackout
virtual void RealBackoutMem(void *pMem
, size_t dwSize
#ifdef _DEBUG
- , __in __in_z const char *szFile
+ , _In_ _In_z_ const char *szFile
, int lineNum
- , __in __in_z const char *szAllocFile
+ , _In_ _In_z_ const char *szAllocFile
, int allocLineNum
#endif
) DAC_EMPTY();
diff --git a/src/coreclr/vm/cominterfacemarshaler.cpp b/src/coreclr/vm/cominterfacemarshaler.cpp
index c3a3fef8b8ad65..93101305133e1d 100644
--- a/src/coreclr/vm/cominterfacemarshaler.cpp
+++ b/src/coreclr/vm/cominterfacemarshaler.cpp
@@ -14,7 +14,6 @@
#include "runtimecallablewrapper.h"
#include "cominterfacemarshaler.h"
#include "interopconverter.h"
-#include "notifyexternals.h"
#include "comdelegate.h"
#include "olecontexthelpers.h"
diff --git a/src/coreclr/vm/comreflectioncache.hpp b/src/coreclr/vm/comreflectioncache.hpp
index 80909f94a0876b..f2ac4b84ae64ac 100644
--- a/src/coreclr/vm/comreflectioncache.hpp
+++ b/src/coreclr/vm/comreflectioncache.hpp
@@ -233,7 +233,7 @@ struct DispIDCacheElement
pMT = var.pMT;
strNameLength = var.strNameLength;
lcid = var.lcid;
- wcscpy_s (strName, COUNTOF(strName), var.strName);
+ wcscpy_s (strName, ARRAY_SIZE(strName), var.strName);
return *this;
}
diff --git a/src/coreclr/vm/comtoclrcall.cpp b/src/coreclr/vm/comtoclrcall.cpp
index 6337e9436b975a..4568d9884f6e82 100644
--- a/src/coreclr/vm/comtoclrcall.cpp
+++ b/src/coreclr/vm/comtoclrcall.cpp
@@ -32,7 +32,6 @@
#include "mlinfo.h"
#include "dbginterface.h"
#include "sigbuilder.h"
-#include "notifyexternals.h"
#include "callconvbuilder.hpp"
#include "comdelegate.h"
#include "finalizerthread.h"
diff --git a/src/coreclr/vm/comutilnative.cpp b/src/coreclr/vm/comutilnative.cpp
index 141eb7b64b0723..9e30b6090dbf68 100644
--- a/src/coreclr/vm/comutilnative.cpp
+++ b/src/coreclr/vm/comutilnative.cpp
@@ -77,7 +77,7 @@ bool IsDigit(WCHAR c, int radix, int *result)
return false;
}
-INT32 wtoi(__in_ecount(length) WCHAR* wstr, DWORD length)
+INT32 wtoi(_In_reads_(length) WCHAR* wstr, DWORD length)
{
CONTRACTL
{
diff --git a/src/coreclr/vm/dacenumerablehash.inl b/src/coreclr/vm/dacenumerablehash.inl
index 4216ef35033724..049329bbfbc67d 100644
--- a/src/coreclr/vm/dacenumerablehash.inl
+++ b/src/coreclr/vm/dacenumerablehash.inl
@@ -243,7 +243,7 @@ void DacEnumerableHashTable::GrowTable()
template
DWORD DacEnumerableHashTable::NextLargestPrime(DWORD dwNumber)
{
- for (DWORD i = 0; i < COUNTOF(g_rgPrimes); i++)
+ for (DWORD i = 0; i < ARRAY_SIZE(g_rgPrimes); i++)
if (g_rgPrimes[i] >= dwNumber)
{
dwNumber = g_rgPrimes[i];
@@ -400,8 +400,8 @@ namespace HashTableDetail
{
// Use the C++ detection idiom (https://isocpp.org/blog/2017/09/detection-idiom-a-stopgap-for-concepts-simon-brand) to call the
// derived table's EnumMemoryRegionsForEntry method if it defines one.
- template
- using void_t = void;
+ template struct make_void { using type = void; };
+ template using void_t = typename make_void::type;
template
struct negation : std::integral_constant { };
diff --git a/src/coreclr/vm/dbginterface.h b/src/coreclr/vm/dbginterface.h
index 0a3e7d0520ce00..51b2c3bf36358f 100644
--- a/src/coreclr/vm/dbginterface.h
+++ b/src/coreclr/vm/dbginterface.h
@@ -263,8 +263,8 @@ class DebugInterface
virtual void SendLogSwitchSetting (int iLevel,
int iReason,
- __in_z LPCWSTR pLogSwitchName,
- __in_z LPCWSTR pParentSwitchName) = 0;
+ _In_z_ LPCWSTR pLogSwitchName,
+ _In_z_ LPCWSTR pParentSwitchName) = 0;
virtual bool IsLoggingEnabled (void) = 0;
@@ -374,7 +374,7 @@ class DebugInterface
virtual DWORD* GetJMCFlagAddr(Module * pModule) = 0;
// notification for SQL fiber debugging support
- virtual void CreateConnection(CONNID dwConnectionId, __in_z WCHAR *wzName) = 0;
+ virtual void CreateConnection(CONNID dwConnectionId, _In_z_ WCHAR *wzName) = 0;
virtual void DestroyConnection(CONNID dwConnectionId) = 0;
virtual void ChangeConnection(CONNID dwConnectionId) = 0;
diff --git a/src/coreclr/vm/debughelp.cpp b/src/coreclr/vm/debughelp.cpp
index 17e62fcdf7208b..822ee4a233fb40 100644
--- a/src/coreclr/vm/debughelp.cpp
+++ b/src/coreclr/vm/debughelp.cpp
@@ -337,7 +337,7 @@ MethodDesc* AsMethodDesc(size_t addr)
/*******************************************************************/
WCHAR* formatMethodTable(MethodTable* pMT,
- __out_z __inout_ecount(bufSize) WCHAR* buff,
+ _Inout_updates_z_(bufSize) WCHAR* buff,
DWORD bufSize)
{
CONTRACTL
@@ -377,7 +377,7 @@ WCHAR* formatMethodTable(MethodTable* pMT,
/*******************************************************************/
WCHAR* formatMethodDesc(MethodDesc* pMD,
- __out_z __inout_ecount(bufSize) WCHAR* buff,
+ _Inout_updates_z_(bufSize) WCHAR* buff,
DWORD bufSize)
{
CONTRACTL
@@ -1015,7 +1015,7 @@ void printfToDbgOut(const char* fmt, ...)
va_start(args, fmt);
char buffer[4096];
- _vsnprintf_s(buffer, COUNTOF(buffer), _TRUNCATE, fmt, args);
+ _vsnprintf_s(buffer, ARRAY_SIZE(buffer), _TRUNCATE, fmt, args);
va_end(args);
OutputDebugStringA( buffer );
diff --git a/src/coreclr/vm/dispatchinfo.cpp b/src/coreclr/vm/dispatchinfo.cpp
index 3b231c3882baa2..b026040ce0b201 100644
--- a/src/coreclr/vm/dispatchinfo.cpp
+++ b/src/coreclr/vm/dispatchinfo.cpp
@@ -197,7 +197,7 @@ void DispatchMemberInfo::Init()
EX_END_CATCH(RethrowTerminalExceptions);
}
-HRESULT DispatchMemberInfo::GetIDsOfParameters(__in_ecount(NumNames) WCHAR **astrNames, int NumNames, DISPID *aDispIds, BOOL bCaseSensitive)
+HRESULT DispatchMemberInfo::GetIDsOfParameters(_In_reads_(NumNames) WCHAR **astrNames, int NumNames, DISPID *aDispIds, BOOL bCaseSensitive)
{
CONTRACTL
{
diff --git a/src/coreclr/vm/dispatchinfo.h b/src/coreclr/vm/dispatchinfo.h
index c109741eea6dda..623a56c7ab0c5e 100644
--- a/src/coreclr/vm/dispatchinfo.h
+++ b/src/coreclr/vm/dispatchinfo.h
@@ -68,7 +68,7 @@ struct DispatchMemberInfo
}
// This method retrieves the ID's of the specified names.
- HRESULT GetIDsOfParameters(__in_ecount(NumNames) WCHAR **astrNames, int NumNames, DISPID *aDispIds, BOOL bCaseSensitive);
+ HRESULT GetIDsOfParameters(_In_reads_(NumNames) WCHAR **astrNames, int NumNames, DISPID *aDispIds, BOOL bCaseSensitive);
// Accessors.
PTRARRAYREF GetParameters();
diff --git a/src/coreclr/vm/dllimport.cpp b/src/coreclr/vm/dllimport.cpp
index 6c4ce7608660ee..3a35a8e108fa45 100644
--- a/src/coreclr/vm/dllimport.cpp
+++ b/src/coreclr/vm/dllimport.cpp
@@ -107,6 +107,7 @@ StubSigDesc::StubSigDesc(MethodDesc *pMD)
m_tkMethodDef = pMD->GetMemberDef();
SigTypeContext::InitTypeContext(pMD, &m_typeContext);
+ m_pMetadataModule = pMD->GetModule();
m_pLoaderModule = pMD->GetLoaderModule(); // Used for ILStubCache selection and MethodTable creation.
INDEBUG(InitDebugNames());
@@ -133,11 +134,13 @@ StubSigDesc::StubSigDesc(MethodDesc* pMD, const Signature& sig, Module* pModule)
{
m_tkMethodDef = pMD->GetMemberDef();
SigTypeContext::InitTypeContext(pMD, &m_typeContext);
+ m_pMetadataModule = pMD->GetModule();
m_pLoaderModule = pMD->GetLoaderModule(); // Used for ILStubCache selection and MethodTable creation.
}
else
{
m_tkMethodDef = mdMethodDefNil;
+ m_pMetadataModule = m_pModule;
m_pLoaderModule = m_pModule;
}
@@ -166,7 +169,8 @@ StubSigDesc::StubSigDesc(MethodTable* pMT, const Signature& sig, Module* pModule
if (pMT != NULL)
{
SigTypeContext::InitTypeContext(pMT, &m_typeContext);
- m_pLoaderModule = pMT->GetLoaderModule(); // Used for ILStubCache selection and MethodTable creation.
+ m_pMetadataModule = pMT->GetModule();
+ m_pLoaderModule = pMT->GetLoaderModule();
}
else
{
@@ -193,6 +197,7 @@ StubSigDesc::StubSigDesc(const Signature& sig, Module* pModule)
m_sig = sig;
m_pModule = pModule;
m_tkMethodDef = mdMethodDefNil;
+ m_pMetadataModule = m_pModule;
m_pLoaderModule = m_pModule;
INDEBUG(InitDebugNames());
@@ -959,7 +964,7 @@ class ILStubState : public StubState
if (pTargetMD)
{
pTargetMD->GetMethodInfoWithNewSig(strNamespaceOrClassName, strMethodName, strMethodSignature);
- uModuleId = (UINT64)pTargetMD->GetModule()->GetAddrModuleID();
+ uModuleId = (UINT64)(TADDR)pTargetMD->GetModule_NoLogging();
}
//
@@ -3287,6 +3292,15 @@ BOOL NDirect::MarshalingRequired(
}
CollateParamTokens(pMDImport, methodToken, numArgs - 1, pParamTokenArray);
+ // We enable the runtime marshalling system whenever it is enabled on the module as a whole
+ // or when the call is a COM interop call. COM interop calls are already using a significant portion of the runtime
+ // marshalling system just to function at all, so we aren't going to disable the parameter marshalling;
+ // we'd rather have developers use the feature flag to diable the whole COM interop subsystem at once.
+ bool runtimeMarshallingEnabled = pModule->IsRuntimeMarshallingEnabled();
+#ifdef FEATURE_COMINTEROP
+ runtimeMarshallingEnabled |= pMD && pMD->IsComPlusCall();
+#endif
+
for (ULONG i = 0; i < numArgs; i++)
{
SigPointer arg = ptr;
@@ -3300,7 +3314,7 @@ BOOL NDirect::MarshalingRequired(
IfFailThrow(arg.GetElemType(NULL)); // skip ELEMENT_TYPE_PTR
IfFailThrow(arg.PeekElemType(&type));
- if (type == ELEMENT_TYPE_VALUETYPE)
+ if (runtimeMarshallingEnabled && type == ELEMENT_TYPE_VALUETYPE)
{
if ((arg.HasCustomModifier(pModule,
"Microsoft.VisualC.NeedsCopyConstructorModifier",
@@ -3331,11 +3345,21 @@ BOOL NDirect::MarshalingRequired(
{
TypeHandle hndArgType = arg.GetTypeHandleThrowing(pModule, &emptyTypeContext);
- // JIT can handle internal blittable value types
- if (!hndArgType.IsBlittable() && !hndArgType.IsEnum())
+ // When the runtime runtime marshalling system is disabled, we don't support
+ // any types that contain gc pointers, but all "unmanaged" types are treated as blittable
+ // as long as they aren't auto-layout and don't have any auto-layout fields.
+ if (!runtimeMarshallingEnabled &&
+ (hndArgType.GetMethodTable()->ContainsPointers()
+ || hndArgType.GetMethodTable()->IsAutoLayoutOrHasAutoLayoutField()))
{
return TRUE;
}
+ else if (runtimeMarshallingEnabled && !hndArgType.IsBlittable() && !hndArgType.IsEnum())
+ {
+ // When the runtime runtime marshalling system is enabled, we do special handling
+ // for any types that aren't blittable or enums.
+ return TRUE;
+ }
if (i > 0)
{
@@ -3348,10 +3372,15 @@ BOOL NDirect::MarshalingRequired(
case ELEMENT_TYPE_BOOLEAN:
case ELEMENT_TYPE_CHAR:
{
+ // When runtime marshalling is enabled:
// Bool requires marshaling
// Char may require marshaling (MARSHAL_TYPE_ANSICHAR)
- return TRUE;
+ if (runtimeMarshallingEnabled)
+ {
+ return TRUE;
+ }
}
+ FALLTHROUGH;
default:
{
@@ -3376,7 +3405,10 @@ BOOL NDirect::MarshalingRequired(
// check for explicit MarshalAs
NativeTypeParamInfo paramInfo;
- if (pParamTokenArray[i] != mdParamDefNil)
+ // We only check the MarshalAs info when the runtime marshalling system is enabled.
+ // We ignore MarshalAs when the system is disabled, so no reason to disqualify from inlining
+ // when it is present.
+ if (runtimeMarshallingEnabled && pParamTokenArray[i] != mdParamDefNil)
{
if (!ParseNativeTypeInfo(pParamTokenArray[i], pMDImport, ¶mInfo) ||
paramInfo.m_NativeType != NATIVE_TYPE_DEFAULT)
@@ -3594,6 +3626,7 @@ static void CreateNDirectStubWorker(StubState* pss,
CONSISTENCY_CHECK_MSGF(false, ("BreakOnInteropStubSetup: '%s' ", pSigDesc->m_pDebugName));
#endif // _DEBUG
+ bool runtimeMarshallingEnabled = SF_IsCOMStub(dwStubFlags) || pSigDesc->m_pMetadataModule->IsRuntimeMarshallingEnabled();
if (SF_IsCOMStub(dwStubFlags))
{
_ASSERTE(0 == nlType);
@@ -3615,26 +3648,48 @@ static void CreateNDirectStubWorker(StubState* pss,
&pSigDesc->m_typeContext);
if (SF_IsVarArgStub(dwStubFlags))
+ {
+ if (!runtimeMarshallingEnabled)
+ {
+ COMPlusThrow(kMarshalDirectiveException, IDS_EE_NDIRECT_DISABLEDMARSHAL_VARARGS);
+ }
msig.SetTreatAsVarArg();
+ }
bool fThisCall = (unmgdCallConv == CorInfoCallConvExtension::Thiscall);
- pss->SetLastError(nlFlags & nlfLastError);
+ if (nlFlags & nlfLastError)
+ {
+ if (!runtimeMarshallingEnabled)
+ {
+ COMPlusThrow(kMarshalDirectiveException, IDS_EE_NDIRECT_DISABLEDMARSHAL_SETLASTERROR);
+ }
+ pss->SetLastError(TRUE);
+ }
// This has been in the product since forward P/Invoke via delegates was
// introduced. It's wrong, but please keep it for backward compatibility.
- if (SF_IsDelegateStub(dwStubFlags))
+ if (runtimeMarshallingEnabled && SF_IsDelegateStub(dwStubFlags))
pss->SetLastError(TRUE);
pss->BeginEmit(dwStubFlags);
if (-1 != iLCIDArg)
{
- // The code to handle the LCID will call MarshalLCID before calling MarshalArgument
+ if (!runtimeMarshallingEnabled)
+ {
+ COMPlusThrow(kMarshalDirectiveException, IDS_EE_NDIRECT_DISABLEDMARSHAL_LCID);
+ }
+ // The code to handle the LCID will call MarshalLCID before calling MarshalArgument
// on the argument the LCID should go after. So we just bump up the index here.
iLCIDArg++;
}
+ if (!runtimeMarshallingEnabled && SF_IsHRESULTSwapping(dwStubFlags))
+ {
+ COMPlusThrow(kMarshalDirectiveException, IDS_EE_NDIRECT_DISABLEDMARSHAL_PRESERVESIG);
+ }
+
int numArgs = msig.NumFixedArgs();
// thiscall must have at least one parameter (the "this")
diff --git a/src/coreclr/vm/dllimport.h b/src/coreclr/vm/dllimport.h
index f731823ff4a0b0..8b472e3a0aafb6 100644
--- a/src/coreclr/vm/dllimport.h
+++ b/src/coreclr/vm/dllimport.h
@@ -23,7 +23,15 @@ struct StubSigDesc
MethodDesc *m_pMD;
MethodTable *m_pMT;
Signature m_sig;
+ // Module to use for signature reading.
Module *m_pModule;
+ // Module that owns any metadata that influences interop behavior.
+ // This is usually the same as m_pModule, but can differ with vararg
+ // P/Invokes, where the calling assembly's module is assigned to m_pModule
+ // since the specific caller signature is defined in that assembly, not the
+ // assembly that defined the P/Invoke.
+ Module *m_pMetadataModule;
+ // Used for ILStubCache selection and MethodTable creation.
Module *m_pLoaderModule;
mdMethodDef m_tkMethodDef;
SigTypeContext m_typeContext;
diff --git a/src/coreclr/vm/dllimportcallback.cpp b/src/coreclr/vm/dllimportcallback.cpp
index 455d33813eec03..65d2afd7d05128 100644
--- a/src/coreclr/vm/dllimportcallback.cpp
+++ b/src/coreclr/vm/dllimportcallback.cpp
@@ -195,37 +195,6 @@ extern "C" VOID STDCALL ReversePInvokeBadTransition()
);
}
-// Disable from a place that is calling into managed code via a UMEntryThunk.
-extern "C" VOID STDCALL UMThunkStubRareDisableWorker(Thread *pThread, UMEntryThunk *pUMEntryThunk)
-{
- STATIC_CONTRACT_THROWS;
- STATIC_CONTRACT_GC_TRIGGERS;
-
- // Do not add a CONTRACT here. We haven't set up SEH.
-
- // WARNING!!!!
- // when we start executing here, we are actually in cooperative mode. But we
- // haven't synchronized with the barrier to reentry yet. So we are in a highly
- // dangerous mode. If we call managed code, we will potentially be active in
- // the GC heap, even as GC's are occuring!
-
- // We must do the following in this order, because otherwise we would be constructing
- // the exception for the abort without synchronizing with the GC. Also, we have no
- // CLR SEH set up, despite the fact that we may throw a ThreadAbortException.
- pThread->RareDisablePreemptiveGC();
- pThread->HandleThreadAbort();
-
-#ifdef DEBUGGING_SUPPORTED
- // If the debugger is attached, we use this opportunity to see if
- // we're disabling preemptive GC on the way into the runtime from
- // unmanaged code. We end up here because
- // Increment/DecrementTraceCallCount() will bump
- // g_TrapReturningThreads for us.
- if (CORDebuggerTraceCall())
- g_pDebugInterface->TraceCall((const BYTE *)pUMEntryThunk->GetManagedTarget());
-#endif // DEBUGGING_SUPPORTED
-}
-
PCODE TheUMEntryPrestubWorker(UMEntryThunk * pUMEntryThunk)
{
STATIC_CONTRACT_THROWS;
@@ -234,39 +203,13 @@ PCODE TheUMEntryPrestubWorker(UMEntryThunk * pUMEntryThunk)
Thread * pThread = GetThreadNULLOk();
if (pThread == NULL)
- pThread = CreateThreadBlockThrow();
-
- GCX_COOP_THREAD_EXISTS(pThread);
-
- if (pThread->IsAbortRequested())
- pThread->HandleThreadAbort();
-
- UMEntryThunk::DoRunTimeInit(pUMEntryThunk);
-
- return (PCODE)pUMEntryThunk->GetCode();
-}
-
-void RunTimeInit_Wrapper(LPVOID /* UMThunkMarshInfo * */ ptr)
-{
- WRAPPER_NO_CONTRACT;
-
- UMEntryThunk::DoRunTimeInit((UMEntryThunk*)ptr);
-}
-
-
-// asm entrypoint
-void STDCALL UMEntryThunk::DoRunTimeInit(UMEntryThunk* pUMEntryThunk)
-{
-
- CONTRACTL
{
- THROWS;
- GC_TRIGGERS;
- MODE_COOPERATIVE;
- ENTRY_POINT;
- PRECONDITION(CheckPointer(pUMEntryThunk));
+ CREATETHREAD_IF_NULL_FAILFAST(pThread, W("Failed to setup new thread during reverse P/Invoke"));
}
- CONTRACTL_END;
+
+ // Verify the current thread isn't in COOP mode.
+ if (pThread->PreemptiveGCDisabled())
+ ReversePInvokeBadTransition();
INSTALL_MANAGED_EXCEPTION_DISPATCHER;
// this method is called by stubs which are called by managed code,
@@ -274,15 +217,13 @@ void STDCALL UMEntryThunk::DoRunTimeInit(UMEntryThunk* pUMEntryThunk)
// exceptions don't leak out into managed code.
INSTALL_UNWIND_AND_CONTINUE_HANDLER;
- {
- GCX_PREEMP();
-
- ExecutableWriterHolder uMEntryThunkWriterHolder(pUMEntryThunk, sizeof(UMEntryThunk));
- uMEntryThunkWriterHolder.GetRW()->RunTimeInit(pUMEntryThunk);
- }
+ ExecutableWriterHolder uMEntryThunkWriterHolder(pUMEntryThunk, sizeof(UMEntryThunk));
+ uMEntryThunkWriterHolder.GetRW()->RunTimeInit(pUMEntryThunk);
UNINSTALL_UNWIND_AND_CONTINUE_HANDLER;
UNINSTALL_MANAGED_EXCEPTION_DISPATCHER;
+
+ return (PCODE)pUMEntryThunk->GetCode();
}
UMEntryThunk* UMEntryThunk::CreateUMEntryThunk()
diff --git a/src/coreclr/vm/dllimportcallback.h b/src/coreclr/vm/dllimportcallback.h
index 14b7db5704824f..fb2214a8c18d5a 100644
--- a/src/coreclr/vm/dllimportcallback.h
+++ b/src/coreclr/vm/dllimportcallback.h
@@ -16,6 +16,12 @@
#include "class.h"
#include "dllimport.h"
+class UMThunkMarshInfo;
+typedef DPTR(class UMThunkMarshInfo) PTR_UMThunkMarshInfo;
+
+class UMEntryThunk;
+typedef DPTR(class UMEntryThunk) PTR_UMEntryThunk;
+
//----------------------------------------------------------------------
// This structure collects all information needed to marshal an
// unmanaged->managed thunk. The only information missing is the
@@ -189,9 +195,6 @@ class UMEntryThunk
#endif // _DEBUG
}
- // asm entrypoint
- static VOID STDCALL DoRunTimeInit(UMEntryThunk* pThis);
-
PCODE GetManagedTarget() const
{
CONTRACT (PCODE)
@@ -396,14 +399,7 @@ class UMEntryThunkCache
};
#if defined(TARGET_X86) && !defined(FEATURE_STUBS_AS_IL)
-//-------------------------------------------------------------------------
-// One-time creation of special prestub to initialize UMEntryThunks.
-//-------------------------------------------------------------------------
-Stub *GenerateUMThunkPrestub();
-
EXCEPTION_HANDLER_DECL(FastNExportExceptHandler);
-EXCEPTION_HANDLER_DECL(UMThunkPrestubHandler);
-
#endif // TARGET_X86 && !FEATURE_STUBS_AS_IL
extern "C" void TheUMEntryPrestub(void);
diff --git a/src/coreclr/vm/dwbucketmanager.hpp b/src/coreclr/vm/dwbucketmanager.hpp
index 9731b2081c92d6..2524f706c7ef3f 100644
--- a/src/coreclr/vm/dwbucketmanager.hpp
+++ b/src/coreclr/vm/dwbucketmanager.hpp
@@ -156,7 +156,7 @@ class BytesToBase32
WCHAR GetNextChar();
BOOL MoreChars() { LIMITED_METHOD_CONTRACT; return pData < pEnd; }
- int Convert(__inout_ecount(nOut) LPWSTR pOut, int nOut);
+ int Convert(_Inout_updates_(nOut) LPWSTR pOut, int nOut);
};
// This table tells how to pick out 5-bits at a time (8 times) from 5-bytes of data.
@@ -265,7 +265,7 @@ WCHAR BytesToBase32::GetNextChar()
//
//------------------------------------------------------------------------------
int BytesToBase32::Convert(
- __inout_ecount(nOut) LPWSTR pOut,
+ _Inout_updates_(nOut) LPWSTR pOut,
int nOut)
{
WRAPPER_NO_CONTRACT;
@@ -304,32 +304,32 @@ class BaseBucketParamsManager
bool IsCodeContractsFrame(MethodDesc* pMD);
OBJECTREF GetRealExceptionObject();
WCHAR* GetParamBufferForIndex(BucketParameterIndex paramIndex);
- void LogParam(__in_z LPCWSTR paramValue, BucketParameterIndex paramIndex);
+ void LogParam(_In_z_ LPCWSTR paramValue, BucketParameterIndex paramIndex);
protected:
~BaseBucketParamsManager();
- typedef void (BaseBucketParamsManager::*DataPopulatorFunction)(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
+ typedef void (BaseBucketParamsManager::*DataPopulatorFunction)(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
void PopulateBucketParameter(BucketParameterIndex paramIndex, DataPopulatorFunction pFnDataPopulator, int maxLength);
void PopulateEventName(LPCWSTR eventTypeName);
// functions for retrieving data to go into various bucket parameters
- void GetAppName(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetAppVersion(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetAppTimeStamp(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetModuleName(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetModuleVersion(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetModuleTimeStamp(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetMethodDef(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetIlOffset(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetExceptionName(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetPackageMoniker(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetPRAID(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
- void GetIlRva(__out_ecount(maxLength) WCHAR* targetParam, int maxLength);
+ void GetAppName(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetAppVersion(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetAppTimeStamp(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetModuleName(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetModuleVersion(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetModuleTimeStamp(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetMethodDef(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetIlOffset(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetExceptionName(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetPackageMoniker(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetPRAID(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
+ void GetIlRva(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength);
public:
BaseBucketParamsManager(GenericModeBlock* pGenericModeBlock, TypeOfReportedError typeOfError, PCODE initialFaultingPc, Thread* pFaultingThread, OBJECTREF* pThrownException);
- static int CopyStringToBucket(__out_ecount(targetMaxLength) LPWSTR pTargetParam, int targetMaxLength, __in_z LPCWSTR pSource, bool cannonicalize = false);
+ static int CopyStringToBucket(_Out_writes_(targetMaxLength) LPWSTR pTargetParam, int targetMaxLength, _In_z_ LPCWSTR pSource, bool cannonicalize = false);
// function that consumers should call to populate the GMB
virtual void PopulateBucketParameters() = 0;
};
@@ -441,7 +441,7 @@ void BaseBucketParamsManager::PopulateBucketParameter(BucketParameterIndex param
LogParam(targetParam, paramIndex);
}
-void BaseBucketParamsManager::GetAppName(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetAppName(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -465,7 +465,7 @@ void BaseBucketParamsManager::GetAppName(__out_ecount(maxLength) WCHAR* targetPa
}
}
-void BaseBucketParamsManager::GetAppVersion(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetAppVersion(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -500,7 +500,7 @@ void BaseBucketParamsManager::GetAppVersion(__out_ecount(maxLength) WCHAR* targe
}
}
-void BaseBucketParamsManager::GetAppTimeStamp(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetAppTimeStamp(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -532,7 +532,7 @@ void BaseBucketParamsManager::GetAppTimeStamp(__out_ecount(maxLength) WCHAR* tar
EX_END_CATCH(SwallowAllExceptions)
}
-void BaseBucketParamsManager::GetModuleName(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetModuleName(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -622,7 +622,7 @@ void BaseBucketParamsManager::GetModuleName(__out_ecount(maxLength) WCHAR* targe
}
}
-void BaseBucketParamsManager::GetModuleVersion(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetModuleVersion(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -678,7 +678,7 @@ void BaseBucketParamsManager::GetModuleVersion(__out_ecount(maxLength) WCHAR* ta
}
}
-void BaseBucketParamsManager::GetModuleTimeStamp(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetModuleTimeStamp(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -731,7 +731,7 @@ void BaseBucketParamsManager::GetModuleTimeStamp(__out_ecount(maxLength) WCHAR*
}
}
-void BaseBucketParamsManager::GetMethodDef(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetMethodDef(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -756,7 +756,7 @@ void BaseBucketParamsManager::GetMethodDef(__out_ecount(maxLength) WCHAR* target
}
}
-void BaseBucketParamsManager::GetIlOffset(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetIlOffset(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -775,7 +775,7 @@ void BaseBucketParamsManager::GetIlOffset(__out_ecount(maxLength) WCHAR* targetP
ilOffset);
}
-void BaseBucketParamsManager::GetExceptionName(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetExceptionName(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -845,7 +845,7 @@ void BaseBucketParamsManager::GetExceptionName(__out_ecount(maxLength) WCHAR* ta
}
}
-void BaseBucketParamsManager::GetPackageMoniker(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetPackageMoniker(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -858,7 +858,7 @@ void BaseBucketParamsManager::GetPackageMoniker(__out_ecount(maxLength) WCHAR* t
_ASSERTE(!"AppX support NYI for CoreCLR");
}
-void BaseBucketParamsManager::GetPRAID(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetPRAID(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -871,7 +871,7 @@ void BaseBucketParamsManager::GetPRAID(__out_ecount(maxLength) WCHAR* targetPara
_ASSERTE(!"PRAID support NYI for CoreCLR");
}
-void BaseBucketParamsManager::GetIlRva(__out_ecount(maxLength) WCHAR* targetParam, int maxLength)
+void BaseBucketParamsManager::GetIlRva(_Out_writes_(maxLength) WCHAR* targetParam, int maxLength)
{
CONTRACTL
{
@@ -1070,7 +1070,7 @@ OBJECTREF BaseBucketParamsManager::GetRealExceptionObject()
// because that is what a SHA1 hash coded in base32 will require.
// - the maxlen does not include the terminating nul.
//------------------------------------------------------------------------------
-int BaseBucketParamsManager::CopyStringToBucket(__out_ecount(targetMaxLength) LPWSTR pTargetParam, int targetMaxLength, __in_z LPCWSTR pSource, bool cannonicalize)
+int BaseBucketParamsManager::CopyStringToBucket(_Out_writes_(targetMaxLength) LPWSTR pTargetParam, int targetMaxLength, _In_z_ LPCWSTR pSource, bool cannonicalize)
{
CONTRACTL
{
@@ -1142,7 +1142,7 @@ int BaseBucketParamsManager::CopyStringToBucket(__out_ecount(targetMaxLength) LP
return targLen;
}
-void BaseBucketParamsManager::LogParam(__in_z LPCWSTR paramValue, BucketParameterIndex paramIndex)
+void BaseBucketParamsManager::LogParam(_In_z_ LPCWSTR paramValue, BucketParameterIndex paramIndex)
{
#ifdef _DEBUG
LIMITED_METHOD_CONTRACT;
diff --git a/src/coreclr/vm/dwreport.cpp b/src/coreclr/vm/dwreport.cpp
index 228e1d029cd5ea..1032725eb854b3 100644
--- a/src/coreclr/vm/dwreport.cpp
+++ b/src/coreclr/vm/dwreport.cpp
@@ -179,7 +179,7 @@ BOOL RegisterOutOfProcessWatsonCallbacks()
//------------------------------------------------------------------------------
// Description
HRESULT DwGetFileVersionInfo(
- __in_z LPCWSTR wszFilePath,
+ _In_z_ LPCWSTR wszFilePath,
USHORT& major,
USHORT& minor,
USHORT& build,
@@ -222,7 +222,7 @@ HRESULT DwGetFileVersionInfo(
// None
//------------------------------------------------------------------------------
int DwGetAppDescription( // Number of characters written.
- __in_z LPCWSTR wszFilePath, // Path to the executable.
+ _In_z_ LPCWSTR wszFilePath, // Path to the executable.
SString& pBuf // Put description here.
) // Size of buf, wide chars.
{
@@ -354,8 +354,8 @@ int DwGetAppDescription( // Number of characters written.
// None
//------------------------------------------------------------------------------
int DwGetAssemblyVersion( // Number of characters written.
- __in_z LPCWSTR wszFilePath, // Path to the executable.
- __inout_ecount(cchBuf) WCHAR *pBuf, // Put description here.
+ _In_z_ LPCWSTR wszFilePath, // Path to the executable.
+ _Inout_updates_(cchBuf) WCHAR *pBuf, // Put description here.
int cchBuf) // Size of buf, wide chars.
{
CONTRACTL
@@ -551,7 +551,7 @@ UINT_PTR GetIPOfThrowSite(
// false -- otherwise.
//
//------------------------------------------------------------------------------
-BOOL ContainsUnicodeChars(__in_z LPCWSTR wsz)
+BOOL ContainsUnicodeChars(_In_z_ LPCWSTR wsz)
{
LIMITED_METHOD_CONTRACT;
@@ -888,19 +888,19 @@ HRESULT GetBucketParametersForCurrentException(
if (hr == S_OK)
{
// Event type name.
- wcsncpy_s(pParams->pszEventTypeName, COUNTOF(pParams->pszEventTypeName), gmb.wzEventTypeName, _TRUNCATE);
+ wcsncpy_s(pParams->pszEventTypeName, ARRAY_SIZE(pParams->pszEventTypeName), gmb.wzEventTypeName, _TRUNCATE);
// Buckets. Mind the 1-based vs 0-based.
- wcsncpy_s(pParams->pszParams[0], COUNTOF(pParams->pszParams[0]), gmb.wzP1, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[1], COUNTOF(pParams->pszParams[1]), gmb.wzP2, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[2], COUNTOF(pParams->pszParams[2]), gmb.wzP3, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[3], COUNTOF(pParams->pszParams[3]), gmb.wzP4, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[4], COUNTOF(pParams->pszParams[4]), gmb.wzP5, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[5], COUNTOF(pParams->pszParams[5]), gmb.wzP6, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[6], COUNTOF(pParams->pszParams[6]), gmb.wzP7, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[7], COUNTOF(pParams->pszParams[7]), gmb.wzP8, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[8], COUNTOF(pParams->pszParams[8]), gmb.wzP9, _TRUNCATE);
- wcsncpy_s(pParams->pszParams[9], COUNTOF(pParams->pszParams[9]), gmb.wzP10, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[0], ARRAY_SIZE(pParams->pszParams[0]), gmb.wzP1, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[1], ARRAY_SIZE(pParams->pszParams[1]), gmb.wzP2, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[2], ARRAY_SIZE(pParams->pszParams[2]), gmb.wzP3, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[3], ARRAY_SIZE(pParams->pszParams[3]), gmb.wzP4, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[4], ARRAY_SIZE(pParams->pszParams[4]), gmb.wzP5, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[5], ARRAY_SIZE(pParams->pszParams[5]), gmb.wzP6, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[6], ARRAY_SIZE(pParams->pszParams[6]), gmb.wzP7, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[7], ARRAY_SIZE(pParams->pszParams[7]), gmb.wzP8, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[8], ARRAY_SIZE(pParams->pszParams[8]), gmb.wzP9, _TRUNCATE);
+ wcsncpy_s(pParams->pszParams[9], ARRAY_SIZE(pParams->pszParams[9]), gmb.wzP10, _TRUNCATE);
// All good.
pParams->fInited = TRUE;
diff --git a/src/coreclr/vm/dwreport.h b/src/coreclr/vm/dwreport.h
index 485eb7cfdf9152..821213ec9df565 100644
--- a/src/coreclr/vm/dwreport.h
+++ b/src/coreclr/vm/dwreport.h
@@ -55,18 +55,18 @@ BOOL IsWatsonEnabled();
BOOL RegisterOutOfProcessWatsonCallbacks();
int DwGetAssemblyVersion( // Number of characters written.
- __in_z LPCWSTR wszFilePath, // Path to the executable.
- __inout_ecount(cchBuf) WCHAR *pBuf, // Put description here.
+ _In_z_ LPCWSTR wszFilePath, // Path to the executable.
+ _Inout_updates_(cchBuf) WCHAR *pBuf, // Put description here.
int cchBuf);
HRESULT DwGetFileVersionInfo( // S_OK or error
- __in_z LPCWSTR wszFilePath, // Path to the executable.
+ _In_z_ LPCWSTR wszFilePath, // Path to the executable.
USHORT& major,
USHORT& minor,
USHORT& build,
USHORT& revision);
-BOOL ContainsUnicodeChars(__in_z LPCWSTR wsz);
+BOOL ContainsUnicodeChars(_In_z_ LPCWSTR wsz);
// Proxy parameters for Resetting Watson buckets
struct ResetWatsonBucketsParams
diff --git a/src/coreclr/vm/ecalllist.h b/src/coreclr/vm/ecalllist.h
index be7a6826854f0e..f3ada145b68395 100644
--- a/src/coreclr/vm/ecalllist.h
+++ b/src/coreclr/vm/ecalllist.h
@@ -322,8 +322,6 @@ FCFuncStart(gDelegateFuncs)
FCFuncEnd()
FCFuncStart(gMathFuncs)
- FCFuncElementSig("Abs", &gsig_SM_Dbl_RetDbl, COMDouble::Abs)
- FCFuncElementSig("Abs", &gsig_SM_Flt_RetFlt, COMSingle::Abs)
FCFuncElement("Acos", COMDouble::Acos)
FCFuncElement("Acosh", COMDouble::Acosh)
FCFuncElement("Asin", COMDouble::Asin)
diff --git a/src/coreclr/vm/eeconfig.cpp b/src/coreclr/vm/eeconfig.cpp
index 17ecf961879bf3..43378f1700d4e5 100644
--- a/src/coreclr/vm/eeconfig.cpp
+++ b/src/coreclr/vm/eeconfig.cpp
@@ -818,7 +818,7 @@ bool EEConfig::ExcludeReadyToRun(LPCUTF8 assemblyName) const
// Ownership of the string buffer passes to ParseMethList
/* static */
-HRESULT EEConfig::ParseMethList(__in_z LPWSTR str, MethodNamesList** out) {
+HRESULT EEConfig::ParseMethList(_In_z_ LPWSTR str, MethodNamesList** out) {
CONTRACTL {
NOTHROW;
GC_NOTRIGGER;
@@ -899,7 +899,7 @@ bool EEConfig::IsInMethList(MethodNamesList* list, MethodDesc* pMD)
// Ownership of the string buffer passes to ParseTypeList
/* static */
-HRESULT EEConfig::ParseTypeList(__in_z LPWSTR str, TypeNamesList** out)
+HRESULT EEConfig::ParseTypeList(_In_z_ LPWSTR str, TypeNamesList** out)
{
CONTRACTL {
NOTHROW;
@@ -980,7 +980,7 @@ bool EEConfig::RegexOrExactMatch(LPCUTF8 regex, LPCUTF8 input)
return strcmp(regex, input) == 0;
}
-HRESULT TypeNamesList::Init(__in_z LPCWSTR str)
+HRESULT TypeNamesList::Init(_In_z_ LPCWSTR str)
{
CONTRACTL {
NOTHROW;
diff --git a/src/coreclr/vm/eeconfig.h b/src/coreclr/vm/eeconfig.h
index 05eb839c241738..d06e592eaff858 100644
--- a/src/coreclr/vm/eeconfig.h
+++ b/src/coreclr/vm/eeconfig.h
@@ -35,7 +35,7 @@ class TypeNamesList
TypeNamesList();
~TypeNamesList();
- HRESULT Init(__in_z LPCWSTR str);
+ HRESULT Init(_In_z_ LPCWSTR str);
bool IsInList(LPCUTF8 typeName);
};
#endif
@@ -244,7 +244,7 @@ class EEConfig
} CONTRACTL_END
return RegexOrExactMatch(pszBreakOnStructMarshalSetup, className);
}
- static HRESULT ParseTypeList(__in_z LPWSTR str, TypeNamesList** out);
+ static HRESULT ParseTypeList(_In_z_ LPWSTR str, TypeNamesList** out);
static void DestroyTypeList(TypeNamesList* list);
inline bool ShouldGcCoverageOnMethod(LPCUTF8 methodName) const
@@ -491,7 +491,7 @@ class EEConfig
bool m_fInteropLogArguments; // Log all pinned arguments passed to an interop call
#ifdef _DEBUG
- static HRESULT ParseMethList(__in_z LPWSTR str, MethodNamesList* * out);
+ static HRESULT ParseMethList(_In_z_ LPWSTR str, MethodNamesList* * out);
static void DestroyMethList(MethodNamesList* list);
static bool IsInMethList(MethodNamesList* list, MethodDesc* pMD);
diff --git a/src/coreclr/vm/eecontract.cpp b/src/coreclr/vm/eecontract.cpp
index c0b6830b2ba21f..a6e9972fb4e523 100644
--- a/src/coreclr/vm/eecontract.cpp
+++ b/src/coreclr/vm/eecontract.cpp
@@ -22,7 +22,7 @@ void EEContract::Disable()
BaseContract::Disable();
}
-void EEContract::DoChecks(UINT testmask, __in_z const char *szFunction, __in_z const char *szFile, int lineNum)
+void EEContract::DoChecks(UINT testmask, _In_z_ const char *szFunction, _In_z_ const char *szFile, int lineNum)
{
SCAN_IGNORE_THROW; // Tell the static contract analyzer to ignore contract violations
SCAN_IGNORE_FAULT; // due to the contract checking logic itself.
diff --git a/src/coreclr/vm/eecontract.h b/src/coreclr/vm/eecontract.h
index 61adea1dc80ba3..4df0c6f8fcaf5b 100644
--- a/src/coreclr/vm/eecontract.h
+++ b/src/coreclr/vm/eecontract.h
@@ -40,7 +40,7 @@ class EEContract : public BaseContract
}
void Disable();
- void DoChecks(UINT testmask, __in_z const char *szFunction, __in_z const char *szFile, int lineNum);
+ void DoChecks(UINT testmask, _In_z_ const char *szFunction, _In_z_ const char *szFile, int lineNum);
};
diff --git a/src/coreclr/vm/eepolicy.cpp b/src/coreclr/vm/eepolicy.cpp
index b9084568144076..c085315499253b 100644
--- a/src/coreclr/vm/eepolicy.cpp
+++ b/src/coreclr/vm/eepolicy.cpp
@@ -185,8 +185,8 @@ void EEPolicy::HandleExitProcess(ShutdownCompleteAction sca)
//---------------------------------------------------------------------------------------
// This class is responsible for displaying a stack trace. It uses a condensed way for
// stack overflow stack traces where there are possibly many repeated frames.
-// It displays a count and a repeated sequence of frames at the top of the stack in
-// such a case, instead of displaying possibly thousands of lines with the same
+// It displays a count and a repeated sequence of frames at the top of the stack in
+// such a case, instead of displaying possibly thousands of lines with the same
// method.
//---------------------------------------------------------------------------------------
class CallStackLogger
@@ -291,7 +291,7 @@ class CallStackLogger
for (int i = m_largestCommonStartLength * m_largestCommonStartRepeat; i < m_frames.Count(); i++)
{
PrintFrame(i, pWordAt);
- }
+ }
}
};
@@ -412,7 +412,7 @@ void LogInfoForFatalError(UINT exitCode, LPCWSTR pszMessage, LPCWSTR errorSource
{
}
EX_END_CATCH(SwallowAllExceptions)
-
+
InterlockedCompareExchangeT(&s_pCrashingThread, FatalErrorLoggingFinished, pThread);
}
@@ -484,7 +484,7 @@ void EEPolicy::LogFatalError(UINT exitCode, UINT_PTR address, LPCWSTR pszMessage
InlineSString<80> ssMessage;
InlineSString<80> ssErrorFormat;
if(!ssErrorFormat.LoadResource(CCompRC::Optional, IDS_ER_UNMANAGEDFAILFASTMSG ))
- ssErrorFormat.Set(W("at IP %1 (%2) with exit code %3."));
+ ssErrorFormat.Set(W("at IP 0x%x (0x%x) with exit code 0x%x."));
SmallStackSString addressString;
addressString.Printf(W("%p"), pExceptionInfo? (UINT_PTR)pExceptionInfo->ExceptionRecord->ExceptionAddress : address);
diff --git a/src/coreclr/vm/eetoprofinterfaceimpl.cpp b/src/coreclr/vm/eetoprofinterfaceimpl.cpp
index cfe62645dcbd26..0944ce115d21b9 100644
--- a/src/coreclr/vm/eetoprofinterfaceimpl.cpp
+++ b/src/coreclr/vm/eetoprofinterfaceimpl.cpp
@@ -254,8 +254,8 @@ inline void SetProfilerCallbacksAllowedForThread(Thread * pThread, BOOL fValue)
static HRESULT CoCreateProfiler(
const CLSID * pClsid,
- __in_z LPCWSTR wszClsid,
- __in_z LPCWSTR wszProfileDLL,
+ _In_z_ LPCWSTR wszClsid,
+ _In_z_ LPCWSTR wszProfileDLL,
ICorProfilerCallback2 ** ppCallback,
HMODULE * phmodProfilerDLL)
{
@@ -500,8 +500,8 @@ EEToProfInterfaceImpl::EEToProfInterfaceImpl() :
HRESULT EEToProfInterfaceImpl::Init(
ProfToEEInterfaceImpl * pProfToEE,
const CLSID * pClsid,
- __in_z LPCWSTR wszClsid,
- __in_z LPCWSTR wszProfileDLL,
+ _In_z_ LPCWSTR wszClsid,
+ _In_z_ LPCWSTR wszProfileDLL,
BOOL fLoadedViaAttach,
DWORD dwConcurrentGCWaitTimeoutInMs)
{
@@ -644,8 +644,8 @@ void EEToProfInterfaceImpl::SetProfilerInfo(ProfilerInfo *pProfilerInfo)
HRESULT EEToProfInterfaceImpl::CreateProfiler(
const CLSID * pClsid,
- __in_z LPCWSTR wszClsid,
- __in_z LPCWSTR wszProfileDLL)
+ _In_z_ LPCWSTR wszClsid,
+ _In_z_ LPCWSTR wszProfileDLL)
{
CONTRACTL
{
@@ -3034,7 +3034,7 @@ HRESULT EEToProfInterfaceImpl::ThreadAssignedToOSThread(ThreadID managedThreadId
HRESULT EEToProfInterfaceImpl::ThreadNameChanged(ThreadID managedThreadId,
ULONG cchName,
- __in_ecount_opt(cchName) WCHAR name[])
+ _In_reads_bytes_opt_(cchName) WCHAR name[])
{
CONTRACTL
{
diff --git a/src/coreclr/vm/eetoprofinterfaceimpl.h b/src/coreclr/vm/eetoprofinterfaceimpl.h
index e1259c6c7d7e1a..dd11a48abedb0c 100644
--- a/src/coreclr/vm/eetoprofinterfaceimpl.h
+++ b/src/coreclr/vm/eetoprofinterfaceimpl.h
@@ -49,7 +49,7 @@ class EEToProfInterfaceImpl
ProfToEEInterfaceImpl * pProfToEE,
const CLSID * pClsid,
__inout_z LPCWSTR wszClsid,
- __in_z LPCWSTR wszProfileDLL,
+ _In_z_ LPCWSTR wszProfileDLL,
BOOL fLoadedViaAttach,
DWORD dwConcurrentGCWaitTimeoutInMs);
@@ -144,7 +144,7 @@ class EEToProfInterfaceImpl
HRESULT ThreadNameChanged(ThreadID managedThreadId,
ULONG cchName,
- __in_ecount_opt(cchName) WCHAR name[]);
+ _In_reads_bytes_opt_(cchName) WCHAR name[]);
//
// Startup/Shutdown Events
@@ -611,8 +611,8 @@ class EEToProfInterfaceImpl
HRESULT CreateProfiler(
const CLSID * pClsid,
- __in_z LPCWSTR wszClsid,
- __in_z LPCWSTR wszProfileDLL);
+ _In_z_ LPCWSTR wszClsid,
+ _In_z_ LPCWSTR wszProfileDLL);
HRESULT DetermineAndSetEnterLeaveFunctionHooksForJit();
diff --git a/src/coreclr/vm/eventpipeinternal.cpp b/src/coreclr/vm/eventpipeinternal.cpp
index d759a1e0f1accc..e3debbf276649a 100644
--- a/src/coreclr/vm/eventpipeinternal.cpp
+++ b/src/coreclr/vm/eventpipeinternal.cpp
@@ -12,7 +12,7 @@
#ifdef FEATURE_PERFTRACING
extern "C" UINT64 QCALLTYPE EventPipeInternal_Enable(
- __in_z LPCWSTR outputFile,
+ _In_z_ LPCWSTR outputFile,
EventPipeSerializationFormat format,
UINT32 circularBufferSizeInMB,
/* COR_PRF_EVENTPIPE_PROVIDER_CONFIG */ LPCVOID pProviders,
@@ -84,7 +84,7 @@ extern "C" bool QCALLTYPE EventPipeInternal_GetSessionInfo(UINT64 sessionID, Eve
}
extern "C" INT_PTR QCALLTYPE EventPipeInternal_CreateProvider(
- __in_z LPCWSTR providerName,
+ _In_z_ LPCWSTR providerName,
EventPipeCallback pCallbackFunc)
{
QCALL_CONTRACT;
@@ -125,7 +125,7 @@ extern "C" INT_PTR QCALLTYPE EventPipeInternal_DefineEvent(
return reinterpret_cast(pEvent);
}
-extern "C" INT_PTR QCALLTYPE EventPipeInternal_GetProvider(__in_z LPCWSTR providerName)
+extern "C" INT_PTR QCALLTYPE EventPipeInternal_GetProvider(_In_z_ LPCWSTR providerName)
{
QCALL_CONTRACT;
diff --git a/src/coreclr/vm/eventpipeinternal.h b/src/coreclr/vm/eventpipeinternal.h
index 33fdc0e64cd238..bf57fed8b5acf3 100644
--- a/src/coreclr/vm/eventpipeinternal.h
+++ b/src/coreclr/vm/eventpipeinternal.h
@@ -40,7 +40,7 @@ struct EventPipeSessionInfo
//! Sets the sampling rate and enables the event pipe for the specified configuration.
//!
extern "C" UINT64 QCALLTYPE EventPipeInternal_Enable(
- __in_z LPCWSTR outputFile,
+ _In_z_ LPCWSTR outputFile,
EventPipeSerializationFormat format,
UINT32 circularBufferSizeInMB,
/* COR_PRF_EVENTPIPE_PROVIDER_CONFIG */ LPCVOID pProviders,
@@ -54,7 +54,7 @@ extern "C" void QCALLTYPE EventPipeInternal_Disable(UINT64 sessionID);
extern "C" bool QCALLTYPE EventPipeInternal_GetSessionInfo(UINT64 sessionID, EventPipeSessionInfo *pSessionInfo);
extern "C" INT_PTR QCALLTYPE EventPipeInternal_CreateProvider(
- __in_z LPCWSTR providerName,
+ _In_z_ LPCWSTR providerName,
EventPipeCallback pCallbackFunc);
extern "C" INT_PTR QCALLTYPE EventPipeInternal_DefineEvent(
@@ -67,7 +67,7 @@ extern "C" INT_PTR QCALLTYPE EventPipeInternal_DefineEvent(
UINT32 metadataLength);
extern "C" INT_PTR QCALLTYPE EventPipeInternal_GetProvider(
- __in_z LPCWSTR providerName);
+ _In_z_ LPCWSTR providerName);
extern "C" void QCALLTYPE EventPipeInternal_DeleteProvider(
INT_PTR provHandle);
diff --git a/src/coreclr/vm/eventreporter.cpp b/src/coreclr/vm/eventreporter.cpp
index 318cc21320f622..e865549052464a 100644
--- a/src/coreclr/vm/eventreporter.cpp
+++ b/src/coreclr/vm/eventreporter.cpp
@@ -110,7 +110,7 @@ EventReporter::EventReporter(EventReporterType type)
case ERT_ManagedFailFast:
if(!ssMessage.LoadResource(CCompRC::Optional, IDS_ER_MANAGEDFAILFAST))
- m_Description.Append(W("Description: The application requested process termination through Environment.FailFast."));
+ m_Description.Append(W("Description: The application requested process termination through System.Environment.FailFast."));
else
{
m_Description.Append(ssMessage);
@@ -120,7 +120,7 @@ EventReporter::EventReporter(EventReporterType type)
case ERT_UnmanagedFailFast:
if(!ssMessage.LoadResource(CCompRC::Optional, IDS_ER_UNMANAGEDFAILFAST))
- m_Description.Append(W("Description: The process was terminated due to an internal error in the .NET Runtime."));
+ m_Description.Append(W("Description: The process was terminated due to an internal error in the .NET Runtime "));
else
{
m_Description.Append(ssMessage);
@@ -165,7 +165,7 @@ EventReporter::EventReporter(EventReporterType type)
// Return Value:
// None.
//
-void EventReporter::AddDescription(__in WCHAR *pString)
+void EventReporter::AddDescription(_In_ WCHAR *pString)
{
CONTRACTL
{
diff --git a/src/coreclr/vm/eventreporter.h b/src/coreclr/vm/eventreporter.h
index ac74acb76a1019..9b600e76cd4aea 100644
--- a/src/coreclr/vm/eventreporter.h
+++ b/src/coreclr/vm/eventreporter.h
@@ -52,7 +52,7 @@ class EventReporter
// Construct
EventReporter(EventReporterType type);
// Add extra info into description part of the log
- void AddDescription(__in WCHAR *pString);
+ void AddDescription(_In_ WCHAR *pString);
void AddDescription(SString& s);
// Start callstack record
void BeginStackTrace();
diff --git a/src/coreclr/vm/eventtrace.cpp b/src/coreclr/vm/eventtrace.cpp
index a9a33e50efc145..e5473b11041775 100644
--- a/src/coreclr/vm/eventtrace.cpp
+++ b/src/coreclr/vm/eventtrace.cpp
@@ -4961,7 +4961,7 @@ VOID ETW::ExceptionLog::ExceptionFilterEnd()
/****************************************************************************/
/* This is called by the runtime when a domain is loaded */
/****************************************************************************/
-VOID ETW::LoaderLog::DomainLoadReal(BaseDomain *pDomain, __in_opt LPWSTR wszFriendlyName)
+VOID ETW::LoaderLog::DomainLoadReal(BaseDomain *pDomain, _In_opt_ LPWSTR wszFriendlyName)
{
CONTRACTL {
NOTHROW;
@@ -5671,7 +5671,7 @@ VOID ETW::MethodLog::MethodTableRestored(MethodTable *pMethodTable)
/****************************************************************************/
/* This is called by the runtime when a Strong Name Verification Starts */
/****************************************************************************/
-VOID ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, __in LPWSTR strFullyQualifiedAssemblyName)
+VOID ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, _In_ LPWSTR strFullyQualifiedAssemblyName)
{
WRAPPER_NO_CONTRACT;
}
@@ -5680,7 +5680,7 @@ VOID ETW::SecurityLog::StrongNameVerificationStart(DWORD dwInFlags, __in LPWSTR
/****************************************************************************/
/* This is called by the runtime when a Strong Name Verification Ends */
/****************************************************************************/
-VOID ETW::SecurityLog::StrongNameVerificationStop(DWORD dwInFlags,ULONG result, __in LPWSTR strFullyQualifiedAssemblyName)
+VOID ETW::SecurityLog::StrongNameVerificationStop(DWORD dwInFlags,ULONG result, _In_ LPWSTR strFullyQualifiedAssemblyName)
{
WRAPPER_NO_CONTRACT;
}
@@ -6091,8 +6091,8 @@ VOID ETW::LoaderLog::SendAssemblyEvent(Assembly *pAssembly, DWORD dwEventOptions
ETW_INLINE
ULONG
ETW::LoaderLog::SendModuleRange(
- __in Module *pModule,
- __in DWORD dwEventOptions)
+ _In_ Module *pModule,
+ _In_ DWORD dwEventOptions)
{
ULONG Result = ERROR_SUCCESS;
diff --git a/src/coreclr/vm/excep.cpp b/src/coreclr/vm/excep.cpp
index df71d0e0e06c8e..fa2b8ffc7dfe38 100644
--- a/src/coreclr/vm/excep.cpp
+++ b/src/coreclr/vm/excep.cpp
@@ -190,7 +190,7 @@ BOOL ExceptionIsOfRightType(TypeHandle clauseType, TypeHandle thrownType)
// Gets the message text from an exception
//===========================================================================
ULONG GetExceptionMessage(OBJECTREF throwable,
- __inout_ecount(bufferLength) LPWSTR buffer,
+ _Inout_updates_(bufferLength) LPWSTR buffer,
ULONG bufferLength)
{
CONTRACTL
@@ -5162,7 +5162,7 @@ static SString GetExceptionMessageWrapper(Thread* pThread, OBJECTREF throwable)
void STDMETHODCALLTYPE
DefaultCatchHandlerExceptionMessageWorker(Thread* pThread,
OBJECTREF throwable,
- __inout_ecount(buf_size) WCHAR *buf,
+ _Inout_updates_(buf_size) WCHAR *buf,
const int buf_size,
BOOL sendWindowsEventLog)
{
@@ -11476,7 +11476,7 @@ void ResetThreadAbortState(PTR_Thread pThread, CrawlFrame *pCf, StackFrame sfCur
// Note: The "cond" argument is there to tide us over during the transition from
// BAD_FORMAT_ASSERT to THROW_BAD_FORMAT. It will go away soon.
//---------------------------------------------------------------------------------
-VOID ThrowBadFormatWorker(UINT resID, LPCWSTR imageName DEBUGARG(__in_z const char *cond))
+VOID ThrowBadFormatWorker(UINT resID, LPCWSTR imageName DEBUGARG(_In_z_ const char *cond))
{
CONTRACTL
{
@@ -11906,8 +11906,8 @@ VOID DECLSPEC_NORETURN ThrowFieldLayoutError(mdTypeDef cl, // cl
}
CHAR offsetBuf[16];
- sprintf_s(offsetBuf, COUNTOF(offsetBuf), "%d", dwOffset);
- offsetBuf[COUNTOF(offsetBuf) - 1] = '\0';
+ sprintf_s(offsetBuf, ARRAY_SIZE(offsetBuf), "%d", dwOffset);
+ offsetBuf[ARRAY_SIZE(offsetBuf) - 1] = '\0';
pModule->GetAssembly()->ThrowTypeLoadException(pszNamespace,
pszName,
diff --git a/src/coreclr/vm/excep.h b/src/coreclr/vm/excep.h
index f95a8b6784ea97..b76839bdcffdd7 100644
--- a/src/coreclr/vm/excep.h
+++ b/src/coreclr/vm/excep.h
@@ -347,7 +347,7 @@ void CreateTypeInitializationExceptionObject(LPCWSTR pTypeThatFailed,
//==========================================================================
ULONG GetExceptionMessage(OBJECTREF throwable,
- __inout_ecount(bufferLength) LPWSTR buffer,
+ _Inout_updates_(bufferLength) LPWSTR buffer,
ULONG bufferLength);
void GetExceptionMessage(OBJECTREF throwable, SString &result);
STRINGREF GetExceptionMessage(OBJECTREF throwable);
diff --git a/src/coreclr/vm/exceptionhandling.cpp b/src/coreclr/vm/exceptionhandling.cpp
index 4af702fab14996..dcd6681a1b08c1 100644
--- a/src/coreclr/vm/exceptionhandling.cpp
+++ b/src/coreclr/vm/exceptionhandling.cpp
@@ -117,7 +117,7 @@ inline void RestoreNonvolatileRegisterPointers(PT_KNONVOLATILE_CONTEXT_POINTERS
//
#ifdef _DEBUG
void DumpClauses(IJitManager* pJitMan, const METHODTOKEN& MethToken, UINT_PTR uMethodStartPC, UINT_PTR dwControlPc);
-static void DoEHLog(DWORD lvl, __in_z const char *fmt, ...);
+static void DoEHLog(DWORD lvl, _In_z_ const char *fmt, ...);
#define EH_LOG(expr) { DoEHLog expr ; }
#else
#define EH_LOG(expr)
@@ -2035,7 +2035,7 @@ CLRUnwindStatus ExceptionTracker::ProcessOSExceptionNotification(
}
// static
-void ExceptionTracker::DebugLogTrackerRanges(__in_z const char *pszTag)
+void ExceptionTracker::DebugLogTrackerRanges(_In_z_ const char *pszTag)
{
#ifdef _DEBUG
CONTRACTL
@@ -4277,7 +4277,7 @@ void DumpClauses(IJitManager* pJitMan, const METHODTOKEN& MethToken, UINT_PTR uM
static void DoEHLog(
DWORD lvl,
- __in_z const char *fmt,
+ _In_z_ const char *fmt,
...
)
{
diff --git a/src/coreclr/vm/exceptionhandling.h b/src/coreclr/vm/exceptionhandling.h
index 50dd756fa7e89c..c3237de6b67b0b 100644
--- a/src/coreclr/vm/exceptionhandling.h
+++ b/src/coreclr/vm/exceptionhandling.h
@@ -360,7 +360,7 @@ class ExceptionTracker
void EnumMemoryRegions(CLRDataEnumMemoryFlags flags);
#endif // DACCESS_COMPILE
- static void DebugLogTrackerRanges(__in_z const char *pszTag);
+ static void DebugLogTrackerRanges(_In_z_ const char *pszTag);
bool IsStackOverflowException();
diff --git a/src/coreclr/vm/exceptmacros.h b/src/coreclr/vm/exceptmacros.h
index 70e1fe0871e0d7..4967da497b5097 100644
--- a/src/coreclr/vm/exceptmacros.h
+++ b/src/coreclr/vm/exceptmacros.h
@@ -502,11 +502,11 @@ LPCWSTR GetPathForErrorMessagesT(T *pImgObj)
}
}
-VOID ThrowBadFormatWorker(UINT resID, LPCWSTR imageName DEBUGARG(__in_z const char *cond));
+VOID ThrowBadFormatWorker(UINT resID, LPCWSTR imageName DEBUGARG(_In_z_ const char *cond));
template
NOINLINE
-VOID ThrowBadFormatWorkerT(UINT resID, T * pImgObj DEBUGARG(__in_z const char *cond))
+VOID ThrowBadFormatWorkerT(UINT resID, T * pImgObj DEBUGARG(_In_z_ const char *cond))
{
#ifdef DACCESS_COMPILE
ThrowBadFormatWorker(resID, nullptr DEBUGARG(cond));
diff --git a/src/coreclr/vm/frames.cpp b/src/coreclr/vm/frames.cpp
index 77bcb178bb49c2..9377b4ec028b72 100644
--- a/src/coreclr/vm/frames.cpp
+++ b/src/coreclr/vm/frames.cpp
@@ -63,24 +63,15 @@ void Frame::Log() {
MethodDesc* method = GetFunction();
-#ifdef TARGET_X86
- if (GetVTablePtr() == UMThkCallFrame::GetMethodFrameVPtr())
- method = ((UMThkCallFrame*) this)->GetUMEntryThunk()->GetMethod();
-#endif
-
STRESS_LOG3(LF_STUBS, LL_INFO1000000, "STUBS: In Stub with Frame %p assoc Method %pM FrameType = %pV\n", this, method, *((void**) this));
char buff[64];
const char* frameType;
if (GetVTablePtr() == PrestubMethodFrame::GetMethodFrameVPtr())
frameType = "PreStub";
-#ifdef TARGET_X86
- else if (GetVTablePtr() == UMThkCallFrame::GetMethodFrameVPtr())
- frameType = "UMThkCallFrame";
-#endif
else if (GetVTablePtr() == PInvokeCalliFrame::GetMethodFrameVPtr())
{
- sprintf_s(buff, COUNTOF(buff), "PInvoke CALLI target" FMT_ADDR,
+ sprintf_s(buff, ARRAY_SIZE(buff), "PInvoke CALLI target" FMT_ADDR,
DBG_ADDR(((PInvokeCalliFrame*)this)->GetPInvokeCalliTarget()));
frameType = buff;
}
@@ -257,7 +248,7 @@ void Frame::LogFrame(
{
_ASSERTE(!"New Frame type needs to be added to FrameTypeName()");
// Pointer is up to 17chars + vtbl@ = 22 chars
- sprintf_s(buf, COUNTOF(buf), "vtbl@%p", (VOID *)GetVTablePtr());
+ sprintf_s(buf, ARRAY_SIZE(buf), "vtbl@%p", (VOID *)GetVTablePtr());
pFrameType = buf;
}
@@ -1603,32 +1594,6 @@ void ComMethodFrame::DoSecondPassHandlerCleanup(Frame * pCurFrame)
#endif // FEATURE_COMINTEROP
-
-#ifdef TARGET_X86
-
-PTR_UMEntryThunk UMThkCallFrame::GetUMEntryThunk()
-{
- LIMITED_METHOD_DAC_CONTRACT;
- return dac_cast(GetDatum());
-}
-
-#ifdef DACCESS_COMPILE
-void UMThkCallFrame::EnumMemoryRegions(CLRDataEnumMemoryFlags flags)
-{
- WRAPPER_NO_CONTRACT;
- UnmanagedToManagedFrame::EnumMemoryRegions(flags);
-
- // Pieces of the UMEntryThunk need to be saved.
- UMEntryThunk *pThunk = GetUMEntryThunk();
- DacEnumMemoryRegion(dac_cast(pThunk), sizeof(UMEntryThunk));
-
- UMThunkMarshInfo *pMarshInfo = pThunk->GetUMThunkMarshInfo();
- DacEnumMemoryRegion(dac_cast(pMarshInfo), sizeof(UMThunkMarshInfo));
-}
-#endif
-
-#endif // TARGET_X86
-
#ifndef DACCESS_COMPILE
#if defined(_MSC_VER) && defined(TARGET_X86)
@@ -1952,16 +1917,18 @@ VOID InlinedCallFrame::Init()
}
-
+#ifdef FEATURE_COMINTEROP
void UnmanagedToManagedFrame::ExceptionUnwind()
{
WRAPPER_NO_CONTRACT;
AppDomain::ExceptionUnwind(this);
}
+#endif // FEATURE_COMINTEROP
#endif // !DACCESS_COMPILE
+#ifdef FEATURE_COMINTEROP
PCODE UnmanagedToManagedFrame::GetReturnAddress()
{
WRAPPER_NO_CONTRACT;
@@ -1980,6 +1947,7 @@ PCODE UnmanagedToManagedFrame::GetReturnAddress()
return pRetAddr;
}
}
+#endif // FEATURE_COMINTEROP
#ifndef DACCESS_COMPILE
//=================================================================================
diff --git a/src/coreclr/vm/frames.h b/src/coreclr/vm/frames.h
index c2946ced0b2f66..82e57cbbb04017 100644
--- a/src/coreclr/vm/frames.h
+++ b/src/coreclr/vm/frames.h
@@ -90,23 +90,18 @@
// | |
// | +-TPMethodFrame - for calls on transparent proxy
// |
+#ifdef FEATURE_COMINTEROP
// +-UnmanagedToManagedFrame - this frame represents a transition from
// | | unmanaged code back to managed code. It's
// | | main functions are to stop COM+ exception
// | | propagation and to expose unmanaged parameters.
// | |
-#ifdef FEATURE_COMINTEROP
-// | |
// | +-ComMethodFrame - this frame represents a transition from
// | | com to com+
// | |
// | +-ComPrestubMethodFrame - prestub frame for calls from COM to CLR
// |
#endif //FEATURE_COMINTEROP
-#ifdef TARGET_X86
-// | +-UMThkCallFrame - this frame represents an unmanaged->managed
-// | transition through N/Direct
-#endif
#if defined(TARGET_X86) && !defined(UNIX_X86_ABI)
// +-TailCallFrame - padding for tailcalls
// |
@@ -172,16 +167,9 @@ Delegate over a native function pointer:
Reverse P/Invoke (used for C++ exports & fixups as well as delegates
obtained from function pointers):
Normal stub:
- x86: The stub is generated by UMEntryThunk::CompileUMThunkWorker
- (in DllImportCallback.cpp) and it is frameless. It calls directly
- the managed target or to IL stub if marshaling is required.
- non-x86: The stub exists statically as UMThunkStub and calls to IL stub.
+ The stub exists statically as UMThunkStub and calls to IL stub.
Prestub:
- The prestub is generated by GenerateUMThunkPrestub (x86) or exists statically
- as TheUMEntryPrestub (64-bit), and it erects an UMThkCallFrame frame.
-
-Reverse P/Invoke AppDomain selector stub:
- The asm helper is IJWNOADThunkJumpTarget (in asmhelpers.asm) and it is frameless.
+ The prestub exists statically as TheUMEntryPrestub.
//------------------------------------------------------------------------
#endif // 0
@@ -212,8 +200,8 @@ FRAME_TYPE_NAME(HelperMethodFrame_3OBJ)
FRAME_TYPE_NAME(HelperMethodFrame_PROTECTOBJ)
FRAME_ABSTRACT_TYPE_NAME(FramedMethodFrame)
FRAME_TYPE_NAME(MulticastFrame)
-FRAME_ABSTRACT_TYPE_NAME(UnmanagedToManagedFrame)
#ifdef FEATURE_COMINTEROP
+FRAME_ABSTRACT_TYPE_NAME(UnmanagedToManagedFrame)
FRAME_TYPE_NAME(ComMethodFrame)
FRAME_TYPE_NAME(ComPlusMethodFrame)
FRAME_TYPE_NAME(ComPrestubMethodFrame)
@@ -238,9 +226,6 @@ FRAME_TYPE_NAME(DebuggerClassInitMarkFrame)
FRAME_TYPE_NAME(DebuggerSecurityCodeMarkFrame)
FRAME_TYPE_NAME(DebuggerExitFrame)
FRAME_TYPE_NAME(DebuggerU2MCatchHandlerFrame)
-#ifdef TARGET_X86
-FRAME_TYPE_NAME(UMThkCallFrame)
-#endif
FRAME_TYPE_NAME(InlinedCallFrame)
#if defined(TARGET_X86) && !defined(UNIX_X86_ABI)
FRAME_TYPE_NAME(TailCallFrame)
@@ -281,9 +266,6 @@ class Frame;
class FramedMethodFrame;
typedef VPTR(class FramedMethodFrame) PTR_FramedMethodFrame;
struct HijackArgs;
-class UMEntryThunk;
-class UMThunkMarshInfo;
-class Marshaler;
struct ResolveCacheElem;
#if defined(DACCESS_COMPILE)
class DacDbiInterfaceImpl;
@@ -1814,6 +1796,8 @@ class MulticastFrame : public TransitionFrame
};
+#ifdef FEATURE_COMINTEROP
+
//-----------------------------------------------------------------------
// Transition frame from unmanaged to managed
//-----------------------------------------------------------------------
@@ -1922,8 +1906,6 @@ class UnmanagedToManagedFrame : public Frame
#endif
};
-#ifdef FEATURE_COMINTEROP
-
//------------------------------------------------------------------------
// This frame represents a transition from COM to COM+
//------------------------------------------------------------------------
@@ -2774,43 +2756,6 @@ class DebuggerU2MCatchHandlerFrame : public Frame
DEFINE_VTABLE_GETTER_AND_DTOR(DebuggerU2MCatchHandlerFrame)
};
-
-class UMThunkMarshInfo;
-typedef DPTR(class UMThunkMarshInfo) PTR_UMThunkMarshInfo;
-
-class UMEntryThunk;
-typedef DPTR(class UMEntryThunk) PTR_UMEntryThunk;
-
-#if defined(TARGET_X86)
-//------------------------------------------------------------------------
-// This frame guards an unmanaged->managed transition thru a UMThk
-//------------------------------------------------------------------------
-
-class UMThkCallFrame : public UnmanagedToManagedFrame
-{
- VPTR_VTABLE_CLASS(UMThkCallFrame, UnmanagedToManagedFrame)
-
-public:
-
-#ifdef DACCESS_COMPILE
- virtual void EnumMemoryRegions(CLRDataEnumMemoryFlags flags);
-#endif
-
- PTR_UMEntryThunk GetUMEntryThunk();
-
- static int GetOffsetOfUMEntryThunk()
- {
- WRAPPER_NO_CONTRACT;
- return GetOffsetOfDatum();
- }
-
-protected:
-
- // Keep as last entry in class
- DEFINE_VTABLE_GETTER_AND_CTOR_AND_DTOR(UMThkCallFrame)
-};
-#endif // TARGET_X86 && !TARGET_UNIX
-
// Frame for the Reverse PInvoke (i.e. UnmanagedCallersOnlyAttribute).
struct ReversePInvokeFrame
{
@@ -2821,29 +2766,6 @@ struct ReversePInvokeFrame
#endif
};
-#if defined(TARGET_X86) && defined(FEATURE_COMINTEROP)
-//-------------------------------------------------------------------------
-// Exception handler for COM to managed frame
-// and the layout of the exception registration record structure in the stack
-// the layout is similar to the NT's EXCEPTIONREGISTRATION record
-// followed by the UnmanagedToManagedFrame specific info
-
-struct ComToManagedExRecord
-{
- EXCEPTION_REGISTRATION_RECORD m_ExReg;
- ArgumentRegisters m_argRegs;
- GSCookie m_gsCookie;
- UMThkCallFrame m_frame;
-
- UnmanagedToManagedFrame * GetCurrFrame()
- {
- LIMITED_METHOD_CONTRACT;
- return &m_frame;
- }
-};
-#endif // TARGET_X86 && FEATURE_COMINTEROP
-
-
//------------------------------------------------------------------------
// This frame is pushed by any JIT'ted method that contains one or more
// inlined N/Direct calls. Note that the JIT'ted method keeps it pushed
diff --git a/src/coreclr/vm/h2inc.pl b/src/coreclr/vm/h2inc.pl
deleted file mode 100644
index 6d2e0c3e03dcf1..00000000000000
--- a/src/coreclr/vm/h2inc.pl
+++ /dev/null
@@ -1,61 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-# C to MASM include file translator
-# This is replacement for the deprecated h2inc tool that used to be part of VS.
-
-use File::Basename;
-
-sub ProcessFile($) {
- my ($input_file) = @_;
-
- local *INPUT_FILE;
- if (!open(INPUT_FILE, $input_file))
- {
- print "#error: File can not be opened: $input_file\n";
- return;
- }
-
- print ("// File start: $input_file\n");
-
- while() {
- # Skip all pragmas
- if (m/^\s*#\s*pragma/) {
- next;
- }
-
- # Expand includes.
- if (m/\s*#\s*include\s*\"(.+)\"/) {
- ProcessFile(dirname($input_file) . "/" . $1);
- next;
- }
-
- # Augment #defines with their MASM equivalent
- if (m/^\s*#\s*define\s+(\S+)\s+(.*)/) {
- my $name = $1;
- my $value = $2;
-
- # Note that we do not handle multiline constants
-
- # Strip comments from value
- $value =~ s/\/\/.*//;
- $value =~ s/\/\*.*\*\///g;
-
- # Strip whitespaces from value
- $value =~ s/\s+$//;
-
- # ignore #defines with arguments
- if (!($name =~ m/\(/)) {
- my $number = 0;
- $number |= ($value =~ s/\b0x(\w+)\b/0\1h/g); # Convert hex constants
- $number |= ($value =~ s/(-?\b\d+\b)/\1t/g); # Convert dec constants
- print $number ? "$name EQU $value\n" : "$name TEXTEQU <$value>\n";
- }
- }
- print;
- }
-
- print ("// File end: $input_file\n");
-}
-
-ProcessFile($ARGV[0]);
diff --git a/src/coreclr/vm/h2inc.ps1 b/src/coreclr/vm/h2inc.ps1
deleted file mode 100644
index f2c2c07f26582b..00000000000000
--- a/src/coreclr/vm/h2inc.ps1
+++ /dev/null
@@ -1,69 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-# C to MASM include file translator
-# This is replacement for the deprecated h2inc tool that used to be part of VS.
-
-#
-# The use of [console]::WriteLine (instead of Write-Output) is intentional.
-# PowerShell 2.0 (installed by default on Windows 7) wraps lines written with
-# Write-Output at whatever column width is being used by the current terminal,
-# even when output is being redirected to a file. We can't have this behavior
-# because it will cause the generated file to be malformed.
-#
-
-Function ProcessFile($filePath) {
-
- [console]::WriteLine("// File start: $filePath")
-
- Get-Content $filePath | ForEach-Object {
-
- if ($_ -match "^\s*#\spragma") {
- # Ignore pragmas
- return
- }
-
- if ($_ -match "^\s*#\s*include\s*`"(.*)`"")
- {
- # Expand includes.
- ProcessFile(Join-Path (Split-Path -Parent $filePath) $Matches[1])
- return
- }
-
- if ($_ -match "^\s*#define\s+(\S+)\s*(.*)")
- {
- # Augment #defines with their MASM equivalent
- $name = $Matches[1]
- $value = $Matches[2]
-
- # Note that we do not handle multiline constants
-
- # Strip comments from value
- $value = $value -replace "//.*", ""
- $value = $value -replace "/\*.*\*/", ""
-
- # Strip whitespaces from value
- $value = $value -replace "\s+$", ""
-
- # ignore #defines with arguments
- if ($name -notmatch "\(") {
- $HEX_NUMBER_PATTERN = "\b0x(\w+)\b"
- $DECIMAL_NUMBER_PATTERN = "(-?\b\d+\b)"
-
- if ($value -match $HEX_NUMBER_PATTERN -or $value -match $DECIMAL_NUMBER_PATTERN) {
- $value = $value -replace $HEX_NUMBER_PATTERN, "0`$1h" # Convert hex constants
- $value = $value -replace $DECIMAL_NUMBER_PATTERN, "`$1t" # Convert dec constants
- [console]::WriteLine("$name EQU $value")
- } else {
- [console]::WriteLine("$name TEXTEQU <$value>")
- }
- }
- }
-
- [console]::WriteLine("$_")
- }
-
- [console]::WriteLine("// File end: $filePath")
-}
-
-ProcessFile $args[0]
diff --git a/src/coreclr/vm/i386/asmhelpers.asm b/src/coreclr/vm/i386/asmhelpers.asm
index d3eb78da472562..896c249822c552 100644
--- a/src/coreclr/vm/i386/asmhelpers.asm
+++ b/src/coreclr/vm/i386/asmhelpers.asm
@@ -43,7 +43,6 @@ EXTERN _COMPlusFrameHandlerRevCom:PROC
endif ; FEATURE_COMINTEROP
EXTERN __alloca_probe:PROC
EXTERN _NDirectImportWorker@4:PROC
-EXTERN _UMThunkStubRareDisableWorker@8:PROC
EXTERN _VarargPInvokeStubWorker@12:PROC
EXTERN _GenericPInvokeCalliStubWorker@12:PROC
@@ -53,6 +52,7 @@ EXTERN _CopyCtorCallStubWorker@4:PROC
endif
EXTERN _PreStubWorker@8:PROC
+EXTERN _TheUMEntryPrestubWorker@4:PROC
ifdef FEATURE_COMINTEROP
EXTERN _CLRToCOMWorker@8:PROC
@@ -255,9 +255,6 @@ COMPlusNestedExceptionHandler proto c
FastNExportExceptHandler proto c
.safeseh FastNExportExceptHandler
-UMThunkPrestubHandler proto c
-.safeseh UMThunkPrestubHandler
-
ifdef FEATURE_COMINTEROP
COMPlusFrameHandlerRevCom proto c
.safeseh COMPlusFrameHandlerRevCom
@@ -872,23 +869,6 @@ getFPReturn4:
retn 8
_getFPReturn@8 endp
-; VOID __cdecl UMThunkStubRareDisable()
-;
-; @todo: this is very similar to StubRareDisable
-;
-_UMThunkStubRareDisable proc public
- push eax
- push ecx
-
- push eax ; Push the UMEntryThunk
- push ecx ; Push thread
- call _UMThunkStubRareDisableWorker@8
-
- pop ecx
- pop eax
- retn
-_UMThunkStubRareDisable endp
-
; void __stdcall JIT_ProfilerEnterLeaveTailcallStub(UINT_PTR ProfilerHandle)
_JIT_ProfilerEnterLeaveTailcallStub@4 proc public
@@ -1432,6 +1412,22 @@ public _ThePreStubPatchLabel@0
ret
_ThePreStubPatch@0 endp
+_TheUMEntryPrestub@0 proc public
+ ; push argument registers
+ push ecx
+ push edx
+
+ push eax ; UMEntryThunk*
+ call _TheUMEntryPrestubWorker@4
+
+ ; pop argument registers
+ pop edx
+ pop ecx
+
+ ; eax = PCODE
+ jmp eax ; Tail Jmp
+_TheUMEntryPrestub@0 endp
+
ifdef FEATURE_COMINTEROP
;==========================================================================
; CLR -> COM generic or late-bound call
diff --git a/src/coreclr/vm/i386/cgenx86.cpp b/src/coreclr/vm/i386/cgenx86.cpp
index f0a81d6daeea16..d2d5d1676e95c8 100644
--- a/src/coreclr/vm/i386/cgenx86.cpp
+++ b/src/coreclr/vm/i386/cgenx86.cpp
@@ -931,58 +931,6 @@ WORD GetUnpatchedCodeData(LPCBYTE pAddr)
#ifndef DACCESS_COMPILE
-#if defined(TARGET_X86) && !defined(FEATURE_STUBS_AS_IL)
-//-------------------------------------------------------------------------
-// One-time creation of special prestub to initialize UMEntryThunks.
-//-------------------------------------------------------------------------
-Stub *GenerateUMThunkPrestub()
-{
- CONTRACT(Stub*)
- {
- STANDARD_VM_CHECK;
- POSTCONDITION(CheckPointer(RETVAL));
- }
- CONTRACT_END;
-
- CPUSTUBLINKER sl;
- CPUSTUBLINKER *psl = &sl;
-
- CodeLabel* rgRareLabels[] = { psl->NewCodeLabel(),
- psl->NewCodeLabel(),
- psl->NewCodeLabel()
- };
-
-
- CodeLabel* rgRejoinLabels[] = { psl->NewCodeLabel(),
- psl->NewCodeLabel(),
- psl->NewCodeLabel()
- };
-
- // emit the initial prolog
- psl->EmitComMethodStubProlog(UMThkCallFrame::GetMethodFrameVPtr(), rgRareLabels, rgRejoinLabels, FALSE /*Don't profile*/);
-
- // mov ecx, [esi+UMThkCallFrame.pUMEntryThunk]
- psl->X86EmitIndexRegLoad(kECX, kESI, UMThkCallFrame::GetOffsetOfUMEntryThunk());
-
- // The call conv is a __stdcall
- psl->X86EmitPushReg(kECX);
-
- // call UMEntryThunk::DoRunTimeInit
- psl->X86EmitCall(psl->NewExternalCodeLabel((LPVOID)UMEntryThunk::DoRunTimeInit), 4);
-
- // mov ecx, [esi+UMThkCallFrame.pUMEntryThunk]
- psl->X86EmitIndexRegLoad(kEAX, kESI, UMThkCallFrame::GetOffsetOfUMEntryThunk());
-
- // lea eax, [eax + UMEntryThunk.m_code] // point to fixedup UMEntryThunk
- psl->X86EmitOp(0x8d, kEAX, kEAX,
- UMEntryThunk::GetCodeOffset() + UMEntryThunkCode::GetEntryPointOffset());
-
- psl->EmitComMethodStubEpilog(UMThkCallFrame::GetMethodFrameVPtr(), rgRareLabels, rgRejoinLabels, FALSE /*Don't profile*/);
-
- RETURN psl->Link(SystemDomain::GetGlobalLoaderAllocator()->GetExecutableHeap());
-}
-#endif // TARGET_X86 && !FEATURE_STUBS_AS_IL
-
Stub *GenerateInitPInvokeFrameHelper()
{
CONTRACT(Stub*)
diff --git a/src/coreclr/vm/i386/excepx86.cpp b/src/coreclr/vm/i386/excepx86.cpp
index 3d2e0e4dddeca0..15dd0667dd6c4f 100644
--- a/src/coreclr/vm/i386/excepx86.cpp
+++ b/src/coreclr/vm/i386/excepx86.cpp
@@ -113,17 +113,6 @@ static void RtlUnwindCallback()
_ASSERTE(!"Should never get here");
}
-BOOL NExportSEH(EXCEPTION_REGISTRATION_RECORD* pEHR)
-{
- LIMITED_METHOD_CONTRACT;
-
- if ((LPVOID)pEHR->Handler == (LPVOID)UMThunkPrestubHandler)
- {
- return TRUE;
- }
- return FALSE;
-}
-
BOOL FastNExportSEH(EXCEPTION_REGISTRATION_RECORD* pEHR)
{
LIMITED_METHOD_CONTRACT;
@@ -156,9 +145,8 @@ BOOL IsUnmanagedToManagedSEHHandler(EXCEPTION_REGISTRATION_RECORD *pEstablisherF
//
// ComPlusFrameSEH() is for COMPlusFrameHandler & COMPlusNestedExceptionHandler.
// FastNExportSEH() is for FastNExportExceptHandler.
- // NExportSEH() is for UMThunkPrestubHandler.
//
- return (ComPlusFrameSEH(pEstablisherFrame) || FastNExportSEH(pEstablisherFrame) || NExportSEH(pEstablisherFrame) || ReverseCOMSEH(pEstablisherFrame));
+ return (ComPlusFrameSEH(pEstablisherFrame) || FastNExportSEH(pEstablisherFrame) || ReverseCOMSEH(pEstablisherFrame));
}
Frame *GetCurrFrame(EXCEPTION_REGISTRATION_RECORD *pEstablisherFrame)
@@ -166,10 +154,7 @@ Frame *GetCurrFrame(EXCEPTION_REGISTRATION_RECORD *pEstablisherFrame)
Frame *pFrame;
WRAPPER_NO_CONTRACT;
_ASSERTE(IsUnmanagedToManagedSEHHandler(pEstablisherFrame));
- if (NExportSEH(pEstablisherFrame))
- pFrame = ((ComToManagedExRecord *)pEstablisherFrame)->GetCurrFrame();
- else
- pFrame = ((FrameHandlerExRecord *)pEstablisherFrame)->GetCurrFrame();
+ pFrame = ((FrameHandlerExRecord *)pEstablisherFrame)->GetCurrFrame();
// Assert that the exception frame is on the thread or that the exception frame is the top frame.
_ASSERTE(GetThreadNULLOk() == NULL || GetThread()->GetFrame() == (Frame*)-1 || GetThread()->GetFrame() <= pFrame);
@@ -3384,52 +3369,6 @@ EXCEPTION_HANDLER_IMPL(FastNExportExceptHandler)
return retval;
}
-
-// Just like a regular NExport handler -- except it pops an extra frame on unwind. A handler
-// like this is needed by the COMMethodStubProlog code. It first pushes a frame -- and then
-// pushes a handler. When we unwind, we need to pop the extra frame to avoid corrupting the
-// frame chain in the event of an unmanaged catcher.
-//
-EXCEPTION_HANDLER_IMPL(UMThunkPrestubHandler)
-{
- // @todo: we'd like to have a dynamic contract here, but there's a problem. (Bug 129180) Enter on the CRST used
- // in HandleManagedFault leaves the no-trigger count incremented. The destructor of this contract will restore
- // it to zero, then when we leave the CRST in LinkFrameAndThrow, we assert because we're trying to decrement the
- // gc-trigger count down past zero. The solution is to fix what we're doing with this CRST.
- STATIC_CONTRACT_THROWS; // COMPlusFrameHandler throws
- STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_MODE_ANY;
-
- EXCEPTION_DISPOSITION retval = ExceptionContinueSearch;
-
- // We must forward to the COMPlusFrameHandler. This will unwind the Frame Chain up to here, and also leave the
- // preemptive GC mode set correctly.
- retval = EXCEPTION_HANDLER_FWD(COMPlusFrameHandler);
-
-#ifdef _DEBUG
- // If the exception is escaping the last CLR personality routine on the stack,
- // then state a flag on the thread to indicate so.
- if (retval == ExceptionContinueSearch)
- {
- SetReversePInvokeEscapingUnhandledExceptionStatus(IS_UNWINDING(pExceptionRecord->ExceptionFlags), pEstablisherFrame);
- }
-#endif // _DEBUG
-
- if (IS_UNWINDING(pExceptionRecord->ExceptionFlags))
- {
- // Pops an extra frame on unwind.
-
- GCX_COOP(); // Must be cooperative to modify frame chain.
-
- Thread *pThread = GetThread();
- Frame *pFrame = pThread->GetFrame();
- pFrame->ExceptionUnwind();
- pFrame->Pop(pThread);
- }
-
- return retval;
-}
-
#ifdef FEATURE_COMINTEROP
// The reverse COM interop path needs to be sure to pop the ComMethodFrame that is pushed, but we do not want
// to have an additional FS:0 handler between the COM callsite and the call into managed. So we push this
diff --git a/src/coreclr/vm/i386/stublinkerx86.cpp b/src/coreclr/vm/i386/stublinkerx86.cpp
index 685883dd1ae808..74d55fd4544db3 100644
--- a/src/coreclr/vm/i386/stublinkerx86.cpp
+++ b/src/coreclr/vm/i386/stublinkerx86.cpp
@@ -37,7 +37,6 @@
#include "runtimecallablewrapper.h"
#include "comcache.h"
#include "olevariant.h"
-#include "notifyexternals.h"
#endif // FEATURE_COMINTEROP
#if defined(_DEBUG) && defined(STUBLINKER_GENERATES_UNWIND_INFO)
@@ -2446,44 +2445,21 @@ VOID StubLinkerCPU::X86EmitCurrentThreadFetch(X86Reg dstreg, unsigned preservedR
#endif // TARGET_UNIX
}
-#if defined(TARGET_X86)
+#if defined(FEATURE_COMINTEROP) && defined(TARGET_X86)
-#if defined(PROFILING_SUPPORTED) && !defined(FEATURE_STUBS_AS_IL)
+#if defined(PROFILING_SUPPORTED)
VOID StubLinkerCPU::EmitProfilerComCallProlog(TADDR pFrameVptr, X86Reg regFrame)
{
STANDARD_VM_CONTRACT;
- if (pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr())
- {
- // Load the methoddesc into ECX (UMThkCallFrame->m_pvDatum->m_pMD)
- X86EmitIndexRegLoad(kECX, regFrame, UMThkCallFrame::GetOffsetOfDatum());
- X86EmitIndexRegLoad(kECX, kECX, UMEntryThunk::GetOffsetOfMethodDesc());
-
- // Push arguments and notify profiler
- X86EmitPushImm32(COR_PRF_TRANSITION_CALL); // Reason
- X86EmitPushReg(kECX); // MethodDesc*
- X86EmitCall(NewExternalCodeLabel((LPVOID) ProfilerUnmanagedToManagedTransitionMD), 2*sizeof(void*));
- }
+ // Load the methoddesc into ECX (Frame->m_pvDatum->m_pMD)
+ X86EmitIndexRegLoad(kECX, regFrame, ComMethodFrame::GetOffsetOfDatum());
+ X86EmitIndexRegLoad(kECX, kECX, ComCallMethodDesc::GetOffsetOfMethodDesc());
-#ifdef FEATURE_COMINTEROP
- else if (pFrameVptr == ComMethodFrame::GetMethodFrameVPtr())
- {
- // Load the methoddesc into ECX (Frame->m_pvDatum->m_pMD)
- X86EmitIndexRegLoad(kECX, regFrame, ComMethodFrame::GetOffsetOfDatum());
- X86EmitIndexRegLoad(kECX, kECX, ComCallMethodDesc::GetOffsetOfMethodDesc());
-
- // Push arguments and notify profiler
- X86EmitPushImm32(COR_PRF_TRANSITION_CALL); // Reason
- X86EmitPushReg(kECX); // MethodDesc*
- X86EmitCall(NewExternalCodeLabel((LPVOID) ProfilerUnmanagedToManagedTransitionMD), 2*sizeof(void*));
- }
-#endif // FEATURE_COMINTEROP
-
- // Unrecognized frame vtbl
- else
- {
- _ASSERTE(!"Unrecognized vtble passed to EmitComMethodStubProlog with profiling turned on.");
- }
+ // Push arguments and notify profiler
+ X86EmitPushImm32(COR_PRF_TRANSITION_CALL); // Reason
+ X86EmitPushReg(kECX); // MethodDesc*
+ X86EmitCall(NewExternalCodeLabel((LPVOID) ProfilerUnmanagedToManagedTransitionMD), 2*sizeof(void*));
}
@@ -2492,50 +2468,21 @@ VOID StubLinkerCPU::EmitProfilerComCallEpilog(TADDR pFrameVptr, X86Reg regFrame)
CONTRACTL
{
STANDARD_VM_CHECK;
-#ifdef FEATURE_COMINTEROP
- PRECONDITION(pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr() || pFrameVptr == ComMethodFrame::GetMethodFrameVPtr());
-#else
- PRECONDITION(pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr());
-#endif // FEATURE_COMINTEROP
+ PRECONDITION(pFrameVptr == ComMethodFrame::GetMethodFrameVPtr());
}
CONTRACTL_END;
- if (pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr())
- {
- // Load the methoddesc into ECX (UMThkCallFrame->m_pvDatum->m_pMD)
- X86EmitIndexRegLoad(kECX, regFrame, UMThkCallFrame::GetOffsetOfDatum());
- X86EmitIndexRegLoad(kECX, kECX, UMEntryThunk::GetOffsetOfMethodDesc());
-
- // Push arguments and notify profiler
- X86EmitPushImm32(COR_PRF_TRANSITION_RETURN); // Reason
- X86EmitPushReg(kECX); // MethodDesc*
- X86EmitCall(NewExternalCodeLabel((LPVOID) ProfilerManagedToUnmanagedTransitionMD), 2*sizeof(void*));
- }
-
-#ifdef FEATURE_COMINTEROP
- else if (pFrameVptr == ComMethodFrame::GetMethodFrameVPtr())
- {
- // Load the methoddesc into ECX (Frame->m_pvDatum->m_pMD)
- X86EmitIndexRegLoad(kECX, regFrame, ComMethodFrame::GetOffsetOfDatum());
- X86EmitIndexRegLoad(kECX, kECX, ComCallMethodDesc::GetOffsetOfMethodDesc());
-
- // Push arguments and notify profiler
- X86EmitPushImm32(COR_PRF_TRANSITION_RETURN); // Reason
- X86EmitPushReg(kECX); // MethodDesc*
- X86EmitCall(NewExternalCodeLabel((LPVOID) ProfilerManagedToUnmanagedTransitionMD), 2*sizeof(void*));
- }
-#endif // FEATURE_COMINTEROP
+ // Load the methoddesc into ECX (Frame->m_pvDatum->m_pMD)
+ X86EmitIndexRegLoad(kECX, regFrame, ComMethodFrame::GetOffsetOfDatum());
+ X86EmitIndexRegLoad(kECX, kECX, ComCallMethodDesc::GetOffsetOfMethodDesc());
- // Unrecognized frame vtbl
- else
- {
- _ASSERTE(!"Unrecognized vtble passed to EmitComMethodStubEpilog with profiling turned on.");
- }
+ // Push arguments and notify profiler
+ X86EmitPushImm32(COR_PRF_TRANSITION_RETURN); // Reason
+ X86EmitPushReg(kECX); // MethodDesc*
+ X86EmitCall(NewExternalCodeLabel((LPVOID) ProfilerManagedToUnmanagedTransitionMD), 2*sizeof(void*));
}
-#endif // PROFILING_SUPPORTED && !FEATURE_STUBS_AS_IL
-
+#endif // PROFILING_SUPPORTED
-#ifndef FEATURE_STUBS_AS_IL
//========================================================================
// Prolog for entering managed code from COM
// pushes the appropriate frame ptr
@@ -2585,13 +2532,6 @@ void StubLinkerCPU::EmitComMethodStubProlog(TADDR pFrameVptr,
// lea esi, [esp+4] ;; set ESI -> new frame
X86EmitEspOffset(0x8d, kESI, 4); // lea ESI, [ESP+4]
- if (pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr())
- {
- // Preserve argument registers for thiscall/fastcall
- X86EmitPushReg(kECX);
- X86EmitPushReg(kEDX);
- }
-
// Emit Setup thread
EmitSetup(rgRareLabels[0]); // rareLabel for rare setup
EmitLabel(rgRejoinLabels[0]); // rejoin label for rare setup
@@ -2640,23 +2580,6 @@ void StubLinkerCPU::EmitComMethodStubProlog(TADDR pFrameVptr,
// mov [ebx + Thread.GetFrame()], esi
X86EmitIndexRegStore(kEBX, Thread::GetOffsetOfCurrentFrame(), kESI);
- if (pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr())
- {
- // push UnmanagedToManagedExceptHandler
- X86EmitPushImmPtr((LPVOID)UMThunkPrestubHandler);
-
- // mov eax, fs:[0]
- static const BYTE codeSEH1[] = { 0x64, 0xA1, 0x0, 0x0, 0x0, 0x0};
- EmitBytes(codeSEH1, sizeof(codeSEH1));
-
- // push eax
- X86EmitPushReg(kEAX);
-
- // mov dword ptr fs:[0], esp
- static const BYTE codeSEH2[] = { 0x64, 0x89, 0x25, 0x0, 0x0, 0x0, 0x0};
- EmitBytes(codeSEH2, sizeof(codeSEH2));
- }
-
#if _DEBUG
if (Frame::ShouldLogTransitions())
{
@@ -2693,19 +2616,6 @@ void StubLinkerCPU::EmitComMethodStubEpilog(TADDR pFrameVptr,
EmitCheckGSCookie(kESI, UnmanagedToManagedFrame::GetOffsetOfGSCookie());
- if (pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr())
- {
- // if we are using exceptions, unlink the SEH
- // mov ecx,[esp] ;;pointer to the next exception record
- X86EmitEspOffset(0x8b, kECX, 0);
-
- // mov dword ptr fs:[0], ecx
- static const BYTE codeSEH[] = { 0x64, 0x89, 0x0D, 0x0, 0x0, 0x0, 0x0 };
- EmitBytes(codeSEH, sizeof(codeSEH));
-
- X86EmitAddEsp(sizeof(EXCEPTION_REGISTRATION_RECORD));
- }
-
// mov [ebx + Thread.GetFrame()], edi ;; restore previous frame
X86EmitIndexRegStore(kEBX, Thread::GetOffsetOfCurrentFrame(), kEDI);
@@ -2715,13 +2625,6 @@ void StubLinkerCPU::EmitComMethodStubEpilog(TADDR pFrameVptr,
EmitEnable(rgRareLabels[2]); // rare gc
EmitLabel(rgRejoinLabels[2]); // rejoin for rare gc
- if (pFrameVptr == UMThkCallFrame::GetMethodFrameVPtr())
- {
- // Restore argument registers for thiscall/fastcall
- X86EmitPopReg(kEDX);
- X86EmitPopReg(kECX);
- }
-
// add esp, popstack
X86EmitAddEsp(sizeof(GSCookie) + UnmanagedToManagedFrame::GetOffsetOfCalleeSavedRegisters());
@@ -2762,7 +2665,6 @@ void StubLinkerCPU::EmitComMethodStubEpilog(TADDR pFrameVptr,
EmitLabel(rgRareLabels[0]); // label for rare setup thread
EmitRareSetup(rgRejoinLabels[0], /*fThrow*/ TRUE); // emit rare setup thread
}
-#endif // !FEATURE_STUBS_AS_IL
//---------------------------------------------------------------
// Emit code to store the setup current Thread structure in eax.
@@ -2793,16 +2695,12 @@ VOID StubLinkerCPU::EmitRareSetup(CodeLabel *pRejoinPoint, BOOL fThrow)
{
STANDARD_VM_CONTRACT;
-#ifndef FEATURE_COMINTEROP
- _ASSERTE(fThrow);
-#else // !FEATURE_COMINTEROP
if (!fThrow)
{
X86EmitPushReg(kESI);
X86EmitCall(NewExternalCodeLabel((LPVOID) CreateThreadBlockReturnHr), sizeof(void*));
}
else
-#endif // !FEATURE_COMINTEROP
{
X86EmitCall(NewExternalCodeLabel((LPVOID) CreateThreadBlockThrow), 0);
}
@@ -2812,10 +2710,6 @@ VOID StubLinkerCPU::EmitRareSetup(CodeLabel *pRejoinPoint, BOOL fThrow)
X86EmitNearJump(pRejoinPoint);
}
-//========================================================================
-#endif // TARGET_X86
-//========================================================================
-#if defined(FEATURE_COMINTEROP) && defined(TARGET_X86)
//========================================================================
// Epilog for stubs that enter managed code from COM
//
@@ -2921,9 +2815,9 @@ void StubLinkerCPU::EmitSharedComMethodStubEpilog(TADDR pFrameVptr,
EmitRareSetup(rgRejoinLabels[0],/*fThrow*/ FALSE); // emit rare setup thread
}
-//========================================================================
#endif // defined(FEATURE_COMINTEROP) && defined(TARGET_X86)
+
#if !defined(FEATURE_STUBS_AS_IL) && defined(TARGET_X86)
/*==============================================================================
Pushes a TransitionFrame on the stack
@@ -3438,7 +3332,7 @@ VOID StubLinkerCPU::EmitUnwindInfoCheckSubfunction()
#endif // defined(_DEBUG) && defined(STUBLINKER_GENERATES_UNWIND_INFO)
-#ifdef TARGET_X86
+#if defined(FEATURE_COMINTEROP) && defined(TARGET_X86)
//-----------------------------------------------------------------------
// Generates the inline portion of the code to enable preemptive GC. Hopefully,
@@ -3547,49 +3441,6 @@ VOID StubLinkerCPU::EmitDisable(CodeLabel *pForwardRef, BOOL fCallIn, X86Reg Thr
// jnz RarePath
X86EmitCondJump(pForwardRef, X86CondCode::kJNZ);
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORESYSTEM)
- // If we are checking whether the current thread holds the loader lock, vector
- // such cases to the rare disable pathway, where we can check again.
- if (fCallIn && ShouldCheckLoaderLock())
- {
- X86EmitPushReg(kEAX);
- X86EmitPushReg(kEDX);
-
- if (ThreadReg == kECX)
- X86EmitPushReg(kECX);
-
- // BOOL AuxUlibIsDLLSynchronizationHeld(BOOL *IsHeld)
- //
- // So we need to be sure that both the return value and the passed BOOL are both TRUE.
- // If either is FALSE, then the call failed or the lock is not held. Either way, the
- // probe should not fire.
-
- X86EmitPushReg(kEDX); // BOOL temp
- Emit8(0x54); // push ESP because arg is &temp
- X86EmitCall(NewExternalCodeLabel((LPVOID) AuxUlibIsDLLSynchronizationHeld), 0);
-
- // callee has popped.
- X86EmitPopReg(kEDX); // recover temp
-
- CodeLabel *pPopLabel = NewCodeLabel();
-
- Emit16(0xc085); // test eax, eax
- X86EmitCondJump(pPopLabel, X86CondCode::kJZ);
-
- Emit16(0xd285); // test edx, edx
-
- EmitLabel(pPopLabel); // retain the conditional flags across the pops
-
- if (ThreadReg == kECX)
- X86EmitPopReg(kECX);
-
- X86EmitPopReg(kEDX);
- X86EmitPopReg(kEAX);
-
- X86EmitCondJump(pForwardRef, X86CondCode::kJNZ);
- }
-#endif
-
#ifdef _DEBUG
if (ThreadReg != kECX)
X86EmitDebugTrashReg(kECX);
@@ -3623,7 +3474,6 @@ VOID StubLinkerCPU::EmitRareDisable(CodeLabel *pRejoinPoint)
X86EmitNearJump(pRejoinPoint);
}
-#ifdef FEATURE_COMINTEROP
//-----------------------------------------------------------------------
// Generates the out-of-line portion of the code to disable preemptive GC.
// After the work is done, the code normally jumps back to the "pRejoinPoint"
@@ -3655,10 +3505,8 @@ VOID StubLinkerCPU::EmitRareDisableHRESULT(CodeLabel *pRejoinPoint, CodeLabel *p
X86EmitNearJump(pExitPoint);
}
-#endif // FEATURE_COMINTEROP
-
-#endif // TARGET_X86
+#endif // defined(FEATURE_COMINTEROP) && defined(TARGET_X86)
VOID StubLinkerCPU::EmitShuffleThunk(ShuffleEntry *pShuffleEntryArray)
diff --git a/src/coreclr/vm/i386/stublinkerx86.h b/src/coreclr/vm/i386/stublinkerx86.h
index 02ab6e9d253ea7..c719057e97ea39 100644
--- a/src/coreclr/vm/i386/stublinkerx86.h
+++ b/src/coreclr/vm/i386/stublinkerx86.h
@@ -250,17 +250,6 @@ class StubLinkerCPU : public StubLinker
);
VOID X86EmitPushEBPframe();
-#if defined(TARGET_X86)
-#if defined(PROFILING_SUPPORTED) && !defined(FEATURE_STUBS_AS_IL)
- // These are used to emit calls to notify the profiler of transitions in and out of
- // managed code through COM->COM+ interop or N/Direct
- VOID EmitProfilerComCallProlog(TADDR pFrameVptr, X86Reg regFrame);
- VOID EmitProfilerComCallEpilog(TADDR pFrameVptr, X86Reg regFrame);
-#endif // PROFILING_SUPPORTED && !FEATURE_STUBS_AS_IL
-#endif // TARGET_X86
-
-
-
// Emits the most efficient form of the operation:
//
// opcode altreg, [basereg + scaledreg*scale + ofs]
@@ -340,6 +329,7 @@ class StubLinkerCPU : public StubLinker
#endif
}
+#if defined(FEATURE_COMINTEROP) && defined(TARGET_X86)
VOID EmitEnable(CodeLabel *pForwardRef);
VOID EmitRareEnable(CodeLabel *pRejoinPoint);
@@ -349,20 +339,13 @@ class StubLinkerCPU : public StubLinker
VOID EmitSetup(CodeLabel *pForwardRef);
VOID EmitRareSetup(CodeLabel* pRejoinPoint, BOOL fThrow);
+#endif // FEATURE_COMINTEROP && TARGET_X86
#ifndef FEATURE_STUBS_AS_IL
VOID EmitMethodStubProlog(TADDR pFrameVptr, int transitionBlockOffset);
VOID EmitMethodStubEpilog(WORD numArgBytes, int transitionBlockOffset);
VOID EmitCheckGSCookie(X86Reg frameReg, int gsCookieOffset);
-
-#ifdef TARGET_X86
- void EmitComMethodStubProlog(TADDR pFrameVptr, CodeLabel** rgRareLabels,
- CodeLabel** rgRejoinLabels, BOOL bShouldProfile);
-
- void EmitComMethodStubEpilog(TADDR pFrameVptr, CodeLabel** rgRareLabels,
- CodeLabel** rgRejoinLabels, BOOL bShouldProfile);
-#endif // TARGET_X86
#endif // !FEATURE_STUBS_AS_IL
#ifdef TARGET_X86
@@ -379,6 +362,20 @@ class StubLinkerCPU : public StubLinker
VOID EmitComputedInstantiatingMethodStub(MethodDesc* pSharedMD, struct ShuffleEntry *pShuffleEntryArray, void* extraArg);
#if defined(FEATURE_COMINTEROP) && defined(TARGET_X86)
+
+#if defined(PROFILING_SUPPORTED)
+ // These are used to emit calls to notify the profiler of transitions in and out of
+ // managed code through COM->COM+ interop or N/Direct
+ VOID EmitProfilerComCallProlog(TADDR pFrameVptr, X86Reg regFrame);
+ VOID EmitProfilerComCallEpilog(TADDR pFrameVptr, X86Reg regFrame);
+#endif // PROFILING_SUPPORTED
+
+ void EmitComMethodStubProlog(TADDR pFrameVptr, CodeLabel** rgRareLabels,
+ CodeLabel** rgRejoinLabels, BOOL bShouldProfile);
+
+ void EmitComMethodStubEpilog(TADDR pFrameVptr, CodeLabel** rgRareLabels,
+ CodeLabel** rgRejoinLabels, BOOL bShouldProfile);
+
//========================================================================
// shared Epilog for stubs that enter managed code from COM
// uses a return thunk within the method desc
diff --git a/src/coreclr/vm/ilmarshalers.cpp b/src/coreclr/vm/ilmarshalers.cpp
index 4782df6281b128..b6cb70ccf56c7a 100644
--- a/src/coreclr/vm/ilmarshalers.cpp
+++ b/src/coreclr/vm/ilmarshalers.cpp
@@ -4922,8 +4922,8 @@ FCIMPL3(void, MngdSafeArrayMarshaler::ConvertSpaceToManaged, MngdSafeArrayMarsha
{
WCHAR strExpectedRank[64];
WCHAR strActualRank[64];
- _ltow_s(pThis->m_iRank, strExpectedRank, COUNTOF(strExpectedRank), 10);
- _ltow_s(iSafeArrayRank, strActualRank, COUNTOF(strActualRank), 10);
+ _ltow_s(pThis->m_iRank, strExpectedRank, ARRAY_SIZE(strExpectedRank), 10);
+ _ltow_s(iSafeArrayRank, strActualRank, ARRAY_SIZE(strActualRank), 10);
COMPlusThrow(kSafeArrayRankMismatchException, IDS_EE_SAFEARRAYRANKMISMATCH, strActualRank, strExpectedRank);
}
}
diff --git a/src/coreclr/vm/interoputil.cpp b/src/coreclr/vm/interoputil.cpp
index 610c3418ae530f..3bf1abcfcfbee9 100644
--- a/src/coreclr/vm/interoputil.cpp
+++ b/src/coreclr/vm/interoputil.cpp
@@ -43,7 +43,6 @@
#include "commtmemberinfomap.h"
#include "olevariant.h"
#include "stdinterfaces.h"
-#include "notifyexternals.h"
#include "typeparse.h"
#include "interoputil.inl"
#include "typestring.h"
@@ -920,7 +919,7 @@ ReadBestFitCustomAttribute(Module* pModule, mdTypeDef cl, BOOL* BestFit, BOOL* T
}
-int InternalWideToAnsi(__in_ecount(iNumWideChars) LPCWSTR szWideString, int iNumWideChars, __out_ecount_opt(cbAnsiBufferSize) LPSTR szAnsiString, int cbAnsiBufferSize, BOOL fBestFit, BOOL fThrowOnUnmappableChar)
+int InternalWideToAnsi(_In_reads_(iNumWideChars) LPCWSTR szWideString, int iNumWideChars, _Out_writes_bytes_opt_(cbAnsiBufferSize) LPSTR szAnsiString, int cbAnsiBufferSize, BOOL fBestFit, BOOL fThrowOnUnmappableChar)
{
CONTRACTL
{
@@ -2784,7 +2783,7 @@ BOOL IsComTargetValidForType(REFLECTCLASSBASEREF* pRefClassObj, OBJECTREF* pTarg
return FALSE;
}
-DISPID ExtractStandardDispId(__in_z LPWSTR strStdDispIdMemberName)
+DISPID ExtractStandardDispId(_In_z_ LPWSTR strStdDispIdMemberName)
{
CONTRACTL
{
@@ -3316,7 +3315,7 @@ void IUInvokeDispMethod(
vDispIDElement.pMT = pInvokedMT;
vDispIDElement.strNameLength = strNameLength;
vDispIDElement.lcid = lcid;
- wcscpy_s(vDispIDElement.strName, COUNTOF(vDispIDElement.strName), aNamesToConvert[0]);
+ wcscpy_s(vDispIDElement.strName, ARRAY_SIZE(vDispIDElement.strName), aNamesToConvert[0]);
// Only look up if the cache has already been created.
DispIDCache* pDispIDCache = GetAppDomain()->GetRefDispIDCache();
@@ -3782,13 +3781,13 @@ VOID IntializeInteropLogging()
g_TraceCount = g_pConfig->GetTraceWrapper();
}
-VOID LogInterop(__in_z LPCSTR szMsg)
+VOID LogInterop(_In_z_ LPCSTR szMsg)
{
LIMITED_METHOD_CONTRACT;
LOG( (LF_INTEROP, LL_INFO10, "%s\n",szMsg) );
}
-VOID LogInterop(__in_z LPCWSTR wszMsg)
+VOID LogInterop(_In_z_ LPCWSTR wszMsg)
{
LIMITED_METHOD_CONTRACT;
LOG( (LF_INTEROP, LL_INFO10, "%S\n", wszMsg) );
@@ -3964,7 +3963,7 @@ VOID LogInteropLeak(IUnknown* pItf)
//-------------------------------------------------------------------
// VOID LogInteropQI(IUnknown* pItf, REFIID iid, HRESULT hr, LPCSTR szMsg)
//-------------------------------------------------------------------
-VOID LogInteropQI(IUnknown* pItf, REFIID iid, HRESULT hrArg, __in_z LPCSTR szMsg)
+VOID LogInteropQI(IUnknown* pItf, REFIID iid, HRESULT hrArg, _In_z_ LPCSTR szMsg)
{
if (!LoggingOn(LF_INTEROP, LL_ALWAYS))
return;
@@ -4013,7 +4012,7 @@ VOID LogInteropQI(IUnknown* pItf, REFIID iid, HRESULT hrArg, __in_z LPCSTR szMsg
//-------------------------------------------------------------------
// VOID LogInteropAddRef(IUnknown* pItf, ULONG cbRef, LPCSTR szMsg)
//-------------------------------------------------------------------
-VOID LogInteropAddRef(IUnknown* pItf, ULONG cbRef, __in_z LPCSTR szMsg)
+VOID LogInteropAddRef(IUnknown* pItf, ULONG cbRef, _In_z_ LPCSTR szMsg)
{
if (!LoggingOn(LF_INTEROP, LL_ALWAYS))
return;
@@ -4046,7 +4045,7 @@ VOID LogInteropAddRef(IUnknown* pItf, ULONG cbRef, __in_z LPCSTR szMsg)
//-------------------------------------------------------------------
// VOID LogInteropRelease(IUnknown* pItf, ULONG cbRef, LPCSTR szMsg)
//-------------------------------------------------------------------
-VOID LogInteropRelease(IUnknown* pItf, ULONG cbRef, __in_z LPCSTR szMsg)
+VOID LogInteropRelease(IUnknown* pItf, ULONG cbRef, _In_z_ LPCSTR szMsg)
{
if (!LoggingOn(LF_INTEROP, LL_ALWAYS))
return;
diff --git a/src/coreclr/vm/interoputil.h b/src/coreclr/vm/interoputil.h
index f9706d88079983..eec7e378a561c4 100644
--- a/src/coreclr/vm/interoputil.h
+++ b/src/coreclr/vm/interoputil.h
@@ -92,7 +92,7 @@ BOOL IsComObjectClass(TypeHandle type);
//---------------------------------------------------------
VOID ReadBestFitCustomAttribute(MethodDesc* pMD, BOOL* BestFit, BOOL* ThrowOnUnmappableChar);
VOID ReadBestFitCustomAttribute(Module* pModule, mdTypeDef cl, BOOL* BestFit, BOOL* ThrowOnUnmappableChar);
-int InternalWideToAnsi(__in_ecount(iNumWideChars) LPCWSTR szWideString, int iNumWideChars, __out_ecount_opt(cbAnsiBufferSize) LPSTR szAnsiString, int cbAnsiBufferSize, BOOL fBestFit, BOOL fThrowOnUnmappableChar);
+int InternalWideToAnsi(_In_reads_(iNumWideChars) LPCWSTR szWideString, int iNumWideChars, _Out_writes_bytes_opt_(cbAnsiBufferSize) LPSTR szAnsiString, int cbAnsiBufferSize, BOOL fBestFit, BOOL fThrowOnUnmappableChar);
//---------------------------------------------------------
// Read the ClassInterfaceType custom attribute info from
@@ -358,14 +358,14 @@ ClassFactoryBase *GetComClassFactory(MethodTable* pClassMT);
#ifdef _DEBUG
-VOID LogInterop(__in_z LPCSTR szMsg);
-VOID LogInterop(__in_z LPCWSTR szMsg);
+VOID LogInterop(_In_z_ LPCSTR szMsg);
+VOID LogInterop(_In_z_ LPCWSTR szMsg);
VOID LogInteropLeak(IUnkEntry * pEntry);
VOID LogInteropLeak(IUnknown* pItf);
-VOID LogInteropQI(IUnknown* pItf, REFIID riid, HRESULT hr, __in_z LPCSTR szMsg);
-VOID LogInteropAddRef(IUnknown* pItf, ULONG cbRef, __in_z LPCSTR szMsg);
-VOID LogInteropRelease(IUnknown* pItf, ULONG cbRef, __in_z LPCSTR szMsg);
+VOID LogInteropQI(IUnknown* pItf, REFIID riid, HRESULT hr, _In_z_ LPCSTR szMsg);
+VOID LogInteropAddRef(IUnknown* pItf, ULONG cbRef, _In_z_ LPCSTR szMsg);
+VOID LogInteropRelease(IUnknown* pItf, ULONG cbRef, _In_z_ LPCSTR szMsg);
VOID LogRCWCreate(RCW* pWrap, IUnknown* pUnk);
VOID LogRCWMinorCleanup(RCW* pWrap);
diff --git a/src/coreclr/vm/interpreter.cpp b/src/coreclr/vm/interpreter.cpp
index 6ca5bb6935a622..ac8037cb5a835d 100644
--- a/src/coreclr/vm/interpreter.cpp
+++ b/src/coreclr/vm/interpreter.cpp
@@ -1628,7 +1628,7 @@ size_t Interpreter::GetFrameSize(InterpreterMethodInfo* interpMethInfo)
}
// static
-ARG_SLOT Interpreter::ExecuteMethodWrapper(struct InterpreterMethodInfo* interpMethInfo, bool directCall, BYTE* ilArgs, void* stubContext, __out bool* pDoJmpCall, CORINFO_RESOLVED_TOKEN* pResolvedToken)
+ARG_SLOT Interpreter::ExecuteMethodWrapper(struct InterpreterMethodInfo* interpMethInfo, bool directCall, BYTE* ilArgs, void* stubContext, _Out_ bool* pDoJmpCall, CORINFO_RESOLVED_TOKEN* pResolvedToken)
{
#define INTERP_DYNAMIC_CONTRACTS 1
#if INTERP_DYNAMIC_CONTRACTS
@@ -1995,7 +1995,7 @@ void Interpreter::DoMonitorExitWork()
}
-void Interpreter::ExecuteMethod(ARG_SLOT* retVal, __out bool* pDoJmpCall, __out unsigned* pJmpCallToken)
+void Interpreter::ExecuteMethod(ARG_SLOT* retVal, _Out_ bool* pDoJmpCall, _Out_ unsigned* pJmpCallToken)
{
#if INTERP_DYNAMIC_CONTRACTS
CONTRACTL {
diff --git a/src/coreclr/vm/interpreter.h b/src/coreclr/vm/interpreter.h
index a6346cebc4ccfa..041484855c4dc8 100644
--- a/src/coreclr/vm/interpreter.h
+++ b/src/coreclr/vm/interpreter.h
@@ -722,7 +722,7 @@ class InterpreterCEEInfo: public CEEInfo
{
CEEJitInfo m_jitInfo;
public:
- InterpreterCEEInfo(CORINFO_METHOD_HANDLE meth): CEEInfo((MethodDesc*)meth), m_jitInfo((MethodDesc*)meth, NULL, NULL, CORJIT_FLAGS::CORJIT_FLAG_SPEED_OPT) { m_pOverride = this; }
+ InterpreterCEEInfo(CORINFO_METHOD_HANDLE meth): CEEInfo((MethodDesc*)meth), m_jitInfo((MethodDesc*)meth, NULL, NULL, CORJIT_FLAGS::CORJIT_FLAG_SPEED_OPT) { }
// Certain methods are unimplemented by CEEInfo (they hit an assert). They are implemented by CEEJitInfo, yet
// don't seem to require any of the CEEJitInfo state we can't provide. For those case, delegate to the "partial"
diff --git a/src/coreclr/vm/jithelpers.cpp b/src/coreclr/vm/jithelpers.cpp
index 3e92144dca122b..109f98ceecfe13 100644
--- a/src/coreclr/vm/jithelpers.cpp
+++ b/src/coreclr/vm/jithelpers.cpp
@@ -5950,7 +5950,7 @@ void InitJitHelperLogging()
else
{
_ASSERTE(((size_t)hlpFunc->pfnHelper - 1) >= 0 &&
- ((size_t)hlpFunc->pfnHelper - 1) < COUNTOF(hlpDynamicFuncTable));
+ ((size_t)hlpFunc->pfnHelper - 1) < ARRAY_SIZE(hlpDynamicFuncTable));
VMHELPDEF* dynamicHlpFunc = &hlpDynamicFuncTable[((size_t)hlpFunc->pfnHelper - 1)];
// While we're here initialize the table of VMHELPCOUNTDEF
diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp
index df4e985fda1e6a..e28434acabe56e 100644
--- a/src/coreclr/vm/jitinterface.cpp
+++ b/src/coreclr/vm/jitinterface.cpp
@@ -190,16 +190,6 @@ BOOL ModifyCheckForDynamicMethod(DynamicResolver *pResolver,
/*****************************************************************************/
-void CEEInfo::setOverride(ICorDynamicInfo *pOverride, CORINFO_METHOD_HANDLE currentMethod)
-{
- LIMITED_METHOD_CONTRACT;
- m_pOverride = pOverride;
- m_pMethodBeingCompiled = (MethodDesc *)currentMethod; // method being compiled
-
- m_hMethodForSecurity_Key = NULL;
- m_pMethodForSecurity_Value = NULL;
-}
-
// Initialize from data we passed across to the JIT
void CEEInfo::GetTypeContext(const CORINFO_SIG_INST *info, SigTypeContext *pTypeContext)
{
@@ -573,7 +563,7 @@ CORINFO_CLASS_HANDLE CEEInfo::getTokenTypeAsHandle (CORINFO_RESOLVED_TOKEN * pRe
size_t CEEInfo::findNameOfToken (
CORINFO_MODULE_HANDLE scopeHnd,
mdToken metaTOK,
- __out_ecount (FQNameCapacity) char * szFQName,
+ _Out_writes_ (FQNameCapacity) char * szFQName,
size_t FQNameCapacity)
{
CONTRACTL {
@@ -716,7 +706,7 @@ const char16_t* CEEInfo::getStringLiteral (
/* static */
size_t CEEInfo::findNameOfToken (Module* module,
mdToken metaTOK,
- __out_ecount (FQNameCapacity) char * szFQName,
+ _Out_writes_ (FQNameCapacity) char * szFQName,
size_t FQNameCapacity)
{
CONTRACTL {
@@ -1470,8 +1460,7 @@ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken,
fieldAccessor = intrinsicAccessor;
}
else
- if (IsCompilingForNGen() ||
- // Static fields are not pinned in collectible types. We will always access
+ if (// Static fields are not pinned in collectible types. We will always access
// them using a helper since the address cannot be embeded into the code.
pFieldMT->Collectible() ||
// We always treat accessing thread statics as if we are in domain neutral code.
@@ -1633,13 +1622,6 @@ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken,
pResult->accessCalloutHelper.args[0].Set(CORINFO_METHOD_HANDLE(pCallerForSecurity));
pResult->accessCalloutHelper.args[1].Set(CORINFO_FIELD_HANDLE(pField));
-
- if (IsCompilingForNGen())
- {
- //see code:CEEInfo::getCallInfo for more information.
- if (pCallerForSecurity->ContainsGenericVariables())
- COMPlusThrowNonLocalized(kNotSupportedException, W("Cannot embed generic MethodDesc"));
- }
}
}
}
@@ -2603,7 +2585,7 @@ void CEEInfo::ScanForModuleDependencies(Module* pModule, SigPointer psig)
if (!pTypeDefModule->IsSystem() && (pModule != pTypeDefModule))
{
- m_pOverride->addActiveDependency((CORINFO_MODULE_HANDLE)pModule, (CORINFO_MODULE_HANDLE)pTypeDefModule);
+ addActiveDependency((CORINFO_MODULE_HANDLE)pModule, (CORINFO_MODULE_HANDLE)pTypeDefModule);
}
}
break;
@@ -2683,7 +2665,7 @@ void CEEInfo::ScanInstantiation(Module * pModule, Instantiation inst)
if (!pDefModule->IsSystem() && (pModule != pDefModule))
{
- m_pOverride->addActiveDependency((CORINFO_MODULE_HANDLE)pModule, (CORINFO_MODULE_HANDLE)pDefModule);
+ addActiveDependency((CORINFO_MODULE_HANDLE)pModule, (CORINFO_MODULE_HANDLE)pDefModule);
}
if (pMT->HasInstantiation())
@@ -2765,7 +2747,7 @@ void CEEInfo::ScanToken(Module * pModule, CORINFO_RESOLVED_TOKEN * pResolvedToke
if (pModule != pDefModule)
{
- m_pOverride->addActiveDependency((CORINFO_MODULE_HANDLE)pModule, (CORINFO_MODULE_HANDLE)pDefModule);
+ addActiveDependency((CORINFO_MODULE_HANDLE)pModule, (CORINFO_MODULE_HANDLE)pDefModule);
}
MethodTable * pParentMT = pMT->GetParentMethodTable();
@@ -3374,7 +3356,7 @@ const char* CEEInfo::getHelperName (CorInfoHelpFunc ftnNum)
/*********************************************************************/
-int CEEInfo::appendClassName(__deref_inout_ecount(*pnBufLen) char16_t** ppBuf,
+int CEEInfo::appendClassName(_Outptr_result_buffer_(*pnBufLen) char16_t** ppBuf,
int* pnBufLen,
CORINFO_CLASS_HANDLE clsHnd,
bool fNamespace,
@@ -3725,27 +3707,13 @@ CorInfoInitClassResult CEEInfo::initClass(
MethodDesc *methodBeingCompiled = m_pMethodBeingCompiled;
- BOOL fMethodZappedOrNGen = IsCompilingForNGen();
-
MethodTable *pTypeToInitMT = typeToInitTH.AsMethodTable();
- // This should be the most common early-out case.
- if (fMethodZappedOrNGen)
- {
- if (pTypeToInitMT->IsClassPreInited())
- {
- result = CORINFO_INITCLASS_NOT_REQUIRED;
- goto exit;
- }
- }
- else
+ if (pTypeToInitMT->IsClassInited())
{
- if (pTypeToInitMT->IsClassInited())
- {
- // If the type is initialized there really is nothing to do.
- result = CORINFO_INITCLASS_INITIALIZED;
- goto exit;
- }
+ // If the type is initialized there really is nothing to do.
+ result = CORINFO_INITCLASS_INITIALIZED;
+ goto exit;
}
if (pTypeToInitMT->IsGlobalClass())
@@ -3848,14 +3816,6 @@ CorInfoInitClassResult CEEInfo::initClass(
}
}
- if (fMethodZappedOrNGen)
- {
- // Well, because of code sharing we can't do anything at coge generation time.
- // We have to do it at runtime.
- result = CORINFO_INITCLASS_USE_HELPER;
- goto exit;
- }
-
//
// Optimizations for domain specific code
//
@@ -4830,13 +4790,6 @@ CorInfoIsAccessAllowedResult CEEInfo::canAccessClass(
pAccessHelper->args[0].Set(CORINFO_METHOD_HANDLE(pCallerForSecurity));
pAccessHelper->args[1].Set(CORINFO_CLASS_HANDLE(pCalleeForSecurity.AsPtr()));
-
- if (IsCompilingForNGen())
- {
- //see code:CEEInfo::getCallInfo for more information.
- if (pCallerForSecurity->ContainsGenericVariables() || pCalleeForSecurity.ContainsGenericVariables())
- COMPlusThrowNonLocalized(kNotSupportedException, W("Cannot embed generic TypeHandle"));
- }
}
EE_TO_JIT_TRANSITION();
@@ -5413,19 +5366,6 @@ void CEEInfo::getCallInfo(
pResult->callsiteCalloutHelper.args[0].Set(CORINFO_METHOD_HANDLE(pCallerForSecurity));
pResult->callsiteCalloutHelper.args[1].Set(CORINFO_METHOD_HANDLE(pCalleeForSecurity));
-
- //We now embed open instantiations in a few places for security callouts (since you can only
- //do the security check on the open instantiation). We throw these methods out in
- //TriageMethodForZap. In addition, NGen has problems referencing them properly. Just throw out the whole
- //method and rejit at runtime.
- if (IsCompilingForNGen())
- {
- if (pCallerForSecurity->ContainsGenericVariables()
- || pCalleeForSecurity->ContainsGenericVariables())
- {
- COMPlusThrowNonLocalized(kNotSupportedException, W("Cannot embed generic MethodDesc"));
- }
- }
}
}
}
@@ -5895,8 +5835,8 @@ CorInfoHelpFunc CEEInfo::getCastingHelper(CORINFO_RESOLVED_TOKEN * pResolvedToke
bool fClassMustBeRestored;
result = getCastingHelperStatic(TypeHandle(pResolvedToken->hClass), fThrowing, &fClassMustBeRestored);
- if (fClassMustBeRestored && m_pOverride != NULL)
- m_pOverride->classMustBeLoadedBeforeCodeIsRun(pResolvedToken->hClass);
+ if (fClassMustBeRestored)
+ classMustBeLoadedBeforeCodeIsRun(pResolvedToken->hClass);
EE_TO_JIT_TRANSITION();
@@ -6019,8 +5959,7 @@ CorInfoHelpFunc CEEInfo::getUnBoxHelper(CORINFO_CLASS_HANDLE clsHnd)
{
LIMITED_METHOD_CONTRACT;
- if (m_pOverride != NULL)
- m_pOverride->classMustBeLoadedBeforeCodeIsRun(clsHnd);
+ classMustBeLoadedBeforeCodeIsRun(clsHnd);
TypeHandle VMClsHnd(clsHnd);
if (Nullable::IsNullableType(VMClsHnd))
@@ -9359,7 +9298,7 @@ CorInfoTypeWithMod CEEInfo::getArgType (
TypeHandle thPtr = ptr.GetTypeHandleNT(pModule, &typeContext);
if(!thPtr.IsNull())
{
- m_pOverride->classMustBeLoadedBeforeCodeIsRun(CORINFO_CLASS_HANDLE(thPtr.AsPtr()));
+ classMustBeLoadedBeforeCodeIsRun(CORINFO_CLASS_HANDLE(thPtr.AsPtr()));
}
}
break;
@@ -10033,7 +9972,7 @@ HRESULT CEEInfo::GetErrorHRESULT(struct _EXCEPTION_POINTERS *pExceptionPointers)
}
-uint32_t CEEInfo::GetErrorMessage(__inout_ecount(bufferLength) char16_t* buffer, uint32_t bufferLength)
+uint32_t CEEInfo::GetErrorMessage(_Inout_updates_(bufferLength) char16_t* buffer, uint32_t bufferLength)
{
CONTRACTL {
THROWS;
@@ -10416,7 +10355,7 @@ bool CEEInfo::runWithErrorTrap(void (*function)(void*), void* param)
#if !defined(TARGET_UNIX)
RunWithErrorTrapFilterParam trapParam;
- trapParam.m_corInfo = m_pOverride == nullptr ? this : m_pOverride;
+ trapParam.m_corInfo = this;
trapParam.m_function = function;
trapParam.m_param = param;
diff --git a/src/coreclr/vm/jitinterface.h b/src/coreclr/vm/jitinterface.h
index 43b9040b7c3363..1afac1ba80201a 100644
--- a/src/coreclr/vm/jitinterface.h
+++ b/src/coreclr/vm/jitinterface.h
@@ -425,7 +425,7 @@ class CEEInfo : public ICorJitInfo
static CorInfoHelpFunc getSharedStaticsHelper(FieldDesc * pField, MethodTable * pFieldMT);
static size_t findNameOfToken (Module* module, mdToken metaTOK,
- __out_ecount (FQNameCapacity) char * szFQName, size_t FQNameCapacity);
+ _Out_writes_ (FQNameCapacity) char * szFQName, size_t FQNameCapacity);
DWORD getMethodAttribsInternal (CORINFO_METHOD_HANDLE ftnHnd);
@@ -475,14 +475,6 @@ class CEEInfo : public ICorJitInfo
CORINFO_GET_TAILCALL_HELPERS_FLAGS flags,
CORINFO_TAILCALL_HELPERS* pResult);
- // Returns whether we are generating code for NGen image.
- bool IsCompilingForNGen()
- {
- LIMITED_METHOD_CONTRACT;
- // NGen is the only place where we set the override
- return this != m_pOverride;
- }
-
// This normalizes EE type information into the form expected by the JIT.
//
// If typeHnd contains exact type information, then *clsRet will contain
@@ -492,7 +484,6 @@ class CEEInfo : public ICorJitInfo
CORINFO_CLASS_HANDLE *clsRet = NULL /* optional out */ );
CEEInfo(MethodDesc * fd = NULL, bool fVerifyOnly = false, bool fAllowInlining = true) :
- m_pOverride(NULL),
m_pMethodBeingCompiled(fd),
m_fVerifyOnly(fVerifyOnly),
m_pThread(GetThreadNULLOk()),
@@ -569,13 +560,6 @@ class CEEInfo : public ICorJitInfo
#endif
protected:
- // NGen provides its own modifications to EE-JIT interface. From technical reason it cannot simply inherit
- // from code:CEEInfo class (because it has dependencies on VM that NGen does not want).
- // Therefore the "normal" EE-JIT interface has code:m_pOverride hook that is set either to
- // * 'this' (code:CEEInfo) at runtime, or to
- // * code:ZapInfo - the NGen specific implementation of the interface.
- ICorDynamicInfo * m_pOverride;
-
MethodDesc* m_pMethodBeingCompiled; // Top-level method being compiled
bool m_fVerifyOnly;
Thread * m_pThread; // Cached current thread for faster JIT-EE transitions
@@ -847,8 +831,6 @@ class CEEJitInfo : public CEEInfo
GC_NOTRIGGER;
MODE_ANY;
} CONTRACTL_END;
-
- m_pOverride = this;
}
~CEEJitInfo()
diff --git a/src/coreclr/vm/method.cpp b/src/coreclr/vm/method.cpp
index 6e20c4d28f51c0..4309978b132346 100644
--- a/src/coreclr/vm/method.cpp
+++ b/src/coreclr/vm/method.cpp
@@ -1656,6 +1656,13 @@ UINT MethodDesc::CbStackPop()
SUPPORTS_DAC;
MetaSig msig(this);
ArgIterator argit(&msig);
+
+ bool fCtorOfVariableSizedObject = msig.HasThis() && (GetMethodTable() == g_pStringClass) && IsCtor();
+ if (fCtorOfVariableSizedObject)
+ {
+ msig.ClearHasThis();
+ }
+
return argit.CbStackPop();
}
#endif // TARGET_X86
diff --git a/src/coreclr/vm/methodtable.h b/src/coreclr/vm/methodtable.h
index 86a033a0593a29..76c552a3042849 100644
--- a/src/coreclr/vm/methodtable.h
+++ b/src/coreclr/vm/methodtable.h
@@ -1517,6 +1517,8 @@ class MethodTable
inline BOOL HasExplicitSize();
+ inline BOOL IsAutoLayoutOrHasAutoLayoutField();
+
UINT32 GetNativeSize();
DWORD GetBaseSize()
diff --git a/src/coreclr/vm/methodtable.inl b/src/coreclr/vm/methodtable.inl
index d14a73532b6e12..72b628dae9545a 100644
--- a/src/coreclr/vm/methodtable.inl
+++ b/src/coreclr/vm/methodtable.inl
@@ -947,6 +947,13 @@ inline BOOL MethodTable::HasExplicitSize()
return GetClass()->HasExplicitSize();
}
+//==========================================================================================
+inline BOOL MethodTable::IsAutoLayoutOrHasAutoLayoutField()
+{
+ LIMITED_METHOD_CONTRACT;
+ return GetClass()->IsAutoLayoutOrHasAutoLayoutField();
+}
+
//==========================================================================================
inline DWORD MethodTable::GetPerInstInfoSize()
{
diff --git a/src/coreclr/vm/methodtablebuilder.cpp b/src/coreclr/vm/methodtablebuilder.cpp
index 694e03cca35f2a..68d11affa4351f 100644
--- a/src/coreclr/vm/methodtablebuilder.cpp
+++ b/src/coreclr/vm/methodtablebuilder.cpp
@@ -8648,6 +8648,14 @@ MethodTableBuilder::HandleExplicitLayout(
BuildMethodTableThrowException(IDS_CLASSLOAD_GENERAL);
}
}
+
+ if (!numInstanceFieldBytes.IsOverflow() && numInstanceFieldBytes.Value() == 0)
+ {
+ // If we calculate a 0-byte size here, we should have also calculated a 0-byte size
+ // in the initial layout algorithm.
+ _ASSERTE(GetLayoutInfo()->IsZeroSized());
+ numInstanceFieldBytes = S_UINT32(1);
+ }
}
// The GC requires that all valuetypes containing orefs be sized to a multiple of TARGET_POINTER_SIZE.
diff --git a/src/coreclr/vm/mlinfo.cpp b/src/coreclr/vm/mlinfo.cpp
index 1dcc726213640f..5a071c2b9f8f99 100644
--- a/src/coreclr/vm/mlinfo.cpp
+++ b/src/coreclr/vm/mlinfo.cpp
@@ -1056,6 +1056,78 @@ OleColorMarshalingInfo *EEMarshalingData::GetOleColorMarshalingInfo()
}
#endif // FEATURE_COMINTEROP
+namespace
+{
+ MarshalInfo::MarshalType GetDisabledMarshallerType(
+ Module* pModule,
+ SigPointer sig,
+ const SigTypeContext * pTypeContext,
+ MethodTable** pMTOut,
+ UINT* errorResIDOut)
+ {
+ switch (sig.PeekElemTypeNormalized(pModule, pTypeContext))
+ {
+ case ELEMENT_TYPE_BOOLEAN:
+ case ELEMENT_TYPE_U1:
+ return MarshalInfo::MARSHAL_TYPE_GENERIC_U1;
+ case ELEMENT_TYPE_I1:
+ return MarshalInfo::MARSHAL_TYPE_GENERIC_1;
+ case ELEMENT_TYPE_CHAR:
+ case ELEMENT_TYPE_U2:
+ return MarshalInfo::MARSHAL_TYPE_GENERIC_U2;
+ case ELEMENT_TYPE_I2:
+ return MarshalInfo::MARSHAL_TYPE_GENERIC_2;
+ case ELEMENT_TYPE_U4:
+ return MarshalInfo::MARSHAL_TYPE_GENERIC_U4;
+ case ELEMENT_TYPE_I4:
+ return MarshalInfo::MARSHAL_TYPE_GENERIC_4;
+ case ELEMENT_TYPE_U8:
+ case ELEMENT_TYPE_I8:
+ return MarshalInfo::MARSHAL_TYPE_GENERIC_8;
+#ifdef TARGET_64BIT
+ case ELEMENT_TYPE_U:
+ case ELEMENT_TYPE_PTR:
+ case ELEMENT_TYPE_FNPTR:
+ case ELEMENT_TYPE_I:
+ return MarshalInfo::MARSHAL_TYPE_GENERIC_8;
+#else
+ case ELEMENT_TYPE_U:
+ return MarshalInfo::MARSHAL_TYPE_GENERIC_U4;
+ case ELEMENT_TYPE_PTR:
+ case ELEMENT_TYPE_FNPTR:
+ case ELEMENT_TYPE_I:
+ return MarshalInfo::MARSHAL_TYPE_GENERIC_4;
+#endif
+ case ELEMENT_TYPE_R4:
+ return MarshalInfo::MARSHAL_TYPE_FLOAT;
+ case ELEMENT_TYPE_R8:
+ return MarshalInfo::MARSHAL_TYPE_DOUBLE;
+ case ELEMENT_TYPE_VAR:
+ case ELEMENT_TYPE_VALUETYPE:
+ {
+ TypeHandle sigTH = sig.GetTypeHandleThrowing(pModule, pTypeContext);
+ MethodTable* pMT = sigTH.GetMethodTable();
+
+ if (!pMT->IsValueType() || pMT->ContainsPointers())
+ {
+ *errorResIDOut = IDS_EE_BADMARSHAL_MARSHAL_DISABLED;
+ return MarshalInfo::MARSHAL_TYPE_UNKNOWN;
+ }
+ if (pMT->IsAutoLayoutOrHasAutoLayoutField())
+ {
+ *errorResIDOut = IDS_EE_BADMARSHAL_AUTOLAYOUT;
+ return MarshalInfo::MARSHAL_TYPE_UNKNOWN;
+ }
+ *pMTOut = pMT;
+ return MarshalInfo::MARSHAL_TYPE_BLITTABLEVALUECLASS;
+ }
+ default:
+ *errorResIDOut = IDS_EE_BADMARSHAL_MARSHAL_DISABLED;
+ return MarshalInfo::MARSHAL_TYPE_UNKNOWN;
+ }
+ }
+}
+
//==========================================================================
// Constructs MarshalInfo.
//==========================================================================
@@ -1130,27 +1202,27 @@ MarshalInfo::MarshalInfo(Module* pModule,
CHAR achDbgContext[DEBUG_CONTEXT_STR_LEN] = "";
if (!pDebugName)
{
- strncpy_s(achDbgContext, COUNTOF(achDbgContext), "", _TRUNCATE);
+ strncpy_s(achDbgContext, ARRAY_SIZE(achDbgContext), "", _TRUNCATE);
}
else
{
- strncat_s(achDbgContext, COUNTOF(achDbgContext), pDebugClassName, _TRUNCATE);
- strncat_s(achDbgContext, COUNTOF(achDbgContext), NAMESPACE_SEPARATOR_STR, _TRUNCATE);
- strncat_s(achDbgContext, COUNTOF(achDbgContext), pDebugName, _TRUNCATE);
- strncat_s(achDbgContext, COUNTOF(achDbgContext), " ", _TRUNCATE);
+ strncat_s(achDbgContext, ARRAY_SIZE(achDbgContext), pDebugClassName, _TRUNCATE);
+ strncat_s(achDbgContext, ARRAY_SIZE(achDbgContext), NAMESPACE_SEPARATOR_STR, _TRUNCATE);
+ strncat_s(achDbgContext, ARRAY_SIZE(achDbgContext), pDebugName, _TRUNCATE);
+ strncat_s(achDbgContext, ARRAY_SIZE(achDbgContext), " ", _TRUNCATE);
switch (argidx)
{
case (UINT)-1:
- strncat_s(achDbgContext, COUNTOF(achDbgContext), "field", _TRUNCATE);
+ strncat_s(achDbgContext, ARRAY_SIZE(achDbgContext), "field", _TRUNCATE);
break;
case 0:
- strncat_s(achDbgContext, COUNTOF(achDbgContext), "return value", _TRUNCATE);
+ strncat_s(achDbgContext, ARRAY_SIZE(achDbgContext), "return value", _TRUNCATE);
break;
default:
{
char buf[30];
- sprintf_s(buf, COUNTOF(buf), "param #%lu", (ULONG)argidx);
- strncat_s(achDbgContext, COUNTOF(achDbgContext), buf, _TRUNCATE);
+ sprintf_s(buf, ARRAY_SIZE(buf), "param #%lu", (ULONG)argidx);
+ strncat_s(achDbgContext, ARRAY_SIZE(achDbgContext), buf, _TRUNCATE);
}
}
}
@@ -1163,7 +1235,30 @@ MarshalInfo::MarshalInfo(Module* pModule,
m_byref = TRUE;
#endif
+ // For COM IL-stub scenarios, we do not support disabling the runtime marshalling support.
+ // The runtime-integrated COM support uses a significant portion of the marshalling infrastructure as well as
+ // quite a bit of its own custom marshalling infrastructure to function in basically any aspect.
+ // As a result, disabling marshalling in COM scenarios isn't useful. Instead, we recommend that people set the
+ // feature switch to false to disable the runtime COM support if they want it disabled.
+ // For field marshalling scenarios, we also don't disable runtime marshalling. If we're already in a field
+ // marshalling scenario, we've already decided that the context for the owning type is using runtime marshalling,
+ // so the fields of the struct should also use runtime marshalling.
+ const bool useRuntimeMarshalling = ms != MARSHAL_SCENARIO_NDIRECT || pModule->IsRuntimeMarshallingEnabled();
+ if (!useRuntimeMarshalling)
+ {
+ m_in = TRUE;
+ m_out = FALSE;
+ m_byref = FALSE;
+ m_type = GetDisabledMarshallerType(
+ pModule,
+ sig,
+ pTypeContext,
+ &m_pMT,
+ &m_resID);
+ m_args.m_pMT = m_pMT;
+ return;
+ }
// Retrieve the native type for the current parameter.
if (!ParseNativeTypeInfo(token, pModule->GetMDImport(), &ParamInfo))
@@ -1322,6 +1417,7 @@ MarshalInfo::MarshalInfo(Module* pModule,
switch (mtype)
{
case ELEMENT_TYPE_BOOLEAN:
+
switch (nativeType)
{
case NATIVE_TYPE_BOOLEAN:
@@ -1482,10 +1578,6 @@ MarshalInfo::MarshalInfo(Module* pModule,
break;
case ELEMENT_TYPE_I:
- // Technically the "native int" and "native uint" types aren't supported in the WinRT scenario,
- // but we need to not block ourselves from using them to enable accurate managed->native marshalling of
- // projected types such as NotifyCollectionChangedEventArgs and NotifyPropertyChangedEventArgs.
-
if (!(nativeType == NATIVE_TYPE_INT || nativeType == NATIVE_TYPE_UINT || nativeType == NATIVE_TYPE_DEFAULT))
{
m_resID = IDS_EE_BADMARSHAL_I;
@@ -1499,7 +1591,6 @@ MarshalInfo::MarshalInfo(Module* pModule,
break;
case ELEMENT_TYPE_U:
-
if (!(nativeType == NATIVE_TYPE_UINT || nativeType == NATIVE_TYPE_INT || nativeType == NATIVE_TYPE_DEFAULT))
{
m_resID = IDS_EE_BADMARSHAL_I;
@@ -1564,6 +1655,21 @@ MarshalInfo::MarshalInfo(Module* pModule,
{
TypeHandle sigTH = sig.GetTypeHandleThrowing(pModule, pTypeContext);
+ if (sigTH.GetMethodTable()->IsValueType())
+ {
+ // For value types, we need to handle the "value type marshalled as a COM interface"
+ // case here for back-compat.
+ // Otherwise, we can go to the value-type case.
+#ifdef FEATURE_COMINTEROP
+ if (nativeType != NATIVE_TYPE_INTF)
+ {
+ goto lValueClass;
+ }
+#else
+ goto lValueClass;
+#endif
+ }
+
// Disallow marshaling generic types.
if (sigTH.HasInstantiation())
{
@@ -1968,14 +2074,13 @@ MarshalInfo::MarshalInfo(Module* pModule,
}
}
-
else if (m_pMT->IsArray())
{
_ASSERTE(!"This invalid signature should never be hit!");
IfFailGoto(E_FAIL, lFail);
}
#endif // FEATURE_COMINTEROP
- else if (!m_pMT->IsValueType())
+ else
{
if (!(nativeType == NATIVE_TYPE_INTF || nativeType == NATIVE_TYPE_DEFAULT))
{
@@ -1990,12 +2095,6 @@ MarshalInfo::MarshalInfo(Module* pModule,
IfFailGoto(E_FAIL, lFail);
#endif // FEATURE_COMINTEROP
}
-
- else
- {
- _ASSERTE(m_pMT->IsValueType());
- goto lValueClass;
- }
}
break;
}
@@ -2166,8 +2265,7 @@ MarshalInfo::MarshalInfo(Module* pModule,
|| m_pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__VECTOR64T))
|| m_pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__VECTOR128T))
|| m_pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__VECTOR256T))
- // Crossgen scenarios block Vector from even being loaded
- || m_pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__VECTORT))
+ || m_pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__VECTORT))
)))
{
m_resID = IDS_EE_BADMARSHAL_GENERICS_RESTRICTION;
@@ -2896,12 +2994,21 @@ UINT16 MarshalInfo::GetNativeSize(MarshalType mtype)
#include "mtypes.h"
};
- _ASSERTE((SIZE_T)mtype < COUNTOF(nativeSizes));
+ _ASSERTE((SIZE_T)mtype < ARRAY_SIZE(nativeSizes));
BYTE nativeSize = nativeSizes[mtype];
if (nativeSize == VARIABLESIZE)
{
_ASSERTE(IsValueClass(mtype));
+ // For blittable types, use the GetNumInstanceFieldBytes method.
+ // When we generate IL stubs when marshalling is disabled,
+ // we reuse the blittable value class marshalling mechanism.
+ // In that scenario, only GetNumInstanceFieldBytes will return the correct value.
+ // GetNativeSize will return the size for when runtime marshalling is enabled.
+ if (mtype == MARSHAL_TYPE_BLITTABLEVALUECLASS)
+ {
+ return (UINT16) m_pMT->GetNumInstanceFieldBytes();
+ }
return (UINT16) m_pMT->GetNativeSize();
}
@@ -2959,7 +3066,7 @@ OVERRIDEPROC MarshalInfo::GetArgumentOverrideProc(MarshalType mtype)
#include "mtypes.h"
};
- _ASSERTE((SIZE_T)mtype < COUNTOF(ILArgumentOverrideProcs));
+ _ASSERTE((SIZE_T)mtype < ARRAY_SIZE(ILArgumentOverrideProcs));
return ILArgumentOverrideProcs[mtype];
}
@@ -2979,7 +3086,7 @@ RETURNOVERRIDEPROC MarshalInfo::GetReturnOverrideProc(MarshalType mtype)
#include "mtypes.h"
};
- _ASSERTE((SIZE_T)mtype < COUNTOF(ILReturnOverrideProcs));
+ _ASSERTE((SIZE_T)mtype < ARRAY_SIZE(ILReturnOverrideProcs));
return ILReturnOverrideProcs[mtype];
}
@@ -3172,7 +3279,7 @@ VOID MarshalInfo::DumpMarshalInfo(Module* pModule, SigPointer sig, const SigType
while (cbNativeType--)
{
char num[100];
- sprintf_s(num, COUNTOF(num), "0x%lx ", (ULONG)*pvNativeType);
+ sprintf_s(num, ARRAY_SIZE(num), "0x%lx ", (ULONG)*pvNativeType);
logbuf.AppendASCII(num);
switch (*(pvNativeType++))
{
@@ -3314,7 +3421,7 @@ VOID MarshalInfo::DumpMarshalInfo(Module* pModule, SigPointer sig, const SigType
logbuf.AppendASCII("MarshalType : ");
{
char num[100];
- sprintf_s(num, COUNTOF(num), "0x%lx ", (ULONG)m_type);
+ sprintf_s(num, ARRAY_SIZE(num), "0x%lx ", (ULONG)m_type);
logbuf.AppendASCII(num);
}
switch (m_type)
diff --git a/src/coreclr/vm/multicorejit.cpp b/src/coreclr/vm/multicorejit.cpp
index 2ad518bf9f7361..b747608a184783 100644
--- a/src/coreclr/vm/multicorejit.cpp
+++ b/src/coreclr/vm/multicorejit.cpp
@@ -1551,7 +1551,7 @@ DWORD MulticoreJitManager::EncodeModuleHelper(void * pModuleContext, Module * pR
// wszProfile - profile name
// ptrNativeAssemblyBinder - the binding context
//
-extern "C" void QCALLTYPE MultiCoreJIT_InternalStartProfile(__in_z LPCWSTR wszProfile, INT_PTR ptrNativeAssemblyBinder)
+extern "C" void QCALLTYPE MultiCoreJIT_InternalStartProfile(_In_z_ LPCWSTR wszProfile, INT_PTR ptrNativeAssemblyBinder)
{
QCALL_CONTRACT;
@@ -1570,7 +1570,7 @@ extern "C" void QCALLTYPE MultiCoreJIT_InternalStartProfile(__in_z LPCWSTR wszPr
}
-extern "C" void QCALLTYPE MultiCoreJIT_InternalSetProfileRoot(__in_z LPCWSTR wszProfilePath)
+extern "C" void QCALLTYPE MultiCoreJIT_InternalSetProfileRoot(_In_z_ LPCWSTR wszProfilePath)
{
QCALL_CONTRACT;
diff --git a/src/coreclr/vm/multicorejit.h b/src/coreclr/vm/multicorejit.h
index 7faff54d9485c7..f4e38c6dc0953b 100644
--- a/src/coreclr/vm/multicorejit.h
+++ b/src/coreclr/vm/multicorejit.h
@@ -313,7 +313,7 @@ class MulticoreJitManager
// For qcallentrypoints.cpp
-extern "C" void QCALLTYPE MultiCoreJIT_InternalSetProfileRoot(__in_z LPCWSTR directoryPath);
-extern "C" void QCALLTYPE MultiCoreJIT_InternalStartProfile(__in_z LPCWSTR wszProfile, INT_PTR ptrNativeAssemblyBinder);
+extern "C" void QCALLTYPE MultiCoreJIT_InternalSetProfileRoot(_In_z_ LPCWSTR directoryPath);
+extern "C" void QCALLTYPE MultiCoreJIT_InternalStartProfile(_In_z_ LPCWSTR wszProfile, INT_PTR ptrNativeAssemblyBinder);
#endif // __MULTICORE_JIT_H__
diff --git a/src/coreclr/vm/nativeeventsource.cpp b/src/coreclr/vm/nativeeventsource.cpp
index 45550259079ee0..751e8e625aad78 100644
--- a/src/coreclr/vm/nativeeventsource.cpp
+++ b/src/coreclr/vm/nativeeventsource.cpp
@@ -13,7 +13,7 @@
#if defined(FEATURE_EVENTSOURCE_XPLAT)
-extern "C" void QCALLTYPE LogEventSource(__in_z int eventID, __in_z LPCWSTR eventName, __in_z LPCWSTR eventSourceName, __in_z LPCWSTR payload)
+extern "C" void QCALLTYPE LogEventSource(_In_z_ int eventID, _In_z_ LPCWSTR eventName, _In_z_ LPCWSTR eventSourceName, _In_z_ LPCWSTR payload)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -44,7 +44,7 @@ extern "C" BOOL QCALLTYPE IsEventSourceLoggingEnabled()
// change genRuntimeEventSources.py script to not emit the body that throws NotImplementedException for the event that
// want to be fired from managed code.
// See https://github.com/dotnet/runtime/pull/47829 for an example of how to do this.
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStart(__in_z uint activeWorkerThreadCount, __in_z uint retiredWorkerThreadCount, __in_z short clrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStart(_In_z_ uint activeWorkerThreadCount, _In_z_ uint retiredWorkerThreadCount, _In_z_ short clrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -54,7 +54,7 @@ extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStart(__in_z uint activeWorke
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStop(__in_z uint activeWorkerThreadCount, __in_z uint retiredWorkerThreadCount, __in_z short clrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStop(_In_z_ uint activeWorkerThreadCount, _In_z_ uint retiredWorkerThreadCount, _In_z_ short clrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -64,7 +64,7 @@ extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStop(__in_z uint activeWorker
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadWait(__in_z uint activeWorkerThreadCount, __in_z uint retiredWorkerThreadCount, __in_z short clrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadWait(_In_z_ uint activeWorkerThreadCount, _In_z_ uint retiredWorkerThreadCount, _In_z_ short clrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -74,7 +74,7 @@ extern "C" void QCALLTYPE LogThreadPoolWorkerThreadWait(__in_z uint activeWorker
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentSample(__in_z double throughput, __in_z short clrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentSample(_In_z_ double throughput, _In_z_ short clrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -84,7 +84,7 @@ extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentSample(__in_z doubl
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentAdjustment(__in_z double averageThroughput, __in_z uint newWorkerThreadCount, __in_z uint reason, __in_z short clrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentAdjustment(_In_z_ double averageThroughput, _In_z_ uint newWorkerThreadCount, _In_z_ uint reason, _In_z_ short clrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -94,7 +94,7 @@ extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentAdjustment(__in_z d
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentStats(__in_z double duration, __in_z double throughput, __in_z double threadWave, __in_z double throughputWave, __in_z double throughputErrorEstimate, __in_z double AverageThroughputErrorEstimate, __in_z double ThroughputRatio, __in_z double confidence, __in_z double newControlSetting, __in_z short newThreadWaveMagnitude, __in_z short ClrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentStats(_In_z_ double duration, _In_z_ double throughput, _In_z_ double threadWave, _In_z_ double throughputWave, _In_z_ double throughputErrorEstimate, _In_z_ double AverageThroughputErrorEstimate, _In_z_ double ThroughputRatio, _In_z_ double confidence, _In_z_ double newControlSetting, _In_z_ short newThreadWaveMagnitude, _In_z_ short ClrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -104,7 +104,7 @@ extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentStats(__in_z double
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolIOEnqueue(__in_z void* nativeOverlapped, __in_z void* overlapped, __in_z bool multiDequeues, __in_z short ClrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolIOEnqueue(_In_z_ void* nativeOverlapped, _In_z_ void* overlapped, _In_z_ bool multiDequeues, _In_z_ short ClrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -114,7 +114,7 @@ extern "C" void QCALLTYPE LogThreadPoolIOEnqueue(__in_z void* nativeOverlapped,
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolIODequeue(__in_z void* nativeOverlapped, __in_z void* overlapped, __in_z short ClrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolIODequeue(_In_z_ void* nativeOverlapped, _In_z_ void* overlapped, _In_z_ short ClrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
@@ -124,7 +124,7 @@ extern "C" void QCALLTYPE LogThreadPoolIODequeue(__in_z void* nativeOverlapped,
END_QCALL;
}
-extern "C" void QCALLTYPE LogThreadPoolWorkingThreadCount(__in_z uint count, __in_z short ClrInstanceID)
+extern "C" void QCALLTYPE LogThreadPoolWorkingThreadCount(_In_z_ uint count, _In_z_ short ClrInstanceID)
{
QCALL_CONTRACT;
BEGIN_QCALL;
diff --git a/src/coreclr/vm/nativeeventsource.h b/src/coreclr/vm/nativeeventsource.h
index 34313b04bcc6e1..9dbb751261de68 100644
--- a/src/coreclr/vm/nativeeventsource.h
+++ b/src/coreclr/vm/nativeeventsource.h
@@ -15,17 +15,17 @@
#include "qcall.h"
#if defined(FEATURE_PERFTRACING)
-extern "C" void QCALLTYPE LogEventSource(__in_z int eventID, __in_z LPCWSTR eventName, __in_z LPCWSTR eventSourceName, __in_z LPCWSTR payload);
+extern "C" void QCALLTYPE LogEventSource(_In_z_ int eventID, _In_z_ LPCWSTR eventName, _In_z_ LPCWSTR eventSourceName, _In_z_ LPCWSTR payload);
extern "C" BOOL QCALLTYPE IsEventSourceLoggingEnabled();
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStart(__in_z uint activeWorkerThreadCount, __in_z uint retiredWorkerThreadCount, __in_z short clrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStop(__in_z uint activeWorkerThreadCount, __in_z uint retiredWorkerThreadCount, __in_z short clrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadWait(__in_z uint activeWorkerThreadCount, __in_z uint retiredWorkerThreadCount, __in_z short clrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentSample(__in_z double throughput, __in_z short clrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentAdjustment(__in_z double averageThroughput, __in_z uint newWorkerThreadCount, __in_z uint reason, __in_z short clrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentStats(__in_z double duration, __in_z double throughput, __in_z double threadWave, __in_z double throughputWave, __in_z double throughputErrorEstimate, __in_z double AverageThroughputErrorEstimate, __in_z double ThroughputRatio, __in_z double confidence, __in_z double newControlSetting, __in_z short newThreadWaveMagnitude, __in_z short ClrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolIOEnqueue(__in_z void* nativeOverlapped, __in_z void* overlapped, __in_z bool multiDequeues, __in_z short ClrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolIODequeue(__in_z void* nativeOverlapped, __in_z void* overlapped, __in_z short ClrInstanceID);
-extern "C" void QCALLTYPE LogThreadPoolWorkingThreadCount(__in_z uint count, __in_z short ClrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStart(_In_z_ uint activeWorkerThreadCount, _In_z_ uint retiredWorkerThreadCount, _In_z_ short clrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadStop(_In_z_ uint activeWorkerThreadCount, _In_z_ uint retiredWorkerThreadCount, _In_z_ short clrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadWait(_In_z_ uint activeWorkerThreadCount, _In_z_ uint retiredWorkerThreadCount, _In_z_ short clrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentSample(_In_z_ double throughput, _In_z_ short clrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentAdjustment(_In_z_ double averageThroughput, _In_z_ uint newWorkerThreadCount, _In_z_ uint reason, _In_z_ short clrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolWorkerThreadAdjustmentStats(_In_z_ double duration, _In_z_ double throughput, _In_z_ double threadWave, _In_z_ double throughputWave, _In_z_ double throughputErrorEstimate, _In_z_ double AverageThroughputErrorEstimate, _In_z_ double ThroughputRatio, _In_z_ double confidence, _In_z_ double newControlSetting, _In_z_ short newThreadWaveMagnitude, _In_z_ short ClrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolIOEnqueue(_In_z_ void* nativeOverlapped, _In_z_ void* overlapped, _In_z_ bool multiDequeues, _In_z_ short ClrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolIODequeue(_In_z_ void* nativeOverlapped, _In_z_ void* overlapped, _In_z_ short ClrInstanceID);
+extern "C" void QCALLTYPE LogThreadPoolWorkingThreadCount(_In_z_ uint count, _In_z_ short ClrInstanceID);
#endif // defined(FEATURE_PERFTRACING)
#endif //_NATIVEEVENTSOURCE_H_
diff --git a/src/coreclr/vm/nativelibrary.cpp b/src/coreclr/vm/nativelibrary.cpp
index 9ec47c423311fd..d5a91b4863c2fc 100644
--- a/src/coreclr/vm/nativelibrary.cpp
+++ b/src/coreclr/vm/nativelibrary.cpp
@@ -526,7 +526,7 @@ namespace
SString::CIterator it = libName.Begin();
if (libName.Find(it, PLATFORM_SHARED_LIB_SUFFIX_W))
{
- it += COUNTOF(PLATFORM_SHARED_LIB_SUFFIX_W);
+ it += ARRAY_SIZE(PLATFORM_SHARED_LIB_SUFFIX_W);
containsSuffix = it == libName.End() || *it == (WCHAR)'.';
}
@@ -648,7 +648,7 @@ namespace
// (both of these are typically done to smooth over cross-platform differences).
// We try to dlopen with such variations on the original.
const WCHAR* prefixSuffixCombinations[MaxVariationCount] = {};
- int numberOfVariations = COUNTOF(prefixSuffixCombinations);
+ int numberOfVariations = ARRAY_SIZE(prefixSuffixCombinations);
DetermineLibNameVariations(prefixSuffixCombinations, &numberOfVariations, wszLibName, libNameIsRelativePath);
for (int i = 0; i < numberOfVariations; i++)
{
diff --git a/src/coreclr/vm/notifyexternals.cpp b/src/coreclr/vm/notifyexternals.cpp
deleted file mode 100644
index 49c2443da3bcb3..00000000000000
--- a/src/coreclr/vm/notifyexternals.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// ===========================================================================
-// File: notifyexternals.cpp
-//
-
-// ===========================================================================
-
-
-#include "common.h"
-
-#include "excep.h"
-#include "interoputil.h"
-#include "comcache.h"
-
-#include "notifyexternals.h"
-
-// On some platforms, we can detect whether the current thread holds the loader
-// lock. It is unsafe to execute managed code when this is the case
-BOOL ShouldCheckLoaderLock()
-{
- CONTRACTL
- {
- NOTHROW;
- GC_NOTRIGGER;
- MODE_ANY;
- }
- CONTRACTL_END;
-
-#ifdef FEATURE_CORESYSTEM
- // CoreSystem does not support this.
- return FALSE;
-#else
- // Because of how C++ generates code, we must use default initialization to
- // 0 here. Any explicit initialization will result in thread-safety problems.
- static BOOL fInited;
- static BOOL fShouldCheck;
-
- if (VolatileLoad(&fInited) == FALSE)
- {
- fShouldCheck = AuxUlibInitialize(); // may fail
-
- VolatileStore(&fInited, TRUE);
- }
- return (fShouldCheck);
-#endif // FEATURE_CORESYSTEM
-}
diff --git a/src/coreclr/vm/notifyexternals.h b/src/coreclr/vm/notifyexternals.h
deleted file mode 100644
index 8d204d1a7881ef..00000000000000
--- a/src/coreclr/vm/notifyexternals.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-////////////////////////////////////////////////////////////////////////////////
-
-
-#ifndef _NOTIFY_EXTERNALS_H
-#define _NOTIFY_EXTERNALS_H
-
-#ifndef FEATURE_COMINTEROP
-#error FEATURE_COMINTEROP is required for this file
-#endif // FEATURE_COMINTEROP
-
-extern BOOL g_fComStarted;
-
-BOOL ShouldCheckLoaderLock(BOOL fForMDA = TRUE);
-
-#include "aux_ulib.h"
-
-#endif
diff --git a/src/coreclr/vm/object.cpp b/src/coreclr/vm/object.cpp
index 6b64f72e5e2805..4a0ac960e9ace9 100644
--- a/src/coreclr/vm/object.cpp
+++ b/src/coreclr/vm/object.cpp
@@ -852,7 +852,7 @@ STRINGREF* StringObject::InitEmptyStringRefPtr() {
// strAChars must be null-terminated, with an appropriate aLength
// strBChars must be null-terminated, with an appropriate bLength OR bLength == -1
// If bLength == -1, we stop on the first null character in strBChars
-BOOL StringObject::CaseInsensitiveCompHelper(__in_ecount(aLength) WCHAR *strAChars, __in_z INT8 *strBChars, INT32 aLength, INT32 bLength, INT32 *result) {
+BOOL StringObject::CaseInsensitiveCompHelper(_In_reads_(aLength) WCHAR *strAChars, _In_z_ INT8 *strBChars, INT32 aLength, INT32 bLength, INT32 *result) {
CONTRACTL {
NOTHROW;
GC_NOTRIGGER;
diff --git a/src/coreclr/vm/object.h b/src/coreclr/vm/object.h
index a47adb8c7985c8..0f4033f45b507b 100644
--- a/src/coreclr/vm/object.h
+++ b/src/coreclr/vm/object.h
@@ -444,7 +444,7 @@ class Object
// we must zero out the lowest 2 bits on 32-bit and 3 bits on 64-bit.
#ifdef TARGET_64BIT
return dac_cast((dac_cast(m_pMethTab)) & ~((UINT_PTR)7));
-#else
+#else
return dac_cast((dac_cast(m_pMethTab)) & ~((UINT_PTR)3));
#endif //TARGET_64BIT
}
@@ -935,7 +935,7 @@ class StringObject : public Object
BOOL HasTrailByte();
BOOL GetTrailByte(BYTE *bTrailByte);
BOOL SetTrailByte(BYTE bTrailByte);
- static BOOL CaseInsensitiveCompHelper(__in_ecount(aLength) WCHAR * strA, __in_z INT8 * strB, int aLength, int bLength, int *result);
+ static BOOL CaseInsensitiveCompHelper(_In_reads_(aLength) WCHAR * strA, _In_z_ INT8 * strB, int aLength, int bLength, int *result);
/*=================RefInterpretGetStringValuesDangerousForGC======================
**N.B.: This perfoms no range checking and relies on the caller to have done this.
@@ -948,7 +948,7 @@ class StringObject : public Object
// !!!! If you use this function, you have to be careful because chars is a pointer
// !!!! to the data buffer of ref. If GC happens after this call, you need to make
// !!!! sure that you have a pin handle on ref, or use GCPROTECT_BEGINPINNING on ref.
- void RefInterpretGetStringValuesDangerousForGC(__deref_out_ecount(*length + 1) WCHAR **chars, int *length) {
+ void RefInterpretGetStringValuesDangerousForGC(_Outptr_result_buffer_(*length + 1) WCHAR **chars, int *length) {
WRAPPER_NO_CONTRACT;
_ASSERTE(GetGCSafeMethodTable() == g_pStringClass);
diff --git a/src/coreclr/vm/peimage.cpp b/src/coreclr/vm/peimage.cpp
index 4c517a1bd3e5f4..1b72b89106df65 100644
--- a/src/coreclr/vm/peimage.cpp
+++ b/src/coreclr/vm/peimage.cpp
@@ -18,7 +18,6 @@
#ifndef DACCESS_COMPILE
-
CrstStatic PEImage::s_hashLock;
PtrHashMap *PEImage::s_Images = NULL;
CrstStatic PEImage::s_ijwHashLock;
@@ -95,7 +94,7 @@ PEImage::~PEImage()
if(m_hFile!=INVALID_HANDLE_VALUE)
CloseHandle(m_hFile);
- for (unsigned int i=0;iRelease();
@@ -754,7 +753,7 @@ PEImage::PEImage():
MODE_ANY;
}
CONTRACTL_END;
- for (DWORD i=0;iGetEntryPoint();
-#endif // TARGET_X86 && !FEATURE_STUBS_AS_IL
-
ThePreStubManager::Init();
}
@@ -2297,11 +2289,7 @@ PCODE TheUMThunkPreStub()
{
LIMITED_METHOD_CONTRACT;
-#if defined(TARGET_X86) && !defined(FEATURE_STUBS_AS_IL)
- return g_UMThunkPreStub;
-#else // TARGET_X86 && !FEATURE_STUBS_AS_IL
return GetEEFuncEntryPoint(TheUMEntryPrestub);
-#endif // TARGET_X86 && !FEATURE_STUBS_AS_IL
}
PCODE TheVarargNDirectStub(BOOL hasRetBuffArg)
diff --git a/src/coreclr/vm/proftoeeinterfaceimpl.cpp b/src/coreclr/vm/proftoeeinterfaceimpl.cpp
index 2f742d05638a55..50e57f8144eef3 100644
--- a/src/coreclr/vm/proftoeeinterfaceimpl.cpp
+++ b/src/coreclr/vm/proftoeeinterfaceimpl.cpp
@@ -1274,7 +1274,7 @@ bool AllocByClassHelper(Object * pBO, void * pv)
_ASSERTE(pv != NULL);
{
- BEGIN_PROFILER_CALLBACK(CORProfilerTrackAllocations());
+ BEGIN_PROFILER_CALLBACK(CORProfilerTrackGC());
// Pass along the call
g_profControlBlock.AllocByClass(
(ObjectID) pBO,
@@ -2820,8 +2820,8 @@ HRESULT ProfToEEInterfaceImpl::GetArrayObjectInfo(ObjectID objectId,
HRESULT ProfToEEInterfaceImpl::GetArrayObjectInfoHelper(Object * pObj,
ULONG32 cDimensionSizes,
- __out_ecount(cDimensionSizes) ULONG32 pDimensionSizes[],
- __out_ecount(cDimensionSizes) int pDimensionLowerBounds[],
+ _Out_writes_(cDimensionSizes) ULONG32 pDimensionSizes[],
+ _Out_writes_(cDimensionSizes) int pDimensionLowerBounds[],
BYTE **ppData)
{
CONTRACTL
@@ -3907,7 +3907,7 @@ HRESULT ProfToEEInterfaceImpl::GetModuleInfo(ModuleID moduleId,
LPCBYTE * ppBaseLoadAddress,
ULONG cchName,
ULONG * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR wszName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR wszName[],
AssemblyID * pAssemblyId)
{
CONTRACTL
@@ -4027,7 +4027,7 @@ HRESULT ProfToEEInterfaceImpl::GetModuleInfo2(ModuleID moduleId,
LPCBYTE * ppBaseLoadAddress,
ULONG cchName,
ULONG * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR wszName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR wszName[],
AssemblyID * pAssemblyId,
DWORD * pdwModuleFlags)
{
@@ -5532,7 +5532,7 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionFromTokenAndTypeArgs(ModuleID moduleID
HRESULT ProfToEEInterfaceImpl::GetAppDomainInfo(AppDomainID appDomainId,
ULONG cchName,
ULONG *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[],
ProcessID *pProcessId)
{
CONTRACTL
@@ -5640,7 +5640,7 @@ HRESULT ProfToEEInterfaceImpl::GetAppDomainInfo(AppDomainID appDomainId,
HRESULT ProfToEEInterfaceImpl::GetAssemblyInfo(AssemblyID assemblyId,
ULONG cchName,
ULONG *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[],
AppDomainID *pAppDomainId,
ModuleID *pModuleId)
{
@@ -6391,7 +6391,7 @@ HRESULT ProfToEEInterfaceImpl::GetDynamicFunctionInfo(FunctionID functionId,
ULONG* pbSig,
ULONG cchName,
ULONG *pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR wszName[])
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR wszName[])
{
CONTRACTL
{
@@ -6992,7 +6992,7 @@ HRESULT ProfToEEInterfaceImpl::GetEnvironmentVariable(
const WCHAR *szName,
ULONG cchValue,
ULONG *pcchValue,
- __out_ecount_part_opt(cchValue, *pcchValue) WCHAR szValue[])
+ _Out_writes_to_opt_(cchValue, *pcchValue) WCHAR szValue[])
{
CONTRACTL
{
@@ -9408,7 +9408,7 @@ HRESULT ProfToEEInterfaceImpl::GetRuntimeInformation(USHORT * pClrInstanceId,
USHORT * pQFEVersion,
ULONG cchVersionString,
ULONG * pcchVersionString,
- __out_ecount_part_opt(cchVersionString, *pcchVersionString) WCHAR szVersionString[])
+ _Out_writes_to_opt_(cchVersionString, *pcchVersionString) WCHAR szVersionString[])
{
CONTRACTL
{
diff --git a/src/coreclr/vm/proftoeeinterfaceimpl.h b/src/coreclr/vm/proftoeeinterfaceimpl.h
index 5ece684c3b39ab..645b23da037672 100644
--- a/src/coreclr/vm/proftoeeinterfaceimpl.h
+++ b/src/coreclr/vm/proftoeeinterfaceimpl.h
@@ -213,7 +213,7 @@ class ProfToEEInterfaceImpl : public ICorProfilerInfo12
LPCBYTE * ppBaseLoadAddress,
ULONG cchName,
ULONG * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[],
AssemblyID * pAssemblyId);
COM_METHOD GetModuleMetaData(
@@ -274,14 +274,14 @@ class ProfToEEInterfaceImpl : public ICorProfilerInfo12
AppDomainID appDomainId,
ULONG cchName,
ULONG * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[],
ProcessID * pProcessId);
COM_METHOD GetAssemblyInfo(
AssemblyID assemblyId,
ULONG cchName,
ULONG * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[],
AppDomainID * pAppDomainId,
ModuleID * pModuleId);
@@ -472,7 +472,7 @@ class ProfToEEInterfaceImpl : public ICorProfilerInfo12
USHORT * pQFEVersion, // out
ULONG cchVersionString, // in
ULONG * pcchVersionString, // out
- __out_ecount_part_opt(cchVersionString, *pcchVersionString) WCHAR szVersionString[]); // out
+ _Out_writes_to_opt_(cchVersionString, *pcchVersionString) WCHAR szVersionString[]); // out
COM_METHOD GetThreadStaticAddress2(ClassID classId, // in
mdFieldDef fieldToken, // in
@@ -490,7 +490,7 @@ class ProfToEEInterfaceImpl : public ICorProfilerInfo12
LPCBYTE * ppBaseLoadAddress,
ULONG cchName,
ULONG * pcchName,
- __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[],
+ _Out_writes_to_opt_(cchName, *pcchName) WCHAR szName[],
AssemblyID * pAssemblyId,
DWORD * pdwModuleFlags);
@@ -652,7 +652,7 @@ class ProfToEEInterfaceImpl : public ICorProfilerInfo12
const WCHAR *szName,
ULONG cchValue,
ULONG *pcchValue,
- __out_ecount_part_opt(cchValue, *pcchValue) WCHAR szValue[]);
+ _Out_writes_to_opt_(cchValue, *pcchValue) WCHAR szValue[]);
COM_METHOD SetEnvironmentVariable(
const WCHAR *szName,
@@ -736,8 +736,8 @@ class ProfToEEInterfaceImpl : public ICorProfilerInfo12
HRESULT GetArrayObjectInfoHelper(Object * pObj,
ULONG32 cDimensionSizes,
- __out_ecount(cDimensionSizes) ULONG32 pDimensionSizes[],
- __out_ecount(cDimensionSizes) int pDimensionLowerBounds[],
+ _Out_writes_(cDimensionSizes) ULONG32 pDimensionSizes[],
+ _Out_writes_(cDimensionSizes) int pDimensionLowerBounds[],
BYTE ** ppData);
DWORD GetModuleFlags(Module * pModule);
diff --git a/src/coreclr/vm/runtimecallablewrapper.cpp b/src/coreclr/vm/runtimecallablewrapper.cpp
index 10e859c0f04469..fca8708ec1edcf 100644
--- a/src/coreclr/vm/runtimecallablewrapper.cpp
+++ b/src/coreclr/vm/runtimecallablewrapper.cpp
@@ -31,7 +31,6 @@ class Object;
#include "eeconfig.h"
#include "comdelegate.h"
#include "comcache.h"
-#include "notifyexternals.h"
#include "../md/compiler/custattr.h"
#include "olevariant.h"
#include "interopconverter.h"
@@ -585,7 +584,7 @@ OBJECTREF ComClassFactory::CreateInstance(MethodTable* pMTClass, BOOL ForManaged
//--------------------------------------------------------------
// Init the ComClassFactory.
-void ComClassFactory::Init(__in_opt PCWSTR wszServer, MethodTable* pClassMT)
+void ComClassFactory::Init(_In_opt_ PCWSTR wszServer, MethodTable* pClassMT)
{
LIMITED_METHOD_CONTRACT;
diff --git a/src/coreclr/vm/runtimecallablewrapper.h b/src/coreclr/vm/runtimecallablewrapper.h
index bebcde6e6c262d..57dc8530524acb 100644
--- a/src/coreclr/vm/runtimecallablewrapper.h
+++ b/src/coreclr/vm/runtimecallablewrapper.h
@@ -727,7 +727,7 @@ class ComClassFactory : public ClassFactoryBase
//--------------------------------------------------------------
// Init the ComClassFactory
- void Init(__in_opt PCWSTR wszServer, MethodTable* pClassMT);
+ void Init(_In_opt_ PCWSTR wszServer, MethodTable* pClassMT);
//-------------------------------------------------------------
// create instance, calls IClassFactory::CreateInstance
diff --git a/src/coreclr/vm/sigformat.cpp b/src/coreclr/vm/sigformat.cpp
index f506eedf2032b9..2225be54cd7bd5 100644
--- a/src/coreclr/vm/sigformat.cpp
+++ b/src/coreclr/vm/sigformat.cpp
@@ -235,7 +235,7 @@ void SigFormat::AddTypeString(Module* pModule, SigPointer sig, const SigTypeCont
else
{
char smallbuf[20];
- sprintf_s(smallbuf, COUNTOF(smallbuf), "!!%d", ix);
+ sprintf_s(smallbuf, ARRAY_SIZE(smallbuf), "!!%d", ix);
AddString(smallbuf);
}
}
@@ -253,7 +253,7 @@ void SigFormat::AddTypeString(Module* pModule, SigPointer sig, const SigTypeCont
else
{
char smallbuf[20];
- sprintf_s(smallbuf, COUNTOF(smallbuf), "!%d", ix);
+ sprintf_s(smallbuf, ARRAY_SIZE(smallbuf), "!%d", ix);
AddString(smallbuf);
}
}
diff --git a/src/coreclr/vm/siginfo.cpp b/src/coreclr/vm/siginfo.cpp
index f10acff25522e3..a197fbc87cabd9 100644
--- a/src/coreclr/vm/siginfo.cpp
+++ b/src/coreclr/vm/siginfo.cpp
@@ -2553,7 +2553,7 @@ UINT MetaSig::GetElemSize(CorElementType etype, TypeHandle thValueType)
}
CONTRACTL_END
- if ((UINT)etype >= COUNTOF(gElementTypeInfo))
+ if ((UINT)etype >= ARRAY_SIZE(gElementTypeInfo))
ThrowHR(COR_E_BADIMAGEFORMAT, BFA_BAD_COMPLUS_SIG);
int cbsize = gElementTypeInfo[(UINT)etype].m_cbSize;
diff --git a/src/coreclr/vm/sourceline.cpp b/src/coreclr/vm/sourceline.cpp
index d9adddf230c200..305358484aee0e 100644
--- a/src/coreclr/vm/sourceline.cpp
+++ b/src/coreclr/vm/sourceline.cpp
@@ -127,7 +127,7 @@ class CCallback : public IDiaLoadCallback
//////////////////////////////////////////////////////////////////
-bool SourceLine::LoadDataFromPdb( __in_z LPWSTR wszFilename )
+bool SourceLine::LoadDataFromPdb( _In_z_ LPWSTR wszFilename )
{
CONTRACTL {
THROWS;
@@ -172,7 +172,7 @@ bool SourceLine::LoadDataFromPdb( __in_z LPWSTR wszFilename )
//////////////////////////////////////////////////////////////////
-SourceLine::SourceLine( __in_z LPWSTR pszFileName )
+SourceLine::SourceLine( _In_z_ LPWSTR pszFileName )
{
WRAPPER_NO_CONTRACT;
if (LoadDataFromPdb(pszFileName)) {
@@ -185,7 +185,7 @@ SourceLine::SourceLine( __in_z LPWSTR pszFileName )
//////////////////////////////////////////////////////////////////
-HRESULT SourceLine::GetSourceLine( DWORD dwFunctionToken, DWORD dwOffset, __out_ecount(dwFileNameMaxLen) __out_z LPWSTR pszFileName, DWORD dwFileNameMaxLen, PDWORD pdwLineNumber )
+HRESULT SourceLine::GetSourceLine( DWORD dwFunctionToken, DWORD dwOffset, _Out_writes_z_(dwFileNameMaxLen) LPWSTR pszFileName, DWORD dwFileNameMaxLen, PDWORD pdwLineNumber )
{
CONTRACTL {
THROWS;
@@ -242,7 +242,7 @@ HRESULT SourceLine::GetSourceLine( DWORD dwFunctionToken, DWORD dwOffset, __out_
//////////////////////////////////////////////////////////////////
-HRESULT SourceLine::GetLocalName( DWORD dwFunctionToken, DWORD dwSlot, __out_ecount(dwNameMaxLen) __out_z LPWSTR pszName, DWORD dwNameMaxLen )
+HRESULT SourceLine::GetLocalName( DWORD dwFunctionToken, DWORD dwSlot, _Out_writes_z_(dwNameMaxLen) LPWSTR pszName, DWORD dwNameMaxLen )
{
CONTRACTL {
THROWS;
@@ -307,19 +307,19 @@ HRESULT SourceLine::GetLocalName( DWORD dwFunctionToken, DWORD dwSlot, __out_eco
}
#else // !ENABLE_DIAGNOSTIC_SYMBOL_READING
-SourceLine::SourceLine( __in_z LPWSTR pszFileName )
+SourceLine::SourceLine( _In_z_ LPWSTR pszFileName )
{
LIMITED_METHOD_CONTRACT;
initialized_ = false;
}
-HRESULT SourceLine::GetSourceLine( DWORD dwFunctionToken, DWORD dwOffset, __out_ecount(dwFileNameMaxLen) __out_z LPWSTR pszFileName, DWORD dwFileNameMaxLen, PDWORD pdwLineNumber )
+HRESULT SourceLine::GetSourceLine( DWORD dwFunctionToken, DWORD dwOffset, _Out_writes_z_(dwFileNameMaxLen) LPWSTR pszFileName, DWORD dwFileNameMaxLen, PDWORD pdwLineNumber )
{
LIMITED_METHOD_CONTRACT;
return E_NOTIMPL;
}
-HRESULT SourceLine::GetLocalName( DWORD dwFunctionToken, DWORD dwSlot, __out_ecount(dwNameMaxLen) __out_z LPWSTR pszName, DWORD dwNameMaxLen )
+HRESULT SourceLine::GetLocalName( DWORD dwFunctionToken, DWORD dwSlot, _Out_writes_z_(dwNameMaxLen) LPWSTR pszName, DWORD dwNameMaxLen )
{
LIMITED_METHOD_CONTRACT;
return E_NOTIMPL;
diff --git a/src/coreclr/vm/sourceline.h b/src/coreclr/vm/sourceline.h
index 2ab99344b9f31e..3c241d4328a00b 100644
--- a/src/coreclr/vm/sourceline.h
+++ b/src/coreclr/vm/sourceline.h
@@ -21,23 +21,23 @@ class SourceLine
CComPtr(IDiaSymbol) pGlobal_;
CComPtr(IDiaSession) pSession_;
- bool LoadDataFromPdb( __in_z LPWSTR wszFilename );
+ bool LoadDataFromPdb( _In_z_ LPWSTR wszFilename );
#endif // ENABLE_DIAGNOSTIC_SYMBOL_READING
public:
- SourceLine( __in_z LPWSTR pszFileName );
+ SourceLine( _In_z_ LPWSTR pszFileName );
bool IsInitialized() { return initialized_; }
//
// Given function token (methoddef) and offset, return filename and line number
//
- HRESULT GetSourceLine( DWORD dwFunctionToken, DWORD dwOffset, __out_ecount(dwFileNameMaxLen) __out_z LPWSTR wszFileName, DWORD dwFileNameMaxLen, PDWORD pdwLineNumber );
+ HRESULT GetSourceLine( DWORD dwFunctionToken, DWORD dwOffset, _Out_writes_z_(dwFileNameMaxLen) LPWSTR wszFileName, DWORD dwFileNameMaxLen, PDWORD pdwLineNumber );
//
// Given function token (methoddef) and slot, return name of the local variable
//
- HRESULT GetLocalName( DWORD dwFunctionToken, DWORD dwSlot, __out_ecount(dwNameMaxLen) __out_z LPWSTR wszName, DWORD dwNameMaxLen );
+ HRESULT GetLocalName( DWORD dwFunctionToken, DWORD dwSlot, _Out_writes_z_(dwNameMaxLen) LPWSTR wszName, DWORD dwNameMaxLen );
};
#endif // __SOURCELINE_H__
diff --git a/src/coreclr/vm/stackwalk.cpp b/src/coreclr/vm/stackwalk.cpp
index 45bdf3088db074..18345aec77ac24 100644
--- a/src/coreclr/vm/stackwalk.cpp
+++ b/src/coreclr/vm/stackwalk.cpp
@@ -755,7 +755,7 @@ UINT_PTR Thread::VirtualUnwindToFirstManagedCallFrame(T_CONTEXT* pContext)
#endif // FEATURE_EH_FUNCLETS
#ifdef _DEBUG
-void Thread::DebugLogStackWalkInfo(CrawlFrame* pCF, __in_z LPCSTR pszTag, UINT32 uFramesProcessed)
+void Thread::DebugLogStackWalkInfo(CrawlFrame* pCF, _In_z_ LPCSTR pszTag, UINT32 uFramesProcessed)
{
LIMITED_METHOD_CONTRACT;
SUPPORTS_DAC;
diff --git a/src/coreclr/vm/stdinterfaces.cpp b/src/coreclr/vm/stdinterfaces.cpp
index 094b5ab407b187..4ccee10d1a634e 100644
--- a/src/coreclr/vm/stdinterfaces.cpp
+++ b/src/coreclr/vm/stdinterfaces.cpp
@@ -1152,7 +1152,7 @@ Dispatch_GetTypeInfo(IDispatch* pDisp, unsigned int itinfo, LCID lcid, ITypeInfo
}
HRESULT __stdcall
-Dispatch_GetIDsOfNames(IDispatch* pDisp, REFIID riid, __in_ecount(cNames) OLECHAR **rgszNames, unsigned int cNames, LCID lcid, DISPID *rgdispid)
+Dispatch_GetIDsOfNames(IDispatch* pDisp, REFIID riid, _In_reads_(cNames) OLECHAR **rgszNames, unsigned int cNames, LCID lcid, DISPID *rgdispid)
{
CONTRACTL
{
@@ -1231,7 +1231,7 @@ OleAutDispatchImpl_GetIDsOfNames
(
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid
@@ -1334,7 +1334,7 @@ HRESULT __stdcall
InternalDispatchImpl_GetIDsOfNames (
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid)
@@ -1560,7 +1560,7 @@ HRESULT __stdcall DispatchEx_GetTypeInfo (
HRESULT __stdcall DispatchEx_GetIDsOfNames (
IDispatchEx* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid
diff --git a/src/coreclr/vm/stdinterfaces.h b/src/coreclr/vm/stdinterfaces.h
index db04fd93b08afd..fb3871f4434f76 100644
--- a/src/coreclr/vm/stdinterfaces.h
+++ b/src/coreclr/vm/stdinterfaces.h
@@ -168,7 +168,7 @@ HRESULT __stdcall Dispatch_GetTypeInfo_Wrapper (
HRESULT __stdcall Dispatch_GetIDsOfNames_Wrapper (
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
@@ -190,7 +190,7 @@ HRESULT __stdcall Dispatch_Invoke_Wrapper (
HRESULT __stdcall InternalDispatchImpl_GetIDsOfNames_Wrapper (
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
@@ -229,7 +229,7 @@ HRESULT __stdcall DispatchEx_GetTypeInfo_Wrapper (
HRESULT __stdcall DispatchEx_GetIDsOfNames_Wrapper (
IDispatchEx* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
@@ -384,7 +384,7 @@ HRESULT __stdcall
InternalDispatchImpl_GetIDsOfNames (
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
diff --git a/src/coreclr/vm/stdinterfaces_internal.h b/src/coreclr/vm/stdinterfaces_internal.h
index acabf15be1d842..bd1b7b336a2a0b 100644
--- a/src/coreclr/vm/stdinterfaces_internal.h
+++ b/src/coreclr/vm/stdinterfaces_internal.h
@@ -76,7 +76,7 @@ HRESULT __stdcall Dispatch_GetTypeInfo (
HRESULT __stdcall Dispatch_GetIDsOfNames (
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
@@ -102,7 +102,7 @@ HRESULT __stdcall Dispatch_Invoke (
HRESULT __stdcall OleAutDispatchImpl_GetIDsOfNames (
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
@@ -129,7 +129,7 @@ HRESULT __stdcall OleAutDispatchImpl_Invoke (
HRESULT __stdcall InternalDispatchImpl_GetIDsOfNames (
IDispatch* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
@@ -168,7 +168,7 @@ HRESULT __stdcall DispatchEx_GetTypeInfo (
HRESULT __stdcall DispatchEx_GetIDsOfNames (
IDispatchEx* pDisp,
REFIID riid,
- __in_ecount(cNames) OLECHAR **rgszNames,
+ _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames,
LCID lcid,
DISPID *rgdispid);
diff --git a/src/coreclr/vm/stdinterfaces_wrapper.cpp b/src/coreclr/vm/stdinterfaces_wrapper.cpp
index 91fc46651952b9..400d90405e7e52 100644
--- a/src/coreclr/vm/stdinterfaces_wrapper.cpp
+++ b/src/coreclr/vm/stdinterfaces_wrapper.cpp
@@ -1016,7 +1016,7 @@ VOID __stdcall Dispatch_GetIDsOfNames_CallBack(LPVOID ptr)
}
}
-HRESULT __stdcall Dispatch_GetIDsOfNames_Wrapper(IDispatch* pDisp, REFIID riid, __in_ecount(cNames) OLECHAR **rgszNames,
+HRESULT __stdcall Dispatch_GetIDsOfNames_Wrapper(IDispatch* pDisp, REFIID riid, _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames, LCID lcid, DISPID *rgdispid)
{
SetupForComCallHR();
@@ -1062,7 +1062,7 @@ VOID __stdcall InternalDispatchImpl_GetIDsOfNames_CallBack(LPVOID ptr)
}
}
-HRESULT __stdcall InternalDispatchImpl_GetIDsOfNames_Wrapper(IDispatch* pDisp, REFIID riid, __in_ecount(cNames) OLECHAR **rgszNames,
+HRESULT __stdcall InternalDispatchImpl_GetIDsOfNames_Wrapper(IDispatch* pDisp, REFIID riid, _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames, LCID lcid, DISPID *rgdispid)
{
SetupForComCallHR();
@@ -1341,7 +1341,7 @@ VOID __stdcall DispatchEx_GetIDsOfNames_CallBack(LPVOID ptr)
}
}
-HRESULT __stdcall DispatchEx_GetIDsOfNames_Wrapper(IDispatchEx* pDisp, REFIID riid, __in_ecount(cNames) OLECHAR **rgszNames,
+HRESULT __stdcall DispatchEx_GetIDsOfNames_Wrapper(IDispatchEx* pDisp, REFIID riid, _In_reads_(cNames) OLECHAR **rgszNames,
unsigned int cNames, LCID lcid, DISPID *rgdispid)
{
SetupForComCallHR();
diff --git a/src/coreclr/vm/stringliteralmap.cpp b/src/coreclr/vm/stringliteralmap.cpp
index ca1d80f6867924..17e0d5fa3e031a 100644
--- a/src/coreclr/vm/stringliteralmap.cpp
+++ b/src/coreclr/vm/stringliteralmap.cpp
@@ -428,7 +428,7 @@ StringLiteralEntry *GlobalStringLiteralMap::GetInternedString(STRINGREF *pString
}
#ifdef LOGGING
-static void LogStringLiteral(__in_z const char* action, EEStringData *pStringData)
+static void LogStringLiteral(_In_z_ const char* action, EEStringData *pStringData)
{
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_NOTRIGGER;
diff --git a/src/coreclr/vm/stubgen.cpp b/src/coreclr/vm/stubgen.cpp
index f829212a8ef6ed..2249756c3358aa 100644
--- a/src/coreclr/vm/stubgen.cpp
+++ b/src/coreclr/vm/stubgen.cpp
@@ -2669,7 +2669,7 @@ void ILStubLinker::TransformArgForJIT(LocalDesc *pLoc)
// JIT will handle structures
if (pLoc->InternalToken.IsValueType())
{
- _ASSERTE(pLoc->InternalToken.IsBlittable());
+ _ASSERTE(pLoc->InternalToken.IsNativeValueType() || !pLoc->InternalToken.GetMethodTable()->ContainsPointers());
break;
}
FALLTHROUGH;
diff --git a/src/coreclr/vm/syncblk.cpp b/src/coreclr/vm/syncblk.cpp
index 96aa9c701b916f..9dfdfafc050f5d 100644
--- a/src/coreclr/vm/syncblk.cpp
+++ b/src/coreclr/vm/syncblk.cpp
@@ -1491,7 +1491,7 @@ void DumpSyncBlockCache()
param.descrip = descrip;
param.oref = oref;
param.buffer2 = buffer2;
- param.cch2 = COUNTOF(buffer2);
+ param.cch2 = ARRAY_SIZE(buffer2);
param.isString = isString;
PAL_TRY(Param *, pParam, ¶m)
@@ -1514,7 +1514,7 @@ void DumpSyncBlockCache()
descrip = param.descrip;
isString = param.isString;
}
- sprintf_s(buffer, COUNTOF(buffer), "%s", descrip);
+ sprintf_s(buffer, ARRAY_SIZE(buffer), "%s", descrip);
descrip = buffer;
}
if (dumpSBStyle < 2)
diff --git a/src/coreclr/vm/threads.h b/src/coreclr/vm/threads.h
index f7b7479f586d73..1bfccb85e10d6f 100644
--- a/src/coreclr/vm/threads.h
+++ b/src/coreclr/vm/threads.h
@@ -2819,7 +2819,7 @@ class Thread
StackWalkAction MakeStackwalkerCallback(CrawlFrame* pCF, PSTACKWALKFRAMESCALLBACK pCallback, VOID* pData DEBUG_ARG(UINT32 uLoopIteration));
#ifdef _DEBUG
- void DebugLogStackWalkInfo(CrawlFrame* pCF, __in_z LPCSTR pszTag, UINT32 uLoopIteration);
+ void DebugLogStackWalkInfo(CrawlFrame* pCF, _In_z_ LPCSTR pszTag, UINT32 uLoopIteration);
#endif // _DEBUG
public:
diff --git a/src/coreclr/vm/threadsuspend.cpp b/src/coreclr/vm/threadsuspend.cpp
index c4fc869e893ec8..b65cd74270b23e 100644
--- a/src/coreclr/vm/threadsuspend.cpp
+++ b/src/coreclr/vm/threadsuspend.cpp
@@ -3591,12 +3591,12 @@ void ThreadSuspend::SuspendRuntime(ThreadSuspend::SUSPEND_REASON reason)
DWORD id = (DWORD) thread->m_OSThreadId;
if (id == 0xbaadf00d)
{
- sprintf_s (message, COUNTOF(message), "Thread CLR ID=%x cannot be suspended",
+ sprintf_s (message, ARRAY_SIZE(message), "Thread CLR ID=%x cannot be suspended",
thread->GetThreadId());
}
else
{
- sprintf_s (message, COUNTOF(message), "Thread OS ID=%x cannot be suspended",
+ sprintf_s (message, ARRAY_SIZE(message), "Thread OS ID=%x cannot be suspended",
id);
}
DbgAssertDialog(__FILE__, __LINE__, message);
@@ -6255,7 +6255,7 @@ void SuspendStatistics::DisplayAndUpdate()
const char* const str_timeUnit[] = { "usec", "msec", "sec" };
const int timeUnitFactor[] = { 1, 1000, 1000000 };
-void MinMaxTot::DisplayAndUpdate(FILE* logFile, __in_z const char *pName, MinMaxTot *pLastOne, int fullCount, int priorCount, timeUnit unit /* = usec */)
+void MinMaxTot::DisplayAndUpdate(FILE* logFile, _In_z_ const char *pName, MinMaxTot *pLastOne, int fullCount, int priorCount, timeUnit unit /* = usec */)
{
LIMITED_METHOD_CONTRACT;
diff --git a/src/coreclr/vm/threadsuspend.h b/src/coreclr/vm/threadsuspend.h
index 9274327682a6b9..a600d090eef82b 100644
--- a/src/coreclr/vm/threadsuspend.h
+++ b/src/coreclr/vm/threadsuspend.h
@@ -36,7 +36,7 @@ struct MinMaxTot
minVal = maxVal = 0;
}
- void DisplayAndUpdate(FILE* logFile, __in_z const char *pName, MinMaxTot *pLastOne, int fullCount, int priorCount, timeUnit=usec);
+ void DisplayAndUpdate(FILE* logFile, _In_z_ const char *pName, MinMaxTot *pLastOne, int fullCount, int priorCount, timeUnit=usec);
};
// A note about timings. We use QueryPerformanceCounter to measure all timings in units. During
diff --git a/src/coreclr/vm/typeparse.cpp b/src/coreclr/vm/typeparse.cpp
index 6abed5799f3009..524a9e595bc245 100644
--- a/src/coreclr/vm/typeparse.cpp
+++ b/src/coreclr/vm/typeparse.cpp
@@ -981,58 +981,6 @@ TypeHandle TypeName::GetTypeUsingCASearchRules(LPCWSTR szTypeName, Assembly *pRe
-//-------------------------------------------------------------------------------------------
-// Retrieves a type from an assembly. It requires the caller to know which assembly
-// the type is in.
-//-------------------------------------------------------------------------------------------
-/* public static */ TypeHandle TypeName::GetTypeFromAssembly(LPCWSTR szTypeName, Assembly *pAssembly, BOOL bThrowIfNotFound /*= TRUE*/)
-{
- STATIC_CONTRACT_THROWS;
- STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_FAULT;
-
- _ASSERTE(szTypeName != NULL);
- _ASSERTE(pAssembly != NULL);
-
- if (!*szTypeName)
- COMPlusThrow(kArgumentException, W("Format_StringZeroLength"));
-
- DWORD error = (DWORD)-1;
-
-#ifdef __GNUC__
- // When compiling under GCC we have to use the -fstack-check option to ensure we always spot stack
- // overflow. But this option is intolerant of locals growing too large, so we have to cut back a bit
- // on what we can allocate inline here. Leave the Windows versions alone to retain the perf benefits
- // since we don't have the same constraints.
- NewHolder pTypeName = new TypeName(szTypeName, &error);
-#else // __GNUC__
- TypeName typeName(szTypeName, &error);
- TypeName *pTypeName = &typeName;
-#endif // __GNUC__
-
- if (error != (DWORD)-1)
- {
- StackSString buf;
- StackSString msg(W("typeName@"));
- COUNT_T size = buf.GetUnicodeAllocation();
- _itow_s(error,buf.OpenUnicodeBuffer(size),size,10);
- buf.CloseBuffer();
- msg.Append(buf);
- COMPlusThrowArgumentException(msg.GetUnicode(), NULL);
- }
-
- // Because the typename can come from untrusted input, we will throw an exception rather than assert.
- // (This also assures that the shipping build does the right thing.)
- if (!(pTypeName->GetAssembly()->IsEmpty()))
- {
- COMPlusThrow(kArgumentException, IDS_EE_CANNOT_HAVE_ASSEMBLY_SPEC);
- }
-
- return pTypeName->GetTypeWorker(bThrowIfNotFound, /*bIgnoreCase = */FALSE, pAssembly, /*fEnableCASearchRules = */FALSE, FALSE, NULL,
- nullptr, // pPrivHostBinder
- NULL /* cannot find a collectible type unless it is in assembly */);
-}
-
//-------------------------------------------------------------------------------------------
// Retrieves a type. Will assert if the name is not fully qualified.
//-------------------------------------------------------------------------------------------
diff --git a/src/coreclr/vm/typeparse.h b/src/coreclr/vm/typeparse.h
index 5a19c980ad5e1b..2f1854da236dcf 100644
--- a/src/coreclr/vm/typeparse.h
+++ b/src/coreclr/vm/typeparse.h
@@ -269,12 +269,6 @@ class TypeName
virtual ~TypeName();
public:
- //-------------------------------------------------------------------------------------------
- // Retrieves a type from an assembly. It requires the caller to know which assembly
- // the type is in.
- //-------------------------------------------------------------------------------------------
- static TypeHandle GetTypeFromAssembly(LPCWSTR szTypeName, Assembly *pAssembly, BOOL bThrowIfNotFound = TRUE);
-
TypeHandle GetTypeFromAsm();
//-------------------------------------------------------------------------------------------
diff --git a/src/coreclr/vm/virtualcallstub.cpp b/src/coreclr/vm/virtualcallstub.cpp
index 05df034829ba9a..fd85071676e94c 100644
--- a/src/coreclr/vm/virtualcallstub.cpp
+++ b/src/coreclr/vm/virtualcallstub.cpp
@@ -187,142 +187,142 @@ void VirtualCallStubManager::LoggingDump()
if(g_hStubLogFile)
{
#ifdef STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nstub tuning parameters\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nstub tuning parameters\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\t%-30s %3d (0x%02x)\r\n", "STUB_MISS_COUNT_VALUE",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\t%-30s %3d (0x%02x)\r\n", "STUB_MISS_COUNT_VALUE",
STUB_MISS_COUNT_VALUE, STUB_MISS_COUNT_VALUE);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "STUB_COLLIDE_WRITE_PCT",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "STUB_COLLIDE_WRITE_PCT",
STUB_COLLIDE_WRITE_PCT, STUB_COLLIDE_WRITE_PCT);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "STUB_COLLIDE_MONO_PCT",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "STUB_COLLIDE_MONO_PCT",
STUB_COLLIDE_MONO_PCT, STUB_COLLIDE_MONO_PCT);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "DumpLogCounter",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "DumpLogCounter",
g_dumpLogCounter, g_dumpLogCounter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "DumpLogIncr",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "DumpLogIncr",
g_dumpLogCounter, g_dumpLogIncr);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "ResetCacheCounter",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "ResetCacheCounter",
g_resetCacheCounter, g_resetCacheCounter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "ResetCacheIncr",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\t%-30s %3d%% (0x%02x)\r\n", "ResetCacheIncr",
g_resetCacheCounter, g_resetCacheIncr);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#endif // STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nsite data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nsite data\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
//output counters
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_counter", g_site_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_counter", g_site_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_write", g_site_write);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_write", g_site_write);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_write_mono", g_site_write_mono);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_write_mono", g_site_write_mono);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_write_poly", g_site_write_poly);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_write_poly", g_site_write_poly);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n%-30s %d\r\n", "reclaim_counter", g_reclaim_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n%-30s %d\r\n", "reclaim_counter", g_reclaim_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nstub data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nstub data\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_lookup_counter", g_stub_lookup_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_lookup_counter", g_stub_lookup_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_mono_counter", g_stub_mono_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_mono_counter", g_stub_mono_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_poly_counter", g_stub_poly_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_poly_counter", g_stub_poly_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_vtable_counter", g_stub_vtable_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_vtable_counter", g_stub_vtable_counter);
WriteFile(g_hStubLogFile, szPrintStr, (DWORD)strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_space", g_stub_space);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_space", g_stub_space);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#ifdef STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nlookup stub data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nlookup stub data\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
UINT32 total_calls = g_mono_call_counter + g_poly_call_counter;
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "lookup_call_counter", g_call_lookup_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "lookup_call_counter", g_call_lookup_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n%-30s %d\r\n", "total stub dispatch calls", total_calls);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n%-30s %d\r\n", "total stub dispatch calls", total_calls);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n%-30s %#5.2f%%\r\n", "mono stub data",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n%-30s %#5.2f%%\r\n", "mono stub data",
100.0 * double(g_mono_call_counter)/double(total_calls));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "mono_call_counter", g_mono_call_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "mono_call_counter", g_mono_call_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "mono_miss_counter", g_mono_miss_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "mono_miss_counter", g_mono_miss_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
100.0 * double(g_mono_miss_counter)/double(g_mono_call_counter));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n%-30s %#5.2f%%\r\n", "poly stub data",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n%-30s %#5.2f%%\r\n", "poly stub data",
100.0 * double(g_poly_call_counter)/double(total_calls));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "poly_call_counter", g_poly_call_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "poly_call_counter", g_poly_call_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "poly_miss_counter", g_poly_miss_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "poly_miss_counter", g_poly_miss_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
100.0 * double(g_poly_miss_counter)/double(g_poly_call_counter));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#endif // STUB_LOGGING
#ifdef CHAIN_LOOKUP
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nchain lookup data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nchain lookup data\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#ifdef STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_call_counter", g_chained_lookup_call_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_call_counter", g_chained_lookup_call_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_miss_counter", g_chained_lookup_miss_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_miss_counter", g_chained_lookup_miss_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
100.0 * double(g_chained_lookup_miss_counter)/double(g_chained_lookup_call_counter));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_external_call_counter", g_chained_lookup_external_call_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_external_call_counter", g_chained_lookup_external_call_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_external_miss_counter", g_chained_lookup_external_miss_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "chained_lookup_external_miss_counter", g_chained_lookup_external_miss_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_PCT, "miss percent",
100.0 * double(g_chained_lookup_external_miss_counter)/double(g_chained_lookup_external_call_counter));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#endif // STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "chained_entry_promoted", g_chained_entry_promoted);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "chained_entry_promoted", g_chained_entry_promoted);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#endif // CHAIN_LOOKUP
#ifdef STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n%-30s %#5.2f%%\r\n", "worker (slow resolver) data",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n%-30s %#5.2f%%\r\n", "worker (slow resolver) data",
100.0 * double(g_worker_call)/double(total_calls));
#else // !STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nworker (slow resolver) data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nworker (slow resolver) data\r\n");
#endif // !STUB_LOGGING
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "worker_call", g_worker_call);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "worker_call", g_worker_call);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "worker_call_no_patch", g_worker_call_no_patch);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "worker_call_no_patch", g_worker_call_no_patch);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "external_call", g_external_call);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "external_call", g_external_call);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "external_call_no_patch", g_external_call_no_patch);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "external_call_no_patch", g_external_call_no_patch);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "worker_collide_to_mono", g_worker_collide_to_mono);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "worker_collide_to_mono", g_worker_collide_to_mono);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
UINT32 total_inserts = g_insert_cache_external
@@ -330,74 +330,74 @@ void VirtualCallStubManager::LoggingDump()
+ g_insert_cache_dispatch
+ g_insert_cache_resolve;
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n%-30s %d\r\n", "insert cache data", total_inserts);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n%-30s %d\r\n", "insert cache data", total_inserts);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_external", g_insert_cache_external,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_external", g_insert_cache_external,
100.0 * double(g_insert_cache_external)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_shared", g_insert_cache_shared,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_shared", g_insert_cache_shared,
100.0 * double(g_insert_cache_shared)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_dispatch", g_insert_cache_dispatch,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_dispatch", g_insert_cache_dispatch,
100.0 * double(g_insert_cache_dispatch)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_resolve", g_insert_cache_resolve,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_resolve", g_insert_cache_resolve,
100.0 * double(g_insert_cache_resolve)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_hit", g_insert_cache_hit,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_hit", g_insert_cache_hit,
100.0 * double(g_insert_cache_hit)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_miss", g_insert_cache_miss,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_miss", g_insert_cache_miss,
100.0 * double(g_insert_cache_miss)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_collide", g_insert_cache_collide,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_collide", g_insert_cache_collide,
100.0 * double(g_insert_cache_collide)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_write", g_insert_cache_write,
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT_PCT, "insert_cache_write", g_insert_cache_write,
100.0 * double(g_insert_cache_write)/double(total_inserts));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\ncache data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\ncache data\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
size_t total, used;
g_resolveCache->GetLoadFactor(&total, &used);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_SIZE, "cache_entry_used", used);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_SIZE, "cache_entry_used", used);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_counter", g_cache_entry_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_counter", g_cache_entry_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_space", g_cache_entry_space);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_space", g_cache_entry_space);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nstub hash table data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nstub hash table data\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "bucket_space", g_bucket_space);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "bucket_space", g_bucket_space);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "bucket_space_dead", g_bucket_space_dead);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "bucket_space_dead", g_bucket_space_dead);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\ncache_load:\t%zu used, %zu total, utilization %#5.2f%%\r\n",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\ncache_load:\t%zu used, %zu total, utilization %#5.2f%%\r\n",
used, total, 100.0 * double(used) / double(total));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#ifdef STUB_LOGGING
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\ncache entry write counts\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\ncache entry write counts\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
DispatchCache::CacheEntryData *rgCacheData = g_resolveCache->cacheData;
for (UINT16 i = 0; i < CALL_STUB_CACHE_SIZE; i++)
{
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), " %4d", rgCacheData[i]);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), " %4d", rgCacheData[i]);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
if (i % 16 == 15)
{
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
}
}
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#endif // STUB_LOGGING
@@ -406,7 +406,7 @@ void VirtualCallStubManager::LoggingDump()
{
if (ContractImplMap::deltasDescs[i] != 0)
{
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "deltasDescs[%d]\t%d\r\n", i, ContractImplMap::deltasDescs[i]);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "deltasDescs[%d]\t%d\r\n", i, ContractImplMap::deltasDescs[i]);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
}
}
@@ -414,19 +414,19 @@ void VirtualCallStubManager::LoggingDump()
{
if (ContractImplMap::deltasSlots[i] != 0)
{
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "deltasSlots[%d]\t%d\r\n", i, ContractImplMap::deltasSlots[i]);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "deltasSlots[%d]\t%d\r\n", i, ContractImplMap::deltasSlots[i]);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
}
}
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "cout of maps:\t%d\r\n", ContractImplMap::countMaps);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "cout of maps:\t%d\r\n", ContractImplMap::countMaps);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "count of interfaces:\t%d\r\n", ContractImplMap::countInterfaces);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "count of interfaces:\t%d\r\n", ContractImplMap::countInterfaces);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "count of deltas:\t%d\r\n", ContractImplMap::countDelta);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "count of deltas:\t%d\r\n", ContractImplMap::countDelta);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "total delta for descs:\t%d\r\n", ContractImplMap::totalDeltaDescs);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "total delta for descs:\t%d\r\n", ContractImplMap::totalDeltaDescs);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "total delta for slots:\t%d\r\n", ContractImplMap::totalDeltaSlots);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "total delta for slots:\t%d\r\n", ContractImplMap::totalDeltaSlots);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
#endif // 0
@@ -2972,38 +2972,38 @@ void VirtualCallStubManager::LogStats()
if (g_hStubLogFile && (stats.site_write != 0))
{
//output counters
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_counter", stats.site_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_counter", stats.site_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_write", stats.site_write);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_write", stats.site_write);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_write_mono", stats.site_write_mono);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_write_mono", stats.site_write_mono);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_write_poly", stats.site_write_poly);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "site_write_poly", stats.site_write_poly);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nstub data\r\n");
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\nstub data\r\n");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_lookup_counter", stats.stub_lookup_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_lookup_counter", stats.stub_lookup_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_mono_counter", stats.stub_mono_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_mono_counter", stats.stub_mono_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_poly_counter", stats.stub_poly_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_poly_counter", stats.stub_poly_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "stub_space", stats.stub_space);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "stub_space", stats.stub_space);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
size_t total, used;
g_resolveCache->GetLoadFactor(&total, &used);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_SIZE, "cache_entry_used", used);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_SIZE, "cache_entry_used", used);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_counter", stats.cache_entry_counter);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_counter", stats.cache_entry_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_space", stats.cache_entry_space);
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), OUTPUT_FORMAT_INT, "cache_entry_space", stats.cache_entry_space);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
- sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\ncache_load:\t%zu used, %zu total, utilization %#5.2f%%\r\n",
+ sprintf_s(szPrintStr, ARRAY_SIZE(szPrintStr), "\r\ncache_load:\t%zu used, %zu total, utilization %#5.2f%%\r\n",
used, total, 100.0 * double(used) / double(total));
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
}
diff --git a/src/coreclr/vm/wks/CMakeLists.txt b/src/coreclr/vm/wks/CMakeLists.txt
index cb7ba8ca2cc997..b0113575c1e05e 100644
--- a/src/coreclr/vm/wks/CMakeLists.txt
+++ b/src/coreclr/vm/wks/CMakeLists.txt
@@ -26,7 +26,6 @@ add_dependencies(cee_wks_obj eventing_headers)
add_dependencies(cee_wks_mergeable_obj eventing_headers)
if (CLR_CMAKE_TARGET_WIN32)
-
if(NOT CLR_CMAKE_HOST_ARCH_ARM AND NOT CLR_CMAKE_HOST_ARCH_ARM64)
if (CLR_CMAKE_HOST_ARCH_I386)
@@ -34,33 +33,16 @@ if (CLR_CMAKE_TARGET_WIN32)
endif (CLR_CMAKE_HOST_ARCH_I386)
# Convert AsmConstants.h into AsmConstants.inc
- find_program(POWERSHELL powershell)
- if (POWERSHELL STREQUAL "POWERSHELL-NOTFOUND")
- message(FATAL_ERROR "POWERSHELL not found")
- endif()
-
- # Get the current list of definitions
- get_compile_definitions(DEFINITIONS)
- add_custom_command(
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc"
- DEPENDS ${VM_DIR}/${ARCH_SOURCES_DIR}/asmconstants.h
- COMMAND ${POWERSHELL} -NoProfile -ExecutionPolicy Bypass -NonInteractive \"& \"\"${VM_DIR}/h2inc.ps1\"\"\" \"\"\"${VM_DIR}/${ARCH_SOURCES_DIR}/asmconstants.h\"\"\" >"${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.tmp"
- COMMAND ${CMAKE_CXX_COMPILER} ${DEFINITIONS} /EP "${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.tmp" >"${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc"
- )
+ h2inc("${VM_DIR}/${ARCH_SOURCES_DIR}/asmconstants.h" "${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.tmp")
+ preprocess_file("${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.tmp" "${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc")
- set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc PROPERTIES GENERATED TRUE)
-
- add_custom_target(
- asmconstants_inc
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc
- )
+ add_custom_target(asmconstants_inc DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/AsmConstants.inc)
add_dependencies(cee_wks_core asmconstants_inc)
add_dependencies(cee_wks_obj asmconstants_inc)
add_dependencies(cee_wks_mergeable_obj asmconstants_inc)
endif(NOT CLR_CMAKE_HOST_ARCH_ARM AND NOT CLR_CMAKE_HOST_ARCH_ARM64)
-
endif (CLR_CMAKE_TARGET_WIN32)
add_custom_target(precompiled_asm DEPENDS ${VM_WKS_ARCH_ASM_OBJECTS})
diff --git a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Ssl.cs b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Ssl.cs
index f1200eabdd2a7c..9ae88238278c11 100644
--- a/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Ssl.cs
+++ b/src/libraries/Common/src/Interop/Android/System.Security.Cryptography.Native.Android/Interop.Ssl.cs
@@ -233,8 +233,7 @@ private static partial void SSLStreamGetPeerCertificates(
internal static IntPtr[]? SSLStreamGetPeerCertificates(SafeSslHandle ssl)
{
IntPtr[]? ptrs;
- int count;
- Interop.AndroidCrypto.SSLStreamGetPeerCertificates(ssl, out ptrs, out count);
+ Interop.AndroidCrypto.SSLStreamGetPeerCertificates(ssl, out ptrs, out _);
return ptrs;
}
diff --git a/src/libraries/Common/src/Interop/FreeBSD/Interop.Process.cs b/src/libraries/Common/src/Interop/FreeBSD/Interop.Process.cs
index 3d18ead32d116d..f7549adf6a9c32 100644
--- a/src/libraries/Common/src/Interop/FreeBSD/Interop.Process.cs
+++ b/src/libraries/Common/src/Interop/FreeBSD/Interop.Process.cs
@@ -74,7 +74,7 @@ internal static unsafe int[] ListAllPids()
/// Gets executable name for process given it's PID
///
/// The PID of the process
- public static unsafe string? GetProcPath(int pid)
+ public static unsafe string GetProcPath(int pid)
{
Span sysctlName = stackalloc int[] { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, pid };
byte* pBuffer = null;
@@ -83,7 +83,7 @@ internal static unsafe int[] ListAllPids()
try
{
Interop.Sys.Sysctl(sysctlName, ref pBuffer, ref bytesLength);
- return System.Text.Encoding.UTF8.GetString(pBuffer, (int)bytesLength - 1);
+ return System.Text.Encoding.UTF8.GetString(pBuffer, bytesLength - 1);
}
finally
{
diff --git a/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs b/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
index 8be9f32cbedee3..0f2287ce4164bd 100644
--- a/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
+++ b/src/libraries/Common/src/Interop/Linux/procfs/Interop.ProcFsStat.ParseMapModules.cs
@@ -61,10 +61,8 @@ private static ProcessModuleCollection ParseMapsModulesCore(IEnumerable
// Not a continuation, commit any current modules and create a new one.
CommitCurrentModule();
- module = new ProcessModule
+ module = new ProcessModule(parsedLine.Path, Path.GetFileName(parsedLine.Path))
{
- FileName = parsedLine.Path,
- ModuleName = Path.GetFileName(parsedLine.Path),
ModuleMemorySize = parsedLine.Size,
EntryPointAddress = IntPtr.Zero // unknown
};
diff --git a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Ssl.cs b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Ssl.cs
index 2e6e72c9418b44..af6596efd51da6 100644
--- a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Ssl.cs
+++ b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Ssl.cs
@@ -46,6 +46,7 @@ internal enum PAL_TlsHandshakeState
WouldBlock,
ServerAuthCompleted,
ClientAuthCompleted,
+ ClientCertRequested,
}
internal enum PAL_TlsIo
@@ -99,6 +100,12 @@ private static partial int AppleCryptoNative_SslSetBreakOnClientAuth(
int setBreak,
out int pOSStatus);
+ [GeneratedDllImport(Interop.Libraries.AppleCryptoNative)]
+ private static partial int AppleCryptoNative_SslSetBreakOnCertRequested(
+ SafeSslHandle sslHandle,
+ int setBreak,
+ out int pOSStatus);
+
[GeneratedDllImport(Interop.Libraries.AppleCryptoNative)]
private static partial int AppleCryptoNative_SslSetCertificate(
SafeSslHandle sslHandle,
@@ -266,6 +273,25 @@ internal static void SslBreakOnClientAuth(SafeSslHandle sslHandle, bool setBreak
throw new SslException();
}
+ internal static void SslBreakOnCertRequested(SafeSslHandle sslHandle, bool setBreak)
+ {
+ int osStatus;
+ int result = AppleCryptoNative_SslSetBreakOnCertRequested(sslHandle, setBreak ? 1 : 0, out osStatus);
+
+ if (result == 1)
+ {
+ return;
+ }
+
+ if (result == 0)
+ {
+ throw CreateExceptionForOSStatus(osStatus);
+ }
+
+ Debug.Fail($"AppleCryptoNative_SslSetBreakOnCertRequested returned {result}");
+ throw new SslException();
+ }
+
internal static void SslSetCertificate(SafeSslHandle sslHandle, IntPtr[] certChainPtrs)
{
using (SafeCreateHandle cfCertRefs = CoreFoundation.CFArrayCreate(certChainPtrs, (UIntPtr)certChainPtrs.Length))
diff --git a/src/libraries/Common/src/Interop/Unix/Interop.Libraries.cs b/src/libraries/Common/src/Interop/Unix/Interop.Libraries.cs
index 8e2d9046af8987..1a0114cca21895 100644
--- a/src/libraries/Common/src/Interop/Unix/Interop.Libraries.cs
+++ b/src/libraries/Common/src/Interop/Unix/Interop.Libraries.cs
@@ -5,6 +5,8 @@ internal static partial class Interop
{
internal static partial class Libraries
{
+ internal const string Libc = "libc";
+
// Shims
internal const string SystemNative = "libSystem.Native";
internal const string NetSecurityNative = "libSystem.Net.Security.Native";
diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.LChflags.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.LChflags.cs
index 1353fbc3acec63..a5bc36dfa3d2fc 100644
--- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.LChflags.cs
+++ b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.LChflags.cs
@@ -22,5 +22,11 @@ internal enum UserFlags : uint
[GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_LChflagsCanSetHiddenFlag")]
[SuppressGCTransition]
private static partial int LChflagsCanSetHiddenFlag();
+
+ internal static readonly bool SupportsHiddenFlag = (CanGetHiddenFlag() != 0);
+
+ [GeneratedDllImport(Libraries.SystemNative, EntryPoint = "SystemNative_CanGetHiddenFlag")]
+ [SuppressGCTransition]
+ private static partial int CanGetHiddenFlag();
}
}
diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EvpPkey.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EvpPkey.cs
index 593c6f4e593f6d..95e9ab89fc5054 100644
--- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EvpPkey.cs
+++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EvpPkey.cs
@@ -105,18 +105,28 @@ internal static unsafe SafeEvpPKeyHandle DecodePkcs8PrivateKey(
}
[GeneratedDllImport(Libraries.CryptoNative)]
- private static partial int CryptoNative_GetPkcs8PrivateKeySize(IntPtr pkey);
+ private static partial int CryptoNative_GetPkcs8PrivateKeySize(IntPtr pkey, out int p8size);
private static int GetPkcs8PrivateKeySize(IntPtr pkey)
{
- int ret = CryptoNative_GetPkcs8PrivateKeySize(pkey);
+ const int Success = 1;
+ const int Error = -1;
+ const int MissingPrivateKey = -2;
- if (ret < 0)
+ int ret = CryptoNative_GetPkcs8PrivateKeySize(pkey, out int p8size);
+
+ switch (ret)
{
- throw CreateOpenSslCryptographicException();
+ case Success:
+ return p8size;
+ case Error:
+ throw CreateOpenSslCryptographicException();
+ case MissingPrivateKey:
+ throw new CryptographicException(SR.Cryptography_CSP_NoPrivateKey);
+ default:
+ Debug.Fail($"Unexpected return '{ret}' value from {nameof(CryptoNative_GetPkcs8PrivateKeySize)}.");
+ throw new CryptographicException();
}
-
- return ret;
}
[GeneratedDllImport(Libraries.CryptoNative)]
diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs
index 828af2acfac0ee..d403daac342ad1 100644
--- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs
+++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OpenSsl.cs
@@ -78,9 +78,11 @@ private static bool DisableTlsResume
// This is helper function to adjust requested protocols based on CipherSuitePolicy and system capability.
private static SslProtocols CalculateEffectiveProtocols(SslAuthenticationOptions sslAuthenticationOptions)
{
- SslProtocols protocols = sslAuthenticationOptions.EnabledSslProtocols;
+ // make sure low bit is not set since we use it in context dictionary to distinguish use with ALPN
+ Debug.Assert(((int)sslAuthenticationOptions.EnabledSslProtocols & 1) == 0);
+ SslProtocols protocols = sslAuthenticationOptions.EnabledSslProtocols & ~((SslProtocols)1);
- if (!Interop.Ssl.Tls13Supported)
+ if (!Interop.Ssl.Capabilities.Tls13Supported)
{
if (protocols != SslProtocols.None &&
CipherSuitesPolicyPal.WantsTls13(protocols))
@@ -122,7 +124,7 @@ private static SslProtocols CalculateEffectiveProtocols(SslAuthenticationOptions
}
// This essentially wraps SSL_CTX* aka SSL_CTX_new + setting
- internal static SafeSslContextHandle AllocateSslContext(SafeFreeSslCredentials credential, SslAuthenticationOptions sslAuthenticationOptions, SslProtocols protocols)
+ internal static SafeSslContextHandle AllocateSslContext(SafeFreeSslCredentials credential, SslAuthenticationOptions sslAuthenticationOptions, SslProtocols protocols, bool enableResume)
{
SafeX509Handle? certHandle = credential.CertHandle;
SafeEvpPKeyHandle? certKeyHandle = credential.CertKeyHandle;
@@ -181,6 +183,8 @@ internal static SafeSslContextHandle AllocateSslContext(SafeFreeSslCredentials c
// https://www.openssl.org/docs/manmaster/ssl/SSL_shutdown.html
Ssl.SslCtxSetQuietShutdown(sslCtx);
+ Ssl.SslCtxSetCaching(sslCtx, enableResume ? 1 : 0);
+
if (sslAuthenticationOptions.IsServer && sslAuthenticationOptions.ApplicationProtocols != null && sslAuthenticationOptions.ApplicationProtocols.Count != 0)
{
unsafe
@@ -215,6 +219,45 @@ internal static SafeSslContextHandle AllocateSslContext(SafeFreeSslCredentials c
return sslCtx;
}
+ internal static void UpdateClientCertiticate(SafeSslHandle ssl, SslAuthenticationOptions sslAuthenticationOptions)
+ {
+ // Disable certificate selection callback. We either got certificate or we will try to proceed without it.
+ Interop.Ssl.SslSetClientCertCallback(ssl, 0);
+
+ if (sslAuthenticationOptions.CertificateContext == null)
+ {
+ return;
+ }
+
+ var credential = new SafeFreeSslCredentials(sslAuthenticationOptions.CertificateContext, sslAuthenticationOptions.EnabledSslProtocols, sslAuthenticationOptions.EncryptionPolicy, sslAuthenticationOptions.IsServer);
+ SafeX509Handle? certHandle = credential.CertHandle;
+ SafeEvpPKeyHandle? certKeyHandle = credential.CertKeyHandle;
+
+ Debug.Assert(certHandle != null);
+ Debug.Assert(certKeyHandle != null);
+
+ int retVal = Ssl.SslUseCertificate(ssl, certHandle);
+ if (1 != retVal)
+ {
+ throw CreateSslException(SR.net_ssl_use_cert_failed);
+ }
+
+ retVal = Ssl.SslUsePrivateKey(ssl, certKeyHandle);
+ if (1 != retVal)
+ {
+ throw CreateSslException(SR.net_ssl_use_private_key_failed);
+ }
+
+ if (sslAuthenticationOptions.CertificateContext.IntermediateCertificates.Length > 0)
+ {
+ if (!Ssl.AddExtraChainCertificates(ssl, sslAuthenticationOptions.CertificateContext.IntermediateCertificates))
+ {
+ throw CreateSslException(SR.net_ssl_use_cert_failed);
+ }
+ }
+
+ }
+
// This essentially wraps SSL* SSL_new()
internal static SafeSslHandle AllocateSslHandle(SafeFreeSslCredentials credential, SslAuthenticationOptions sslAuthenticationOptions)
{
@@ -222,24 +265,24 @@ internal static SafeSslHandle AllocateSslHandle(SafeFreeSslCredentials credentia
SafeSslContextHandle? sslCtxHandle = null;
SafeSslContextHandle? newCtxHandle = null;
SslProtocols protocols = CalculateEffectiveProtocols(sslAuthenticationOptions);
+ bool hasAlpn = sslAuthenticationOptions.ApplicationProtocols != null && sslAuthenticationOptions.ApplicationProtocols.Count != 0;
bool cacheSslContext = !DisableTlsResume && sslAuthenticationOptions.EncryptionPolicy == EncryptionPolicy.RequireEncryption &&
+ sslAuthenticationOptions.IsServer &&
sslAuthenticationOptions.CertificateContext != null &&
sslAuthenticationOptions.CertificateContext.SslContexts != null &&
- sslAuthenticationOptions.CipherSuitesPolicy == null &&
- (!sslAuthenticationOptions.IsServer ||
- (sslAuthenticationOptions.ApplicationProtocols != null && sslAuthenticationOptions.ApplicationProtocols.Count != 0));
+ sslAuthenticationOptions.CipherSuitesPolicy == null;
if (cacheSslContext)
{
- sslAuthenticationOptions.CertificateContext!.SslContexts!.TryGetValue(protocols, out sslCtxHandle);
+ sslAuthenticationOptions.CertificateContext!.SslContexts!.TryGetValue(protocols | (SslProtocols)(hasAlpn ? 1 : 0), out sslCtxHandle);
}
if (sslCtxHandle == null)
{
// We did not get SslContext from cache
- sslCtxHandle = newCtxHandle = AllocateSslContext(credential, sslAuthenticationOptions, protocols);
+ sslCtxHandle = newCtxHandle = AllocateSslContext(credential, sslAuthenticationOptions, protocols, cacheSslContext);
- if (cacheSslContext && sslAuthenticationOptions.CertificateContext!.SslContexts!.TryAdd(protocols, newCtxHandle))
+ if (cacheSslContext && sslAuthenticationOptions.CertificateContext!.SslContexts!.TryAdd(protocols | (SslProtocols)(hasAlpn ? 1 : 0), newCtxHandle))
{
newCtxHandle = null;
}
@@ -283,6 +326,13 @@ internal static SafeSslHandle AllocateSslHandle(SafeFreeSslCredentials credentia
{
Crypto.ErrClearError();
}
+
+ if (sslAuthenticationOptions.CertSelectionDelegate != null && sslAuthenticationOptions.CertificateContext == null)
+ {
+ // We don't have certificate but we have callback. We should wait for remote certificate and
+ // possible trusted issuer list.
+ Interop.Ssl.SslSetClientCertCallback(sslHandle, 1);
+ }
}
if (sslAuthenticationOptions.IsServer && sslAuthenticationOptions.RemoteCertRequired)
@@ -320,7 +370,7 @@ internal static SecurityStatusPal SslRenegotiate(SafeSslHandle sslContext, out b
return new SecurityStatusPal(SecurityStatusPalErrorCode.OK);
}
- internal static bool DoSslHandshake(SafeSslHandle context, ReadOnlySpan input, out byte[]? sendBuf, out int sendCount)
+ internal static SecurityStatusPalErrorCode DoSslHandshake(SafeSslHandle context, ReadOnlySpan input, out byte[]? sendBuf, out int sendCount)
{
sendBuf = null;
sendCount = 0;
@@ -341,6 +391,11 @@ internal static bool DoSslHandshake(SafeSslHandle context, ReadOnlySpan in
Exception? innerError;
Ssl.SslErrorCode error = GetSslError(context, retVal, out innerError);
+ if (error == Ssl.SslErrorCode.SSL_ERROR_WANT_X509_LOOKUP)
+ {
+ return SecurityStatusPalErrorCode.CredentialsNeeded;
+ }
+
if ((retVal != -1) || (error != Ssl.SslErrorCode.SSL_ERROR_WANT_READ))
{
// Handshake failed, but even if the handshake does not need to read, there may be an Alert going out.
@@ -385,7 +440,8 @@ internal static bool DoSslHandshake(SafeSslHandle context, ReadOnlySpan in
{
context.MarkHandshakeCompleted();
}
- return stateOk;
+
+ return stateOk ? SecurityStatusPalErrorCode.OK : SecurityStatusPalErrorCode.ContinueNeeded;
}
internal static int Encrypt(SafeSslHandle context, ReadOnlySpan input, ref byte[] output, out Ssl.SslErrorCode errorCode)
diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs
index 1db80064b2c80c..379ab7586ed38c 100644
--- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs
+++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs
@@ -6,6 +6,8 @@
using System.Diagnostics;
using System.Net.Security;
using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Win32.SafeHandles;
@@ -46,7 +48,7 @@ internal static partial class Ssl
internal static partial void SslSetAcceptState(SafeSslHandle ssl);
[GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslSetAlpnProtos")]
- internal static partial int SslSetAlpnProtos(SafeSslHandle ssl, IntPtr protos, int len);
+ internal static unsafe partial int SslSetAlpnProtos(SafeSslHandle ssl, byte* protos, int len);
[GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslGetVersion")]
internal static partial IntPtr SslGetVersion(SafeSslHandle ssl);
@@ -149,16 +151,25 @@ internal static partial class Ssl
[GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslSetData")]
internal static partial int SslSetData(IntPtr ssl, IntPtr data);
- internal static unsafe int SslSetAlpnProtos(SafeSslHandle ssl, List protocols)
+ [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslUseCertificate")]
+ internal static extern int SslUseCertificate(SafeSslHandle ssl, SafeX509Handle certPtr);
+
+ [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslUsePrivateKey")]
+ internal static extern int SslUsePrivateKey(SafeSslHandle ssl, SafeEvpPKeyHandle keyPtr);
+
+ [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslSetClientCertCallback")]
+ internal static extern unsafe void SslSetClientCertCallback(SafeSslHandle ssl, int set);
+
+ [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_Tls13Supported")]
+ private static partial int Tls13SupportedImpl();
+
+ internal static class Capabilities
{
- byte[] buffer = ConvertAlpnProtocolListToByteArray(protocols);
- fixed (byte* b = buffer)
- {
- return SslSetAlpnProtos(ssl, (IntPtr)b, buffer.Length);
- }
+ // needs separate type (separate static cctor) to be sure OpenSSL is initialized.
+ internal static readonly bool Tls13Supported = Tls13SupportedImpl() != 0;
}
- internal static byte[] ConvertAlpnProtocolListToByteArray(List applicationProtocols)
+ internal static int GetAlpnProtocolListSerializedLength(List applicationProtocols)
{
int protocolSize = 0;
foreach (SslApplicationProtocol protocol in applicationProtocols)
@@ -171,16 +182,59 @@ internal static byte[] ConvertAlpnProtocolListToByteArray(List applicationProtocols, Span buffer)
+ {
+ Debug.Assert(GetAlpnProtocolListSerializedLength(applicationProtocols) == buffer.Length,
+ "GetAlpnProtocolListSerializedSize(applicationProtocols) == buffer.Length");
+
+ int offset = 0;
foreach (SslApplicationProtocol protocol in applicationProtocols)
{
- buffer[offset++] = (byte)(protocol.Protocol.Length);
- protocol.Protocol.Span.CopyTo(buffer.AsSpan(offset));
+ buffer[offset++] = (byte)protocol.Protocol.Length;
+ protocol.Protocol.Span.CopyTo(buffer.Slice(offset));
offset += protocol.Protocol.Length;
}
+ }
+
+ internal static unsafe int SslSetAlpnProtos(SafeSslHandle ssl, List applicationProtocols)
+ {
+ int length = GetAlpnProtocolListSerializedLength(applicationProtocols);
+ Span buffer = length <= 256 ? stackalloc byte[256].Slice(0, length) : new byte[length];
+ SerializeAlpnProtocolList(applicationProtocols, buffer);
+ return SslSetAlpnProtos(ssl, buffer);
+ }
+
+ internal static unsafe int SslSetAlpnProtos(SafeSslHandle ssl, Span serializedProtocols)
+ {
+ fixed (byte* pBuffer = &MemoryMarshal.GetReference(serializedProtocols))
+ {
+ return SslSetAlpnProtos(ssl, pBuffer, serializedProtocols.Length);
+ }
+ }
+
+ [DllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslAddExtraChainCert")]
+ internal static extern bool SslAddExtraChainCert(SafeSslHandle ssl, SafeX509Handle x509);
+
+ internal static bool AddExtraChainCertificates(SafeSslHandle ssl, X509Certificate2[] chain)
+ {
+ // send pre-computed list of intermediates.
+ for (int i = 0; i < chain.Length; i++)
+ {
+ SafeX509Handle dupCertHandle = Crypto.X509UpRef(chain[i].Handle);
+ Crypto.CheckValidOpenSslHandle(dupCertHandle);
+ if (!SslAddExtraChainCert(ssl, dupCertHandle))
+ {
+ Crypto.ErrClearError();
+ dupCertHandle.Dispose(); // we still own the safe handle; clean it up
+ return false;
+ }
+ dupCertHandle.SetHandleAsInvalid(); // ownership has been transferred to sslHandle; do not free via this safe handle
+ }
- return buffer;
+ return true;
}
internal static string? GetOpenSslCipherSuiteName(SafeSslHandle ssl, TlsCipherSuite cipherSuite, out bool isTls12OrLower)
@@ -190,10 +244,6 @@ internal static byte[] ConvertAlpnProtocolListToByteArray(List callback, IntPtr arg);
+ [GeneratedDllImport(Libraries.CryptoNative, EntryPoint = "CryptoNative_SslCtxSetCaching")]
+ internal static unsafe partial void SslCtxSetCaching(SafeSslContextHandle ctx, int mode);
+
internal static bool AddExtraChainCertificates(SafeSslContextHandle ctx, X509Certificate2[] chain)
{
// send pre-computed list of intermediates.
diff --git a/src/libraries/Common/src/Interop/Unix/libc/Interop.GetParentPid.cs b/src/libraries/Common/src/Interop/Unix/libc/Interop.GetParentPid.cs
new file mode 100644
index 00000000000000..95b27abf158287
--- /dev/null
+++ b/src/libraries/Common/src/Interop/Unix/libc/Interop.GetParentPid.cs
@@ -0,0 +1,13 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ internal static partial class libc
+ {
+ [GeneratedDllImport(Libraries.Libc, EntryPoint = "getppid")]
+ internal static partial int GetParentPid();
+ }
+}
diff --git a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextPropertyString.cs b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextPropertyString.cs
index 8f942403261ac6..ed60c1730e54e9 100644
--- a/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextPropertyString.cs
+++ b/src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertGetCertificateContextPropertyString.cs
@@ -9,6 +9,6 @@ internal static partial class Interop
internal static partial class Crypt32
{
[GeneratedDllImport(Libraries.Crypt32, EntryPoint = "CertGetCertificateContextProperty", CharSet = CharSet.Unicode, SetLastError = true)]
- internal static unsafe partial bool CertGetCertificateContextPropertyString(SafeCertContextHandle pCertContext, CertContextPropId dwPropId, byte* pvData, ref int pcbData);
+ internal static unsafe partial bool CertGetCertificateContextPropertyString(SafeCertContextHandle pCertContext, CertContextPropId dwPropId, byte* pvData, ref uint pcbData);
}
}
diff --git a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleMode.cs b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleMode.cs
index 6eb46b1f4b6d90..8275904b8286b6 100644
--- a/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleMode.cs
+++ b/src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetConsoleMode.cs
@@ -13,8 +13,7 @@ internal static partial class Kernel32
internal static bool IsGetConsoleModeCallSuccessful(IntPtr handle)
{
- int mode;
- return GetConsoleMode(handle, out mode);
+ return GetConsoleMode(handle, out _);
}
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
diff --git a/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs b/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs
index 43b718524d1ca9..8c3b6d815c169f 100644
--- a/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs
+++ b/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs
@@ -49,9 +49,7 @@ internal void Set(IntPtr value)
internal static int EnumeratePackages(out int pkgnum, out SafeFreeContextBuffer pkgArray)
{
- int res = -1;
- SafeFreeContextBuffer_SECURITY? pkgArray_SECURITY = null;
- res = Interop.SspiCli.EnumerateSecurityPackagesW(out pkgnum, out pkgArray_SECURITY);
+ int res = Interop.SspiCli.EnumerateSecurityPackagesW(out pkgnum, out SafeFreeContextBuffer_SECURITY? pkgArray_SECURITY);
pkgArray = pkgArray_SECURITY;
if (res != 0)
@@ -230,11 +228,8 @@ public static unsafe int AcquireCredentialsHandle(
ref SafeSspiAuthDataHandle authdata,
out SafeFreeCredentials outCredential)
{
- int errorCode = -1;
- long timeStamp;
-
outCredential = new SafeFreeCredential_SECURITY();
- errorCode = Interop.SspiCli.AcquireCredentialsHandleW(
+ int errorCode = Interop.SspiCli.AcquireCredentialsHandleW(
null,
package,
(int)intent,
@@ -243,7 +238,7 @@ public static unsafe int AcquireCredentialsHandle(
null,
null,
ref outCredential._handle,
- out timeStamp);
+ out _);
if (errorCode != 0)
{
@@ -260,7 +255,6 @@ public static unsafe int AcquireCredentialsHandle(
out SafeFreeCredentials outCredential)
{
int errorCode = -1;
- long timeStamp;
outCredential = new SafeFreeCredential_SECURITY();
@@ -273,7 +267,7 @@ public static unsafe int AcquireCredentialsHandle(
null,
null,
ref outCredential._handle,
- out timeStamp);
+ out _);
if (NetEventSource.Log.IsEnabled()) NetEventSource.Verbose(null, $"{nameof(Interop.SspiCli.AcquireCredentialsHandleW)} returns 0x{errorCode:x}, handle = {outCredential}");
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs
index 2ab6998096704e..253e0548dea9d9 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs
@@ -54,8 +54,7 @@ public override bool IsInvalid
protected override bool ReleaseHandle()
{
- Interop.NetSecurityNative.Status minorStatus;
- Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseName(out minorStatus, ref handle);
+ Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseName(out _, ref handle);
SetHandle(IntPtr.Zero);
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}
@@ -75,7 +74,7 @@ internal sealed class SafeGssCredHandle : SafeHandle
public static SafeGssCredHandle CreateAcceptor()
{
- SafeGssCredHandle? retHandle = null;
+ SafeGssCredHandle? retHandle;
Interop.NetSecurityNative.Status status;
Interop.NetSecurityNative.Status minorStatus;
@@ -143,8 +142,7 @@ public override bool IsInvalid
protected override bool ReleaseHandle()
{
- Interop.NetSecurityNative.Status minorStatus;
- Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseCred(out minorStatus, ref handle);
+ Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.ReleaseCred(out _, ref handle);
SetHandle(IntPtr.Zero);
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}
@@ -169,8 +167,7 @@ public override bool IsInvalid
protected override unsafe bool ReleaseHandle()
{
- Interop.NetSecurityNative.Status minorStatus;
- Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.DeleteSecContext(out minorStatus, ref handle);
+ Interop.NetSecurityNative.Status status = Interop.NetSecurityNative.DeleteSecContext(out _, ref handle);
SetHandle(IntPtr.Zero);
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}
diff --git a/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionFactory.cs b/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionFactory.cs
index 5418b4ff8bba76..d329db38dd0317 100644
--- a/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionFactory.cs
+++ b/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionFactory.cs
@@ -386,23 +386,13 @@ internal DbMetaDataFactory GetMetaDataFactory(DbConnectionPoolGroup connectionPo
// if two threads happen to hit this at the same time. One will be GC'd
if (metaDataFactory == null)
{
- bool allowCache = false;
- metaDataFactory = CreateMetaDataFactory(internalConnection, out allowCache);
- if (allowCache)
- {
- connectionPoolGroup.MetaDataFactory = metaDataFactory;
- }
+ metaDataFactory = CreateMetaDataFactory(internalConnection);
+ connectionPoolGroup.MetaDataFactory = metaDataFactory;
}
return metaDataFactory;
}
- protected virtual DbMetaDataFactory CreateMetaDataFactory(DbConnectionInternal internalConnection, out bool cacheMetaDataFactory)
- {
- // providers that support GetSchema must override this with a method that creates a meta data
- // factory appropriate for them.
- cacheMetaDataFactory = false;
- throw ADP.NotSupported();
- }
+ protected abstract DbMetaDataFactory CreateMetaDataFactory(DbConnectionInternal internalConnection);
protected abstract DbConnectionInternal CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, object poolGroupProviderInfo, DbConnectionPool? pool, DbConnection? owningConnection);
diff --git a/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionInternal.cs b/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionInternal.cs
index 5c1c4c0034cd95..1103b6488733bc 100644
--- a/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionInternal.cs
+++ b/src/libraries/Common/src/System/Data/ProviderBase/DbConnectionInternal.cs
@@ -319,7 +319,7 @@ protected bool TryOpenConnectionInternal(DbConnection outerConnection, DbConnect
// ?->Connecting: prevent set_ConnectionString during Open
if (connectionFactory.SetInnerConnectionFrom(outerConnection, DbConnectionClosedConnecting.SingletonInstance, this))
{
- DbConnectionInternal? openConnection = null;
+ DbConnectionInternal? openConnection;
try
{
connectionFactory.PermissionDemand(outerConnection);
diff --git a/src/libraries/Common/src/System/Data/ProviderBase/DbMetaDataFactory.cs b/src/libraries/Common/src/System/Data/ProviderBase/DbMetaDataFactory.cs
index e2727c92b6bdfa..61f4cfcb9ce08c 100644
--- a/src/libraries/Common/src/System/Data/ProviderBase/DbMetaDataFactory.cs
+++ b/src/libraries/Common/src/System/Data/ProviderBase/DbMetaDataFactory.cs
@@ -109,8 +109,8 @@ private DataTable ExecuteCommand(DataRow requestedCollectionRow, string?[]? rest
DataColumn collectionNameColumn = metaDataCollectionsTable.Columns[_collectionName]!;
DataTable? resultTable = null;
- DbCommand? command = null;
- DataTable? schemaTable = null;
+ DbCommand? command;
+ DataTable? schemaTable;
Debug.Assert(requestedCollectionRow != null);
string sqlCommand = (requestedCollectionRow[populationStringColumn, DataRowVersion.Current] as string)!;
@@ -185,7 +185,6 @@ private DataTable ExecuteCommand(DataRow requestedCollectionRow, string?[]? rest
if (reader != null)
{
reader.Dispose();
- reader = null;
}
}
return resultTable;
@@ -341,8 +340,8 @@ private void FixUpVersion(DataTable dataSourceInfoTable)
private string GetParameterName(string neededCollectionName, int neededRestrictionNumber)
{
- DataTable? restrictionsTable = null;
- DataColumnCollection? restrictionColumns = null;
+ DataTable? restrictionsTable;
+ DataColumnCollection? restrictionColumns;
DataColumn? collectionName = null;
DataColumn? parameterName = null;
DataColumn? restrictionName = null;
@@ -396,10 +395,10 @@ public virtual DataTable GetSchema(DbConnection connection, string collectionNam
DataTable metaDataCollectionsTable = _metaDataCollectionsDataSet.Tables[DbMetaDataCollectionNames.MetaDataCollections]!;
DataColumn populationMechanismColumn = metaDataCollectionsTable.Columns[_populationMechanism]!;
DataColumn collectionNameColumn = metaDataCollectionsTable.Columns[DbMetaDataColumnNames.CollectionName]!;
- DataRow? requestedCollectionRow = null;
- DataTable? requestedSchema = null;
+ DataRow? requestedCollectionRow;
+ DataTable? requestedSchema;
string[]? hiddenColumns;
- string? exactCollectionName = null;
+ string? exactCollectionName;
requestedCollectionRow = FindMetaDataCollectionRow(collectionName);
exactCollectionName = (requestedCollectionRow[collectionNameColumn, DataRowVersion.Current] as string)!;
diff --git a/src/libraries/Common/src/System/Diagnostics/NetFrameworkUtils.cs b/src/libraries/Common/src/System/Diagnostics/NetFrameworkUtils.cs
index 4bab9a4590c358..d8ec150103d9b4 100644
--- a/src/libraries/Common/src/System/Diagnostics/NetFrameworkUtils.cs
+++ b/src/libraries/Common/src/System/Diagnostics/NetFrameworkUtils.cs
@@ -19,9 +19,7 @@ internal static void EnterMutex(string name, ref Mutex mutex)
internal static void EnterMutexWithoutGlobal(string mutexName, ref Mutex mutex)
{
- bool createdNew;
-
- Mutex tmpMutex = new Mutex(false, mutexName, out createdNew);
+ Mutex tmpMutex = new Mutex(false, mutexName, out _);
SafeWaitForMutex(tmpMutex, ref mutex);
}
diff --git a/src/libraries/Common/src/System/IO/FileSystem.Attributes.Windows.cs b/src/libraries/Common/src/System/IO/FileSystem.Attributes.Windows.cs
index 7e7afcec97a726..dab4cf7a8f6c5c 100644
--- a/src/libraries/Common/src/System/IO/FileSystem.Attributes.Windows.cs
+++ b/src/libraries/Common/src/System/IO/FileSystem.Attributes.Windows.cs
@@ -15,7 +15,7 @@ internal static partial class FileSystem
{
public static bool DirectoryExists(string? fullPath)
{
- return DirectoryExists(fullPath, out int lastError);
+ return DirectoryExists(fullPath, out _);
}
private static bool DirectoryExists(string? path, out int lastError)
diff --git a/src/libraries/Common/src/System/IO/TempFileCollection.cs b/src/libraries/Common/src/System/IO/TempFileCollection.cs
index 4c29dc0e70c389..95ca600bf2fab7 100644
--- a/src/libraries/Common/src/System/IO/TempFileCollection.cs
+++ b/src/libraries/Common/src/System/IO/TempFileCollection.cs
@@ -116,8 +116,8 @@ private void EnsureTempNameCreated()
{
if (_basePath == null)
{
- string tempFileName = null;
- bool uniqueFile = false;
+ string tempFileName;
+ bool uniqueFile;
int retryCount = 5000;
do
{
diff --git a/src/libraries/Common/src/System/Net/Http/aspnetcore/Http3/QPack/H3StaticTable.Http3.cs b/src/libraries/Common/src/System/Net/Http/aspnetcore/Http3/QPack/H3StaticTable.Http3.cs
index 6e109d6f8c5471..e254c3a1ef0bc1 100644
--- a/src/libraries/Common/src/System/Net/Http/aspnetcore/Http3/QPack/H3StaticTable.Http3.cs
+++ b/src/libraries/Common/src/System/Net/Http/aspnetcore/Http3/QPack/H3StaticTable.Http3.cs
@@ -48,7 +48,7 @@ public static bool TryGetStatusIndex(int status, out int index)
// TODO: just use Dictionary directly to avoid interface dispatch.
public static IReadOnlyDictionary MethodIndex => s_methodIndex;
- public static ref HeaderField Get(int index) => ref s_staticTable[index];
+ public static ref readonly HeaderField Get(int index) => ref s_staticTable[index];
private static readonly HeaderField[] s_staticTable = new HeaderField[]
{
diff --git a/src/libraries/Common/src/System/Net/NTAuthentication.Common.cs b/src/libraries/Common/src/System/Net/NTAuthentication.Common.cs
index 148d1dc9a0700c..a46e7314c9f507 100644
--- a/src/libraries/Common/src/System/Net/NTAuthentication.Common.cs
+++ b/src/libraries/Common/src/System/Net/NTAuthentication.Common.cs
@@ -179,8 +179,7 @@ internal int MakeSignature(byte[] buffer, int offset, int count, [AllowNull] ref
}
else
{
- SecurityStatusPal statusCode;
- decodedOutgoingBlob = GetOutgoingBlob(decodedIncomingBlob, true, out statusCode);
+ decodedOutgoingBlob = GetOutgoingBlob(decodedIncomingBlob, true);
}
string? outgoingBlob = null;
@@ -199,8 +198,7 @@ internal int MakeSignature(byte[] buffer, int offset, int count, [AllowNull] ref
internal byte[]? GetOutgoingBlob(byte[]? incomingBlob, bool thrownOnError)
{
- SecurityStatusPal statusCode;
- return GetOutgoingBlob(incomingBlob, thrownOnError, out statusCode);
+ return GetOutgoingBlob(incomingBlob, thrownOnError, out _);
}
// Accepts an incoming binary security blob and returns an outgoing binary security blob.
diff --git a/src/libraries/Common/src/System/Net/SocketProtocolSupportPal.Unix.cs b/src/libraries/Common/src/System/Net/SocketProtocolSupportPal.Unix.cs
index 8de1e2a0f4ce31..c755c16517c77a 100644
--- a/src/libraries/Common/src/System/Net/SocketProtocolSupportPal.Unix.cs
+++ b/src/libraries/Common/src/System/Net/SocketProtocolSupportPal.Unix.cs
@@ -15,7 +15,9 @@ private static unsafe bool IsSupported(AddressFamily af)
IntPtr socket = invalid;
try
{
- return Interop.Sys.Socket(af, SocketType.Dgram, 0, &socket) != Interop.Error.EAFNOSUPPORT;
+ Interop.Error result = Interop.Sys.Socket(af, SocketType.Dgram, 0, &socket);
+ // we get EAFNOSUPPORT when family is not supported by Kernel, EPROTONOSUPPORT may come from policy enforcement like FreeBSD jail()
+ return result != Interop.Error.EAFNOSUPPORT && result != Interop.Error.EPROTONOSUPPORT;
}
finally
{
diff --git a/src/libraries/Common/src/System/Resources/ResourceWriter.cs b/src/libraries/Common/src/System/Resources/ResourceWriter.cs
index 71697a29e04bbe..b9184070fbc8be 100644
--- a/src/libraries/Common/src/System/Resources/ResourceWriter.cs
+++ b/src/libraries/Common/src/System/Resources/ResourceWriter.cs
@@ -595,7 +595,7 @@ private void WriteValue(ResourceTypeCode typeCode, object? value, BinaryWriter w
s.Position = 0;
writer.Write((int)s.Length);
byte[] buffer = new byte[4096];
- int read = 0;
+ int read;
while ((read = s.Read(buffer, 0, buffer.Length)) != 0)
{
writer.Write(buffer, 0, read);
diff --git a/src/libraries/Common/src/System/Runtime/InteropServices/ArrayMarshaller.cs b/src/libraries/Common/src/System/Runtime/InteropServices/ArrayMarshaller.cs
index dc11f7efd42157..a1b99ab9223774 100644
--- a/src/libraries/Common/src/System/Runtime/InteropServices/ArrayMarshaller.cs
+++ b/src/libraries/Common/src/System/Runtime/InteropServices/ArrayMarshaller.cs
@@ -67,7 +67,8 @@ public ArrayMarshaller(T[]? managed, Span stackSpace, int sizeOfNativeElem
/// Number kept small to ensure that P/Invokes with a lot of array parameters doesn't
/// blow the stack since this is a new optimization in the code-generated interop.
///
- public const int StackBufferSize = 0x200;
+ public const int BufferSize = 0x200;
+ public const bool RequiresStackBuffer = true;
public Span ManagedValues => _managedArray;
@@ -160,7 +161,8 @@ public PtrArrayMarshaller(T*[]? managed, Span stackSpace, int sizeOfNative
/// Number kept small to ensure that P/Invokes with a lot of array parameters doesn't
/// blow the stack since this is a new optimization in the code-generated interop.
///
- public const int StackBufferSize = 0x200;
+ public const int BufferSize = 0x200;
+ public const bool RequiresStackBuffer = true;
public Span ManagedValues => Unsafe.As(_managedArray);
diff --git a/src/libraries/Common/src/System/Security/Cryptography/EccSecurityTransforms.macOS.cs b/src/libraries/Common/src/System/Security/Cryptography/EccSecurityTransforms.macOS.cs
index af0bdd21d7dc95..8e9c3f8790acd4 100644
--- a/src/libraries/Common/src/System/Security/Cryptography/EccSecurityTransforms.macOS.cs
+++ b/src/libraries/Common/src/System/Security/Cryptography/EccSecurityTransforms.macOS.cs
@@ -29,7 +29,7 @@ private static ECParameters ExportParametersFromLegacyKey(SecKeyPair keys, bool
{
EccKeyFormatHelper.ReadSubjectPublicKeyInfo(
keyBlob,
- out int localRead,
+ out _,
out ECParameters key);
return key;
}
@@ -38,7 +38,7 @@ private static ECParameters ExportParametersFromLegacyKey(SecKeyPair keys, bool
EccKeyFormatHelper.ReadEncryptedPkcs8(
keyBlob,
ExportPassword,
- out int localRead,
+ out _,
out ECParameters key);
return key;
}
diff --git a/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs b/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs
index fcd2d846a265cb..c78de735480356 100644
--- a/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs
+++ b/src/libraries/Common/src/System/Security/Cryptography/RSAAndroid.cs
@@ -690,7 +690,7 @@ public override byte[] SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RS
Span.Empty,
hashAlgorithm, padding,
true,
- out int bytesWritten,
+ out _,
out byte[]? signature))
{
Debug.Fail("TrySignHash should not return false in allocation mode");
diff --git a/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs b/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs
index f80a641a98f019..149e240893039b 100644
--- a/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs
+++ b/src/libraries/Common/src/System/Security/Cryptography/RSAOpenSsl.cs
@@ -762,7 +762,7 @@ public override byte[] SignHash(byte[] hash, HashAlgorithmName hashAlgorithm, RS
Span.Empty,
hashAlgorithm, padding,
true,
- out int bytesWritten,
+ out _,
out byte[]? signature))
{
Debug.Fail("TrySignHash should not return false in allocation mode");
diff --git a/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs b/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs
index 29ce858255e768..7bce2648d443a9 100644
--- a/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs
+++ b/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.cs
@@ -564,7 +564,7 @@ public override bool VerifyHash(ReadOnlySpan hash, ReadOnlySpan sign
if (padding == RSASignaturePadding.Pkcs1)
{
Interop.AppleCrypto.PAL_HashAlgorithm palAlgId =
- PalAlgorithmFromAlgorithmName(hashAlgorithm, out int expectedSize);
+ PalAlgorithmFromAlgorithmName(hashAlgorithm, out _);
return Interop.AppleCrypto.VerifySignature(
GetKeys().PublicKey,
hash,
diff --git a/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.macOS.cs b/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.macOS.cs
index 8496d3ab2fc0e0..2a99e40a129df2 100644
--- a/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.macOS.cs
+++ b/src/libraries/Common/src/System/Security/Cryptography/RSASecurityTransforms.macOS.cs
@@ -62,7 +62,7 @@ private static RSAParameters ExportParametersFromLegacyKey(SecKeyPair keys, bool
RSAKeyFormatHelper.ReadEncryptedPkcs8(
keyBlob,
ExportPassword,
- out int localRead,
+ out _,
out RSAParameters key);
return key;
}
diff --git a/src/libraries/Common/tests/SourceGenerators/LiveReferencePack.cs b/src/libraries/Common/tests/SourceGenerators/LiveReferencePack.cs
new file mode 100644
index 00000000000000..7d04c4b278145c
--- /dev/null
+++ b/src/libraries/Common/tests/SourceGenerators/LiveReferencePack.cs
@@ -0,0 +1,31 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Collections.Immutable;
+using System.IO;
+using System.Linq;
+
+using Microsoft.CodeAnalysis;
+
+namespace SourceGenerators.Tests
+{
+ internal static class LiveReferencePack
+ {
+ ///
+ /// Get the metadata references for the reference assemblies from the live build.
+ ///
+ /// The metadata references
+ ///
+ /// This function assumes the references are in a live-ref-pack subfolder next to the
+ /// containing assembly. Test projects can set TestRunRequiresLiveRefPack to copy the
+ /// live references to a live-ref-pack subfolder in their output directory.
+ ///
+ public static ImmutableArray GetMetadataReferences()
+ {
+ string testDirectory = Path.GetDirectoryName(typeof(LiveReferencePack).Assembly.Location)!;
+ return Directory.EnumerateFiles(Path.Combine(testDirectory, "live-ref-pack"))
+ .Select(f => MetadataReference.CreateFromFile(f))
+ .ToImmutableArray();
+ }
+ }
+}
diff --git a/src/libraries/Common/tests/System/Collections/DebugView.Tests.cs b/src/libraries/Common/tests/System/Collections/DebugView.Tests.cs
index 35e6b16b654158..d363af3479c3bb 100644
--- a/src/libraries/Common/tests/System/Collections/DebugView.Tests.cs
+++ b/src/libraries/Common/tests/System/Collections/DebugView.Tests.cs
@@ -60,7 +60,7 @@ public static IEnumerable